ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I guess you will have to set up a pretty simple TF tree. Instead of just two frames, I would actually use three: /world -> base_link -> sensor
In tf, you basically just specify the relation between a parent and a child frame, i.e. your system need to publish only two transforms: /world -> base_link and base_link -> sensor. If the sensor is not moving relative to the robot, i.e. if it is fixed on the robot, you can run a static_transform_publisher node. The transform /world -> base_link must be published by your gps node or whatever node is globally localizing your robot. Have a look at the broadcasting tutorial for examples.
2 | No.2 Revision |
I guess you will have to set up a pretty simple TF tree. Instead of just two frames, I would actually use three: /world -> base_link -> sensor
In tf, you basically just specify the relation between a parent and a child frame, i.e. your system need to publish only two transforms: /world -> base_link and base_link -> sensor. If the sensor is not moving relative to the robot, i.e. if it is fixed on the robot, you can run a static_transform_publisher node. The transform /world -> base_link must be published by your gps node or whatever node is globally localizing your robot. Have a look at the broadcasting tutorial for examples.
Edit: I feel like you have a misconception regarding how the TF tree is constructed. In TF, not the nodes of the TF tree, i.e. the frames are sent over the TF topic but the relation between nodes. So if you send only one single transform with frame id world
and child frame id base_footprint
, the system creates two nodes where the root is world
. world
then of course does not have a parent and is the global reference frame. In other words, world is at (0, 0, 0) in world.
In your case, you said already that you have a node that computes the localization of your robot (translation and rotation) from gps data. Just use that transformation and publish it with frame id world
and child frame id base_link
or whatever you want to use for your robot's base. I would still add the sensor as a static transform because it makes the tree self-explanatory, in particular because you won't have to let the sensor driver its data in the robot's base frame but a separate sensor frame.