Projected Gravity
- Also called: projected gravity vector, body-frame gravity vector
- Category: Sensing › Proprioceptive
- Tags: orientation, legged-locomotion, reinforcement-learning, imu, observation-design
The unit gravity direction expressed in a robot's body frame; it encodes roll and pitch without yaw and is a standard tilt input for learned locomotion and balance policies.
Definition
Projected gravity is the direction of gravity expressed in the coordinate frame of a robot body, usually the base or torso. In the world frame gravity points straight down, (0, 0, -1) as a unit vector. Rotating it into the body frame with the transpose of the body's orientation matrix gives a three-component vector that changes as the body tilts. When the body is upright the vector is (0, 0, -1); as the body tilts by an angle θ, the horizontal part grows to length sin θ and the vertical part shrinks to -cos θ. The norm of the x and y components is therefore a direct measure of tilt, zero when upright and one when the body is on its side, and the direction of that horizontal part shows which way the body is leaning.
The main reason for using this vector instead of roll, pitch and yaw angles is that it contains exactly the orientation information a balance or locomotion controller needs. It is unaffected by heading, so a policy behaves the same whichever way the robot faces, and it is a smooth function of orientation, without the wrap-around and singularities of Euler angles. For these reasons it is a standard observation term in reinforcement-learning frameworks for legged robots and humanoids, such as legged_gym and Isaac Lab, and its horizontal components are often used directly in rewards that penalize body tilt.
On hardware, projected gravity comes from the orientation estimate of an IMU, usually computed by a filter that combines gyroscope and accelerometer data. It is not the same as the raw accelerometer reading: an accelerometer measures specific force, which equals the gravity direction only when the body is not accelerating. A policy trained on perfect simulated orientation can therefore behave differently when given a filtered estimate that lags or is disturbed during impacts, which is why noise and delay are often added to this observation during training. The same construction can be applied to any body, such as a tray held by a humanoid, to measure how level it is.
Why it matters
Tilt relative to gravity is the single most important orientation signal for keeping a robot, or an object it carries, upright. Projected gravity provides it in a compact, heading-independent form that learned controllers handle well, which is why it is a standard entry in the observations of learned locomotion policies.
Key applications
- Observation input for learned legged and humanoid locomotion policies
- Reward terms that penalize body or payload tilt
- Fall detection and recovery triggers
- Balancing carried objects such as trays and containers
- Tilt-aware control of mobile manipulators on slopes
In practice
A team trains a humanoid policy to carry a tray without spilling. The observation includes the projected gravity of the torso, from the IMU, and of the tray, computed from the tray's estimated orientation. The reward penalizes the squared norm of the tray's horizontal gravity components, which is zero when the tray is level. During training in simulation, noise and a small delay are added to both vectors to match the onboard orientation filter. On the real robot, the team checks that the IMU's frame convention matches the simulator's, since a swapped axis or a sign error in this vector makes the policy try to correct a tilt that is not there.
Common misconceptions
- Projected gravity is the accelerometer reading — the accelerometer also measures linear acceleration, so it matches gravity only when the body is not accelerating
- It encodes the full orientation — rotation about the gravity axis (yaw) is not represented, which is usually intended
- It is just roll and pitch angles under another name — it carries the same tilt information but as a smooth unit vector without angle wrap-around or singularities
Who should know this
- Reinforcement-learning engineers training locomotion and balance policies
- Legged and humanoid robot controls engineers
- Engineers deploying sim-trained policies on real IMUs
- Robotics students working with orientation representations
Related technologies
- Isaac Lab
- legged_gym
- Attitude and Heading Reference System
- Quaternion Orientation Estimation
- Mahony and Madgwick Filters
Related terms
Related projects
- LeRobot: HuggingFace ML library for real-world robotics in PyTorch
- MuJoCo: DeepMind physics engine for robotics and ML research
- PyBullet: Python physics simulator for robotics and RL research with fast CPU-based simulation
- Microduck: Pollen Robotics' $399 walking duck robot: open-source software, closed hardware
- Isaac Lab: NVIDIA robot learning framework: one task API across Newton, PhysX and Isaac Sim
- Newton: Open GPU physics engine for robot learning, with Kamino for closed-loop linkages