Compare commits
3
Commits
1591105f26
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
179afdb705 | ||
|
|
a59faf3b03 | ||
|
|
175a1a0da8 |
No files matched your search
+14
-8
@@ -14,7 +14,10 @@ remote/ Teensy 4.0 firmware (PlatformIO env remote)
|
||||
shared/HexapodProtocol/ wire protocol, used by robot, remote and sim
|
||||
sim/ robot firmware -> hexapod_sim.dll (CMake + g++), headless smoke test
|
||||
Hexapod_Simulation_Unity/ Unity 6000.6 project that loads the DLL (Assets/HexapodSim/)
|
||||
scripts/ PlatformIO helper
|
||||
dongle/ USB nRF24 stick firmware (STM32F030): the PC's radio, bridge mode for Unity
|
||||
hardware/ OpenSCAD rebuild + new remote case, Fusion 360 designs, PCB notes
|
||||
scripts/ PlatformIO helper, make_remote_hmi.py (generates remote/remote.HMI)
|
||||
tools/nextion-hmi-tools/ git submodule: nxhmi (.HMI read/write/render, MCP server)
|
||||
```
|
||||
|
||||
This folder is `2026-current/` inside the `hexapod-robot` repo. The older generations sit next to it
|
||||
@@ -145,7 +148,7 @@ link-loss disarm, servo-trim read-back from telemetry) → PacketBuilder →
|
||||
| `PacketBuilder` | the inverse of InputMapper: stick frame → body frame per the contract, per-submode right-stick mapping, `FLAG_WALK` with 250 ms linger (twist ignored in mode B), tilt deadzone/scale × fade, zeros motion when disarmed |
|
||||
| `RadioLink` | nRF24 TX, short retries (1, 3), ack-based link status and 32-packet quality %, telemetry from the ack payloads (stale after `TELEMETRY_STALE_MS`) |
|
||||
| `Battery` | handset battery through a divider; `BATTERY_SENSE_PIN` 255 = not wired yet (planned A6) |
|
||||
| `NextionUI` | library-free Nextion driver on `Serial1`. HMI sends `'#' len cmd [val]` frames via `printh`; every page's Preinitialize sends `'P'` + page id (and `sendme` / 0x66 recovers the page after a remote restart). The remote writes **only the showing page**, by local component name, and only what changed (FNV hash per instruction in a per-page slot cache), 20 Hz (SERVOS 10 Hz), never blocking on a full TX buffer; full refresh every 2 s and on the 0x88 "ready" frame. UPDATE DISPLAY (tapped twice) or serial `U` runs `runUploadPassthrough()`: USB ↔ display bridge for Nextion Editor, following `Serial.baud()`, never returns |
|
||||
| `NextionUI` | library-free Nextion driver on `Serial2` (pins 7/8). HMI sends `'#' len cmd [val]` frames via `printh`; every page's Preinitialize sends `'P'` + page id (and `sendme` / 0x66 recovers the page after a remote restart). The remote writes **only the showing page**, by local component name, and only what changed (FNV hash per instruction in a per-page slot cache), 20 Hz (SERVOS 10 Hz), never blocking on a full TX buffer; full refresh every 2 s and on the 0x88 "ready" frame. UPDATE DISPLAY (tapped twice) or serial `U` runs `runUploadPassthrough()`: USB ↔ display bridge for Nextion Editor, following `Serial.baud()`, never returns |
|
||||
| `SerialConsole` | USB keystrokes that mirror every UI command plus diagnostics |
|
||||
| `SmoothedValue.h` | copy of the robot's (kept separate so robot/ stays untouched) |
|
||||
| `NEXTION.md` | the HMI: pages, command bytes, which components the firmware writes |
|
||||
@@ -236,6 +239,9 @@ Remote stick-frame convention: logical X + = right, Y + = forward, twist +
|
||||
- **Robot firmware in simulation:** `sim/build/sim_smoke.exe` (headless,
|
||||
scripted checks), or Unity Play mode with Keyboard input or the real
|
||||
remote over the radio (USB nRF24 dongle).
|
||||
- **Remote without robot:** the Unity sim behind the USB nRF24 dongle
|
||||
answers like the robot (telemetry, servo calibration), see
|
||||
`sim/README.md`.
|
||||
- **Remote without robot or display:** the USB serial console (see
|
||||
`remote/README.md`). `p` shows raw/mapped sticks, IMU, link and state.
|
||||
`d` dumps packets at 10 Hz. With no robot, the link shows DOWN and
|
||||
@@ -409,9 +415,8 @@ Remote (`remote/README.md` has detail):
|
||||
- The Nextion must have `bauds=115200` in Program.s, and the HMI must match
|
||||
`NEXTION.md`. The working HMI is `remote/remote.HMI`, generated by
|
||||
`scripts/make_remote_hmi.py` (owner-approved design, 2026-11-17; the old 6-page one in
|
||||
`../2019-teensy-nrf24/remote-nextion/` only lends its splash picture). The display still
|
||||
runs the old HMI until the new `.tft` is uploaded: use serial key `U` for that first upload,
|
||||
the old UPLOAD button isn't recognised any more. Edit and render it with the `nxhmi` MCP server
|
||||
`../2019-teensy-nrf24/remote-nextion/` only lends its splash picture). It's on the real
|
||||
display (turned 180°, see `remote/NEXTION.md`). Edit and render it with the `nxhmi` MCP server
|
||||
(registered in the repo root `.mcp.json`; code is the git submodule `tools/nextion-hmi-tools`,
|
||||
run `git submodule update --init` after cloning; CLI `python -m nxhmi` with `PYTHONPATH` =
|
||||
`tools/nextion-hmi-tools/src`): `info`, `get_page`, `render_page`, `set_attributes`,
|
||||
@@ -468,6 +473,7 @@ Remote (`remote/README.md` has detail):
|
||||
rate limiting on any setpoint that can jump, and paired `.h/.cpp` per
|
||||
concern.
|
||||
- Planned or possible next steps: wire the battery dividers (firmware is
|
||||
ready on both sides, pins still 255) and add a low-battery warning; try
|
||||
ack-payload telemetry and servo calibration on the real radios (only
|
||||
simulated so far).
|
||||
ready on both sides, pins still 255) and add a low-battery warning;
|
||||
flash the robot with protocol v4 and try telemetry and servo calibration
|
||||
with it (the real remote ↔ dongle ↔ Unity sim path already works over the
|
||||
air, 2026-11-17); Unity driving the real robot through the dongle.
|
||||
@@ -1 +1,5 @@
|
||||
Hexapod
|
||||
|
||||
The Unity side of the firmware simulation: it runs the unchanged robot firmware
|
||||
(`../sim/build/hexapod_sim.dll`) on the 3D model, driven by the keyboard or by the
|
||||
real remote over the radio (USB nRF24 dongle). See `../sim/README.md`.
|
||||
+38
-32
@@ -1,7 +1,9 @@
|
||||
# Hexapod
|
||||
|
||||
A six-legged walking robot (Teensy 3.6) and its handheld remote
|
||||
(Teensy 4.0 + Nextion touchscreen), linked over nRF24L01.
|
||||
(Teensy 4.0 + Nextion touchscreen), linked over nRF24L01: commands from the
|
||||
remote, telemetry back from the robot. A USB nRF24 stick lets the PC (the
|
||||
Unity simulation) take the robot's place on the radio.
|
||||
|
||||

|
||||

|
||||
@@ -11,16 +13,19 @@ printed yet). The original printed remote is on the
|
||||
[archive page](hardware/openscad/ARCHIVE.md).
|
||||
|
||||
```
|
||||
robot/ robot firmware: IK, gait, body pose, IMU stabilization, state machine
|
||||
remote/ remote firmware: 2 x 3-axis sticks, MPU6050 tilt, Nextion UI, RF24 TX
|
||||
shared/ HexapodProtocol: the CmdPacket wire format + radio settings used by both
|
||||
robot/ robot firmware: IK, gait, body pose, IMU stabilization, state machine,
|
||||
servo centre calibration, telemetry
|
||||
remote/ remote firmware: 2 x 3-axis sticks, MPU6050 tilt, Nextion UI, RF24 link
|
||||
(+ remote.HMI, the touchscreen project)
|
||||
shared/ HexapodProtocol: CmdPacket + Telemetry wire formats + radio settings
|
||||
sim/ the unchanged robot firmware compiled into a DLL for the simulation
|
||||
Hexapod_Simulation_Unity/ Unity project that runs that DLL on the 3D model
|
||||
dongle/ USB nRF24 stick firmware (STM32F030): the PC-side radio, see dongle/README.md
|
||||
hardware/openscad/ OpenSCAD model of the robot (rebuilt from the Fusion designs) and the new remote
|
||||
hardware/openscad/stl/ print-ready STL exports
|
||||
hardware/fusion360/ Fusion 360 designs: body, legs, servo, servo horn, remote case
|
||||
scripts/ PlatformIO helper (per-environment sketch folder)
|
||||
scripts/ PlatformIO helper (per-environment sketch folder), make_remote_hmi.py
|
||||
tools/nextion-hmi-tools/ git submodule: .HMI reader/writer/renderer (nxhmi), used by the HMI generator
|
||||
```
|
||||
|
||||
This is the `2026-current/` folder of the hexapod-robot repo; the earlier
|
||||
@@ -72,36 +77,33 @@ Hardware (besides the electronics of the old remote):
|
||||
board clamps, no holes in the board), M3 x 40 + nut (kickstand pin)
|
||||
- M2.5 x 14 x 8 (joysticks, into their own boxes), M3 x 5 machine screws x 4
|
||||
(display, tap the posts M3), M3 self-tapping x 2 (UPS board), M2 self-tapping x 2 (switch)
|
||||
- Set the Nextion's display direction to 180 in the Nextion Editor: the
|
||||
display is mounted turned round so its connector clears the Teensy's USB plug.
|
||||
- The display is mounted turned round so its connector clears the Teensy's USB
|
||||
plug. `remote.HMI` is generated for that (display direction 270 in the
|
||||
Editor's terms, see [remote/NEXTION.md](remote/NEXTION.md)), nothing to set.
|
||||
|
||||
Design notes, checks and open points: [hardware/openscad/PLANNING.md](hardware/openscad/PLANNING.md).
|
||||
|
||||
## Planned
|
||||
|
||||
- **PC radio link (owner, later):** a USB nRF24L01 stick on the PC as the
|
||||
PC-side radio, on the same air settings as the robot and the remote, so Unity
|
||||
on the PC can both receive data from (telemetry) and send data to the robot
|
||||
and the remote. The stick is now reverse-engineered and reflashed with our own
|
||||
firmware (STM32F030 + Si24R1 + AT2401C); it shows up as a COM port and is
|
||||
updated wire-free over USB. See **[dongle/README.md](dongle/README.md)**. Still
|
||||
to do:
|
||||
- map the stick's LED and AT2401C power-amp control pins (app toggles them);
|
||||
- the radio protocol: today the remote only transmits a `CmdPacket` to the
|
||||
robot and nothing comes back. Three nodes need an address per node (or
|
||||
per pipe), a packet type byte, and telemetry back (e.g. as ack payloads
|
||||
or in time slots) so the nodes don't talk over each other; who has
|
||||
priority when the PC and the remote both send commands. Owner's
|
||||
decisions: the remote wins, with a toggle on the remote that hands the
|
||||
robot to Unity and lets the remote's sticks control Unity instead; the
|
||||
PC is the hub while it's online, the robot is the hub when it isn't;
|
||||
goals: mirror the real robot in Unity, drive it from Unity, remote data
|
||||
to the PC, and PC data to the remote;
|
||||
- Unity side: a serial-port reader/writer next to the simulation (the
|
||||
2019 generation already drove the robot from Unity, through the remote
|
||||
over USB: see `../2019-teensy-nrf24/`).
|
||||
- Remote battery level and the IMU on the normal pin headers: see
|
||||
[remote/README.md](remote/README.md), "Planned".
|
||||
- **PC radio link:** a USB nRF24L01 stick on the PC as the PC-side radio, on
|
||||
the same air settings as the robot and the remote. It's reverse-engineered
|
||||
and runs our own firmware (STM32F030 + Si24R1 + AT2401C, updated wire-free
|
||||
over USB), see **[dongle/README.md](dongle/README.md)**. Done (2026-11-17):
|
||||
its **bridge mode** lets the real remote drive the Unity simulation over the
|
||||
air, with the sim's telemetry going back to the remote's display as the ack
|
||||
payload ([sim/README.md](sim/README.md), "Using it in Unity"). There's no USB
|
||||
link to the remote or the robot any more; everything goes over the radio.
|
||||
Still to do:
|
||||
- Unity driving the **real** robot (the dongle transmitting instead of
|
||||
listening) and mirroring it;
|
||||
- three nodes at once: today the dongle answers the remote *instead of* the
|
||||
robot. Needs an address per node (or per pipe), a packet type byte, and a
|
||||
rule for who has priority. Owner's decisions: the remote wins, with a
|
||||
toggle on the remote that hands the robot to Unity and lets the remote's
|
||||
sticks control Unity instead; the PC is the hub while it's online, the
|
||||
robot is the hub when it isn't; goals: mirror the real robot in Unity,
|
||||
drive it from Unity, remote data to the PC, and PC data to the remote.
|
||||
- Remote battery level: see [remote/README.md](remote/README.md), "Planned".
|
||||
- Robot power: a stable 6 V supply for the 18 servos, see
|
||||
[hardware/openscad/PLANNING.md](hardware/openscad/PLANNING.md), "Notes for
|
||||
future designs".
|
||||
@@ -113,7 +115,11 @@ Design notes, checks and open points: [hardware/openscad/PLANNING.md](hardware/o
|
||||
robot without a remote.
|
||||
- **[remote/README.md](remote/README.md)**: wiring, control scheme, stick
|
||||
calibration, and the remote's serial console.
|
||||
- **[remote/NEXTION.md](remote/NEXTION.md)**: how to build the touchscreen
|
||||
HMI.
|
||||
- **[remote/NEXTION.md](remote/NEXTION.md)**: the touchscreen HMI (generated
|
||||
by `scripts/make_remote_hmi.py`).
|
||||
- **[sim/README.md](sim/README.md)**: the robot firmware in simulation, headless
|
||||
and in Unity, with the keyboard or the real remote over the radio.
|
||||
- **[dongle/README.md](dongle/README.md)**: the USB nRF24 stick, its firmware,
|
||||
flashing and the bridge protocol.
|
||||
- **[shared/HexapodProtocol/HexapodProtocol.h](shared/HexapodProtocol/HexapodProtocol.h)**:
|
||||
the protocol. Change it only by reflashing both boards.
|
||||
@@ -30,15 +30,31 @@ Found by probing the board over SWD and confirmed at runtime by our firmware:
|
||||
| SPI1 SCK / MISO / MOSI | PA5 / PA6 / PA7 → Si24R1 |
|
||||
| nRF CSN / CE / IRQ | PA3 / PA4 / PA2 |
|
||||
| status LED (active-high) | **PA0** — confirmed by eye |
|
||||
| AT2401C TX/RX enable + unused | PA1, PB1, PF0, PF1 — **not yet distinguished** |
|
||||
| AT2401C TX/RX enable + unused | PA1, PB1, PF0, PF1 — **not distinguishable** (see below) |
|
||||
|
||||
PA0 drives the LED (HIGH = on). The AT2401C control lines are among PA1, PB1,
|
||||
PF0, PF1 (the TSSOP-20 has no other GPIO). Listening for ambient 2.4 GHz with
|
||||
the radio's carrier-detect bit was too noisy to tell them apart, so they need a
|
||||
real link test (dongle ↔ robot/remote, trying each pin while watching whether
|
||||
packets get through). The radio still works without driving the amplifier, just
|
||||
at reduced range. The app firmware can drive any pin (`0`-`4`), sweep them all
|
||||
(`a`), and run a carrier-detect finder (`f`/`n`).
|
||||
PA0 drives the LED (HIGH = on). The AT2401C control lines would be among PA1,
|
||||
PB1, PF0, PF1 (the TSSOP-20 has no other GPIO). Listening for ambient 2.4 GHz
|
||||
with the radio's carrier-detect bit was too noisy to tell them apart. The real
|
||||
link test (2026-11-17: receiving the remote while switching all 16 on/off
|
||||
combinations, at the desk and a few rooms away with the remote at minimum
|
||||
power) got every packet in every combination, so either the link has plenty of
|
||||
margin or the amplifier is switched in hardware. The firmware leaves them low;
|
||||
the link works.
|
||||
|
||||
### App commands (USB serial, 115200, single keys, when not bridging)
|
||||
|
||||
| Key | Action |
|
||||
|-----|--------|
|
||||
| `v` | banner: version and a few radio registers |
|
||||
| `r` | dump nRF registers |
|
||||
| `x` | RX test on the hexapod's air settings; prints packets/s once a second |
|
||||
| `0`-`4` | toggle PA0 (LED) / PA1 / PB1 / PF0 / PF1 |
|
||||
| `a` | sweep every free pin high for 3 s each |
|
||||
| `f` / `n` | carrier-detect finder on / next channel |
|
||||
| `b` | reset into safeboot (what `safeboot_flash.py` uses) |
|
||||
|
||||
**SignalRGB** (if installed) opens every CH340 COM port it sees and holds it;
|
||||
quit it while using the dongle.
|
||||
|
||||
### Programming header (5 holes next to the CH330N)
|
||||
|
||||
@@ -162,14 +178,15 @@ safeboot's 1.5 s cold-boot window.
|
||||
## Air settings
|
||||
|
||||
Matches `shared/HexapodProtocol/HexapodProtocol.h`: 2.4 GHz channel 96
|
||||
(2.496 GHz), 250 kbps, 5-byte address `HXPD1`, 16-bit CRC. The app sets these on
|
||||
(2.496 GHz), 250 kbps, 5-byte address `HXPD1`, 16-bit CRC, auto-ack with
|
||||
dynamic payload lengths and ack payloads (protocol v4). The app sets these on
|
||||
the Si24R1 over SPI (same register layout as the nRF24L01+).
|
||||
|
||||
## Status / next
|
||||
|
||||
- [x] identify the hardware, map the radio + serial pins
|
||||
- [x] permanent two-stage firmware, wire-free USB flashing
|
||||
- [ ] identify the LED and AT2401C TX/RX-enable pins (app toggles the 5 free pins)
|
||||
- [x] LED pin (PA0)
|
||||
- [x] bridge mode: the dongle stands in for the robot's radio, Unity runs the
|
||||
robot firmware (sim) behind it — see "Bridge mode" below
|
||||
- [ ] the other direction: Unity as the remote, driving the real robot
|
||||
|
||||
@@ -159,7 +159,8 @@ charge/on LEDs show through two slots in the floor.
|
||||
plate into the box (no nuts). Reaches 28.5 mm down. Pots (d16.5, 9.2 out)
|
||||
towards the middle and towards the user.
|
||||
- Display mounted turned 180 deg so its J1 connector is on the right, clear
|
||||
of the Teensy's USB plug: set display direction 180 in the Nextion Editor.
|
||||
of the Teensy's USB plug. `remote/remote.HMI` is generated for that
|
||||
(direction 270 in the Nextion Editor's terms; done 2026-11-17).
|
||||
Glass 1.0 mm under the top face, board on 4 posts tapped M3 (3.66 mm of thread, 1.2 mm under the top face);
|
||||
LCD 85.7 x 55 x 3.86 plus a 1.3 mm flex cable on one side, 11.21 mm glass to
|
||||
back of J1 (owner measured).
|
||||
@@ -213,15 +214,17 @@ charge/on LEDs show through two slots in the floor.
|
||||
for the stall current. The battery must also fit the bay (see open
|
||||
question 3) and leave room for the servo plugs.
|
||||
|
||||
- Remote: connect the IMU to the normal pin headers instead of the Teensy
|
||||
4.0's underside pads; see `remote/README.md`, "Planned" (Wire on 18/19,
|
||||
the two stick axes there move to A7/A8).
|
||||
- Remote: the IMU is on the normal pin headers (done 2026-11-17: Wire on
|
||||
18/19, the two stick axes that were there moved to A7/A8; display on
|
||||
Serial2, 7/8). Pinout in `remote/README.md`, "Wiring".
|
||||
|
||||
- Remote: measure the 18650's voltage on the Teensy to show how much charge
|
||||
is left (owner, later). Divider ~100k/100k from the cell's + (holder or the
|
||||
UPS board's B+, not the 5 V output) to A6 (pin 20, free), 100 nF to GND;
|
||||
full cell = ~2.1 V at the pin. Firmware: average, Li-ion curve to %, show
|
||||
on the Nextion with a low-battery warning (optionally send it to the robot).
|
||||
full cell = ~2.1 V at the pin. Firmware: reading, smoothing and the volts
|
||||
on the STATUS page are done (`remote/Battery`, pin still 255 = not wired);
|
||||
still to do: Li-ion curve to %, and a low-battery warning. The robot
|
||||
already sends its own battery voltage back in the telemetry.
|
||||
|
||||
- Servo wires barely fit on the real robot: the six servo headers hang
|
||||
above the battery bay, and the front pair sits right over the bay's end
|
||||
|
||||
@@ -7,7 +7,14 @@ It's **generated** by `../scripts/make_remote_hmi.py`: change the layout
|
||||
there and re-run it, rather than editing the `.HMI` in Nextion Editor (an
|
||||
Editor edit is lost on the next run). Then open `remote.HMI` in Nextion
|
||||
Editor, compile, and upload the `.tft`: SETUP › UPDATE DISPLAY (tap twice)
|
||||
or serial key `U` puts the remote in USB passthrough for the upload.
|
||||
or serial key `U` puts the remote in USB passthrough for the upload. In the
|
||||
Editor, upload to the Teensy's COM port with the baud rate on auto. When the
|
||||
Editor is newer than the display's firmware, the upload first updates that
|
||||
firmware: don't interrupt it. Power-cycle the remote afterwards to leave
|
||||
upload mode.
|
||||
|
||||
The display is on the remote's **Serial2** (Teensy RX2 = pin 7, TX2 = pin 8),
|
||||
at 115200.
|
||||
|
||||
```
|
||||
python scripts\make_remote_hmi.py (from 2026-current)
|
||||
|
||||
@@ -4,7 +4,9 @@ Handheld transmitter for the hexapod. It reads two 3-axis twist-grip
|
||||
joysticks and an MPU6050, takes operator commands from a Nextion
|
||||
touchscreen, and sends a `CmdPacket` (defined in
|
||||
`../shared/HexapodProtocol/HexapodProtocol.h`) to the robot over nRF24L01
|
||||
at 100 Hz.
|
||||
at 100 Hz. The robot's `Telemetry` comes back in the radio's ack payloads.
|
||||
Without the robot, the Unity simulation can answer instead, through the
|
||||
USB nRF24 dongle (`../sim/README.md`).
|
||||
|
||||
## Planned
|
||||
|
||||
@@ -20,6 +22,10 @@ at 100 Hz.
|
||||
|
||||
From the `2026-current` folder: `pio run -e remote`, flash with
|
||||
`pio run -e remote -t upload`, monitor with `pio device monitor -e remote`.
|
||||
The upload opens Teensy Loader; if the Teensy doesn't reboot into it by
|
||||
itself, press its program button. If flashing works but the USB serial port
|
||||
then won't open or goes quiet, try another USB port or cable before
|
||||
suspecting the firmware (a bare Teensy 4.0 showed exactly that on one port).
|
||||
|
||||
## Wiring (edge headers only; edit `Config.h` if yours differs)
|
||||
|
||||
@@ -29,6 +35,7 @@ From the `2026-current` folder: `pio run -e remote`, flash with
|
||||
| nRF24L01 | CE / CSN | 9 / 10 |
|
||||
| nRF24L01 | VCC | 3.3 V, with a 10–100 µF cap right at the module |
|
||||
| MPU6050 | SDA / SCL | **18 / 19 (Wire)** |
|
||||
| MPU6050 | VCC | 3.3 V (a GY-521 runs fine on it). Check the polarity: one supply reversal killed the first board's regulator |
|
||||
| Nextion | TX → RX2, RX ← TX2 | 7 / 8 (Serial2), 5 V supply (found on the real remote) |
|
||||
| Sticks | 6 axes | left stick X / Y / twist on **A3 / A7 / A8** (17 / 21 / 22), right stick on **A0 / A1 / A2** (14 / 15 / 16). A7/A8 hold the two wires that were on A4/A5 (18/19). All but the right twist read inverted (`STICK_INVERT`). Checked on the real remote |
|
||||
| Battery (planned) | divider | A6 (20) |
|
||||
@@ -122,12 +129,13 @@ reads it after every send, and it counts as stale after
|
||||
|
||||
1. Power on with both sticks released and the remote held still. Each
|
||||
axis's resting center is captured automatically.
|
||||
2. For full calibration, disarm, then tap **CAL** (or press `c` on the
|
||||
serial console). Move every axis of both sticks to both limits, release
|
||||
them, and tap **SAVE CAL** (`c`). The result is saved to EEPROM.
|
||||
2. For full calibration, disarm, then tap **CAL STICKS** on the SETUP page
|
||||
(or press `c` on the serial console). Move every axis of both sticks to
|
||||
both limits, release them, and tap **SAVE CAL** (`c`). The result is
|
||||
saved to EEPROM, so it survives power cycles and reflashing.
|
||||
3. If any axis moved less than `CAL_MIN_HALF_SPAN` either side of center,
|
||||
the save is refused and you stay in calibration mode. **CANCEL CAL**
|
||||
(`x`) aborts.
|
||||
the save is refused and you stay in calibration mode. **CANCEL** (`x`)
|
||||
aborts.
|
||||
4. `p` prints the calibration in a form you can paste into `Config.h`
|
||||
defaults. `R` wipes EEPROM back to the `Config.h` defaults.
|
||||
|
||||
@@ -158,18 +166,20 @@ and the servo-calibration state.
|
||||
|
||||
1. **Stick directions:** with `p`, confirm each logical axis reads
|
||||
positive for right / forward / counterclockwise twist. Flip it in
|
||||
`STICK_INVERT[]` if not.
|
||||
`STICK_INVERT[]` if not. Done on the real remote (2026-11-17), then
|
||||
the sweep calibration.
|
||||
2. **IMU mounting:** with `p`, dip the right edge down to get +roll, and
|
||||
tip the far edge down to get +pitch. If not, fix `IMU_AXIS_FROM_CHIP` /
|
||||
`IMU_AXIS_SIGN`.
|
||||
3. **Nextion baud:** the generated HMI sets `bauds=115200` in Program.s.
|
||||
The display still runs the old HMI (probably 9600) until you upload
|
||||
the new one; Nextion Editor finds the baud rate by itself. For that
|
||||
first upload use serial key `U`: the old HMI's UPLOAD button isn't
|
||||
recognised any more.
|
||||
4. **Radio:** with the robot powered, `tLink` / `p` should show ~100%, and
|
||||
`p` should print robot telemetry. If it reads NO LINK, check that both
|
||||
boards were built from the same `HexapodProtocol.h`: each end drops
|
||||
packets of the wrong size.
|
||||
`IMU_AXIS_SIGN`. Done (defaults are right). The first GY-521 got its
|
||||
supply reversed once and its regulator now runs hot: redo this check
|
||||
on the replacement, and see whether it still needs the reset in
|
||||
`RemoteIMU::begin()`.
|
||||
3. **Nextion:** the generated HMI sets `bauds=115200` in Program.s and is
|
||||
on the display (upload through SETUP › UPDATE DISPLAY or serial `U`).
|
||||
4. **Radio:** with the robot (or the Unity sim behind the USB dongle)
|
||||
running, `tLink` / `p` should show ~100%, and `p` should print robot
|
||||
telemetry. If it reads NO LINK, check that both ends were built from
|
||||
the same `HexapodProtocol.h`: each end drops packets of the wrong size.
|
||||
Done against the Unity sim through the dongle; not yet with the robot.
|
||||
5. **End to end with the robot on a stand:** use `d` to dump packets and
|
||||
confirm each field changes the way the table above says.
|
||||
@@ -41,8 +41,9 @@ still a placeholder. Check all of it against the real robot:
|
||||
needed ±90° offsets there, which left the servos at the end of their
|
||||
travel.
|
||||
- `RADIO_CE_PIN` / `RADIO_CSN_PIN` / `RADIO_SCK_PIN`: 39 / 15 / 14, as in
|
||||
the old sketch. Address, channel, data rate, PA level and payload size
|
||||
are in `shared/HexapodProtocol` so they can't drift from the remote.
|
||||
the old sketch. Address, channel, data rate, PA level and the packet
|
||||
structs are in `shared/HexapodProtocol` so they can't drift from the
|
||||
remote.
|
||||
|
||||
## Bench-check checklist (do this before the first stand-up)
|
||||
|
||||
@@ -62,7 +63,11 @@ for your build:
|
||||
down).
|
||||
3. **RobotIMU register map** (`RobotIMU.cpp`) — written for an MPU6050-style
|
||||
chip (I2C addr `0x68`). If your gyro is a different part, its register
|
||||
addresses and scale factors will differ; swap them in.
|
||||
addresses and scale factors will differ; swap them in. Also check that
|
||||
it gives live readings at all (the robot's roll/pitch on the remote's
|
||||
STATUS page): the remote's MPU6050 answered and woke up but read all
|
||||
zeros until it got a full device reset (`PWR_MGMT_1 = 0x80`), which
|
||||
`RobotIMU::begin()` doesn't do.
|
||||
4. **Sit-pose assumption** — the built-in sit pose in `robot.ino` assumes all
|
||||
six feet stay grounded and simply lowers the body (a 0.4x height blend).
|
||||
If your chassis is meant to rest its belly on the ground instead, this
|
||||
@@ -83,7 +88,8 @@ for your build:
|
||||
|
||||
This exact code also compiles for the PC and runs in the Unity model. See
|
||||
`../sim/README.md`. `sim/build/sim_smoke.exe` is a quick headless check
|
||||
after every change.
|
||||
after every change. In Unity the simulated robot can also be driven by the
|
||||
real remote over the radio, through the USB nRF24 dongle.
|
||||
|
||||
## Testing without a remote yet
|
||||
|
||||
@@ -163,6 +169,7 @@ robot/
|
||||
├── StateMachine.h/.cpp - DISARMED/SIT/STAND/WALKING with smoothed sit-stand blend
|
||||
├── InputMapper.h/.cpp - CmdPacket -> twist/pose/mode decoding
|
||||
├── Limits.h/.cpp - workspace clamp, joint rate limit, stance polygon check
|
||||
├── Comms.h/.cpp - nRF24L01 receive (packet definition is in shared/HexapodProtocol)
|
||||
└── ServoDriver.h/.cpp - servo attach/relax/write
|
||||
├── Comms.h/.cpp - nRF24L01 receive + telemetry as ack payload (packets in shared/HexapodProtocol)
|
||||
├── ServoDriver.h/.cpp - servo PWM write/relax, per-servo centre trims (EEPROM), SERVO_CAL
|
||||
└── Battery.h/.cpp - battery voltage through a divider (not wired yet)
|
||||
```
|
||||
@@ -65,15 +65,21 @@ It drives the firmware the way the remote would and checks:
|
||||
- **`+vx` moves the body forward**,
|
||||
- link loss disarms,
|
||||
- a wrong-size packet is ignored,
|
||||
- the serial harness still works.
|
||||
- the robot's telemetry comes back in the ack payload, and every servo
|
||||
calibration command (HOLD / SET / SAVE / REVERT, arming refused) works,
|
||||
- the serial harness still works,
|
||||
- plus the body-pose, leg-clearance, heading and robot-gyro checks listed
|
||||
in the file.
|
||||
|
||||
## Using it in Unity
|
||||
|
||||
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`), and
|
||||
binds the existing leg rig by name (`Leg` → `hip1` / `Hip2` / `Knie`). The
|
||||
on-screen panel (F1 toggles it) offers two input sources:
|
||||
binds the existing leg rig by name (`Leg` → `hip1` / `Hip2` / `Knie`). By
|
||||
default `OpenScadModel` swaps the old scene's robot for the OpenSCAD model
|
||||
of the real one (`HexapodSimulation.useOpenScadModel`). The on-screen panel
|
||||
(F1 toggles it) offers two input sources:
|
||||
|
||||
- **Keyboard:** test without a remote. WASD walks, Q/E turns, IJKL + U/O
|
||||
drive the right stick, 1–7 flip the toggles, Backspace disarms, +/-
|
||||
|
||||
Reference in new issue
Block a user