Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ This repository contains the flight scripts, production ground-control policy,
LinkHub transport gateway and browser UI, physics simulation, calibration tooling,
and documentation for the RAWES hardware and control system.

## [Try the live browser demo](https://mcroomp.github.io/windpower/)

**Run a simulated experiment entirely in your browser** - no installation or
hardware required. The demo uses synthetic telemetry and saves no experiment data.

---

## What Is This System?
Expand Down
3 changes: 2 additions & 1 deletion design/calibration.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ vehicle-status endpoints used by calibration are:
- `POST /v1/mavlink/directories`
- `GET /v1/mavlink/logs`
- `POST|GET|DELETE /v1/mavlink/transfers[/{id}[/content]]` (file and log downloads)
- `GET /v1/motor`, `PUT /v1/motor`, `POST /v1/motor/stop`, `POST /v1/motor/reconnect`
- `GET /v1/motor`, `PUT /v1/motor`, `POST /v1/motor/stop`
(automatic connection and control-session safety: [motor semantics](linkhub.md#bluetooth-bench-motor))
when the optional Bluetooth motor backend is enabled

MAVLink enumerations and bitmasks are named values on LinkHub's wire, not
Expand Down
40 changes: 22 additions & 18 deletions design/linkhub.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,22 +196,25 @@ See [CSV usage and mapping format](../linkhub/README.md#generic-csv-ingestion).

### Bluetooth bench motor

`--motor-name-prefix` enables the external rotor-drive backend. It starts
disconnected and initializes Bluetooth only when a client scans or connects,
so an absent adapter does not prevent MAVLink service startup.
Discovery lists matching device names and opaque IDs from the server's adapter;
an explicit connection selects one exact ID, never another matching device.
The Nordic UART service is verified at connection time.
Connecting initializes the motor off. Switching devices first completes the
previous motor's controlled stop and never starts the selected motor.
Scanning is rejected while connected and running. After Bluetooth loss, scanning
is allowed even if the last running command remains unconfirmed; scanning does
not clear that state. Explicit reconnection initializes the motor off.

Every running command includes the connected `device_id`, speed percentage,
`--motor-name-prefix` enables background discovery on the server's Bluetooth
adapter. An absent adapter or motor does not prevent MAVLink service startup.
After each failed discovery/connection attempt LinkHub waits two seconds before
retrying. It connects only when exactly one advertised name matches the prefix;
zero or multiple matches are explicit errors in status and the journal.
Discovery stops while connected. The Nordic UART service is verified at
connection time, and connection initialization sends only the disabled/off
command. Bluetooth loss releases the handles and resumes discovery.
Automatic connection and reconnection never start or resume the motor.

Every running command includes the connected `device_id`, current `control_id`, speed percentage,
direction, and a finite lease duration. The current motor is forward-only;
reverse requests are rejected. LinkHub rejects commands for a different device.
Motor operations and the supervisor are serialized.
The opaque control ID changes on connection, stop, and lease expiry. Delayed
commands from a previous control session are rejected, even after a stop has
completed or the same device has automatically reconnected. Only an explicit
browser **Start** click acquires the current control ID for lease renewal;
status polling, slider changes before starting, and reconnection do not.

Speed requests are targets, not immediate writes. A Rust-owned motion profile
limits command rate to 25 percentage points/s and changes in that rate to
Expand All @@ -224,7 +227,7 @@ do not reset the profile. Output is quantized to the motor protocol's integer
percentages. The supervisor advances at most one 20 ms profile step per tick;
delays extend the move rather than causing catch-up jumps.

Explicit stop, lease expiry, reconnect, device switching, and graceful service
Explicit stop, lease expiry, and graceful service
shutdown all target zero through this profile. A stop cannot be interrupted by
a running command; wait for off before explicitly restarting. Stop requests wait
for profile completion, but cancelling their HTTP handler does not cancel the
Expand All @@ -246,13 +249,14 @@ motor-firmware/hardware protection. Write failures are reported as unconfirmed
motor state; LinkHub does not send an abrupt brake as an error fallback.
On link/write failure the supervisor exits and releases the Bluetooth peripheral
and adapter handles. Cleanup failures are logged without clearing the original
unconfirmed motor state. A subsequent UI connection acquires fresh handles and
unconfirmed motor state. Automatic reconnection acquires fresh handles and
initializes the motor off; it never resumes the previous command.

The browser renews a 2 s lease every 500 ms only for a motor it explicitly
started. Closing its motor panel, hiding the tab, or a request failure revokes
renewal and attempts a stop. A suspended browser must not revive an expired
lease, and reopening the panel never starts or adopts a running motor.
started. Hiding the tab, leaving the page, or a request failure revokes
renewal and attempts a stop. Collapsing panel details does not revoke the lease:
the compact row retains its speed and Stop controls. A suspended browser must
not revive an expired lease, and expanding details never starts or adopts a running motor.
Renewal remains tied to the same active experiment and its completed snapshot.
Camera verification is required to start the motor, not to renew its lease.
UI operation is described in the [motor panel guide](../linkhub-ui/README.md#bluetooth-motor-panel).
Expand Down
Loading
Loading