# Best practice with tf transforms

Hey,

I've got a small problem: I have three laser scanners mounted at my robot with -> frames:

(name -> tf frame)

• Hokuyo 1 -> hokuyo1_frame
• Hokuyo 2 -> hokuyo2_frame
• Another 4 layer Laser scanner -> Scanner_frame1

these laserscanners are translational and rotational shifted together. Which leads to me to use some tf transformations. So I flew over the tutorials and just gut confused which would be the best practice to convert them all do a static frame at the robot. Also i dont have a baselink at my robot for now so how do i create one in the origin of my robot? If I print the current frames with rosrun tf view_frames I just see the Scanner_frame1 and not the two hokuyo frames, however I can watch the data in rviz by hand typing the fixed frame as hokuyo1/2_frame.

Best regards

edit retag close merge delete

Sort by » oldest newest most voted

The key here is understanding that with /tf the geometry of your system must be specified as a tree. Importantly, every frame can have unlimited children, but only a single parent. The edges between the nodes in the tree are the transform information from the parent to the child. There is no concept of "world" frame, unless you specifically add a "world" frame to your tree.

For your system, there are several ways you could specify the geometry of your robot:

1. You could arbitrarily choose one of your laser frames to be the "root" of your tree. For example, let's choose hokuyo1_frame as the root. Then you would want to create two static transform publishers; one from hokuyo1_frame -> hokuyo2_frame and one from hokuyo1_frame->Scanner_frame1. Alternatively the second transform could go from hokuyo2_frame->Scanner_frame1. It doesn't matter as long as all 3 frames are in your tree, and none of the frames has more than one parent.
2. If you would like your robot to have a base_link frame, then you could make that the root of your tree, and then specify static transforms from base_link to all three laser frames.
3. Probably the most-standard way of doing this is to create a URDF that represents the geometry of your robot and lasers, and then use the robot_state_publisher to send the /tf information.
more

Hi, thanks jarvis for you nice summary! Really good, I really like option 2) and 3), could you provide some more information on how to create a baselink as center of my robot? I will try to create a URDF file of my robot and use it with robot_state_pub but still want to keep an eye on 2) :)

( 2015-11-25 03:53:40 -0500 )edit

I accomplished to build my own urdf and let a joint_state_publisher and robot_state_publisher run, but now i dont know what to do with the real coordinate frames on my real system as mentionend above the 3 laser scanners

( 2015-11-25 09:21:26 -0500 )edit