# Rover

A ground robot in plan view. Choose four or six wheels, steer the front axle, and drive its heading and tread travel from your application.

> 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/robot-rover.json
```

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

## Notes

- Plan view is the identity projection, and the heading is carried by the camera rather than by turning the picture, so the rover faces the same way from every angle. The wheels are cylinders and the chassis a box — neither of which a plan view ever had to have.
- Any axis you supply wins for that axis alone: a controlled heading still leaves the treads and the steering to the component unless you supply those too.
- Steering is not a second animation — it is the heading error, which is why the rover leans into a turn and straightens as it finishes one. It is still an illustration rather than a dynamics solver: nothing integrates a driving path.

## Usage

```tsx
import { RobotRover } from "@/components/ui/robot-rover"

<RobotRover wheels={6} behavior="patrol" />

// Or drive it: pointer mode turns it to face the cursor.
<RobotRover behavior="pointer" interactive onHeadingChange={setHeading} />
<RobotRover heading={25} steering={15} wheelTravel={0.4} active />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One rover, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `wheels` | `4 | 6` | `4` | Two or three axles. Only the front axle steers. |
| `behavior` | `"patrol" | "wander" | "pointer" | "static"` | `"patrol"` | Drive a square patrol, drift about, or come round to face the pointer. |
| `heading` | `number` | — | Clockwise degrees from the top. Omit it and the rover drives behavior. |
| `steering` | `number` | — | Front-wheel angle, clamped to −45..45 degrees. Omit it and the wheels steer themselves: the angle is the heading the chassis has left to cover. |
| `wheelTravel` | `number` | — | Controlled tread phase. Whole turns repeat; decrease to reverse. Omit it and the treads roll while it drives. |
| `speed` | `number` | `0.3` | Legs of the patrol per second, or drift 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` | Press and drag to send it a bearing — the only way to steer it on a touch screen — and arrow-key it 15° at a time. |
| `onHeadingChange` | `(heading: number) => void` | — | The commanded bearing, wrapped to 0–360. |
| `showSensor` | `boolean` | `true` | Draw the roof-mounted sensor turret. |
| `active` | `boolean` | — | Illuminate the front lamps. Omit and they light while it is driving. |
| `label` | `string` | — | Caption underneath the rover, independent of heading. |
| `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/robot-rover.tsx`
