Home | Tutorials | Wiki | Issues
Ask Your Question

Can Gazebo publish /tf (transform) data?

asked 2020-03-10 17:43:46 -0500

TorontoRoboticsClub gravatar image

updated 2020-03-11 09:13:35 -0500


The system is running Ubuntu 16.04, ROS Kinetic, and Gazebo 7.16. The model being used in Gazebo is a modified URDF file.

Can I get /tf data from Gazebo? or, if that's not possible, How do I get the position of all the continuous joints from Gazebo? How do I get the status of every moving joint?

When I fire up RViz, I get a bunch of errors under robotModel because there is no /tf data. Image below shows the robot in RViz after forward motion was executed in Gazebo (using diff_drive plugin).The base_link /tf is OK (relative to /odom) but all other links (the white items) are not ok and are left behind (missing /tf data):

image description


Edit #1

based on my limited skills, readSim() looks like the way to do it (based on http://gazebosim.org/tutorials/?tut=r...).

image description

I looked up the code samples Mr Dave Coleman put up (https://github.com/ros-simulation/gaz...), but there is no example of readSim().

Any advice on how to get the status of joints, is appreciated.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-03-12 07:53:42 -0500

TorontoRoboticsClub gravatar image

I got this done using this answer: https://answers.ros.org/question/2739.... By implementing that answer, and not giving any commands, I am able to get /tf data for the continious joints that are not powered.

Joints that were powered (ex diff_drive via a plugin) I was able to set a tag called <publishWheelTF>true</publishWheelTF> and <publishTf>true</publishTf> and I got the transforms for that wheel. Another fun fact is that the lidar plugin can also provide tf data (the tag is called <frameName>).

On a slightly different note, I think there are other options:

  1. see the image in edit #1 in the questions, and there is a mention of readSim(). I am not a programmer so I didn't know how to chase that down, but I am sure it should be a fruitful chase.
  2. Gazebo has a topic called "/gazebo/link_states" which has the message type "gazebo_msgs/LinkStates". Since Gazebo is closely related to ROS, I can imagine that there is a way to convert the "gazebo_msgs/LinkStates" message to "tf2_msgs/TFMessage" or whatever is sent out of the robot_state_publisher node (see https://wiki.ros.org/robot_state_publ...).
  3. You don't know what you don't know. I suspect there may be more ways, but since I have more problems that need attention I find myself busier than a one legged person in an ass kicking competition; so I stopped looking for better options. If anyone cares to, please add to the list.

Gazebo is so cool, I just wish there was some sort of a book for it that was easy and to the point; a Gazebo equivalent of "A gentle introduction to Ros" is to ROS.

edit flag offensive delete link more

answered 2020-04-04 12:44:02 -0500

Fookii gravatar image

The way to convert the "gazebo_msgs/LinkStates" message to "tf2_msgs/TFMessage":
check http://wiki.ros.org/gazebo2rviz, there's a node called gazebo2tf_node

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-03-10 17:43:46 -0500

Seen: 421 times

Last updated: Mar 12