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

Hello,

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):

I looked at the amcl wiki page (https://wiki.ros.org/amcl), 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):

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

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

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_server (map_server/map_server)
move_base (move_base/move_base)
(turtlebot3_teleop_modified/turtlebot3_teleop_key)
(controller_manager/spawner)
(jimmy_base/jimmy_base_node)
(jimmy_hokuyo_lidar_control/lidar_system_control)
robot_state_publisher (robot_state_publisher/robot_state_publisher)
rviz (rviz/rviz)
urg_node (urg_node/urg_node)


TF Tree:

common costmap:

footprint: [[-0.37, -0.3], [-0.37, 0.3], [0.37, 0.3], [0.37, -0.3]] #MO tuned
obstacle_range: 4
raytrace_range: 3.0
inflation:
cost_scaling_factor: 2.58
enabled: true
resolution: 0.02
static:
map_topic: map
obstacles_laser:
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
plugins:
- {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
plugins:
- {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 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.

( 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.

( 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?

( 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!

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

You are welcome, glad i could help.

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

Sort by » oldest newest most voted

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.

more