Table of Contents
Overview#
Understanding coordinate systems is essential for sensor fusion in robotics. This guide covers LiDAR coordinate conventions and ROS Transform (TF) system.
Standard Coordinate Convention#
RGB Axis System#
Z (Blue)
↑
│
│
└────────→ X (Red)
╱
╱
Y (Green)| Axis | Color | Direction |
|---|---|---|
| X | Red | Forward |
| Y | Green | Left |
| Z | Blue | Upward |
This follows the right-hand rule.
TF (Transform) System#
What is TF?#
TF manages relationships between multiple coordinate systems:
- Robot base to sensor frames
- Map to robot frame
- World to local frames
TF Tree Structure#
map
│
↓
odom
│
↓
base_link
↙ ↘
laser cameraCommon Commands#
View TF Tree#
rosrun tf view_framesGenerates frames.pdf showing transform tree.
Alternative (Noetic)#
For Python 3 compatibility:
rosrun tf2_tools view_frames.pyOr use GUI:
rosrun rqt_tf_tree rqt_tf_treeEcho Transform#
rosrun tf tf_echo base_link laserOutput:
At time t
- Translation: [x, y, z]
- Rotation: [qx, qy, qz, qw]Static Transform Publisher#
For fixed sensor positions:
rosrun tf static_transform_publisher x y z yaw pitch roll parent_frame child_frame period_msExample:
rosrun tf static_transform_publisher 0.1 0 0.05 0 0 0 base_link laser 100RViz Visualization#
Launch RViz#
rosrun rviz rvizAdd TF Display#
- Click “Add”
- Select “TF”
- Configure:
- Show Axes: Check
- Frame Timeout: 15
- Frames: Select relevant ones
URDF Definition#
Sensor Position in URDF#
Located in: ~/catkin_ws/src/your_robot_package/urdf/robot.urdf
<robot name="my_robot">
<link name="base_link"/>
<link name="laser_link">
<visual>
<geometry>
<cylinder length="0.02" radius="0.03"/>
</geometry>
</visual>
</link>
<joint name="laser_joint" type="fixed">
<parent link="base_link"/>
<child link="laser_link"/>
<origin xyz="0.1 0 0.05" rpy="0 0 0"/>
</joint>
</robot>Parameters#
| Parameter | Description |
|---|---|
| xyz | Position offset |
| rpy | Roll, Pitch, Yaw (radians) |
| parent | Reference frame |
| child | This sensor’s frame |
Transform Types#
Static Transform#
Fixed relationship (sensor to robot):
<node pkg="tf" type="static_transform_publisher" name="laser_tf"
args="0.1 0 0.05 0 0 0 base_link laser 100"/>Dynamic Transform#
Changing relationship (robot to map):
- Published by odometry
- Updated by localization
Sensor Fusion Application#
Why Transforms Matter#
To combine LiDAR with other sensors:
- Know each sensor’s position
- Transform data to common frame
- Fuse in unified coordinate system
Example: LiDAR + Camera#
import tf
listener = tf.TransformListener()
# Get transform from camera to laser
(trans, rot) = listener.lookupTransform(
'/camera_link',
'/laser_link',
rospy.Time(0)
)
# Transform point from laser to camera frame
# Apply translation and rotationTroubleshooting#
“Could not find transform”#
# Check if frames exist
rostopic echo /tf | grep frame_idOld Python Error (Noetic)#
If view_frames fails:
# Use tf2 instead
rosrun tf2_tools view_frames.pyVerify Transform Chain#
rosrun tf tf_monitorShows all transforms and their rates.