Revision history [back]

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 (9.75,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.

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 (9.75,0,0) (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.