Projected gravity
That projected gravity encodes roll and pitch but not yaw: turning in place leaves all three numbers unchanged, while nodding or swaying changes them.
What it demonstrates
That projected gravity encodes roll and pitch but not yaw: turning in place leaves all three numbers unchanged, while nodding or swaying changes them.
How it works
A robot base follows a scripted orientation: a steady turn (yaw only), a nod (pitch), a sway (roll), or a walking-like mix of sway, a small pitch bob and a slow turn. At each frame the orientation is turned into a rotation matrix and projected gravity g_b = Rᵀ·[0, 0, −1] is computed and plotted.
The plumb indicator shows the horizontal components (g_x, g_y) in the body frame: the dot moves in the direction that 'down' points relative to the robot.
Adjustable parameters
- Motion: turn, nod, sway, walk
- Tilt amplitude (0–60°)
Known limitations
- The motions are scripted, not simulated dynamics.
- On a real robot projected gravity is estimated by a sensor-fusion filter and carries its own errors, especially during strong accelerations.
Equations
Core update rule
const { roll, pitch, yaw } = attitude(scenario, t);
const g = projectedGravity(eulerToMatrix(roll, pitch, yaw));
// g depends on roll and pitch onlyExplained in Chapter 4: Sensors & Data