# Motion platform

Six actuators and a deck: the Stewart platform doing the job it was invented for, with visible stroke and a fault when a pose asks for more travel than it has.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/motion-platform.json
```

Registry item: `motion-platform` · [`https://robocn.dev/r/motion-platform.json`](https://robocn.dev/r/motion-platform.json)

## Notes

- Every leg length comes from stewart-kinematics, and the deck is drawn through its own six solved anchors rather than as a picture with a transform on it — so the plate tips because the legs moved, and the payload stands on the normal those anchors define.
- A pose that asks a leg for more than its travel is reported, not hidden: the leg is flagged, the lamp changes and the label says over travel. That is the number that tells you whether a pose is reachable.
- Kinematics only — no payload, no actuator dynamics, no washout filter.

## Usage

```tsx
import { MotionPlatform } from "@/components/ui/motion-platform"

<MotionPlatform behavior="sway" payload="camera" />

// Controlled, or a deck you can tip.
<MotionPlatform roll={12} pitch={-6} heave={8} />
<MotionPlatform interactive onPoseChange={setPose} />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"iso"` | Where the camera stands. One platform, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `roll` | `number` | — | Controlled roll in degrees, clamped to ±24. Supplying any pose prop stops the loop. |
| `pitch` | `number` | — | Controlled pitch in degrees, clamped to ±24. |
| `yaw` | `number` | — | Controlled yaw in degrees. |
| `heave` | `number` | — | Controlled rise above the resting height, in world units. |
| `sway` | `number` | — | Controlled sideways offset, in world units. |
| `surge` | `number` | — | Controlled fore-aft offset, in world units. |
| `behavior` | `"settle" | "sway" | "static"` | `"settle"` | The small continuous correction a loaded platform lives on, or the full six-axis excursion. |
| `speed` | `number` | `0.25` | Pose cycles per second. |
| `animate` | `boolean` | `true` | Off parks the machine at phase and stops rendering. A reduced-motion preference does the same. |
| `paused` | `boolean` | `false` | Freeze where it stands. |
| `phase` | `number` | `0` | Seconds of offset, so a row of machines breaks step. |
| `interactive` | `boolean` | `false` | Drag the deck to tip it — across for roll, up and down for pitch — or arrow-key it 4° at a time. |
| `onPoseChange` | `(pose: { roll: number; pitch: number }) => void` | — | The tilt a person has put in, throughout a drag or a key press. |
| `payload` | `"deck" | "camera" | "none"` | `"deck"` | What is bolted to the plate. Both stand on the plate's own solved normal. |
| `showStroke` | `boolean` | `true` | Print the tilt and the longest leg stroke under the drawing. |
| `label` | `string` | — | Caption below the stroke readout. |
| `variant` | `"solid" | "outline" | "blueprint" | "wire"` | `"solid"` | How the machine is painted. Geometry never changes between variants. |
| `size` | `"xs" | "sm" | "md" | "lg" | "xl" | number` | `"md"` | Rendered width in pixels, or a step on the scale. |
| `color` | `string` | `var(--robot-shell)` | Body panels — the colour the machine reads as. |
| `accent` | `string` | `var(--robot-accent)` | Status colour: tip light, live tool, readouts. |
| `metal` | `string` | `var(--robot-metal)` | Bare machined parts: collars, bolts, tool bodies. |
| `dark` | `string` | `var(--robot-dark)` | Cast joints, base, shadow side. |
| `palette` | `Partial<RobotPalette>` | — | Override any subset of roles at once, including glow and grid. |

## Source

- `src/components/ui/motion-platform.tsx`
