ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

Many nodes that carry out state estimation generate both a transform from the odom frame to the base_link frame and a nav_msgs/Odometry message. If, for example, you start up your robot, and then drive 10 meters forward and 20 meters to the left, you will end up at (10, 20) in the odom frame and will likely have a heading (yaw) of pi/2. Your odom->base_link transform will contain the exact same information (although actually transforming a point from the odom frame to the base_link frame would require the inverse of that transform).

Looking at the code example, it seems like what they're trying to do is use the transform as a measurement of the robot's current position. They wait for the robot's first reported position and stick that in start_transform. They then start driving, and repeatedly get the current transform (again, just the robot's position in the odom frame), determine the difference between the current transform and the start transform, and use that to calculate a distance traveled. When the robot has traveled far enough, the loop terminates.

listener_.lookupTransform is just receiving the latest transform. Some other node is broadcasting it. The first two arguments, "base_footprint" and "odom_combined," are the target and source frames, respectively.