0
$\begingroup$

Rosanswers logo

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.


Originally posted by anirban on ROS Answers with karma: 64 on 2019-03-08

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by mgruhler with karma: 12390 on 2019-03-08

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by anirban on 2019-03-08:
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.

Comment by mgruhler on 2019-03-08:
see edit above

Comment by anirban on 2019-03-08:
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.

Comment by mgruhler on 2019-03-11:
@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.

Comment by anirban on 2019-03-11:
@mgruhler thanks for the clarification. Yes it is better to stick with the convention that \odom as a child of \map frame.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.