# Revision history [back]

I think this is really more of a tf question. Let's ignore sensors and such for a second and just focus on two coordinate frames, odom and base_link. When your robot starts out, it is at position (0, 0) in the odom frame. It then drives, say, four meters forward, turns left, and drives six meters. Its position in the odom frame is now (4, 6). This information can be expressed in two ways:

1. A ROS message (in this case, nav_msgs/Odometry) that contains the robot's world pose (and velocity, but let's ignore that for now). We fill out this message with the robot's current pose and send it off to be consumed.
2. A transform from the odom frame to the base_link frame. This contains the exact same information, but is sent via tf instead.

robot_localization produces both (1) and (2).

Now let's say we have an IMU on your robot, but instead of facing forward, we turn it sideways. Additionally, we mount it 0.3 meters to the left of the robot's centroid. We can represent this offset as a transform, and use the static_transform_publisher package to continuously send out a transform from base_link to your IMU's frame_id (e.g., imu). Now, before we can use that IMU data, we need to make sure to transform it into the correct coordinate frame. In this case, robot_localization uses the tf libraries to look up what the transform is between base_link and imu, and then "corrects" (transforms) the IMU data into the robot's body (base_link) frame, and then passes it on to the filter to be fused.

Now let's say you have a LIDAR on your robot, and you define a base_link->lidar transform using static_transform_publisher. Your LIDAR detects an obstacle 10 meters away at 30 degrees. You have a node somewhere that needs to know where that obstacle is in the odom frame and not the lidar frame, so it uses the tf libraries to look up a transform from lidar to odom, which produces the location of that obstacle in the odom frame.

Note that you can name the frames whatever you want. REP-105 just gives suggestions that are commonly used. For PTAM, you can see if PTAM lets your specify the frame_id. If it does, you can set it to odom. If not, you can either (a) just set the odom_frame and world_frame parameters to ptam, or you can specify a static transform of 0 between ptam and odom.