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

Using tf2 to generate a permanent map transform

asked 2022-07-07 19:02:21 -0500

pablo.arandarod gravatar image

So I am currently developing a simulation to test various SLAM and planning algorithms for Differential Drive Robots. I have a first occupancy grid node for map generation nearly working, but I am getting a bit confused with the transforms and tf2 package.

I expected that I could declare a frame in the node one time and it to just be constantly saved, but this is not appearing to be the case. In my map_generation package main's node I am declaring a Transform Broadcaster that when it is created broadcasts the transform from the robot to the map once, and no more times after that, although the ones of the wheels and sensors are correctly calculated. I expected that it would stay and be updated automatically every time (I am working in simulation) without me needing to calculate any new transform. Now I expect that I will need to get the reading of the sensor of odometry,etc. and estimate the transformation from the new point to the original point and keep updating it.

This makes me think, how does tf2 actually work? Is it storing the transforms each time there is a broadcast (does not seem to be the case)? What transforms is it able to actually automatize? Some of them clearly are found, as I mentioned before.

P.D. How could I actually include a fixed frame in the gazebo simulation? I thought on creating a link that has 6DoF respect to the robot, but it seems it does not work anymore according to what I have been reading in various forums.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-07-11 09:13:55 -0500

standmit gravatar image
  1. You should use StaticTransformBroadcaster instead of TransfromBroadcaster.
  2. If you are using URDF to create links, add following tag to your model:

    <gazebo reference="joint_name"> <preserveFixedJoint>true</preserveFixedJoint> </gazebo>

edit flag offensive delete link more


With that, I generate a transform that is always at the same reference from the robot, instead of having a reference frame that is static and has a different transformation towards the robot. I think I will use the p3d sensor transform output as the definition of the transform. Once I implement it in a real case I will just use the estimate of the Filter for the pose as the transformation (and maybe find some offline estimation method to improve the accuracy.

pablo.arandarod gravatar image pablo.arandarod  ( 2022-07-19 16:26:31 -0500 )edit

Question Tools



Asked: 2022-07-07 19:02:21 -0500

Seen: 138 times

Last updated: Jul 11 '22