ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Initial robot pose with respect to map

asked 2019-03-07 23:33:29 -0500

anirban gravatar image

updated 2022-10-30 09:40:58 -0500

lucasw gravatar image

Hi,

I am using map_server to load a map in .pgm format and visualize in RViz. I also load a simulated turtlebot and can see it in same RViz window. I want to move the robot using my cutom planner node while using information from map_server node. I can obtain robot's current pose from \odom topic. My question is what will be the transform between odom frame and map frame. My map_server configuration file (.yaml) is as following

image: map_obstacle.pgm
resolution: 0.01
origin: [-2.0, -2.0, 0]
occupied_thresh: 0.75
free_thresh: 0.20

Any help is appreciated.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-03-08 00:25:19 -0500

mgruhler gravatar image

updated 2019-03-08 01:41:49 -0500

This depends on where your robot is spawned. In the end, the pose in /odom is only the dead-reckoning pose, i.e. estimated from wheel revolutions.

What you would need to do this properly is some kind of localization algorithm that corrects the odometry drift using e.g. a laserscanner. amcl is a package that implements this. See this section about the used/provided transforms.


EDIT

To fake a localization, you can use a static_transform_publisher (documented on the wiki) to publish the transform from map to odom. This can then be static, as we are assuming that the transfrom from odom to base_link is accurate. This should however be published by your robot's base driver / simulation.

Obviously, the transform from map to odom needs to reflect the starting position of your robot.

edit flag offensive delete link more

Comments

Thank you for your response and I know that /odom data is inaccurate. Assuming /odom data as actual robot location, my question is how to know coordinate of the robot in occupancy grid map so that I can use my custom planner.

anirban gravatar image anirban  ( 2019-03-08 01:18:20 -0500 )edit

see edit above

mgruhler gravatar image mgruhler  ( 2019-03-08 01:41:56 -0500 )edit

Thank you for the edit which is really helpful. I think what you said regarding transform between from \map frame to \odom frame is correct in the context of localization in unknown map. But since I am interested in planning when the map is known, I need transform from \odom to \map.

anirban gravatar image anirban  ( 2019-03-08 10:18:42 -0500 )edit

@anirban well, one is the inverse of the other, so it doesn't really matter much. You can get the transforms in any direction you want with a transform listener...

However, as the ROS tf tree is using a directed structure, I suggest to use the standard approach of using map as parent and odom as child frame.

But I agree that the direction of the graph can be confusing.

mgruhler gravatar image mgruhler  ( 2019-03-11 01:48:02 -0500 )edit

@mgruhler thanks for the clarification. Yes it is better to stick with the convention that \odom as a child of \map frame.

anirban gravatar image anirban  ( 2019-03-11 23:52:32 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-03-07 23:33:29 -0500

Seen: 888 times

Last updated: Mar 08 '19