How to publish transformation from map(world) to odom?

asked 2018-11-18 20:17:26 -0500

AutoCar gravatar image

I am working on a particular autonomous robot car application. The robot car uses lidar to find some traffic cones. Since the cones' positions are known, the robot can localize itself by matching the detected cones with the cone's known coordinates. I have written my own particle filters for localization. Now I am trying to visualize the result (car true loaction) with rviz. Currently, my system publish odom, tf, but it does not publish a map message. I have a few questions here

  1. The results of particle filters are location of the car in the world coordinate. Since my system does not publish map, how can I display the car position in rviz?
  2. Currently, I am using odom as fixed frame in my rviz. I can see that the lidar data for the wall, cones are moving around slightly when the robot moves. This means my odom data is no exactly accurate. correct?
  3. How can I publish my own map message? If I publish my own map message, how can I publish the transformation between the map and odom?


edit retag flag offensive close merge delete


  1. I think you need a SLAM package to do mapping job for you. The transformation between frames can be handled using a static_transform_publisher.
Hui Zhang gravatar imageHui Zhang ( 2018-11-19 14:05:06 -0500 )edit

I have my own mapping and localization algorithm. I just do not know how to publish a map frame in my algorithm and how to push the transformation between my map and odom.

AutoCar gravatar imageAutoCar ( 2018-11-19 15:17:28 -0500 )edit

you can write a launch file like <node pkg="tf" type="static_transform_publisher" name="xxx" args="0 0 0 0 0 1 map odom 100">

Hui Zhang gravatar imageHui Zhang ( 2018-11-19 15:23:26 -0500 )edit

Thanks. This will publish the transformation between map and odom. However my system does not have a map frame. Is this command going to add a map frame also?

AutoCar gravatar imageAutoCar ( 2018-11-19 16:27:16 -0500 )edit

when you generate a map(I assume it's OGM), there is a info inside the message defining the pose of your map, that will give you the position of the origin of the map [m, m, rad], This is the real-world pose of the cell (0,0) in the map. I think that will give you map frame.

Hui Zhang gravatar imageHui Zhang ( 2018-11-19 16:35:29 -0500 )edit

my bad, the info should be frame_id inside std_msgs/header

Hui Zhang gravatar imageHui Zhang ( 2018-11-19 16:43:58 -0500 )edit

Thanks, do you have some information about how to publish a map frame from mapping/slam?

AutoCar gravatar imageAutoCar ( 2018-11-19 19:42:55 -0500 )edit

since your map and odom will be changing the proper way would be to use a transform broadcaster

Choco93 gravatar imageChoco93 ( 2018-11-20 06:10:18 -0500 )edit