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

How to publish transform from odom to base_link?

asked 2013-11-22 06:36:42 -0500

updated 2013-12-21 09:01:31 -0500

tfoote gravatar image

I am running a p3at in a gazebo with ros plugins. I need to subscribe to the odometry pose and update broadcast the tf between odom and base_link.How do I do it? Should I define a "odom" link in the .xacro file used for simulation? What about the joint type?

edit retag flag offensive close merge delete

Comments

To my knowledge you don't. As long as you have those frames defined in your urdf/xacro, you shouldn't have to broadcast this information again. It seems redundant if it were!

MartinW gravatar image MartinW  ( 2013-11-22 08:25:26 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
14

answered 2013-11-24 20:55:32 -0500

Thomas gravatar image

updated 2015-10-31 14:01:10 -0500

130s gravatar image

The base_link frame is the root of your robot kinematic tree. Given a particular kinematic model and a particular configuration of your robot you can determine the relative position of all your robot bodies.

When your robot is made of solid bodies linked together by joints whom parameters are accurately known, this problem is quite trivial. In particular, it is solved by the robot_state_publisher node. However, when it comes to the "map" and "odom" frame the problem is totally different. These two frames meaning is defined in REP 105. They define the position of the robot in the "world" frame.

Here you have two cases:

  1. your robot position is fixed all the time and you can use (for instance) a TF static_transform_publisher to stream this relative position.
  2. your robot position evolves over time and you will need to run a localisation component which will estimates your robot position (using the robot command and the robot sensors for instance). See the robot_pose_ekf node from the navigation stack. Other ways include using directly the ground truth coming from your simulator, using an external system such as motion capture, etc. to localize your robots. Regarding embedded approaches, you can use SLAM, integrate your command and fuse it or not with the IMU information, etc.

You usually have two "levels" of localisation:

  • a local method which drifts (integrating the command for instance)
  • a global one which tries to estimate the robot position from exterior information such as the environment (SLAM algorithms, GPS may enter this category).

The local method will define the odom frame (this frames drifts but the position never jump from one position to another one which is good when you need a reference value for your command) whereas the map frame should be accurate anytime but may jump from a position to another one which may produce very high velocities if you try to close the loop on this data.

One should always have: map -> odom -> base_link

If you don't have components to estimate all the frames it is ok to set some of these frames relative information to the identity. At this point the best strategy really depends on your robot and your application.

To conclude, tf is not a tool which only broadcasts frame position estimated from the robot model and its configuration, this is only one possibility offered by ROS. It makes sense for most of the robots to do so to estimate the robot bodies relative position but it makes no sense for the other frames. Therefore, adding odom or map in your robot model is a bad idea unless it is a fixed base robot. Even in this case, IMHO it is better to use a static_transform_publisher as you may want at some point to relocate your robot at a different location w.r.t to your world frame. Also, editing 3rd party package is a bad practice, if you use a model from a ROS package, editing the xacro to fit your own need ... (more)

edit flag offensive delete link more

Comments

2

Thank you! I solved the odom to base_link tf by making publishTF(skid steer ros gazebo plugin) TRUE. I just published map to odom by using tf publisher.

balakumar-s gravatar image balakumar-s  ( 2013-11-25 19:12:12 -0500 )edit

Question Tools

5 followers

Stats

Asked: 2013-11-22 06:36:42 -0500

Seen: 19,180 times

Last updated: Oct 31 '15