Skip to content
Design System
GitHub

AttitudeIndicator (roll, pitch and heading as an artificial horizon with tip-over limits) and Gauge (one value on a dial with Meter's thresholds), both fed by push() at 20 to 50 Hz.

Roll
12°left
Pitch
3°nose down
Heading
271°W

Default

Install
npx shadcn add @syncrobotic/attitude

Also installs: lucide-react@^1, @syncrobotic/cn, @syncrobotic/status-glyph, @syncrobotic/meter, @syncrobotic/clock-time, @syncrobotic/use-reduced-motion, @syncrobotic/format-number

Overview

When to use

  • A legged or tracked robot on rough ground or a slope: how far it leans, against its tip-over limit.
  • An AMR on a ramp or a dock plate: pitch and roll while it climbs.
  • A robot's speed, a motor's temperature or a wheel's current at a glance, beside the drive controls or on a robot's page.

Use something else

  • A level that stays (battery, storage, signal): Meter, a bar, which reads faster in a list.
  • How a value moved over the last minutes: Streaming chart.
  • A limit crossed that needs someone to act: raise an Alarm too; the instrument shows where, the alarm asks for the action.
  • A pose on a map: Robot map; the arm's joints: Joint state.

More examples

States and real uses. Each example is also a Storybook story and a visual regression test.

Over limit

Critical

Pitch warning

No compass

Large

Stale

Waiting

From IMU

Zh tw

Live

Gauge sizes

Gauge thresholds

Gauge low

Gauge from odometry

Gauge stale

Gauge zh tw

Gauge live

Usage rules

  • AttitudeIndicator for a robot that can tip or slide: a legged robot on rough ground, an AMR on a ramp, a tracked robot on a slope. Gauge for one value now with a known range that someone glances at (speed, a motor's temperature, a wheel's current); a level that stays (battery, storage) is a meter, a history is streaming-chart.
  • Angles in degrees with REP 103's signs: positive roll is the right side down, positive pitch the nose down. imuToAttitude(msg) from ros gives them from a sensor_msgs/Imu; never flip pitch to nose-up-positive in the app, the words ("nose up", "nose down") already say it.
  • Set limits from the robot's datasheet: a tip-over warning (roll.warning, 25° on the patrol dog) and the angle it must not pass (critical). They are marked with the kit's status shapes (triangle, square) and stay grey until crossed; past one the value, the mark and the robot's symbol turn warning or danger and a word says so. Colour never alone.
  • Gauge takes Meter's thresholds as they are: low warns, critical is danger, higherIsWorse for a value that heats up or fills up. The arc stays graphite while normal, like Meter's bar; the indigo accent is only the horizon line, the mark to read.
  • Push a stream, never pass it as props: ref.current.push({ roll, pitch, heading }, stamp) or a subscribe that gets push once. The drawing follows every frame; the numbers are written four times a second, so they can be read, and at once when a limit is crossed.
  • Stale is on by default (1 s for the attitude, 3 s for a gauge): a frozen instrument dims and says Stale with the last update's time. Pass the stamp as updatedAt, set staleAfterMs to about three missed messages for a slow topic (a battery at 0.2 Hz: 15 s), and null only for a value that is not live.
  • Heading only from an IMU fused with a magnetometer (or a localisation in a map frame): an IMU alone drifts in yaw. Pass { heading: false } to imuToAttitude and the ring shows no compass.
  • Not a control: nothing in either instrument takes focus. Screen readers hear the attitude as one sentence ("Roll 12° left, pitch 3° nose down, heading 271° W") and each Gauge as a meter; a crossed limit is said politely, at most every 5 s, at once when it turns critical.
  • No sweep: values move straight to where they are, and under reduced motion the drawing steps with the numbers instead of following every frame.

Changelog

  • 0.64.02026-12-01Formatted with Prettier (class order sorted); the code is unchanged.
  • 0.53.02026-11-27Its doc opens with its description, word for word; the code is unchanged.
  • 0.51.02026-11-27Comments trimmed to what they need to say; the code is unchanged.

How to upgrade