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.
API reference
Generated from the types. Every part also takes className.
AttitudeIndicator
- roll
numberDegrees, REP 103: positive is the right side down. For a stream, push instead (reforsubscribe).- pitch
numberDegrees, REP 103: positive is the nose down.- heading
numberCompass heading in degrees, clockwise from north. Left out (and never pushed), the ring shows no compass.- labelrequired
stringWhat the instrument shows, for screen readers: "Attitude, Patrol dog 7F3A".- ref
((instance: AttitudeHandle | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<AttitudeHandle | null>push and clear, called from anywhere without rendering.- subscribe
(push: AttitudeHandle["push"]) => (() => void) | voidConnects a source once: called withpushwhen it mounts (and again if this function changes); return the function that disconnects. Keep it stable (module level, or one the React Compiler memoises).(push).=> ros.subscribe("/ imu/ data", "sensor_msgs/ Imu", (m) => push(imuToAttitude(m), stampToMs(m.header?.stamp))) - limits
{ roll?: AttitudeLimit; pitch?: AttitudeLimit }Warning and critical limits for roll and pitch, either side of level. Marked on the drawing; past one, the value says so.- updatedAt
numberWhen the props' reading was taken (the message's stamp): a new stamp is an update, and it is the time Stale shows.- staleAfterMs
number | null = 1000With no update for this long, the instrument dims and says Stale with the last update's time. 1000 ms by default: an IMU publishes at 50 Hz or more, so a second is 50 missed readings, and a horizon frozen while the robot tips is the failure this guards against.nullnever goes stale.- announceEveryMs
number = 5000How often, at most, screen readers hear a limit crossed (a step up to critical is said at once).- size
"md" | "lg" = "md"md 192 px (the default) or lg 256 px.- locale
stringBCP 47 tag for numbers and times ("zh-TW"): pass the app's locale. Left out, English on the server and in every browser.- labels
Partial<AttitudeIndicatorLabels>
Gauge
- value
numberThe value now. For a stream, push instead (reforsubscribe).- min
number = 0- maxrequired
number- low
numberWarning from here: below it, or at and above it whenhigherIsWorse(Meter's thresholds, Meter's words).- critical
numberDanger from here.- higherIsWorse
boolean = falseA value that is worse as it rises: a temperature, a current, a speed over a limit.- labelrequired
stringWhat is measured: "Speed", "Left motor temperature". Written under the dial, and read with the value.- unit
string = ""Written under the number and after it for screen readers: "m/s", "°C", "A".- digits
number = 1Decimals. Defaults to 1.- size
"sm" | "md" | "lg" = "md"sm 96 px, md 144 px (the default), lg 192 px.- ref
((instance: GaugeHandle | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<GaugeHandle | null>- subscribe
(push: GaugeHandle["push"]) => (() => void) | voidConnects a source once, as AttitudeIndicator's:(push). Keep it stable.=> ros.subscribe("/ odom", "nav_msgs/ Odometry", (m) => push(odometryToSpeed(m), stampToMs(m.header?.stamp))) - updatedAt
number- staleAfterMs
number | null = 3000With no update for this long the gauge dims and says Stale. 3000 ms by default: a gauge shows anything from a speed at 20 Hz to a temperature or a battery at 1 Hz, and three seconds is two missed readings of the slowest. Set it to about three periods of your topic;nullnever goes stale.- announceEveryMs
number = 5000- locale
string- labels
Partial<GaugeLabels>