Need help with basic navigation
I am trying to wrap my head around the navigation stack, and how to run it.
My objective is to get my simple, differential-drive robot to navigate using the nav stack. I want to set a simple goal in rviz, and let my robot navigate to that position.
My robot is publishing tf frames: "base_laser" to "base_link", and "base_link" to "odom". It also sends odometry data (I use stepper motors), and laser scan data from a sonar sensor. I have been following the ROS navigation tutorials to get this far.
My robot currently shows this rqt graph shown below:
Nodes only
Nodes and topics
Right now, it seems that everything is in order, except that I get the tf error "Timed out waiting for transform from base_link to map to become available before running costmap . . . "
isn't the move_base node in charge of publishing the "base_link" to "map" transform?
Screen shot of tf tree:
<launch>
<master auto="start"/>
<!-- Run the map server -->
<node name="map_server" pkg="map_server" type="map_server" args="$(find tf_test)/myTestMap.pgm 0.02"/>
<!--- Run AMCL -->
<include file="$(find amcl)/examples/amcl_diff.launch" />
<node pkg="move_base" type="move_base" respawn="false" name="move_base" output="screen">
<rosparam file="$(find tf_test)/costmap_common_params.yaml" command="load" ns="global_costmap" />
<rosparam file="$(find tf_test)/costmap_common_params.yaml" command="load" ns="local_costmap" />
<rosparam file="$(find tf_test)/local_costmap_params.yaml" command="load" />
<rosparam file="$(find tf_test)/global_costmap_params.yaml" command="load" />
<rosparam file="$(find tf_test)/base_local_planner_params.yaml" command="load" />
</node>
</launch>
//[costmap_common_params.yaml]///////////////////////////////////////////////////////////
obstacle_range: 2.5
raytrace_range: 3.0
footprint: [[-0.10, 0.10], [-0.10, -0.10], [0.10, -0.10], [0.10, 0.10]]
#robot_radius: ir_of_robot
inflation_radius: 0.15
observation_sources: laser_scan_sensor
laser_scan_sensor: {sensor_frame: base_laser, data_type: LaserScan, topic: scan, marking: true, clearing: true}
//[local_costmap_params.yaml]////////////////////////////////////////////////////////////
local_costmap:
global_frame: odom
robot_base_frame: base_link
update_frequency: 10.0
publish_frequency: 10.0
static_map: false
rolling_window: true
width: 2.0
height: 2.0
resolution: 0.02
//[global_costmap_params.yaml]///////////////////////////////////////////////////////////
global_costmap:
global_frame: /map
robot_base_frame: base_link
update_frequency: 0.5
static_map: true
//[base_local_planner_params.yaml]///////////////////////////////////////////////////////
TrajectoryPlannerROS:
max_vel_x: 0.1409946783
min_vel_x: 0.0007049734
max_vel_theta: 2.311388169
min_in_place_vel_theta: 0.01155694
acc_lim_theta: 2.311388169
acc_lim_x: 0.1409946783
acc_lim_y: 0
holonomic_robot: true
amcl_diff.launch:
<launch>
<node pkg="amcl" type="amcl" name="amcl" output="screen">
<!-- Publish scans from best pose at a max of 10 Hz -->
<param name="odom_model_type" value="diff"/>
<param name="odom_alpha5" value="0.1"/>
<param name="transform_tolerance" value="0.2" />
<param name="gui_publish_rate" value="10.0"/>
<param name="laser_max_beams" value="30"/>
<param name="min_particles" value="500"/>
<param name="max_particles" value="5000"/>
<param name="kld_err" value="0.05"/>
<param name="kld_z" value="0.99"/>
<param name="odom_alpha1" value="0.2"/>
<param name="odom_alpha2" value="0.2"/>
<!-- translation std dev, m -->
<param name="odom_alpha3" value="0.8"/>
<param name="odom_alpha4" value="0.2"/>
<param name="laser_z_hit" value="0.5"/>
<param name="laser_z_short" value="0.05"/>
<param name="laser_z_max" value="0.05"/>
<param name="laser_z_rand" value="0.5"/>
<param name="laser_sigma_hit" value="0.2"/>
<param name="laser_lambda_short" value="0.1"/>
<param name="laser_lambda_short" value="0.1"/>
<param name="laser_model_type" value="likelihood_field"/>
<!-- <param name="laser_model_type" value ...
Can you post screenshot of your tf tree?
Can you include the parameter files the Navigation stack? Please also include information from the terminal that is running the Nav Stack. I'm guessing that AMCL isn't running due to perhaps a slow update of laser scan. How often do you publish a new laser scan?
It might be because of a slow laser scan update. I get an output warning, telling me that it hasn't received scan messages, but scan messages are sent about every second. Odom also is only sent while the robot is moving. I have sent cmd_vel messages to my robot to force it to move.
Also, I get:
I get this from roswtf: WARNING The following node subscriptions are unconnected: * /amcl: * /tf_static * /move_base: * /tf_static * /rviz_1502523805001460332: * /tf_static
@Raisintoe: please always just edit your original question if you have new info, want to add screenshots or logging output. The comments are not suited for that.
And please also use the Preformatted Text button (the one with
101010
on it) to format console copy-pastes, or xml or yaml. Thanks.I see no scan message in the rqt-graph, do you have a laser scanner or something simulating (e.g. 3d camera) one?
I've seen where AMCL/MoveBase will set VEL_CMD to 0,0 if there is a delay(500ms) in laser scan. If this happens and your robot then also stops providing ODOM, you'll have two issues compounded. Can you modify the SW to issue both more frequently, even if you're just re-issuing same data twice.
I set up fake scan and odom publishers and tf_broadcasters that published at 10Hz, it didn't change anything.
Feeding scans from sonar to amcl defeats its purpose. Because of the high field of view of the sensor I don't think amcl will be able to do anything useful.
I recommend to 1. drop the amcl node, 2. Use odom in local and global costmap as global_frame and switch the obstacle layer against the the range layer.
I know that the sonar sensor will not work well, I am just using it to learn the ROS system. I have done as you suggested though, and dropped the amcl node . . .etc, and now I only get the error " . . . Dropped 100.00% of messages so far . . ."
To learn: Get a simulation running, Turtlebot should do. So you get a working system you can compare yours to. About the error: AMCLs job is to provide the map->odom tf. Without amcl (or e.g. gmapping...) there is no map frame so you use odom as global frame everywhere (rviz, costmap,...)
Oooh! Something a little exciting happened, my robot will spin around, trying to locate itself when I set a goal in rviz. This might be all it will ever do with a sonar sensor, huh? I will try the Turtlebot_simulator as you suggest.