Ask Your Question

# Header frame_id

I am learning ros and I have a question regarding frame_id in the Header (like in PoseStamped). If I understand correctly frame_id means to which tf the position is relative to. So does that mean if I have a point which I get from kinect and I want to send the robot the goal with frame_id /camera_rgb_optical_frame and it will automaticly transform the point into the correct space? Or have I misunderstood?

edit retag close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

The frame_id in a message specifies the point of reference for data contained in that message.

For example, if I want to specify a goal that is 10 meters directly in front of my robot, I would first declare the "origin" of the robot, which I will name the /base_link frame. The origin of this /base_link frame (0,0,0) is located at the center of mass of my robot. I would send a goal of (10,0,0) in the /base_link frame.

In your scenario in which you have a sensor, the tf tree becomes slightly more complex. Let's say that I have a Kinect that's mounted at the very front of my robot, directly in front of the center of mass. I now declare an "origin" for that sensor and name it the /kinect frame. Since the sensor is mounted 0.25 meters in front of the center of mass, the transform (tf) from /base_link to /kinect is (0.25,0,0), or the transform from /kinect to /base_link is (-0.25,0,0) (because /base_link is 0.25 BEHIND the sensor).

Now is when tf becomes useful. Your sensor data arrives in the frame_id of the sensor collecting it (i.e. your kinect points arrive in the /kinect frame in my example). If the Kinect receives a point of 10.0 meters directly ahead, and you want to navigate to that point, your goal is (10,0,0) in the /kinect frame. However, remember that since your sensor is 0.25 meters IN FRONT of the robot's center, this goal is actually (10.25,0,0) in the /base_link frame. The beauty of tf is that it can transform points from the /kinect frame to the /base_link frame for you.

The only catch is that you must tell tf to perform this transform (you can learn to do this in the tf tutorials). If you're trying to specify a goal for move_base or some other ROS navigation software, chances are that this transform is done for you already (move_base definitely does this for you). This has to be determined on a case-by-case basis, since sometimes it is done for you, but sometimes it is not.

TL;DR: If you're trying to send a goal to move_base using the navigation stack, you don't need to change the frame of the point. If you collect the data in the /camera_rgb_optical_frame, then you can send a goal in the camera_rgb_optical_frame and the navigation stack will take care of the transform for you.

more

## Comments

So if I understand correctly if I am using move_base in your example i would just pass frame_id=/kinect to setGoal? Thank you very much for you thorough answer. You've cleared a lot!

( 2012-05-23 09:05:56 -0600 )edit
1

In my example, yes, you could specify it in the /kinect frame

( 2012-05-23 10:03:58 -0600 )edit

@DimitriProsser your explaination is very comprehensive, however, it contains a bug. The goal is at (10.25,0,0) in the /base_link frame: /base_link (+0.25,0,0) /kinect (+10,0,0) goal. If you want to transform _data_ from one frame to another frame, you have to take the inverse of their tf.

( 2012-05-24 23:49:19 -0600 )edit

Thank you @Stephan. Good catch

( 2012-05-25 03:35:49 -0600 )edit

Question, if the frame_id is the frame reference of all points in the message, what is the bearing of the info.origin.position.x, y, z and info.origin.orientation.x, y, z, w?? I assume that the origin is with respect to the frame_id.. Are they points projected to its parent frame??

( 2014-05-23 01:35:36 -0600 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2012-05-23 07:48:36 -0600

Seen: 16,275 times

Last updated: May 25 '12