Ask Your Question

How to localize diff drive robot on static map using lidar?

asked 2020-05-21 15:27:58 -0500

updated 2020-05-22 10:57:18 -0500


It seems to me that the amcl node in my project is not publishing to the amcl_pose topic. I may be wrong, but when I run the command rqt I see this (the amcl_pose is missing):

image description

I looked at the amcl wiki page (, and indeed the node is getting all the needed info (laser scan, map, tf, initialpose), but I don't see any parameters to force publishing to amcl_pose. Any advice?

System is Ubuntu 18.04, Melodic, running on an intel PC.

The reason I am asking is that I believe this is why RViz is giving me feedback that the view of the world by the robot is wrong. By wrong I mean that the view of the global map and the global costmap (seen here):

image description

and the the RobotModel, LaserScan, footprint, PoseArray and local cost map seen here:

image description

are out of alignment (and I suspect the amcl_pose is the issue):

image description

is fixing the amcl_pose going to align the robot and the staticmap? I can imagine editing the .pgm map, or even the origin in the map's yaml file, but doing this for every map seems not right. I am running out of tutorials, and welcome with open arms package suggestions to automate a means for the robot to find itself on the map. Nodes running are:

amcl (amcl/amcl)
map_odom_broadcaster (tf/static_transform_publisher)
map_server (map_server/map_server)
move_base (move_base/move_base)
robot_state_publisher (robot_state_publisher/robot_state_publisher)
rviz (rviz/rviz)
urg_node (urg_node/urg_node)

Thanks for your time.

TF Tree: image description

common costmap:

footprint: [[-0.37, -0.3], [-0.37, 0.3], [0.37, 0.3], [0.37, -0.3]] #MO tuned
footprint_padding: 0.01
obstacle_range: 4
raytrace_range: 3.0
    inflation_radius: 1.75 
     cost_scaling_factor: 2.58 
     enabled: true           
robot_base_frame: base_link
resolution: 0.02 
    map_topic: map
    subscribe_to_updates: true
    observation_sources: laser_scan_sensor
    laser_scan_sensor: {sensor_frame: laser, data_type: LaserScan, topic: jimmy/laser/scan, marking: true, clearing: true, inf_is_valid: true}

Global Static costmap:

global_frame: map
rolling_window: false
track_unknown_space: true
update_frequency: 4.0
publish_frequency: 3.0
transform_tolerance: 0.5
  - {name: static,                  type: "costmap_2d::StaticLayer"}
  - {name: inflation,               type: "costmap_2d::InflationLayer"}

Local costmap:

global_frame: odom
rolling_window: true
update_frequency: 2.0
publish_frequency: 1.0
transform_tolerance: 0.5
  - {name: obstacles_laser,           type: "costmap_2d::ObstacleLayer"}
  - {name: inflation,                 type: "costmap_2d::InflationLayer"}

initial pose is provided by RViz. I don't feed publish anything to that topic explicitly. Is that an issue?

I built the static map by teleoping, but I haven't tried teleoping in the state of this quetion. I will try and report back.

edit retag flag offensive close merge delete


What does your tf tree look like? (rosrun tf view_frames) Posting your costmap .yaml files would be helpful. How do you feed amcl an initial_pose? What happens if you teleop arround? Iam not sure off the top of my head, how it works for me, but i believe in my system its the tf published by amcl thats actually "doing the work", not the pose topic, which might be usefull for other stuff.

Dragonslayer gravatar image Dragonslayer  ( 2020-05-22 10:14:06 -0500 )edit

@ dragonslayer Thanks for your comment. I edited the question to contain the items you mentioned. Do you see anything that I need to focus on? Thank you very much.

BuilderMike gravatar image BuilderMike  ( 2020-05-22 10:52:56 -0500 )edit

Hi Mike, the localization node usually publishes the map -> odom transform, what is "map_odom_broadcaster", here should be amcl. What happens if you dont launch this node?

Dragonslayer gravatar image Dragonslayer  ( 2020-05-22 11:08:27 -0500 )edit

@Dragonslayer I don't know how to thank you enough! That was the issue.... Thank you...Thank you, and again thank you! I am so grateful! Please post your comment as an answer, and I'll accept it. Thanks!

BuilderMike gravatar image BuilderMike  ( 2020-05-22 11:26:45 -0500 )edit

You are welcome, glad i could help.

Dragonslayer gravatar image Dragonslayer  ( 2020-05-22 11:34:41 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-05-22 11:35:18 -0500

Dragonslayer gravatar image

updated 2020-05-22 11:36:43 -0500

COPY FROM COMMENT: Hi Mike, the localization node usually publishes the map -> odom transform. In your tf tree there is a "map_odom_broadcaster" this seems to hinder amcl from doing this, here should be amcl.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-05-21 15:27:58 -0500

Seen: 273 times

Last updated: May 22 '20