2026 sim: drive the Unity simulation with the real remote over the radio
Dongle (app):
- bridge mode: stands in for the robot's radio (ch 96 / 250k / HXPD1,
auto-ack, dynamic payloads, ack payloads). Received packets go to the PC
as A5-framed 'R' frames; the PC's 'A' frames become the ack payload of
the next packet, like robot/Comms.cpp; dropped after ~0.5 s without a
refresh. 'S' status once a second.
- USART RX through circular DMA into a ring buffer, overrun stall
disabled, error flags cleared: a burst (e.g. SignalRGB probing the port)
used to deafen the app until a replug.
- RX test mode ('x') accepts protocol v4's dynamic-length packets.
- safeboot_flash.py --knock: keeps knocking across a replug to catch
safeboot's cold-boot window when the app doesn't answer.
Unity:
- SimRemote sources: Keyboard, or the real remote via the dongle
(DongleLink.cs: kernel32 serial, auto-finds the CH340, all port I/O on
one background thread). Packets go into the firmware byte for byte, the
robot's telemetry goes back on the ack, so the remote's display shows
the sim. Tested end to end with the real remote.
- Dropped the USB joystick and robot-serial-harness inputs and the old
Serial/Serial2/Serial3/HandleHoystick scripts (and their components in
Main.unity): no USB links to remote or robot any more.
- Test panel: dongle status; no sideways scroll bar.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b3b2629cd
commit
2b4750f8f4
24 files changed
+682
-710
No files matched your search
+23
-16
@@ -71,25 +71,31 @@ It drives the firmware the way the remote would and checks:
|
||||
|
||||
Open `Hexapod_Simulation_Unity` and press Play in `Main.unity`. No scene
|
||||
edits are needed: `HexapodSimBootstrap` adds a `HexapodSimulation` object,
|
||||
disables the old movement scripts (`Walk`, `RotationControl`, `Leg`,
|
||||
`HandleHoystick`), and binds the existing leg rig by name (`Leg` → `hip1`
|
||||
/ `Hip2` / `Knie`). The on-screen panel (F1 toggles it) offers three input
|
||||
sources:
|
||||
disables the old movement scripts (`Walk`, `RotationControl`, `Leg`), and
|
||||
binds the existing leg rig by name (`Leg` → `hip1` / `Hip2` / `Knie`). The
|
||||
on-screen panel (F1 toggles it) offers two input sources:
|
||||
|
||||
- **Joystick:** the real remote as a USB controller, on input axes
|
||||
`"1"`–`"6"` like the old `HandleHoystick`. Axis assignment and inversion
|
||||
are set on the `SimRemote` component. The panel shows the raw axes so you
|
||||
can fix them.
|
||||
- **Keyboard:** test without a remote. WASD walks, Q/E turns, IJKL + U/O
|
||||
drive the right stick, 1–7 flip the toggles, Backspace disarms, +/-
|
||||
change speed.
|
||||
- **Robot serial:** no radio at all. Keystrokes go to `robot.ino`'s own
|
||||
`TEST_SERIAL_INPUT` harness.
|
||||
change speed. The panel has every remote toggle, the speed slider and
|
||||
simulated handset tilt (remote gyro).
|
||||
- **Real remote (radio):** the real handheld remote, over the air. The USB
|
||||
nRF24 dongle (`../dongle/`, bridge mode) receives its packets, they go
|
||||
into the firmware byte for byte, and the robot's `Telemetry` goes back as
|
||||
the radio's ack payload, exactly like the real robot's `Comms`. The
|
||||
remote's display then shows the simulated robot (state, IMU, joint
|
||||
angles, servo calibration). `DongleLink.cs` finds the dongle's CH340 port
|
||||
by itself (or set `SimRemote.donglePort`, e.g. `COM7`); quit SignalRGB
|
||||
first, it grabs CH340 ports. Don't run the real robot at the same time:
|
||||
both would answer the remote.
|
||||
|
||||
The panel also has every remote toggle, the speed slider, simulated
|
||||
handset tilt (remote gyro), a **ground tilt** slider (to test the robot
|
||||
gyro), and live firmware state, joint angles, foot contact, the packet on
|
||||
air and robot serial output.
|
||||
There's no USB link to the remote or the robot any more (the old joystick
|
||||
and serial-harness inputs and the `Serial*` / `HandleHoystick` scripts are
|
||||
gone): everything goes over the radio.
|
||||
|
||||
The panel also has a **ground tilt** slider (to test the robot gyro), and
|
||||
live firmware state, joint angles, foot contact, the packet on air and the
|
||||
robot's debug prints.
|
||||
|
||||
The body moves **kinematically**, computed in the DLL (`SimBody.cpp`), so
|
||||
Unity shows what the smoke test checks:
|
||||
@@ -119,4 +125,5 @@ component to the scene yourself.
|
||||
firmware *intends*, including pulse-limit clamping (which is how it
|
||||
caught the old ±90° coxa offsets). Whether a real servo turns that way is
|
||||
a bench check.
|
||||
- The remote firmware. `SimRemote.cs` mirrors its packet rules instead.
|
||||
- The remote firmware, in Keyboard mode: `SimRemote.cs` mirrors its packet
|
||||
rules instead. With the real remote over the radio, its own firmware runs.
|
||||
Reference in new issue
Block a user