Frames and rotations
Every number a robot uses for position or orientation is relative to some coordinate frame. This page covers frames, rotation matrices, roll–pitch–yaw angles and gimbal lock, quaternions, and homogeneous transforms, then shows how they fit together in the Strido transform (tf) tree.
In Strido
- Base frame: REP-103 (
xforward,yleft,zup), with the origin at the centre of the four hip-axis intersections. It is defined inhardware/kinematics.yaml(base_frame), together with the rotation from the CAD (STEP) frame. - Frame tree:
ros2/strido_description/urdf/strido.urdf.xacrodefinesbase_link,imu_link,lidar_link,camera_link,camera_optical_frameand, for each leg,*_hip,*_thigh,*_calfand*_foot. - Orientation: the firmware runs a Mahony filter and outputs a quaternion (
firmware/strido_esp32s3/src/main.cpp).mcu_bridgepublishes it as/imu/datainimu_link. - Leg transforms in code:
foot_positioninpackages/strido-core/src/strido/leg.py.
Frames
A frame is an origin plus three orthogonal unit axes. A point
ROS fixes the conventions in REP-103. Body frames use base_link origin is the centre of the four hip-axis intersections, so the hips sit at legs_base in hardware/kinematics.yaml).
The CAD model uses a different frame. hardware/kinematics.yaml stores the rotation that maps STEP coordinates into base coordinates:
This is a
Rotation matrices
The orientation of frame
Rotation matrices with these properties form the group
Rotations combine by multiplication,
Roll, pitch, yaw and gimbal lock
A rotation has three degrees of freedom, but its matrix has nine numbers. Euler angles describe it with three successive elementary rotations. ROS and URDF use roll–pitch–yaw (RPY): roll
RPY is easy to read. The Strido camera is mounted with rpy="0 0.261799 0", a
RPY angles have a singularity. At
blow up. That is because the matrix that maps body angular velocity to
Quaternions
A unit quaternion
Rotations compose by the quaternion (Hamilton) product.
The Strido firmware gets orientation.getQuaternion and sends it to the Pi. The learned policy does not use the raw angles. It uses the direction of gravity seen from the body, packages/strido-sim/src/strido_sim/rl/env.py). This vector is smooth for every orientation and has no gimbal lock. See state estimation for how the filter produces
Homogeneous transforms
A pose combines a rotation and a translation. A
Here
Each URDF joint is exactly one such transform. The fixed <origin xyz rpy> comes first. For a revolute joint, it is followed by a rotation about <axis> by the joint angle.
The Strido tf tree
robot_state_publisher computes the leg transforms from the joint angles. The sensor frames are fixed. For example, imu_link sits at base_link. camera_optical_frame uses rpy="-π/2 0 -π/2" so that its odom → base_link comes from gait_node, which integrates the commanded body velocity. It is not measured odometry (see the docstring of ros2/strido_control/strido_control/gait_node.py).
For the front-left leg, the URDF chain is:
Worked example: abducting the front-left leg
In the stand pose (stand_pose() in strido/gait.py, body height
Now abduct by
Adding the hip origin base_link. foot_position("FL", (0.1745, 0.8121, -1.6761)) returns the same point. The same rotation as a quaternion is
Check yourself
- Why is
just the transpose? - The IMU frame is aligned with
base_linkbut offset by a few centimetres. Does the offset change the measured angular velocity? Does it change the measured acceleration? - Why does the policy observe the gravity vector rather than roll, pitch and yaw?
- Write
in terms of the URDF transforms.
Answers
- The columns are orthonormal, so
. - Angular velocity is the same everywhere on a rigid body, so the offset does not change it. Linear acceleration does change: an offset point sees extra
terms. - It is continuous and has no singularity. Yaw is also unobservable from an IMU without a magnetometer, and walking does not need it.
, with each factor built from the joint's xyzandrpy.
Further reading
- K. M. Lynch and F. C. Park, Modern Robotics: Mechanics, Planning, and Control, Cambridge University Press, 2017, ch. 3 (rigid-body motions). Free PDF
- B. Siciliano, L. Sciavicco, L. Villani and G. Oriolo, Robotics: Modelling, Planning and Control, Springer, 2009, ch. 2.
- REP-103: Standard Units of Measure and Coordinate Conventions and REP-105: Coordinate Frames for Mobile Platforms.
- J. Solà, "Quaternion kinematics for the error-state Kalman filter", arXiv:1711.02508, 2017.
- ROS 2 and the robot description in this wiki.