Attitude
v0.64.0, changelogBetaAttitudeIndicator (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.
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 isstreaming-chart. - Angles in degrees with REP 103's signs: positive roll is the right side down, positive pitch the nose down.
imuToAttitude(msg)fromrosgives 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
limitsfrom 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:
lowwarns,criticalis danger,higherIsWorsefor 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({or aroll, pitch, heading }, stamp) subscribethat getspushonce. 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, setstaleAfterMsto about three missed messages for a slow topic (a battery at 0.2 Hz: 15 s), andnullonly 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
{toheading: false } imuToAttitudeand 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.