# Bogie

A powered two-axle bogie, and the only self-excited motion in the set: nothing commands the wheelsets to wander, they wander because they are coned — at exactly Klingel's wavelength, until the flange stops them.

> 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/rail-bogie.json
```

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

## Notes

- Solved: the hunting, from `klingelWavelength()` and `huntingPose()`. Displace a coned wheelset and the rolling radii differ, so it yaws; yaw it and it runs sideways. That loop is undamped and second order, so the lateral position and the yaw come out a quarter of a wavelength apart — the wheelset is running most steeply sideways exactly as it passes centre.
- The frame is not animated either. It joins two wheelsets that are a wheelbase apart on one wave, so it sits on their mean and points along the line between them, and the difference is what the primary suspension has to take.
- Illustrated: the suspension travel, the brake shoes and the traction motor. No speed, no creep forces, no damping and no critical speed — and the flange clearance is drawn generously, or a real one per cent of the gauge would be invisible.

## Usage

```tsx
import { RailBogie } from "@/components/ui/rail-bogie"

<RailBogie behavior="hunt" />

// Conicity is the whole mechanism. Take it away and the motion stops.
<RailBogie travel={9} conicity={0} />
<RailBogie behavior="brake" view="profile" />
```

## Props

| name | type | default | description |
| --- | --- | --- | --- |
| `view` | `"plan" | "front" | "profile" | "iso"` | `"plan"` | Where the camera stands. One bogie, four projections: straight down, straight on, side elevation, or three-quarter from above. |
| `travel` | `number` | — | Distance run, in wheel diameters, 0–40. Supplying it stops the loop. |
| `onTravelChange` | `(travel: number) => void` | — | The run, while a person is scrubbing it. |
| `behavior` | `"hunt" | "curve" | "brake" | "static"` | `"hunt"` | Running and letting the cone work, standing radially on a curve, or running the shoes on until the weave dies away. |
| `conicity` | `number` | `0.1` | Tread conicity — the tan of the cone angle, 0–0.4. The one control worth touching: zero is a cylindrical tread and the hunting stops dead. |
| `amplitude` | `number` | `7` | How far the wheelset wanders, in world units. An input, because the kinematic solution does not set one; the flange clamps it. |
| `brake` | `number` | — | Shoes on the treads, 0 off to 1 hard on. Omit it and the behaviour works them. |
| `speed` | `number` | `0.24` | Runs 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 across the bogie to scrub the run; arrow keys half a wheel diameter at a time. |
| `showTrack` | `boolean` | `true` | The rails and sleepers under it. |
| `active` | `boolean` | — | Light the traction motor and call out a wheelset that is flanging. |
| `label` | `string` | — | Caption underneath the bogie. |
| `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/rail-bogie.tsx`
