Robot frame conventions help us understand where the robot is and how it moves. They give a clear way to talk about the robot's position and orientation in the world.
Robot frame conventions (base_link, odom, map) in ROS
Start learning this pattern below
Jump into concepts and practice - no test required
or
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Introduction
Syntax
ROS
# Typical ROS frames: # base_link: Robot's center frame # odom: Odometry frame, tracks robot movement over time # map: Fixed world frame, global reference # Example of frame relationship: # map -> odom -> base_link
base_link is the robot's own center point, like its body.
odom tracks how the robot moves from where it started, but can drift over time.
Examples
ROS
# base_link frame example # Represents the robot's center # Used for sensors and movement commands base_link
ROS
# odom frame example # Tracks robot's position relative to start # Updated by wheel encoders or sensors odom -> base_link
ROS
# map frame example # Fixed global frame # Used for navigation and mapping map -> odom -> base_link
Sample Program
This code listens for the robot's position in the global map frame. It prints the robot's x and y coordinates as it moves.
ROS
# ROS Python example showing frame usage import rospy from tf2_ros import Buffer, TransformListener rospy.init_node('frame_listener') buffer = Buffer() listener = TransformListener(buffer) rate = rospy.Rate(1) # 1 Hz while not rospy.is_shutdown(): try: # Get transform from map to base_link trans = buffer.lookup_transform('map', 'base_link', rospy.Time(0)) print(f"Robot position in map frame: x={trans.transform.translation.x:.2f}, y={trans.transform.translation.y:.2f}") except Exception as e: print("Waiting for transform...") rate.sleep()
Important Notes
The odom frame can drift over time because it relies on wheel movement.
The map frame is corrected by sensors like GPS or SLAM to stay accurate.
Understanding these frames helps you combine sensor data and control the robot well.
Summary
base_link is the robot's own center frame.
odom tracks movement from start but can drift.
map is a fixed global frame for navigation.
Practice
1. Which ROS frame represents the robot's own center point and moves with it?
easy
Solution
Step 1: Understand the role of
base_linkbase_linkis the frame fixed to the robot itself, representing its center.Step 2: Compare with other frames
odomtracks movement but can drift,mapis a fixed global frame, andworldis not a standard ROS frame here.Final Answer:
base_link -> Option BQuick Check:
Robot center frame = base_link [OK]
Hint: Remember: base_link moves with the robot itself [OK]
Common Mistakes:
- Confusing odom as robot center
- Thinking map moves with robot
- Assuming world is standard ROS frame
2. Which of the following is the correct way to refer to the odometry frame in ROS?
easy
Solution
Step 1: Identify the standard odometry frame name
The standard ROS frame for odometry isodom.Step 2: Check other options
base_linkis robot center,mapis global frame, andodom_frameis not a standard name.Final Answer:
odom -> Option AQuick Check:
Odometry frame = odom [OK]
Hint: Odom frame is just 'odom', no extra suffix [OK]
Common Mistakes:
- Adding '_frame' suffix incorrectly
- Mixing base_link with odom
- Using map instead of odom
3. Given a robot moving in a room, which frame will show drift over time due to sensor noise?
medium
Solution
Step 1: Understand frame drift
Theodomframe tracks movement from start but can accumulate errors causing drift.Step 2: Compare with other frames
mapis fixed and does not drift,base_linkmoves with robot,worldis not standard here.Final Answer:
odom -> Option DQuick Check:
Drifting frame = odom [OK]
Hint: Odom drifts; map stays fixed [OK]
Common Mistakes:
- Thinking map drifts
- Confusing base_link with odom
- Assuming world is used here
4. You notice your robot's position drifts over time when using the
odom frame. What is the best way to fix this issue?medium
Solution
Step 1: Understand the cause of drift
Theodomframe drifts due to sensor noise and integration errors over time.Step 2: Choose a frame that corrects drift
Themapframe is fixed globally and used for localization to correct odom drift.Final Answer:
Use the map frame for global localization -> Option AQuick Check:
Fix drift with map frame [OK]
Hint: Use map frame to correct odom drift [OK]
Common Mistakes:
- Using base_link which moves with robot
- Resetting odom often is impractical
- Ignoring drift causes navigation errors
5. You want to build a navigation system that uses sensor data to update the robot's position on a fixed map. Which sequence of frames should you use to correctly represent the robot's position relative to the world?
hard
Solution
Step 1: Understand frame hierarchy
The robot's position is relative tobase_link, which is relative toodom, andodomis relative tomap.Step 2: Determine correct parent-child order
The correct chain ismap(global fixed frame) ->odom(local odometry) ->base_link(robot center).Final Answer:
map -> odom -> base_link -> Option CQuick Check:
Global to robot: map -> odom -> base_link [OK]
Hint: Frame chain goes from map down to base_link [OK]
Common Mistakes:
- Reversing frame order
- Putting base_link as parent of odom
- Ignoring map as global frame
