gimbal_sensor

Inertial measurement on the body frame: pitch/roll angles, angular rates, gravity vector, and linear acceleration.

Body frame. "Body frame" means the host Sable sub-level's (i.e. the contraption's) frame, not the block's own local frame. At identity sub-level orientation, body axes equal world axes:

As the contraption rotates, body axes rotate with it. The block's mounting orientation does not affect any reading — two gimbal sensors placed in different orientations on the same contraption return identical values.

getAngles()Get the contraption's pitch and roll angles in degrees.
getAnglesRad()Get the contraption's pitch and roll angles in radians.
getAngularRates()Get the contraption's angular velocity in body frame.
getAngularRatesRad()Get the contraption's angular velocity in body frame, in radians/sec.
getGravity()Get the local gravity vector expressed in body frame.
getLinearAcceleration()Get the contraption's proper acceleration in body frame — what an onboard accelerometer would read.
getAngles()Source

Get the contraption's pitch and roll angles in degrees. Both are derived from where world-down points in the body frame:

  • xAngle — rotation about body-X (pitch). 0° = body-Y aligned with world-up.
  • zAngle — rotation about body-Z (roll). 0° = body-Y aligned with world-up.

Yaw is not measurable from gravity alone and is not reported here; use navigation_table.getHeading() for yaw.

Returns

  1. { number... } A two-element list {pitch, roll} in degrees.
getAnglesRad()Source

Get the contraption's pitch and roll angles in radians. See getAngles for axis conventions.

Returns

  1. { number... } A two-element list {pitch, roll} in radians.
getAngularRates()Source

Get the contraption's angular velocity in body frame. Components are rotation rates about each body axis: wx = pitch rate (about body-X, matches the sign of getAngles's pitch derivative); wy = yaw rate (about body-Y); wz = roll rate (about body-Z, matches the sign of getAngles's roll derivative). From Sable's rigid-body engine.

Returns

  1. { number... } A three-element list {wx, wy, wz} in degrees/sec.
getAngularRatesRad()Source

Get the contraption's angular velocity in body frame, in radians/sec. See getAngularRates for axis conventions.

Returns

  1. { number... } A three-element list {wx, wy, wz} in radians/sec.
getGravity()Source

Get the local gravity vector expressed in body frame. The dimension's gravity in world frame, rotated into the contraption's body frame. Sable's stock default is (0, -11.0, 0) m/s² applied uniformly to every dimension (Overworld, Nether, End, modded — all the same out of the box). Other mods, modpacks, or datapacks can override per-dimension by shipping data/<ns>/dimension_physics/<file>.json with a base_gravity entry — e.g. a Moon dimension mod would set [0, -1.6, 0] and this sensor would faithfully report it without any Avionics-side change.

Useful for attitude estimation: atan2(g.x, -g.y) ≈ roll, atan2(g.z, -g.y) ≈ pitch — the same derivation getAngles performs internally.

Returns

  1. { number... } A three-element list {gx, gy, gz} in m/s².
getLinearAcceleration()Source

Get the contraption's proper acceleration in body frame — what an onboard accelerometer would read.

Computed as (Δv × 20) - gravity_body: finite-differenced inertial velocity at the server tick rate, with body-frame gravity subtracted out. Has one tick of lag.

Conventions:

  • Stationary or constant-velocity contraption reads -getGravity() (the normal force "felt" by the body).
  • Free-falling contraption reads zero.
  • To recover inertial acceleration (rate-of-change of body velocity), add getGravity() component-wise.

Returns

  1. { number... } A three-element list {ax, ay, az} in m/s².