Compare commits
24
Commits
cb1e9234c6
...
main
No files matched your search
@@ -37,3 +37,5 @@
|
|||||||
*.ide-wal filter=lfs diff=lfs merge=lfs -text
|
*.ide-wal filter=lfs diff=lfs merge=lfs -text
|
||||||
*.ide-shm filter=lfs diff=lfs merge=lfs -text
|
*.ide-shm filter=lfs diff=lfs merge=lfs -text
|
||||||
2018-unity-sim/**/*.unity filter=lfs diff=lfs merge=lfs -text
|
2018-unity-sim/**/*.unity filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bytes filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.3mf filter=lfs diff=lfs merge=lfs -text
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# local editor settings
|
||||||
|
.vscode/
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "2026-current/tools/nextion-hmi-tools"]
|
||||||
|
path = 2026-current/tools/nextion-hmi-tools
|
||||||
|
url = https://mangavalk.com/mangavalk/openhmi-nx.git
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"mcpServers": {
|
||||||
|
"nxhmi": {
|
||||||
|
"command": "python",
|
||||||
|
"args": ["-m", "nxhmi.mcp_server"],
|
||||||
|
"env": {"PYTHONPATH": "2026-current/tools/nextion-hmi-tools/src"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+121
-56
@@ -1,7 +1,7 @@
|
|||||||
# Hexapod: project memory
|
# Hexapod: project memory
|
||||||
|
|
||||||
Hexapod walking robot plus a custom handheld remote, both Teensy-based and
|
Hexapod walking robot plus a custom handheld remote, both Teensy-based and
|
||||||
linked one-way over nRF24L01 (remote → robot, with hardware auto-ack only).
|
linked over nRF24L01: commands remote → robot, telemetry back in the radio's ack payloads.
|
||||||
A Unity simulation runs the *unchanged* robot firmware as a DLL. This file
|
A Unity simulation runs the *unchanged* robot firmware as a DLL. This file
|
||||||
is the persistent context for working on any part of it. Read it fully
|
is the persistent context for working on any part of it. Read it fully
|
||||||
before changing anything.
|
before changing anything.
|
||||||
@@ -10,11 +10,14 @@ before changing anything.
|
|||||||
|
|
||||||
```
|
```
|
||||||
robot/ Teensy 3.6 firmware (PlatformIO env robot)
|
robot/ Teensy 3.6 firmware (PlatformIO env robot)
|
||||||
remote/ Teensy 4.1 firmware (PlatformIO env remote)
|
remote/ Teensy 4.0 firmware (PlatformIO env remote)
|
||||||
shared/HexapodProtocol/ wire protocol, used by robot, remote and sim
|
shared/HexapodProtocol/ wire protocol, used by robot, remote and sim
|
||||||
sim/ robot firmware -> hexapod_sim.dll (CMake + g++), headless smoke test
|
sim/ robot firmware -> hexapod_sim.dll (CMake + g++), headless smoke test
|
||||||
Hexapod_Simulation_Unity/ Unity 6000.6 project that loads the DLL (Assets/HexapodSim/)
|
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
|
This folder is `2026-current/` inside the `hexapod-robot` repo. The older generations sit next to it
|
||||||
@@ -34,7 +37,7 @@ PlatformIO, one `platformio.ini`, two environments:
|
|||||||
| Env | Board | Sketch dir | Purpose |
|
| Env | Board | Sketch dir | Purpose |
|
||||||
|-----|-------|------------|---------|
|
|-----|-------|------------|---------|
|
||||||
| `robot` | `teensy36` | `robot/` | walking robot |
|
| `robot` | `teensy36` | `robot/` | walking robot |
|
||||||
| `remote` | `teensy41` | `remote/` | handheld transmitter |
|
| `remote` | `teensy40` | `remote/` | handheld transmitter |
|
||||||
|
|
||||||
- `shared/` is PlatformIO's `lib_dir`. `shared/HexapodProtocol/` is a
|
- `shared/` is PlatformIO's `lib_dir`. `shared/HexapodProtocol/` is a
|
||||||
header-only library both sketches `#include <HexapodProtocol.h>`.
|
header-only library both sketches `#include <HexapodProtocol.h>`.
|
||||||
@@ -51,7 +54,7 @@ PlatformIO, one `platformio.ini`, two environments:
|
|||||||
|
|
||||||
## Communication contract (`shared/HexapodProtocol/HexapodProtocol.h`)
|
## Communication contract (`shared/HexapodProtocol/HexapodProtocol.h`)
|
||||||
|
|
||||||
`CmdPacket`, 22 bytes (static_asserted; protocol v3), sent remote → robot at 100 Hz
|
`CmdPacket`, 26 bytes (static_asserted; protocol v4, `HXP_PROTOCOL_VERSION`), sent remote → robot at 100 Hz
|
||||||
(robot `CONTROL_HZ` is 60):
|
(robot `CONTROL_HZ` is 60):
|
||||||
|
|
||||||
| Field | Range | Meaning |
|
| Field | Range | Meaning |
|
||||||
@@ -65,6 +68,16 @@ PlatformIO, one `platformio.ini`, two environments:
|
|||||||
| `speed_scale` | 0–255 | multiplies vx/vy on the robot |
|
| `speed_scale` | 0–255 | multiplies vx/vy on the robot |
|
||||||
| `flags` | bits | `ARMED, STAND, WALK, MODE_B, RSTICK_XLATE, GAIT_WAVE, REMOTE_GYRO, ROBOT_GYRO` (bits 0–7) |
|
| `flags` | bits | `ARMED, STAND, WALK, MODE_B, RSTICK_XLATE, GAIT_WAVE, REMOTE_GYRO, ROBOT_GYRO` (bits 0–7) |
|
||||||
| `seq` | 0–255 | increments per packet (robot doesn't check it yet) |
|
| `seq` | 0–255 | increments per packet (robot doesn't check it yet) |
|
||||||
|
| `cal_cmd` | `CAL_*` | servo centre calibration, only while not armed: `CAL_NONE` normal, `HOLD` centre pose, `SET` trim, `SAVE` / `REVERT` EEPROM. States, not events: repeats are harmless |
|
||||||
|
| `cal_servo`, `cal_value` | 0–17, ±200 µs | selected servo (leg × 3 + joint) and its trim for `CAL_SET` |
|
||||||
|
|
||||||
|
`Telemetry`, 30 bytes, robot → remote as the **ack payload** of the remote's
|
||||||
|
next packet (`Comms::loadAckPayload` after every packet received; no extra
|
||||||
|
transmissions): robot state (`TSTATE_*`, 4 = SERVO_CAL), status bits
|
||||||
|
(`TSTAT_*`: IMU ok, gyro on, servos driven, trims dirty / stored), IMU
|
||||||
|
roll/pitch in 0.1°, battery mV (0 = not measured), the 18 commanded joint
|
||||||
|
angles as int8 (tibia stored + 90), packets received per second, and the
|
||||||
|
echo of `cal_servo` with its trim.
|
||||||
|
|
||||||
- **Axis convention** (ROS REP-103 style): body +X forward, +Y left, +Z up.
|
- **Axis convention** (ROS REP-103 style): body +X forward, +Y left, +Z up.
|
||||||
+roll = right side down, +pitch = nose down, +yaw = CCW.
|
+roll = right side down, +pitch = nose down, +yaw = CCW.
|
||||||
@@ -72,11 +85,15 @@ PlatformIO, one `platformio.ini`, two environments:
|
|||||||
`InputMapper` owns the scaling: `MAX_LINEAR_MM_S` 150,
|
`InputMapper` owns the scaling: `MAX_LINEAR_MM_S` 150,
|
||||||
`MAX_TURN_RATE_DEG_S` 90, `MAX_TILT_DEG` 20, `MAX_POSE_OFFSET_MM` 40.
|
`MAX_TURN_RATE_DEG_S` 90, `MAX_TILT_DEG` 20, `MAX_POSE_OFFSET_MM` 40.
|
||||||
- **Radio settings** live in the same header: address `"HXPD1"`, channel
|
- **Radio settings** live in the same header: address `"HXPD1"`, channel
|
||||||
96, 250 kbps, PA LOW, **static payload size = sizeof(CmdPacket)** on both
|
96, 250 kbps, PA LOW. Ack payloads need dynamic payload lengths
|
||||||
radios. That makes version mismatches fail closed: packets are not
|
(`enableAckPayload()` on both radios), so **each end drops any packet
|
||||||
received, the robot times out, and it disarms.
|
whose length isn't sizeof() of its struct**. That keeps version
|
||||||
- **Changing the protocol means reflashing both boards.** Keep it ≤ 32
|
mismatches failing closed: packets are ignored, the robot times out, and
|
||||||
bytes and update the `static_assert`.
|
it disarms.
|
||||||
|
- **Changing the protocol means reflashing both boards.** Keep both
|
||||||
|
structs ≤ 32 bytes, update the `static_assert`s, bump
|
||||||
|
`HXP_PROTOCOL_VERSION`, and mirror `CmdPacket` in the Unity
|
||||||
|
`HexapodSimNative.cs`.
|
||||||
- **Failsafes:** the robot sets `linkOk()` false after `LINK_TIMEOUT_SEC`
|
- **Failsafes:** the robot sets `linkOk()` false after `LINK_TIMEOUT_SEC`
|
||||||
(0.3 s) without packets and then uses a default `CmdPacket` (flags 0 =
|
(0.3 s) without packets and then uses a default `CmdPacket` (flags 0 =
|
||||||
disarmed, servos detached). The remote disarms itself after
|
disarmed, servos detached). The remote disarms itself after
|
||||||
@@ -101,33 +118,41 @@ joint-rate clamp → servos.
|
|||||||
| `Kinematics` | per-leg 3-DOF analytic IK, `neutralStance()` |
|
| `Kinematics` | per-leg 3-DOF analytic IK, `neutralStance()` |
|
||||||
| `GaitEngine` | tripod/wave patterns, per-leg phase, pattern swap only at touchdown. `limitTwist()` (called in robot.ino right after InputMapper, so the heading estimate integrates the *achieved* ω) scales the walk command until its stride envelope (`strideEnvelope()`: even/odd legs at opposite stride ends, plus a lifted set) is feasible, so full-rate turning can't make neighbouring legs collide. Stance feet are *integrated* each tick from the current twist (v + ω×r at the foot); swing feet arc from lift-off to the next leading edge. `resetFeet()` on entering WALKING restarts the cycle with grounded legs at mid-stance |
|
| `GaitEngine` | tripod/wave patterns, per-leg phase, pattern swap only at touchdown. `limitTwist()` (called in robot.ino right after InputMapper, so the heading estimate integrates the *achieved* ω) scales the walk command until its stride envelope (`strideEnvelope()`: even/odd legs at opposite stride ends, plus a lifted set) is feasible, so full-rate turning can't make neighbouring legs collide. Stance feet are *integrated* each tick from the current twist (v + ω×r at the foot); swing feet arc from lift-off to the next leading edge. `resetFeet()` on entering WALKING restarts the cycle with grounded legs at mid-stance |
|
||||||
| `BodyPose` | 6-axis body pose (smoothed command + IMU roll/pitch correction), applied to foot targets as the *inverse* rotation, so the body moves as commanded. `fitToReach()` scales the *whole* pose by one factor (binary search on `Limits::feetFeasible`; drops at once, recovers at 1/s) so combined poses never bend individual legs out of a rigid foot pattern or into each other. While walking it fits against the stride envelope, not the current feet, so it doesn't saw with the step cycle |
|
| `BodyPose` | 6-axis body pose (smoothed command + IMU roll/pitch correction), applied to foot targets as the *inverse* rotation, so the body moves as commanded. `fitToReach()` scales the *whole* pose by one factor (binary search on `Limits::feetFeasible`; drops at once, recovers at 1/s) so combined poses never bend individual legs out of a rigid foot pattern or into each other. While walking it fits against the stride envelope, not the current feet, so it doesn't saw with the step cycle |
|
||||||
| `RobotIMU` | MPU6050 complementary filter (α 0.98), gated by `FLAG_ROBOT_GYRO` |
|
| `RobotIMU` | MPU6050 complementary filter (α 0.98). Always estimates (the remote shows it); only the self-leveling in robot.ino is gated by `FLAG_ROBOT_GYRO` |
|
||||||
| `StateMachine` | DISARMED → SIT → STAND → WALKING, sit/stand blend at 1/s. Disarm is instant |
|
| `StateMachine` | DISARMED → SIT → STAND → WALKING, sit/stand blend at 1/s. Disarm is instant |
|
||||||
| `InputMapper` | CmdPacket → Twist + PoseCommand + mode flags + stance height. Mode B = steering **relative to where the body faces right now**: the forward/back stick component sets walking direction (vx sign), the sideways component steers (target = current heading + atan2(vy, |vx|) every tick). So W = straight on, S = straight **back** (not turn around; owner's request), W/S+A = walk while turning left, A alone = turn on the spot while held. On release the target freezes at the current heading (hold). An earlier version froze the reference at the first push, so heading only changed after releasing W; the owner rejected that. Mode A keeps the target = current heading so switching to B never jumps. Forward speed × max(0, cos(heading error)), so big corrections turn in place first. Adds remote tilt on top of stick pose when `FLAG_REMOTE_GYRO`, clamped to `MAX_TILT_DEG` |
|
| `InputMapper` | CmdPacket → Twist + PoseCommand + mode flags + stance height. Mode B = steering **relative to where the body faces right now**: the forward/back stick component sets walking direction (vx sign), the sideways component steers (target = current heading + atan2(vy, |vx|) every tick). So W = straight on, S = straight **back** (not turn around; owner's request), W/S+A = walk while turning left, A alone = turn on the spot while held. On release the target freezes at the current heading (hold). An earlier version froze the reference at the first push, so heading only changed after releasing W; the owner rejected that. Mode A keeps the target = current heading so switching to B never jumps. Forward speed × max(0, cos(heading error)), so big corrections turn in place first. Adds remote tilt on top of stick pose when `FLAG_REMOTE_GYRO`, clamped to `MAX_TILT_DEG` |
|
||||||
| `Limits` | workspace clamp (70 mm horiz / 60 mm vert), joint rate clamp, ≥3-legs-in-stance check (not acted on yet). `feetFeasible()` = every foot in its workspace with valid IK **and** neighbouring legs' segments (coxa/femur/tibia, via `Kinematics::jointPositions`) ≥ `LEG_CLEARANCE_MM` apart. This is the single "physically possible" test used by gait and pose limiting |
|
| `Limits` | workspace clamp (70 mm horiz / 60 mm vert), joint rate clamp, ≥3-legs-in-stance check (not acted on yet). `feetFeasible()` = every foot in its workspace with valid IK **and** neighbouring legs' segments (coxa/femur/tibia, via `Kinematics::jointPositions`) ≥ `LEG_CLEARANCE_MM` apart. This is the single "physically possible" test used by gait and pose limiting |
|
||||||
| `Comms` | nRF24 RX, link timeout, `injectPacket()` for the harness |
|
| `Comms` | nRF24 RX (drops wrong-length packets), link timeout, telemetry as ack payload, packets/s, `injectPacket()` for the harness |
|
||||||
| `ServoDriver` | 18 servos on hardware PWM (50 Hz, 16-bit), per-servo calibration from `Config.h` `SERVOS`, duty 0 = relaxed, skips invalid IK solutions |
|
| `ServoDriver` | 18 servos on hardware PWM (50 Hz, 16-bit), per-servo calibration from `Config.h` `SERVOS` plus a per-servo centre trim (µs, EEPROM record at address 0, loaded in setup), duty 0 = relaxed, skips invalid IK solutions. `calibrate()` = SERVO_CAL: applies a `CAL_*` command and holds `CAL_POSE` (coxa 0, femur 0, tibia −90) |
|
||||||
|
| `Battery` | battery voltage through a divider; `BATTERY_SENSE_PIN` 255 = not wired yet |
|
||||||
|
|
||||||
## Remote architecture (`remote/`, Teensy 4.1)
|
`robot.ino` also runs SERVO_CAL (disarmed + `cal_cmd != CAL_NONE`; leaving
|
||||||
|
it relaxes the servos) and fills the `Telemetry` every loop
|
||||||
|
(`sendTelemetry`).
|
||||||
|
|
||||||
|
## Remote architecture (`remote/`, Teensy 4.0)
|
||||||
|
|
||||||
Loop: drain Nextion + USB serial input every pass. On each `TX_HZ` (100)
|
Loop: drain Nextion + USB serial input every pass. On each `TX_HZ` (100)
|
||||||
tick: sticks → IMU → radio link status → RemoteState (smoothers,
|
tick: sticks → IMU → radio link status → battery → RemoteState (smoothers,
|
||||||
link-loss disarm) → PacketBuilder → `radio.write` → Nextion render.
|
link-loss disarm, servo-trim read-back from telemetry) → PacketBuilder →
|
||||||
|
`radio.write` (+ read the ack payload's telemetry) → Nextion render.
|
||||||
|
|
||||||
| Module | Role |
|
| Module | Role |
|
||||||
|--------|------|
|
|--------|------|
|
||||||
| `remote.ino` | loop wiring, status print, packet dump |
|
| `remote.ino` | loop wiring, status print, packet dump |
|
||||||
| `Config.h` | **all placeholder pins, calibration defaults, deadzones, rates** |
|
| `Config.h` | **all placeholder pins, calibration defaults, deadzones, rates** |
|
||||||
| `UiTypes.h` | `UiCmd`/`UiEvent` (operator requests), `UiView` (what the display shows) |
|
| `UiTypes.h` | `UiCmd`/`UiEvent` (operator requests), `UiPage` (HMI page ids), `UiView` (what the display shows, incl. robot telemetry) |
|
||||||
| `Sticks` | 6 analog axes: ADC averaging + IIR, piecewise calibration around center, invert, deadzone with rescale, expo → ±1000. Boot-time center capture, sweep calibration saved to EEPROM (magic/version/checksum) |
|
| `Sticks` | 6 analog axes: ADC averaging + IIR, piecewise calibration around center, invert, deadzone with rescale, expo → ±1000. Boot-time center capture, sweep calibration saved to EEPROM (magic/version/checksum) |
|
||||||
| `RemoteIMU` | MPU6050, same complementary filter as the robot, axis remap for mounting, boot gyro-bias capture, "level" zero |
|
| `RemoteIMU` | MPU6050, same complementary filter as the robot, axis remap for mounting, boot gyro-bias capture, "level" zero |
|
||||||
| `RemoteState` | authoritative operator state and interlocks: arm needs centered sticks, disarm clears stand, stand needs armed, calibrate needs disarmed, link-loss auto-disarm. Smooths speed scale and fades remote tilt in/out |
|
| `RemoteState` | authoritative operator state and interlocks: arm needs centered sticks, disarm clears stand, stand needs armed, calibrate needs disarmed, link-loss auto-disarm. Smooths speed scale and fades remote tilt in/out. Servo calibration: only while disarmed and on the CAL page; a newly selected servo is `CAL_HOLD` until its trim has been read back from telemetry, then `CAL_SET`; SAVE/REVERT go out for 300 ms. UPDATE DISPLAY needs a second tap |
|
||||||
| `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 |
|
| `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 % |
|
| `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`) |
|
||||||
| `NextionUI` | library-free Nextion driver on `Serial1`. HMI sends `'#' len cmd [val]` frames via `printh`. Remote pushes state by component name, as `control.<name>` (the owner adds a `control` page with vscope-global components to the old HMI), with diffing, a 2 s full refresh, and a redraw on the Nextion 0x88 "ready" frame. Also writes the old HMI's `t1` status texts (`NEXTION_STATUS_TEXTS`). The old page-1 `b2` sends a standard 0x65 touch frame, which triggers `runUploadPassthrough()`: USB ↔ display bridge for Nextion Editor, following `Serial.baud()`, never returns. Serial key `U` does the same |
|
| `Battery` | handset battery through a divider; `BATTERY_SENSE_PIN` 255 = not wired yet (planned A6) |
|
||||||
|
| `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 |
|
| `SerialConsole` | USB keystrokes that mirror every UI command plus diagnostics |
|
||||||
| `SmoothedValue.h` | copy of the robot's (kept separate so robot/ stays untouched) |
|
| `SmoothedValue.h` | copy of the robot's (kept separate so robot/ stays untouched) |
|
||||||
| `NEXTION.md` | HMI build guide: component names, txt_maxl, touch event code |
|
| `NEXTION.md` | the HMI: pages, command bytes, which components the firmware writes |
|
||||||
|
| `remote.HMI` | **generated** by `scripts/make_remote_hmi.py` (pages splash, drive, status, servos, cal, setup, upload; tabs + top bar with DISARM). Change the layout in the script, not in the Editor |
|
||||||
|
|
||||||
Remote stick-frame convention: logical X + = right, Y + = forward, twist +
|
Remote stick-frame convention: logical X + = right, Y + = forward, twist +
|
||||||
= CCW. The mapping into the packet is in `PacketBuilder.cpp` (e.g.
|
= CCW. The mapping into the packet is in `PacketBuilder.cpp` (e.g.
|
||||||
@@ -166,14 +191,28 @@ Remote stick-frame convention: logical X + = right, Y + = forward, twist +
|
|||||||
`Knie.x = −(tibia + 90)`.
|
`Knie.x = −(tibia + 90)`.
|
||||||
- **Unity (`Assets/HexapodSim/`):**
|
- **Unity (`Assets/HexapodSim/`):**
|
||||||
- `HexapodSimBootstrap` auto-adds `HexapodSimulation` in any scene and
|
- `HexapodSimBootstrap` auto-adds `HexapodSimulation` in any scene and
|
||||||
disables the old scripts (`Walk`, `RotationControl`, `Leg`,
|
disables the old scripts (`Walk`, `RotationControl`, `Leg`). Those are
|
||||||
`HandleHoystick`). Those are kept for reference only.
|
kept for reference only. The old USB serial / joystick scripts
|
||||||
|
(`Serial*`, `HandleHoystick`) were removed (owner, 2026-11-17: no USB
|
||||||
|
links to remote or robot any more, everything goes over the radio).
|
||||||
|
- `OpenScadModel` replaces the old scene's robot with the OpenSCAD model
|
||||||
|
(meshes from `hardware/openscad/export_unity.py` in
|
||||||
|
`Resources/OpenScadModel/`): it builds a new rig with the same names at
|
||||||
|
the Config.h geometry, whose rest pose (coxa 0, femur 0, tibia -90) is
|
||||||
|
the zero rotation. `HexapodSimulation.useOpenScadModel` turns it off.
|
||||||
- `HexapodSimNative` loads a temp copy of the DLL via
|
- `HexapodSimNative` loads a temp copy of the DLL via
|
||||||
LoadLibrary/GetProcAddress, so there's no file lock and each Play is a
|
LoadLibrary/GetProcAddress, so there's no file lock and each Play is a
|
||||||
fresh power-on.
|
fresh power-on.
|
||||||
- `SimRemote` stands in for the remote (Joystick axes "1"–"6" as in the
|
- `SimRemote` has two sources. **Keyboard** stands in for the remote and
|
||||||
old project, Keyboard, or the robot's own serial harness) and mirrors
|
mirrors `remote/PacketBuilder.cpp` + `RemoteState.cpp` rules (keep them
|
||||||
`remote/PacketBuilder.cpp` + `RemoteState.cpp` rules. Keep them in sync.
|
in sync). **Real remote** takes the real remote's packets over the air
|
||||||
|
from the USB nRF24 dongle (`DongleLink.cs`, the dongle's bridge mode,
|
||||||
|
see `dongle/README.md`), feeds them to the firmware unchanged
|
||||||
|
(`HexapodSimNative.RadioSend(byte[])`) and returns the robot's
|
||||||
|
telemetry as the ack payload, so the remote's display shows the sim.
|
||||||
|
`DongleLink` opens the port through kernel32 (no `System.IO.Ports`),
|
||||||
|
auto-finds the CH340 (VID 1A86 PID 7523), and does all port I/O on one
|
||||||
|
background thread.
|
||||||
- `SimTestPanel` is the IMGUI panel (F1).
|
- `SimTestPanel` is the IMGUI panel (F1).
|
||||||
- Body motion is kinematic and lives **in the DLL** (`sim/SimBody.cpp`,
|
- Body motion is kinematic and lives **in the DLL** (`sim/SimBody.cpp`,
|
||||||
`hxsim_get_body`), so Unity shows exactly what `sim_smoke` checks.
|
`hxsim_get_body`), so Unity shows exactly what `sim_smoke` checks.
|
||||||
@@ -198,8 +237,11 @@ Remote stick-frame convention: logical X + = right, Y + = forward, twist +
|
|||||||
stand → walk. The harness does not exercise the right stick or remote
|
stand → walk. The harness does not exercise the right stick or remote
|
||||||
tilt. Add keys if needed.
|
tilt. Add keys if needed.
|
||||||
- **Robot firmware in simulation:** `sim/build/sim_smoke.exe` (headless,
|
- **Robot firmware in simulation:** `sim/build/sim_smoke.exe` (headless,
|
||||||
scripted checks), or Unity Play mode with Keyboard / Joystick / Robot
|
scripted checks), or Unity Play mode with Keyboard input or the real
|
||||||
serial input.
|
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 without robot or display:** the USB serial console (see
|
||||||
`remote/README.md`). `p` shows raw/mapped sticks, IMU, link and state.
|
`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
|
`d` dumps packets at 10 Hz. With no robot, the link shows DOWN and
|
||||||
@@ -212,14 +254,25 @@ Robot (`robot/README.md` has detail):
|
|||||||
- `Config.h` geometry now comes from the Unity model (owner's request),
|
- `Config.h` geometry now comes from the Unity model (owner's request),
|
||||||
1 unit = 10 mm:
|
1 unit = 10 mm:
|
||||||
- legs at X ±100 / 0, Y ±50 / ±65 mm,
|
- legs at X ±100 / 0, Y ±50 / ±65 mm,
|
||||||
- mount angles ±90° (coxa straight sideways at servo center),
|
- mount angles ±30° / ±90° / ±150° (hexagon layout, owner's request: mid
|
||||||
|
legs sideways, corner legs 60° further round; coxa direction at servo
|
||||||
|
centre — the corner brackets sit 60° round on their splines),
|
||||||
- coxa/femur/tibia 55/100/150 mm,
|
- coxa/femur/tibia 55/100/150 mm,
|
||||||
- stance radius 75 (so 130 mm out from the coxa pivot), height 150 mm.
|
- stance radius 75 (so 130 mm out from the coxa pivot), height 150 mm.
|
||||||
|
|
||||||
The old scene's `Leg.translateX` = ±5 was only the old code's rotation
|
The old scene's `Leg.translateX` = ±5 was only the old code's rotation
|
||||||
pivot; the rig hips are at x ±10. Still to confirm on the real chassis:
|
pivot; the rig hips are at x ±10. Still to confirm on the real chassis:
|
||||||
joint limits, servo pins, µs/deg calibration, `MAX_JOINT_DEG_S` (in
|
servo pins, µs/deg calibration, `MAX_JOINT_DEG_S` (in
|
||||||
robot.ino), the Limits envelope, InputMapper maxima.
|
robot.ino), the Limits envelope, InputMapper maxima.
|
||||||
|
- **Geometry and limits confirmed against the CAD (owner's request):** the
|
||||||
|
OpenSCAD rebuild of the real chassis (`hardware/openscad/`, see its
|
||||||
|
`PLANNING.md`) has exactly these mounts and 55/100/150 mm links (tibia to
|
||||||
|
the centre of a 10 mm foot ball; femur/knee axes in the coxa pivot plane,
|
||||||
|
13.5 mm above the bottom plate). Its collision sweep gave the joint
|
||||||
|
limits now in `Config.h`: coxa limits are **per leg**
|
||||||
|
(`COXA_MIN_DEG[i]`/`COXA_MAX_DEG[i]`; all ±60 in the hexagon layout, but in
|
||||||
|
the old sideways layout a corner leg only swung ~36° towards its mid leg),
|
||||||
|
and `LEG_CLEARANCE_MM` is 56 (a leg is 55.2 mm wide at the joints). The sim API exports the per-leg coxa limits (version 7). Version 8 adds `hxsim_get_ack_payload` (the robot's telemetry); sim_smoke checks telemetry and every `CAL_*` command.
|
||||||
- **Fixed (owner-approved):** the `Kinematics.cpp` femur elevation sign
|
- **Fixed (owner-approved):** the `Kinematics.cpp` femur elevation sign
|
||||||
(`atan2(local_z, horiz)`; it used to solve for a foot above the hip, so
|
(`atan2(local_z, horiz)`; it used to solve for a foot above the hip, so
|
||||||
every solution was invalid). Stance pose is now femur −1.2°, tibia
|
every solution was invalid). Stance pose is now femur −1.2°, tibia
|
||||||
@@ -349,22 +402,35 @@ Robot (`robot/README.md` has detail):
|
|||||||
|
|
||||||
Remote (`remote/README.md` has detail):
|
Remote (`remote/README.md` has detail):
|
||||||
- Pins in `remote/Config.h`, taken from the old remote sketch: radio CE 9 /
|
- Pins in `remote/Config.h`, taken from the old remote sketch: radio CE 9 /
|
||||||
CSN 10, sticks A0–A5, Nextion on Serial1 (0/1). The MPU6050 is on
|
CSN 10, Nextion on **Serial2 (7/8)**, confirmed on the real remote. Owner's choice
|
||||||
**Wire2 (25/24)**, since A4/A5 = Wire's SDA/SCL are stick pins; that's
|
(2026-11-17): edge headers only, no pads underneath. So the MPU6050 is on **Wire (18/19)**
|
||||||
the owner's choice and needs rewiring the MPU. Which stick axis is on
|
and the two stick wires that were on A4/A5 (18/19) move to **A7/A8 (21/22)**: sticks
|
||||||
which pin is still unknown.
|
`{ A0, A1, A2, A3, A7, A8 }`. A6 (20) is kept for the battery divider. Checked on the real
|
||||||
|
remote (2026-11-17): left stick X/Y/twist = A3/A7/A8, right = A0/A1/A2, all inverted but the
|
||||||
|
right twist; each stick only moves about ±700 counts from centre, so run the sweep
|
||||||
|
calibration. The IMU axis defaults are right. Its MPU6050 (likely a clone) reads all zeros
|
||||||
|
until it gets a full device reset, so `RemoteIMU::begin()` resets it first. `RobotIMU` only
|
||||||
|
wakes its chip (owner-verified code, not changed): check the robot's IMU once it's flashed.
|
||||||
- `STICK_INVERT[]`, calibration defaults, deadzones, expo.
|
- `STICK_INVERT[]`, calibration defaults, deadzones, expo.
|
||||||
- `IMU_AXIS_FROM_CHIP` / `IMU_AXIS_SIGN` depend on how the MPU6050 is
|
|
||||||
mounted in the handset.
|
|
||||||
- The Nextion must have `bauds=115200` in Program.s, and the HMI must match
|
- The Nextion must have `bauds=115200` in Program.s, and the HMI must match
|
||||||
`NEXTION.md`. The owner's old 6-page HMI is in `../2019-teensy-nrf24/remote-nextion/remote.HMI`;
|
`NEXTION.md`. The working HMI is `remote/remote.HMI`, generated by
|
||||||
its component names aren't readable outside Nextion Editor. The compiled
|
`scripts/make_remote_hmi.py` (owner-approved design, 2026-11-17; the old 6-page one in
|
||||||
`.tft` is gitignored.
|
`../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`,
|
||||||
|
`set_event`, `add_component`, `add_page`, `verify`, `build_tft`. Its `.tft` builder is
|
||||||
|
partial and needs the Nextion firmware files, which aren't in the submodule (they're kept
|
||||||
|
locally in `D:\Claude\nextion-hmi-tools\firmware`), so compile the upload `.tft` in Nextion
|
||||||
|
Editor. The compiled `.tft` is gitignored.
|
||||||
- What the old remote sketch (`../2019-teensy-nrf24/remote/`, last ran on a
|
- What the old remote sketch (`../2019-teensy-nrf24/remote/`, last ran on a
|
||||||
Teensy) tells us about the real hardware:
|
Teensy) tells us about the real hardware:
|
||||||
- **Nextion on `Serial1` (pins 0/1)**, driven by the ITEAD Nextion
|
- **Nextion on `Serial2` (pins 7/8)**, driven by the ITEAD Nextion
|
||||||
library, whose `nexInit()` runs at 9600. `remote/Config.h` now uses
|
library (its `nexSerial` is Serial2). The sketch's `Serial1.begin()` and
|
||||||
Serial1 and expects 115200 via `bauds=` in the HMI.
|
its USB ↔ Serial1 passthrough never reached the display: a probe on the
|
||||||
|
real remote (2026-11-17) got `comok` only on Serial2, at 115200.
|
||||||
|
`remote/Config.h` uses Serial2 at 115200 (`bauds=` in the HMI).
|
||||||
- The old HMI is a *servo monitor*, not the control UI in `NEXTION.md`:
|
- The old HMI is a *servo monitor*, not the control UI in `NEXTION.md`:
|
||||||
- page 1: `t1` "connected"/"not connected", and `b2` = enter
|
- page 1: `t1` "connected"/"not connected", and `b2` = enter
|
||||||
upload mode;
|
upload mode;
|
||||||
@@ -372,15 +438,16 @@ Remote (`remote/README.md` has detail):
|
|||||||
`t1` status;
|
`t1` status;
|
||||||
- page 4: `uploadscreen`.
|
- page 4: `uploadscreen`.
|
||||||
|
|
||||||
None of the arm/stand/gait/mode/gyro/speed/height controls exist yet.
|
It had none of the arm/stand/gait/mode/gyro/speed/height controls.
|
||||||
The owner chose to add a `control` page per `NEXTION.md`.
|
It was replaced by the generated tabbed HMI (see above).
|
||||||
- `b2` → **Nextion upload passthrough**: shows `uploadscreen`, then
|
- `b2` → **Nextion upload passthrough**: shows `uploadscreen`, then
|
||||||
bridges USB ↔ Serial1 forever, so Nextion Editor can upload a `.tft`
|
bridges USB ↔ the display serial forever, so Nextion Editor can upload a `.tft`
|
||||||
through the remote's USB port. The new firmware keeps this.
|
through the remote's USB port. The new firmware keeps this as SETUP ›
|
||||||
- Sticks on **A0–A5**, contiguous (`analogInPin + i`). On the Teensy 4.1,
|
UPDATE DISPLAY (page `upload`).
|
||||||
|
- Sticks on **A0–A5**, contiguous (`analogInPin + i`). On the Teensy 4.0,
|
||||||
A4/A5 are pins 18/19 = Wire SDA/SCL, which the MPU6050 needs. The old
|
A4/A5 are pins 18/19 = Wire SDA/SCL, which the MPU6050 needs. The old
|
||||||
code had the MPU code disabled (`if (false)`). Owner's decision: keep
|
code had the MPU code disabled (`if (false)`). Owner's decision: MPU on
|
||||||
the sticks, move the MPU to Wire2.
|
Wire (18/19), those two stick wires move to A7/A8 (21/22).
|
||||||
- nRF24 on CE 9 / CSN 10, the same as `remote/Config.h`. It used
|
- nRF24 on CE 9 / CSN 10, the same as `remote/Config.h`. It used
|
||||||
RF24Network on channel 90, which the new protocol doesn't.
|
RF24Network on channel 90, which the new protocol doesn't.
|
||||||
- Stick calibration was a 10 s min/max sweep saved to EEPROM, output
|
- Stick calibration was a 10 s min/max sweep saved to EEPROM, output
|
||||||
@@ -388,9 +455,6 @@ Remote (`remote/README.md` has detail):
|
|||||||
- USB serial at 250000. It received 18 servo bytes + checksum + `0xFE`
|
- USB serial at 250000. It received 18 servo bytes + checksum + `0xFE`
|
||||||
from the old Unity `Serial.cs` (servo passthrough, forwarded over RF
|
from the old Unity `Serial.cs` (servo passthrough, forwarded over RF
|
||||||
to the robot) and printed `i_value,...` stick lines.
|
to the robot) and printed `i_value,...` stick lines.
|
||||||
- The Unity remote stand-in's joystick axis assignment (which of axes 4/6
|
|
||||||
is forward) couldn't be recovered from the old code. Check it with the
|
|
||||||
panel's raw-axis readout.
|
|
||||||
- Radio retry timing (`RADIO_RETRY_*`) is untested under real link loss.
|
- Radio retry timing (`RADIO_RETRY_*`) is untested under real link loss.
|
||||||
|
|
||||||
## Working rules for this repo
|
## Working rules for this repo
|
||||||
@@ -408,7 +472,8 @@ Remote (`remote/README.md` has detail):
|
|||||||
with BENCH comments for anything hardware-dependent, `SmoothedValue`
|
with BENCH comments for anything hardware-dependent, `SmoothedValue`
|
||||||
rate limiting on any setpoint that can jump, and paired `.h/.cpp` per
|
rate limiting on any setpoint that can jump, and paired `.h/.cpp` per
|
||||||
concern.
|
concern.
|
||||||
- Planned or possible next steps: an ack-payload telemetry channel from
|
- Planned or possible next steps: wire the battery dividers (firmware is
|
||||||
robot → remote (state, battery, link) to show real robot state on the
|
ready on both sides, pins still 255) and add a low-battery warning;
|
||||||
Nextion, battery monitoring on both sides, a `.HMI` file checked into
|
flash the robot with protocol v4 and try telemetry and servo calibration
|
||||||
`remote/`.
|
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.
|
||||||
@@ -0,0 +1,256 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace HexapodSim
|
||||||
|
{
|
||||||
|
// The USB nRF24 dongle (2026-current/dongle/) in bridge mode: it stands in for
|
||||||
|
// the robot's radio. Every packet the real remote sends comes in here; the
|
||||||
|
// simulated robot's Telemetry goes back out as the radio's ack payload, so the
|
||||||
|
// remote and its display see the simulation exactly like the real robot.
|
||||||
|
//
|
||||||
|
// Wire format both ways: A5 type len payload[len] sum (sum = type+len+payload).
|
||||||
|
// to dongle 'L' listen (bridge on), 'X' stop, 'A' ack payload (<= 32 B)
|
||||||
|
// from dongle 'R' received packet, 'S' status (packets u16, acks loaded u16)
|
||||||
|
// The dongle drops the ack payload if it isn't refreshed for ~0.5 s.
|
||||||
|
//
|
||||||
|
// Windows only (the dev PC): the port is opened through kernel32, so there's
|
||||||
|
// no dependency on System.IO.Ports or the project's API compatibility level.
|
||||||
|
public sealed class DongleLink : IDisposable
|
||||||
|
{
|
||||||
|
public string PortName { get; private set; }
|
||||||
|
public bool IsOpen => handle_ != IntPtr.Zero && handle_ != InvalidHandle;
|
||||||
|
public string Error { get; private set; }
|
||||||
|
public int DonglePacketsPerSec { get; private set; } // from the dongle's status frame
|
||||||
|
public int DongleAcksPerSec { get; private set; }
|
||||||
|
public int BadFrames { get; private set; }
|
||||||
|
|
||||||
|
readonly ConcurrentQueue<byte[]> packets_ = new ConcurrentQueue<byte[]>();
|
||||||
|
byte[] pendingAck_; // newest telemetry frame, written by the I/O thread
|
||||||
|
IntPtr handle_ = IntPtr.Zero;
|
||||||
|
Thread io_;
|
||||||
|
volatile bool running_;
|
||||||
|
|
||||||
|
// ---- Opening ----
|
||||||
|
|
||||||
|
// "auto" = the first USB-serial CH340 port Windows knows about (the dongle's
|
||||||
|
// CH330N shows up as VID 1A86 / PID 7523); otherwise e.g. "COM7".
|
||||||
|
public static DongleLink Open(string port)
|
||||||
|
{
|
||||||
|
var link = new DongleLink();
|
||||||
|
string name = port;
|
||||||
|
if (string.IsNullOrEmpty(name) || name.Equals("auto", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
name = FindCh340Port();
|
||||||
|
if (name == null) { link.Error = "no USB nRF24 dongle (CH340, VID 1A86 PID 7523) found"; return link; }
|
||||||
|
}
|
||||||
|
link.PortName = name;
|
||||||
|
link.OpenPort(name);
|
||||||
|
if (link.IsOpen)
|
||||||
|
{
|
||||||
|
link.Write(Frame((byte)'L', null, 0));
|
||||||
|
link.running_ = true;
|
||||||
|
link.io_ = new Thread(link.IoLoop) { IsBackground = true, Name = "DongleLink" };
|
||||||
|
link.io_.Start();
|
||||||
|
}
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenPort(string name)
|
||||||
|
{
|
||||||
|
// Retry briefly: SignalRGB and similar tools grab CH340 ports on enumeration.
|
||||||
|
for (int attempt = 0; attempt < 25; attempt++)
|
||||||
|
{
|
||||||
|
handle_ = CreateFile(@"\\.\" + name, GENERIC_READ | GENERIC_WRITE, 0, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero);
|
||||||
|
if (handle_ != InvalidHandle) break;
|
||||||
|
Thread.Sleep(20);
|
||||||
|
}
|
||||||
|
if (handle_ == InvalidHandle)
|
||||||
|
{
|
||||||
|
Error = $"can't open {name} (Win32 error {Marshal.GetLastWin32Error()}; is SignalRGB or a serial monitor holding it?)";
|
||||||
|
handle_ = IntPtr.Zero;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var dcb = new DCB { DCBlength = (uint)Marshal.SizeOf<DCB>() };
|
||||||
|
GetCommState(handle_, ref dcb);
|
||||||
|
dcb.BaudRate = 115200;
|
||||||
|
dcb.ByteSize = 8;
|
||||||
|
dcb.Parity = 0;
|
||||||
|
dcb.StopBits = 0;
|
||||||
|
dcb.Flags = 0x0001 | 0x0010; // fBinary, fDtrControl = DTR_CONTROL_ENABLE
|
||||||
|
SetCommState(handle_, ref dcb);
|
||||||
|
// Reads return within ~3 ms, so queued telemetry goes out promptly
|
||||||
|
// (reads and writes on one handle take turns: both run on the I/O thread).
|
||||||
|
var to = new COMMTIMEOUTS { ReadIntervalTimeout = 1, ReadTotalTimeoutConstant = 3, WriteTotalTimeoutConstant = 200 };
|
||||||
|
SetCommTimeouts(handle_, ref to);
|
||||||
|
PurgeComm(handle_, 0x0004 | 0x0008); // RXCLEAR | TXCLEAR
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
running_ = false;
|
||||||
|
io_?.Join(300);
|
||||||
|
if (IsOpen)
|
||||||
|
{
|
||||||
|
Write(Frame((byte)'X', null, 0)); // bridge off: the remote sees the link drop
|
||||||
|
CloseHandle(handle_);
|
||||||
|
}
|
||||||
|
handle_ = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Traffic ----
|
||||||
|
|
||||||
|
public bool TryTakePacket(out byte[] packet) => packets_.TryDequeue(out packet);
|
||||||
|
|
||||||
|
// Queues the robot's telemetry for the ack of the remote's next packet.
|
||||||
|
// Only the newest one matters, so an unsent older one is replaced.
|
||||||
|
public void SendAckPayload(byte[] data, int len)
|
||||||
|
{
|
||||||
|
if (len <= 32) Volatile.Write(ref pendingAck_, Frame((byte)'A', data, len));
|
||||||
|
}
|
||||||
|
|
||||||
|
static byte[] Frame(byte type, byte[] data, int len)
|
||||||
|
{
|
||||||
|
var f = new byte[4 + len];
|
||||||
|
f[0] = 0xA5; f[1] = type; f[2] = (byte)len;
|
||||||
|
int sum = type + len;
|
||||||
|
for (int i = 0; i < len; i++) { f[3 + i] = data[i]; sum += data[i]; }
|
||||||
|
f[3 + len] = (byte)sum;
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Write(byte[] f)
|
||||||
|
{
|
||||||
|
if (WriteFile(handle_, f, (uint)f.Length, out _, IntPtr.Zero)) return true;
|
||||||
|
Error = $"write failed (Win32 error {Marshal.GetLastWin32Error()}): dongle unplugged?";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IoLoop()
|
||||||
|
{
|
||||||
|
var chunk = new byte[512];
|
||||||
|
var buf = new byte[4096];
|
||||||
|
int have = 0;
|
||||||
|
while (running_)
|
||||||
|
{
|
||||||
|
byte[] ack = Interlocked.Exchange(ref pendingAck_, null);
|
||||||
|
if (ack != null && !Write(ack)) break;
|
||||||
|
if (!ReadFile(handle_, chunk, (uint)chunk.Length, out uint got, IntPtr.Zero))
|
||||||
|
{
|
||||||
|
if (running_) Error = $"read failed (Win32 error {Marshal.GetLastWin32Error()}): dongle unplugged?";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (got == 0) continue;
|
||||||
|
if (have + got > buf.Length) have = 0; // garbage flood: start over
|
||||||
|
Buffer.BlockCopy(chunk, 0, buf, have, (int)got);
|
||||||
|
have += (int)got;
|
||||||
|
have = ParseFrames(buf, have);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Consumes complete frames from buf[0..len), returns how many bytes remain.
|
||||||
|
int ParseFrames(byte[] buf, int len)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
while (i < len && buf[i] != 0xA5) i++; // skip text between frames
|
||||||
|
if (len - i < 4) break;
|
||||||
|
byte type = buf[i + 1], n = buf[i + 2];
|
||||||
|
if (n > 32) { i++; continue; }
|
||||||
|
if (len - i < 4 + n) break;
|
||||||
|
int sum = type + n;
|
||||||
|
for (int k = 0; k < n; k++) sum += buf[i + 3 + k];
|
||||||
|
if ((byte)sum != buf[i + 3 + n]) { BadFrames++; i++; continue; }
|
||||||
|
var payload = new byte[n];
|
||||||
|
Buffer.BlockCopy(buf, i + 3, payload, 0, n);
|
||||||
|
i += 4 + n;
|
||||||
|
if (type == 'R') packets_.Enqueue(payload);
|
||||||
|
else if (type == 'S' && n >= 4)
|
||||||
|
{
|
||||||
|
DonglePacketsPerSec = payload[0] | payload[1] << 8;
|
||||||
|
DongleAcksPerSec = payload[2] | payload[3] << 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int rest = len - i;
|
||||||
|
if (rest > 0 && i > 0) Buffer.BlockCopy(buf, i, buf, 0, rest);
|
||||||
|
return rest;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---- Finding the port: HKLM\SYSTEM\CurrentControlSet\Enum\USB\VID_1A86&PID_7523\<inst>\Device Parameters\PortName ----
|
||||||
|
|
||||||
|
static string FindCh340Port()
|
||||||
|
{
|
||||||
|
const string baseKey = @"SYSTEM\CurrentControlSet\Enum\USB\VID_1A86&PID_7523";
|
||||||
|
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, baseKey, 0, KEY_READ, out IntPtr key) != 0) return null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder(256);
|
||||||
|
for (uint idx = 0; ; idx++)
|
||||||
|
{
|
||||||
|
uint len = (uint)sb.Capacity;
|
||||||
|
if (RegEnumKeyEx(key, idx, sb, ref len, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero) != 0) break;
|
||||||
|
string port = ReadString(HKEY_LOCAL_MACHINE, baseKey + "\\" + sb + "\\Device Parameters", "PortName");
|
||||||
|
if (port != null && PortExists(port)) return port;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally { RegCloseKey(key); }
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static string ReadString(IntPtr root, string path, string value)
|
||||||
|
{
|
||||||
|
var data = new StringBuilder(64);
|
||||||
|
uint size = (uint)(data.Capacity * 2);
|
||||||
|
return RegGetValue(root, path, value, RRF_RT_REG_SZ, IntPtr.Zero, data, ref size) == 0 ? data.ToString() : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool PortExists(string name) => QueryDosDevice(name, new StringBuilder(256), 256) != 0;
|
||||||
|
|
||||||
|
// ---- Win32 ----
|
||||||
|
|
||||||
|
static readonly IntPtr InvalidHandle = new IntPtr(-1);
|
||||||
|
static readonly IntPtr HKEY_LOCAL_MACHINE = new IntPtr(unchecked((int)0x80000002));
|
||||||
|
const uint GENERIC_READ = 0x80000000, GENERIC_WRITE = 0x40000000, OPEN_EXISTING = 3;
|
||||||
|
const int KEY_READ = 0x20019;
|
||||||
|
const uint RRF_RT_REG_SZ = 0x00000002;
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
struct DCB
|
||||||
|
{
|
||||||
|
public uint DCBlength, BaudRate, Flags;
|
||||||
|
public ushort wReserved, XonLim, XoffLim;
|
||||||
|
public byte ByteSize, Parity, StopBits;
|
||||||
|
public sbyte XonChar, XoffChar, ErrorChar, EofChar, EvtChar;
|
||||||
|
public ushort wReserved1;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
struct COMMTIMEOUTS
|
||||||
|
{
|
||||||
|
public uint ReadIntervalTimeout, ReadTotalTimeoutMultiplier, ReadTotalTimeoutConstant,
|
||||||
|
WriteTotalTimeoutMultiplier, WriteTotalTimeoutConstant;
|
||||||
|
}
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||||
|
static extern IntPtr CreateFile(string name, uint access, uint share, IntPtr sec, uint disposition, uint flags, IntPtr template);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)] static extern bool CloseHandle(IntPtr h);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)] static extern bool GetCommState(IntPtr h, ref DCB dcb);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)] static extern bool SetCommState(IntPtr h, ref DCB dcb);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)] static extern bool SetCommTimeouts(IntPtr h, ref COMMTIMEOUTS t);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)] static extern bool PurgeComm(IntPtr h, uint flags);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)] static extern bool ReadFile(IntPtr h, byte[] buf, uint n, out uint got, IntPtr ov);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)] static extern bool WriteFile(IntPtr h, byte[] buf, uint n, out uint put, IntPtr ov);
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
||||||
|
static extern uint QueryDosDevice(string device, StringBuilder target, int max);
|
||||||
|
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
|
||||||
|
static extern int RegOpenKeyEx(IntPtr key, string sub, int options, int sam, out IntPtr result);
|
||||||
|
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
|
||||||
|
static extern int RegEnumKeyEx(IntPtr key, uint index, StringBuilder name, ref uint nameLen, IntPtr reserved, IntPtr cls, IntPtr clsLen, IntPtr lastWrite);
|
||||||
|
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
|
||||||
|
static extern int RegGetValue(IntPtr key, string sub, string value, uint flags, IntPtr type, StringBuilder data, ref uint size);
|
||||||
|
[DllImport("advapi32.dll")] static extern int RegCloseKey(IntPtr key);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d16e6c95081705a4788b93525709e796
|
||||||
+1
-3
@@ -1,8 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 5f676c461da1c254990d7719d77e6250
|
guid: 4bfa2732a93b22f48babbbb0cf21cc1b
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
timeCreated: 1641405303
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
+75
@@ -0,0 +1,75 @@
|
|||||||
|
using System.IO;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.SceneManagement;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace HexapodSim
|
||||||
|
{
|
||||||
|
// Batch-mode check of the OpenSCAD model in Main.unity, without entering
|
||||||
|
// Play mode: builds the model from the DLL's geometry, poses the legs in
|
||||||
|
// the firmware's standing pose and renders the main camera to PNGs.
|
||||||
|
// Unity.exe -batchmode -projectPath . -executeMethod HexapodSim.OpenScadModelSnapshot.Run
|
||||||
|
// -snapshotDir <folder> -quit
|
||||||
|
public static class OpenScadModelSnapshot
|
||||||
|
{
|
||||||
|
public static void Run()
|
||||||
|
{
|
||||||
|
string dir = Arg("-snapshotDir") ?? Path.GetFullPath("Temp/OpenScadSnapshot");
|
||||||
|
Directory.CreateDirectory(dir);
|
||||||
|
EditorSceneManager.OpenScene("Assets/Main.unity");
|
||||||
|
|
||||||
|
Transform chassis = null;
|
||||||
|
foreach (var t in Object.FindObjectsByType<Transform>())
|
||||||
|
if (t.name == "Leg" && t.Find("hip1") != null) { chassis = t.parent; break; }
|
||||||
|
if (chassis == null) { Debug.LogError("[Snapshot] no leg rig in Main.unity"); EditorApplication.Exit(1); return; }
|
||||||
|
|
||||||
|
string dll = Path.GetFullPath(Path.Combine(Application.dataPath, "..", "..", "sim", "build", "hexapod_sim.dll"));
|
||||||
|
HxGeometry g;
|
||||||
|
using (var native = HexapodSimNative.Load(dll)) g = native.Geometry;
|
||||||
|
OpenScadModel.Build(chassis, g, ForwardAxis.NegativeX, 0.1f);
|
||||||
|
|
||||||
|
// Firmware stance: coxa 0, femur -1.2, tibia -98.3 (HexapodSimulation.ApplyJoints).
|
||||||
|
foreach (Transform leg in chassis)
|
||||||
|
{
|
||||||
|
if (leg.name != "Leg" || !leg.gameObject.activeSelf) continue;
|
||||||
|
var hip2 = leg.Find("hip1/Hip2");
|
||||||
|
var knie = leg.Find("hip1/Hip2/Knie");
|
||||||
|
hip2.localRotation = Quaternion.Euler(1.2f, 0, 0);
|
||||||
|
knie.localRotation = Quaternion.Euler(-(-98.3f + 90f), 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var cam = Camera.main;
|
||||||
|
if (cam == null) cam = new GameObject("SnapshotCamera").AddComponent<Camera>();
|
||||||
|
Vector3 c = chassis.position;
|
||||||
|
Shoot(cam, c + new Vector3(-30, 22, -38), c, Path.Combine(dir, "front_left.png"));
|
||||||
|
Shoot(cam, c + new Vector3(42, 30, 20), c, Path.Combine(dir, "rear_right.png"));
|
||||||
|
Shoot(cam, c + new Vector3(0.01f, 60, 0), c, Path.Combine(dir, "top.png"));
|
||||||
|
Debug.Log("[Snapshot] wrote " + dir);
|
||||||
|
EditorApplication.Exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Shoot(Camera cam, Vector3 pos, Vector3 target, string file)
|
||||||
|
{
|
||||||
|
cam.transform.position = pos;
|
||||||
|
cam.transform.LookAt(target);
|
||||||
|
cam.fieldOfView = 45;
|
||||||
|
var rt = new RenderTexture(1280, 900, 24);
|
||||||
|
cam.targetTexture = rt;
|
||||||
|
cam.Render();
|
||||||
|
RenderTexture.active = rt;
|
||||||
|
var tex = new Texture2D(rt.width, rt.height, TextureFormat.RGB24, false);
|
||||||
|
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
|
||||||
|
tex.Apply();
|
||||||
|
File.WriteAllBytes(file, tex.EncodeToPNG());
|
||||||
|
cam.targetTexture = null;
|
||||||
|
RenderTexture.active = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
static string Arg(string name)
|
||||||
|
{
|
||||||
|
var a = System.Environment.GetCommandLineArgs();
|
||||||
|
for (int i = 0; i < a.Length - 1; i++) if (a[i] == name) return a[i + 1];
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9aa5d204e0b61604b9d0c92405edb7a8
|
||||||
@@ -14,7 +14,10 @@ namespace HexapodSim
|
|||||||
public short rx, ry, rz;
|
public short rx, ry, rz;
|
||||||
public short remote_roll, remote_pitch;
|
public short remote_roll, remote_pitch;
|
||||||
public short body_height; // -1000 lowest .. 0 default .. 1000 highest
|
public short body_height; // -1000 lowest .. 0 default .. 1000 highest
|
||||||
|
public short cal_value; // servo centre calibration (remote only; 0 here)
|
||||||
public byte speed_scale, flags, seq;
|
public byte speed_scale, flags, seq;
|
||||||
|
public byte cal_cmd; // CAL_NONE (0): the sim's remote never calibrates servos
|
||||||
|
public byte cal_servo;
|
||||||
|
|
||||||
public const byte FLAG_ARMED = 1 << 0;
|
public const byte FLAG_ARMED = 1 << 0;
|
||||||
public const byte FLAG_STAND = 1 << 1;
|
public const byte FLAG_STAND = 1 << 1;
|
||||||
@@ -36,7 +39,9 @@ namespace HexapodSim
|
|||||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public float[] mountAngleDeg;
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public float[] mountAngleDeg;
|
||||||
public float coxaMm, femurMm, tibiaMm;
|
public float coxaMm, femurMm, tibiaMm;
|
||||||
public float stanceRadiusMm, stanceHeightMm;
|
public float stanceRadiusMm, stanceHeightMm;
|
||||||
public float coxaMinDeg, coxaMaxDeg, femurMinDeg, femurMaxDeg, tibiaMinDeg, tibiaMaxDeg;
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public float[] coxaMinDeg;
|
||||||
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)] public float[] coxaMaxDeg;
|
||||||
|
public float femurMinDeg, femurMaxDeg, tibiaMinDeg, tibiaMaxDeg;
|
||||||
public float controlHz;
|
public float controlHz;
|
||||||
public float legClearanceMm;
|
public float legClearanceMm;
|
||||||
public float stanceHeightRangeMm;
|
public float stanceHeightRangeMm;
|
||||||
@@ -71,7 +76,7 @@ namespace HexapodSim
|
|||||||
// "Reload firmware" and the new code runs. Each load is a fresh power-on.
|
// "Reload firmware" and the new code runs. Each load is a fresh power-on.
|
||||||
public sealed class HexapodSimNative : IDisposable
|
public sealed class HexapodSimNative : IDisposable
|
||||||
{
|
{
|
||||||
public const int ExpectedApiVersion = 6; // HXSIM_API_VERSION
|
public const int ExpectedApiVersion = 8; // HXSIM_API_VERSION
|
||||||
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate int IntFn();
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate int IntFn();
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void VoidFn();
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void VoidFn();
|
||||||
@@ -86,6 +91,7 @@ namespace HexapodSim
|
|||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void ServosFn(int[] us, int[] attached, uint[] writes);
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void ServosFn(int[] us, int[] attached, uint[] writes);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void FloatsFn(float[] values);
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void FloatsFn(float[] values);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void TwoFloatsFn(float a, float b);
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void TwoFloatsFn(float a, float b);
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate int AckFn(byte[] bytes, int cap);
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void BodyFn(float[] pos3, float[] quatWxyz4, out float yawDeg, out int contactMask);
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate void BodyFn(float[] pos3, float[] quatWxyz4, out float yawDeg, out int contactMask);
|
||||||
|
|
||||||
IntPtr handle_;
|
IntPtr handle_;
|
||||||
@@ -97,14 +103,15 @@ namespace HexapodSim
|
|||||||
VoidFn start_;
|
VoidFn start_;
|
||||||
UIntArgFn step_;
|
UIntArgFn step_;
|
||||||
PacketFn radioSend_;
|
PacketFn radioSend_;
|
||||||
|
BytesInFn radioSendBytes_;
|
||||||
ImuFn setImu_;
|
ImuFn setImu_;
|
||||||
BytesInFn serialInput_;
|
|
||||||
BytesOutFn serialOutput_;
|
BytesOutFn serialOutput_;
|
||||||
ServosFn getServos_;
|
ServosFn getServos_;
|
||||||
FloatsFn getJoints_, getFeet_;
|
FloatsFn getJoints_, getFeet_;
|
||||||
StatusFn getStatus_;
|
StatusFn getStatus_;
|
||||||
TwoFloatsFn setGroundTilt_;
|
TwoFloatsFn setGroundTilt_;
|
||||||
BodyFn getBody_;
|
BodyFn getBody_;
|
||||||
|
AckFn getAckPayload_;
|
||||||
|
|
||||||
public string LoadedFrom { get; private set; }
|
public string LoadedFrom { get; private set; }
|
||||||
|
|
||||||
@@ -135,8 +142,8 @@ namespace HexapodSim
|
|||||||
n.start_ = n.Fn<VoidFn>("hxsim_start");
|
n.start_ = n.Fn<VoidFn>("hxsim_start");
|
||||||
n.step_ = n.Fn<UIntArgFn>("hxsim_step");
|
n.step_ = n.Fn<UIntArgFn>("hxsim_step");
|
||||||
n.radioSend_ = n.Fn<PacketFn>("hxsim_radio_send");
|
n.radioSend_ = n.Fn<PacketFn>("hxsim_radio_send");
|
||||||
|
n.radioSendBytes_ = n.Fn<BytesInFn>("hxsim_radio_send");
|
||||||
n.setImu_ = n.Fn<ImuFn>("hxsim_set_imu");
|
n.setImu_ = n.Fn<ImuFn>("hxsim_set_imu");
|
||||||
n.serialInput_ = n.Fn<BytesInFn>("hxsim_serial_input");
|
|
||||||
n.serialOutput_ = n.Fn<BytesOutFn>("hxsim_serial_output");
|
n.serialOutput_ = n.Fn<BytesOutFn>("hxsim_serial_output");
|
||||||
n.getServos_ = n.Fn<ServosFn>("hxsim_get_servos");
|
n.getServos_ = n.Fn<ServosFn>("hxsim_get_servos");
|
||||||
n.getJoints_ = n.Fn<FloatsFn>("hxsim_get_joints_deg");
|
n.getJoints_ = n.Fn<FloatsFn>("hxsim_get_joints_deg");
|
||||||
@@ -144,6 +151,7 @@ namespace HexapodSim
|
|||||||
n.getStatus_ = n.Fn<StatusFn>("hxsim_get_status");
|
n.getStatus_ = n.Fn<StatusFn>("hxsim_get_status");
|
||||||
n.setGroundTilt_ = n.Fn<TwoFloatsFn>("hxsim_set_ground_tilt");
|
n.setGroundTilt_ = n.Fn<TwoFloatsFn>("hxsim_set_ground_tilt");
|
||||||
n.getBody_ = n.Fn<BodyFn>("hxsim_get_body");
|
n.getBody_ = n.Fn<BodyFn>("hxsim_get_body");
|
||||||
|
n.getAckPayload_ = n.Fn<AckFn>("hxsim_get_ack_payload");
|
||||||
|
|
||||||
int version = n.apiVersion_();
|
int version = n.apiVersion_();
|
||||||
if (version != ExpectedApiVersion)
|
if (version != ExpectedApiVersion)
|
||||||
@@ -176,16 +184,24 @@ namespace HexapodSim
|
|||||||
public void Start() => start_();
|
public void Start() => start_();
|
||||||
public void Step(uint dtMicros) => step_(dtMicros);
|
public void Step(uint dtMicros) => step_(dtMicros);
|
||||||
public void RadioSend(CmdPacket p) => radioSend_(ref p, Marshal.SizeOf<CmdPacket>());
|
public void RadioSend(CmdPacket p) => radioSend_(ref p, Marshal.SizeOf<CmdPacket>());
|
||||||
|
// A packet exactly as it came over the air (the real remote, via the dongle).
|
||||||
|
// Any length: the firmware itself drops ones that aren't sizeof(CmdPacket).
|
||||||
|
public void RadioSend(byte[] bytes) => radioSendBytes_(bytes, bytes.Length);
|
||||||
|
|
||||||
|
// Decodes on-air bytes for display; false if the length doesn't match.
|
||||||
|
public static bool TryDecode(byte[] bytes, out CmdPacket p)
|
||||||
|
{
|
||||||
|
p = default;
|
||||||
|
if (bytes == null || bytes.Length != Marshal.SizeOf<CmdPacket>()) return false;
|
||||||
|
var h = GCHandle.Alloc(bytes, GCHandleType.Pinned);
|
||||||
|
try { p = Marshal.PtrToStructure<CmdPacket>(h.AddrOfPinnedObject()); }
|
||||||
|
finally { h.Free(); }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// Overrides the body-driven IMU with fixed readings from then on (normally unused).
|
// Overrides the body-driven IMU with fixed readings from then on (normally unused).
|
||||||
public void SetImu(Vector3 accelG, Vector3 gyroDps) =>
|
public void SetImu(Vector3 accelG, Vector3 gyroDps) =>
|
||||||
setImu_(accelG.x, accelG.y, accelG.z, gyroDps.x, gyroDps.y, gyroDps.z);
|
setImu_(accelG.x, accelG.y, accelG.z, gyroDps.x, gyroDps.y, gyroDps.z);
|
||||||
|
|
||||||
public void SerialInput(string text)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(text)) return;
|
|
||||||
byte[] b = System.Text.Encoding.ASCII.GetBytes(text);
|
|
||||||
serialInput_(b, b.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
readonly byte[] serialBuf_ = new byte[4096];
|
readonly byte[] serialBuf_ = new byte[4096];
|
||||||
public string SerialOutput()
|
public string SerialOutput()
|
||||||
@@ -203,6 +219,10 @@ namespace HexapodSim
|
|||||||
readonly float[] bodyPos_ = new float[3], bodyQuat_ = new float[4];
|
readonly float[] bodyPos_ = new float[3], bodyQuat_ = new float[4];
|
||||||
// Kinematic body from the DLL, robot-world frame. The rotation is a
|
// Kinematic body from the DLL, robot-world frame. The rotation is a
|
||||||
// robot-frame quaternion held in a Unity Quaternion for its math only.
|
// robot-frame quaternion held in a Unity Quaternion for its math only.
|
||||||
|
// The robot's telemetry (HexapodProtocol.h Telemetry, 30 bytes) from the
|
||||||
|
// last ack payload; returns its length, 0 before the first packet.
|
||||||
|
public int GetAckPayload(byte[] buf) => getAckPayload_(buf, buf.Length);
|
||||||
|
|
||||||
public void GetBody(out Vector3 posMm, out Quaternion rotRobot, out float yawDeg, out int contactMask)
|
public void GetBody(out Vector3 posMm, out Quaternion rotRobot, out float yawDeg, out int contactMask)
|
||||||
{
|
{
|
||||||
getBody_(bodyPos_, bodyQuat_, out yawDeg, out contactMask);
|
getBody_(bodyPos_, bodyQuat_, out yawDeg, out contactMask);
|
||||||
|
|||||||
@@ -32,6 +32,9 @@ namespace HexapodSim
|
|||||||
public float unitsPerMm = 0.1f;
|
public float unitsPerMm = 0.1f;
|
||||||
[Tooltip("Firmware tibia angle when the rig's Knie rotation is 0 (tibia straight down from a horizontal femur).")]
|
[Tooltip("Firmware tibia angle when the rig's Knie rotation is 0 (tibia straight down from a horizontal femur).")]
|
||||||
public float kneeRestDeg = -90f;
|
public float kneeRestDeg = -90f;
|
||||||
|
[Tooltip("Replace the old scene's robot with the OpenSCAD model (hardware/openscad, export_unity.py).")]
|
||||||
|
public bool useOpenScadModel = true;
|
||||||
|
bool openScadBuilt_;
|
||||||
|
|
||||||
[Header("World")]
|
[Header("World")]
|
||||||
[Tooltip("Tilts the ground (deg about robot X = roll, Y = pitch) to exercise the robot gyro.")]
|
[Tooltip("Tilts the ground (deg about robot X = roll, Y = pitch) to exercise the robot gyro.")]
|
||||||
@@ -78,7 +81,7 @@ namespace HexapodSim
|
|||||||
StringBuilder serialLine_ = new StringBuilder();
|
StringBuilder serialLine_ = new StringBuilder();
|
||||||
|
|
||||||
static readonly string[] LegacyMovementScripts =
|
static readonly string[] LegacyMovementScripts =
|
||||||
{ "Walk", "RotationControl", "Leg", "HandleHoystick", "Serial2", "Serial3" };
|
{ "Walk", "RotationControl", "Leg" };
|
||||||
|
|
||||||
// Robot-frame axes, for readability (Unity's Vector3.up etc. are Unity axes).
|
// Robot-frame axes, for readability (Unity's Vector3.up etc. are Unity axes).
|
||||||
static readonly Vector3 AxisX = new Vector3(1, 0, 0); // forward
|
static readonly Vector3 AxisX = new Vector3(1, 0, 0); // forward
|
||||||
@@ -123,6 +126,11 @@ namespace HexapodSim
|
|||||||
Native.SetRadioPresent(radioPresent);
|
Native.SetRadioPresent(radioPresent);
|
||||||
Native.SetImuPresent(imuPresent);
|
Native.SetImuPresent(imuPresent);
|
||||||
Geometry = Native.Geometry;
|
Geometry = Native.Geometry;
|
||||||
|
if (useOpenScadModel && !openScadBuilt_ && OpenScadModel.Available)
|
||||||
|
{
|
||||||
|
OpenScadModel.Build(chassis, Geometry, forwardAxis, unitsPerMm);
|
||||||
|
openScadBuilt_ = true;
|
||||||
|
}
|
||||||
BindRig();
|
BindRig();
|
||||||
Native.SetGroundTilt(groundTiltDeg.x, groundTiltDeg.y);
|
Native.SetGroundTilt(groundTiltDeg.x, groundTiltDeg.y);
|
||||||
Native.Start();
|
Native.Start();
|
||||||
|
|||||||
@@ -0,0 +1,140 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Rendering;
|
||||||
|
|
||||||
|
namespace HexapodSim
|
||||||
|
{
|
||||||
|
// Swaps the old scene's robot for the OpenSCAD model (hardware/openscad,
|
||||||
|
// exported by export_unity.py into Resources/OpenScadModel). Builds a new
|
||||||
|
// rig under the same chassis with the names HexapodSimulation looks for
|
||||||
|
// (Leg > hip1 > Hip2 > Knie, plus the Point foot marker), with its pivots
|
||||||
|
// exactly at the Config.h geometry, and hides the old visuals. The meshes
|
||||||
|
// are in the rest pose (coxa 0, femur 0, tibia -90), which is the rig's
|
||||||
|
// zero rotation, so the existing joint driving moves them correctly.
|
||||||
|
public static class OpenScadModel
|
||||||
|
{
|
||||||
|
const string Folder = "OpenScadModel/";
|
||||||
|
|
||||||
|
public static bool Available => Resources.Load<TextAsset>(Folder + "body") != null;
|
||||||
|
|
||||||
|
public static void Build(Transform chassis, HxGeometry g, ForwardAxis f, float unitsPerMm)
|
||||||
|
{
|
||||||
|
Material template = null;
|
||||||
|
foreach (var r in chassis.GetComponentsInChildren<Renderer>(true))
|
||||||
|
{
|
||||||
|
if (template == null && r.sharedMaterial) template = r.sharedMaterial;
|
||||||
|
r.enabled = false;
|
||||||
|
}
|
||||||
|
foreach (var t in Object.FindObjectsByType<Transform>())
|
||||||
|
if (t.name == "Leg" && HasChild(t, "hip1")) t.gameObject.SetActive(false);
|
||||||
|
|
||||||
|
var shader = Shader.Find("Standard") ?? (template ? template.shader : null);
|
||||||
|
AddMesh(chassis, "OpenSCAD body", Folder + "body", Quaternion.identity, f, unitsPerMm, shader);
|
||||||
|
|
||||||
|
for (int i = 0; i < g.numLegs; i++)
|
||||||
|
{
|
||||||
|
string side = g.mountAngleDeg[i] > 0 ? "left" : "right";
|
||||||
|
float a = g.mountAngleDeg[i] * Mathf.Deg2Rad;
|
||||||
|
var root = new GameObject("Leg").transform;
|
||||||
|
root.SetParent(chassis, false);
|
||||||
|
root.localPosition = RobotFrame.ToUnity(new Vector3(g.mountXmm[i], g.mountYmm[i], 0), f) * unitsPerMm;
|
||||||
|
root.localRotation = Quaternion.LookRotation(
|
||||||
|
RobotFrame.ToUnity(new Vector3(Mathf.Cos(a), Mathf.Sin(a), 0), f), Vector3.up);
|
||||||
|
// The meshes are exported as a leg pointing straight sideways (mount
|
||||||
|
// +90 left, -90 right) in chassis axes; in the joint's own frame that
|
||||||
|
// is the same for any mount angle.
|
||||||
|
float refRad = (side == "left" ? 90f : -90f) * Mathf.Deg2Rad;
|
||||||
|
Quaternion toJoint = Quaternion.Inverse(Quaternion.LookRotation(
|
||||||
|
RobotFrame.ToUnity(new Vector3(Mathf.Cos(refRad), Mathf.Sin(refRad), 0), f), Vector3.up));
|
||||||
|
|
||||||
|
var hip1 = Child(root, "hip1", Vector3.zero);
|
||||||
|
AddMesh(hip1, "coxa", Folder + $"leg_{side}_coxa", toJoint, f, unitsPerMm, shader);
|
||||||
|
var hip2 = Child(hip1, "Hip2", new Vector3(0, 0, g.coxaMm * unitsPerMm));
|
||||||
|
AddMesh(hip2, "femur", Folder + $"leg_{side}_femur", toJoint, f, unitsPerMm, shader);
|
||||||
|
var knie = Child(hip2, "Knie", new Vector3(0, 0, g.femurMm * unitsPerMm));
|
||||||
|
AddMesh(knie, "tibia", Folder + $"leg_{side}_tibia", toJoint, f, unitsPerMm, shader);
|
||||||
|
|
||||||
|
// Where the firmware's FK puts the foot (centre of the foot ball).
|
||||||
|
var marker = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||||
|
var collider = marker.GetComponent<Collider>();
|
||||||
|
if (Application.isPlaying) Object.Destroy(collider); else Object.DestroyImmediate(collider);
|
||||||
|
marker.name = "Point";
|
||||||
|
marker.transform.SetParent(knie, false);
|
||||||
|
marker.transform.localScale = Vector3.one * 4f * unitsPerMm;
|
||||||
|
marker.GetComponent<Renderer>().material = MakeMaterial(shader, new Color(0.9f, 0.1f, 0.1f));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HasChild(Transform t, string name)
|
||||||
|
{
|
||||||
|
foreach (Transform c in t)
|
||||||
|
if (string.Equals(c.name, name, System.StringComparison.OrdinalIgnoreCase) || HasChild(c, name)) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Transform Child(Transform parent, string name, Vector3 localPos)
|
||||||
|
{
|
||||||
|
var t = new GameObject(name).transform;
|
||||||
|
t.SetParent(parent, false);
|
||||||
|
t.localPosition = localPos;
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Material MakeMaterial(Shader shader, Color c)
|
||||||
|
{
|
||||||
|
var m = new Material(shader) { color = c };
|
||||||
|
if (m.HasProperty("_Glossiness")) m.SetFloat("_Glossiness", 0.25f);
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reads one export_unity.py file: robot-frame mm, pivot-relative,
|
||||||
|
// counter-clockwise outward winding (right-handed). RobotFrame.ToUnity is a
|
||||||
|
// reflection, so every triangle is flipped to stay front-facing.
|
||||||
|
static void AddMesh(Transform parent, string name, string resource, Quaternion toLocal,
|
||||||
|
ForwardAxis f, float unitsPerMm, Shader shader)
|
||||||
|
{
|
||||||
|
var asset = Resources.Load<TextAsset>(resource);
|
||||||
|
if (asset == null) { Debug.LogWarning($"[HexapodSim] missing model mesh {resource}"); return; }
|
||||||
|
|
||||||
|
var verts = new List<Vector3>();
|
||||||
|
var groups = new List<int[]>();
|
||||||
|
var mats = new List<Material>();
|
||||||
|
using (var br = new BinaryReader(new MemoryStream(asset.bytes)))
|
||||||
|
{
|
||||||
|
if (new string(br.ReadChars(4)) != "HXM1") { Debug.LogWarning($"[HexapodSim] {resource}: not a model mesh"); return; }
|
||||||
|
int n = br.ReadInt32();
|
||||||
|
for (int k = 0; k < n; k++)
|
||||||
|
{
|
||||||
|
var col = new Color(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
|
||||||
|
int tris = br.ReadInt32();
|
||||||
|
var idx = new int[tris * 3];
|
||||||
|
for (int t = 0; t < tris; t++)
|
||||||
|
{
|
||||||
|
int b0 = verts.Count;
|
||||||
|
for (int v = 0; v < 3; v++)
|
||||||
|
{
|
||||||
|
var r = new Vector3(br.ReadSingle(), br.ReadSingle(), br.ReadSingle());
|
||||||
|
verts.Add(toLocal * (RobotFrame.ToUnity(r, f) * unitsPerMm));
|
||||||
|
}
|
||||||
|
idx[t * 3] = b0; idx[t * 3 + 1] = b0 + 2; idx[t * 3 + 2] = b0 + 1;
|
||||||
|
}
|
||||||
|
groups.Add(idx);
|
||||||
|
mats.Add(MakeMaterial(shader, col));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var mesh = new Mesh { name = name, indexFormat = IndexFormat.UInt32 };
|
||||||
|
mesh.SetVertices(verts);
|
||||||
|
mesh.subMeshCount = groups.Count;
|
||||||
|
for (int k = 0; k < groups.Count; k++) mesh.SetTriangles(groups[k], k);
|
||||||
|
mesh.RecalculateNormals();
|
||||||
|
mesh.RecalculateBounds();
|
||||||
|
|
||||||
|
var go = new GameObject(name);
|
||||||
|
go.transform.SetParent(parent, false);
|
||||||
|
go.AddComponent<MeshFilter>().sharedMesh = mesh;
|
||||||
|
go.AddComponent<MeshRenderer>().sharedMaterials = mats.ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9ac8b69c6750b194da6fcfc0d9d6cf48
|
||||||
+1
-3
@@ -1,8 +1,6 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 942facdab943ceb4ca29453f4ee4d1b3
|
guid: 027b28f48b4d1d34799b61471976c26b
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
timeCreated: 1641404792
|
|
||||||
licenseType: Free
|
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 86e3f55e00f9d5f4a9ae4f95c2dad14b
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 119d6760b10e2d94c89d00627245b5fd
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
LFS
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c8b5e767dc591144899b7e32a99ceabd
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2026-current/Hexapod_Simulation_Unity/Assets/HexapodSim/Resources/OpenScadModel/leg_left_femur.bytes
LFS
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 545cab1c5e6fdb6479a51faf4890b22e
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2026-current/Hexapod_Simulation_Unity/Assets/HexapodSim/Resources/OpenScadModel/leg_left_tibia.bytes
LFS
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1b15eff82e4f31d4d9ae657c556b7874
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
2026-current/Hexapod_Simulation_Unity/Assets/HexapodSim/Resources/OpenScadModel/leg_right_coxa.bytes
LFS
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 12b3384c18597f746a655d3d1558942e
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 6215130e92405f248957c261f62f4ff7
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Binary file not shown.
+7
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 853358b18f634bb438e5980191cfda74
|
||||||
|
TextScriptImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,47 +1,28 @@
|
|||||||
using System;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace HexapodSim
|
namespace HexapodSim
|
||||||
{
|
{
|
||||||
// Stand-in for the handheld remote. Produces CmdPackets exactly per the
|
// Where the simulated robot's commands come from. Two sources:
|
||||||
// protocol contract and sends them over the simulated radio. Toggles and
|
// Keyboard - a stand-in remote: builds CmdPackets per the protocol contract
|
||||||
// interlocks mirror remote/RemoteState.cpp and remote/PacketBuilder.cpp -
|
// and sends them over the simulated radio. Toggles and
|
||||||
// keep them in sync if those change.
|
// interlocks mirror remote/RemoteState.cpp and
|
||||||
//
|
// remote/PacketBuilder.cpp - keep them in sync if those change.
|
||||||
// Input sources:
|
// RealRemote - the real handheld remote, over the air: the USB nRF24 dongle
|
||||||
// Joystick - the real remote as a USB game controller, read through
|
// (2026-current/dongle/, bridge mode) receives its packets, they
|
||||||
// Unity input axes "1".."6" like the old HandleHoystick.
|
// go into the firmware unchanged, and the robot's Telemetry goes
|
||||||
// Keyboard - test without any remote (keys listed in SimTestPanel).
|
// back as the radio's ack payload. The remote's display then
|
||||||
// RobotSerialHarness - no radio at all; typed keys go to the firmware's own
|
// shows the simulated robot. Nothing about the remote is
|
||||||
// TEST_SERIAL_INPUT harness, like the Arduino Serial Monitor.
|
// mirrored here: its own firmware does all of it.
|
||||||
// Toggles, the speed slider and the handset tilt sliders live in SimTestPanel.
|
// Toggles, the speed slider and the handset tilt sliders live in SimTestPanel.
|
||||||
public class SimRemote : MonoBehaviour
|
public class SimRemote : MonoBehaviour
|
||||||
{
|
{
|
||||||
public enum InputSource { Joystick, Keyboard, RobotSerialHarness }
|
public enum InputSource { Keyboard, RealRemote }
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public class AxisBinding
|
|
||||||
{
|
|
||||||
public string axis;
|
|
||||||
public bool invert;
|
|
||||||
public AxisBinding(string axis, bool invert) { this.axis = axis; this.invert = invert; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public InputSource source = InputSource.Keyboard;
|
public InputSource source = InputSource.Keyboard;
|
||||||
|
|
||||||
// Defaults follow the old HandleHoystick: axes 4/6/5 were the walk stick
|
[Header("Real remote (USB nRF24 dongle)")]
|
||||||
// (b2/b1/b3), 2/1/3 the rotation stick (a1/a2/a3), with 1 and 2 inverted.
|
[Tooltip("\"auto\" finds the dongle's CH340 port; or e.g. COM7.")]
|
||||||
// Which of 4/6 is forward vs sideways wasn't recoverable from the old code:
|
public string donglePort = "auto";
|
||||||
// check the raw axis readout in the test panel and fix here.
|
|
||||||
[Header("Joystick axes (Input Manager names)")]
|
|
||||||
[Tooltip("Stick convention after invert: X + = right, Y + = forward, twist + = counterclockwise.")]
|
|
||||||
public AxisBinding leftX = new AxisBinding("4", false);
|
|
||||||
public AxisBinding leftY = new AxisBinding("6", false);
|
|
||||||
public AxisBinding leftTwist = new AxisBinding("5", false);
|
|
||||||
public AxisBinding rightX = new AxisBinding("2", true);
|
|
||||||
public AxisBinding rightY = new AxisBinding("1", true);
|
|
||||||
public AxisBinding rightTwist = new AxisBinding("3", false);
|
|
||||||
[Range(0, 0.5f)] public float deadzone = 0.08f;
|
|
||||||
|
|
||||||
[Header("Operator state (same toggles as the Nextion screen)")]
|
[Header("Operator state (same toggles as the Nextion screen)")]
|
||||||
public bool armed;
|
public bool armed;
|
||||||
@@ -66,49 +47,61 @@ namespace HexapodSim
|
|||||||
public float armCenterTolerance = 0.05f; // ARM_CENTER_TOLERANCE / 1000
|
public float armCenterTolerance = 0.05f; // ARM_CENTER_TOLERANCE / 1000
|
||||||
public float keyStickRatePerSec = 4f; // how fast a held key moves the virtual stick
|
public float keyStickRatePerSec = 4f; // how fast a held key moves the virtual stick
|
||||||
|
|
||||||
// Latest processed sticks, -1..1: [L_X, L_Y, L_TWIST, R_X, R_Y, R_TWIST].
|
// Latest processed sticks, -1..1: [L_X, L_Y, L_TWIST, R_X, R_Y, R_TWIST] (keyboard).
|
||||||
public readonly float[] sticks = new float[6];
|
public readonly float[] sticks = new float[6];
|
||||||
public readonly float[] rawAxes = new float[6]; // Input axes "1".."6" as read
|
|
||||||
public CmdPacket LastPacket { get; private set; }
|
public CmdPacket LastPacket { get; private set; }
|
||||||
public string Message { get; private set; } = "";
|
public string Message { get; private set; } = "";
|
||||||
public bool JoystickAxesMissing { get; private set; }
|
|
||||||
|
// Real remote, for the panel.
|
||||||
|
public DongleLink Dongle { get; private set; }
|
||||||
|
public int RemotePacketsPerSec { get; private set; }
|
||||||
|
public int LastPacketLength { get; private set; }
|
||||||
|
public float SecondsSinceRemotePacket => Time.time - lastRemotePacket_;
|
||||||
|
|
||||||
float speedCurrent_ = 128;
|
float speedCurrent_ = 128;
|
||||||
float lastWalkInputTime_ = -999f;
|
float lastWalkInputTime_ = -999f;
|
||||||
byte seq_;
|
byte seq_;
|
||||||
string serialKeys_ = "";
|
|
||||||
float messageUntil_;
|
float messageUntil_;
|
||||||
|
float lastRemotePacket_ = -999f;
|
||||||
|
int packetsThisSecond_;
|
||||||
|
float secondStart_;
|
||||||
|
readonly byte[] ack_ = new byte[32];
|
||||||
|
|
||||||
public void ResetState()
|
public void ResetState()
|
||||||
{
|
{
|
||||||
armed = stand = false;
|
armed = stand = false;
|
||||||
speedCurrent_ = speedTarget;
|
speedCurrent_ = speedTarget;
|
||||||
lastWalkInputTime_ = -999f;
|
lastWalkInputTime_ = -999f;
|
||||||
serialKeys_ = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
void Awake()
|
|
||||||
{
|
|
||||||
if (Input.GetJoystickNames().Length > 0 && !string.IsNullOrEmpty(Input.GetJoystickNames()[0]))
|
|
||||||
source = InputSource.Joystick;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 6; i++) rawAxes[i] = ReadAxis((i + 1).ToString());
|
// Open the dongle while the real remote is selected, release it otherwise.
|
||||||
|
if (source == InputSource.RealRemote && Dongle == null) ConnectDongle();
|
||||||
|
else if (source != InputSource.RealRemote && Dongle != null) DisconnectDongle();
|
||||||
|
|
||||||
if (source == InputSource.RobotSerialHarness)
|
if (source == InputSource.Keyboard)
|
||||||
{
|
{
|
||||||
serialKeys_ += Input.inputString; // raw keystrokes for the firmware's harness
|
HandleToggleKeys();
|
||||||
return;
|
ReadKeyboardSticks(Time.deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
HandleToggleKeys();
|
|
||||||
if (source == InputSource.Joystick) ReadJoystick();
|
|
||||||
else ReadKeyboardSticks(Time.deltaTime);
|
|
||||||
if (Time.time > messageUntil_) Message = "";
|
if (Time.time > messageUntil_) Message = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OnDisable() => DisconnectDongle();
|
||||||
|
|
||||||
|
public void ConnectDongle()
|
||||||
|
{
|
||||||
|
DisconnectDongle();
|
||||||
|
Dongle = DongleLink.Open(donglePort);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DisconnectDongle()
|
||||||
|
{
|
||||||
|
Dongle?.Dispose();
|
||||||
|
Dongle = null;
|
||||||
|
}
|
||||||
|
|
||||||
// ---- Operator commands (also called by SimTestPanel buttons) ----
|
// ---- Operator commands (also called by SimTestPanel buttons) ----
|
||||||
|
|
||||||
public void ToggleArm()
|
public void ToggleArm()
|
||||||
@@ -144,32 +137,6 @@ namespace HexapodSim
|
|||||||
if (Input.GetKeyDown(KeyCode.PageDown)) height = Mathf.Max(-1000, height - 100);
|
if (Input.GetKeyDown(KeyCode.PageDown)) height = Mathf.Max(-1000, height - 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Sticks ----
|
|
||||||
|
|
||||||
float ReadAxis(string name)
|
|
||||||
{
|
|
||||||
try { return Input.GetAxis(name); }
|
|
||||||
catch (ArgumentException) { JoystickAxesMissing = true; return 0; } // axis not defined in Input Manager
|
|
||||||
}
|
|
||||||
|
|
||||||
float Read(AxisBinding b)
|
|
||||||
{
|
|
||||||
float v = ReadAxis(b.axis) * (b.invert ? -1 : 1);
|
|
||||||
float mag = Mathf.Abs(v);
|
|
||||||
if (mag <= deadzone) return 0;
|
|
||||||
return Mathf.Sign(v) * Mathf.Clamp01((mag - deadzone) / (1 - deadzone));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReadJoystick()
|
|
||||||
{
|
|
||||||
sticks[0] = Read(leftX);
|
|
||||||
sticks[1] = Read(leftY);
|
|
||||||
sticks[2] = Read(leftTwist);
|
|
||||||
sticks[3] = Read(rightX);
|
|
||||||
sticks[4] = Read(rightY);
|
|
||||||
sticks[5] = Read(rightTwist);
|
|
||||||
}
|
|
||||||
|
|
||||||
// WASD + Q/E = left stick (walk, turn), IJKL + U/O = right stick.
|
// WASD + Q/E = left stick (walk, turn), IJKL + U/O = right stick.
|
||||||
void ReadKeyboardSticks(float dt)
|
void ReadKeyboardSticks(float dt)
|
||||||
{
|
{
|
||||||
@@ -187,17 +154,36 @@ namespace HexapodSim
|
|||||||
// Called by HexapodSimulation once per remote TX period.
|
// Called by HexapodSimulation once per remote TX period.
|
||||||
public void Transmit(HexapodSimNative native, float dt)
|
public void Transmit(HexapodSimNative native, float dt)
|
||||||
{
|
{
|
||||||
if (source == InputSource.RobotSerialHarness)
|
if (source == InputSource.RealRemote) { ForwardRealRemote(native); return; }
|
||||||
{
|
|
||||||
native.SerialInput(serialKeys_); // no radio: the firmware's harness injects its own packets
|
|
||||||
serialKeys_ = "";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
speedCurrent_ = Mathf.MoveTowards(speedCurrent_, speedTarget, speedRatePerSec * dt);
|
speedCurrent_ = Mathf.MoveTowards(speedCurrent_, speedTarget, speedRatePerSec * dt);
|
||||||
LastPacket = BuildPacket();
|
LastPacket = BuildPacket();
|
||||||
native.RadioSend(LastPacket);
|
native.RadioSend(LastPacket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Everything the dongle heard since last time goes into the firmware in
|
||||||
|
// order, and each packet's ack carries the telemetry the robot loaded in
|
||||||
|
// reply - the same exchange as on the real robot (robot/Comms.cpp).
|
||||||
|
void ForwardRealRemote(HexapodSimNative native)
|
||||||
|
{
|
||||||
|
if (Time.time - secondStart_ >= 1f)
|
||||||
|
{
|
||||||
|
RemotePacketsPerSec = packetsThisSecond_;
|
||||||
|
packetsThisSecond_ = 0;
|
||||||
|
secondStart_ = Time.time;
|
||||||
|
}
|
||||||
|
if (Dongle == null || !Dongle.IsOpen) return;
|
||||||
|
while (Dongle.TryTakePacket(out byte[] pkt))
|
||||||
|
{
|
||||||
|
native.RadioSend(pkt);
|
||||||
|
int n = native.GetAckPayload(ack_);
|
||||||
|
if (n > 0) Dongle.SendAckPayload(ack_, n);
|
||||||
|
LastPacketLength = pkt.Length;
|
||||||
|
if (HexapodSimNative.TryDecode(pkt, out var p)) LastPacket = p;
|
||||||
|
lastRemotePacket_ = Time.time;
|
||||||
|
packetsThisSecond_++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static short Wire(float v) => (short)Mathf.RoundToInt(Mathf.Clamp(v, -1f, 1f) * 1000f);
|
static short Wire(float v) => (short)Mathf.RoundToInt(Mathf.Clamp(v, -1f, 1f) * 1000f);
|
||||||
|
|
||||||
// Same mapping as remote/PacketBuilder.cpp.
|
// Same mapping as remote/PacketBuilder.cpp.
|
||||||
@@ -208,6 +194,7 @@ namespace HexapodSim
|
|||||||
seq = seq_++,
|
seq = seq_++,
|
||||||
speed_scale = (byte)Mathf.RoundToInt(speedCurrent_),
|
speed_scale = (byte)Mathf.RoundToInt(speedCurrent_),
|
||||||
body_height = (short)Mathf.Clamp(height, -1000, 1000), // a setting: sent even while disarmed
|
body_height = (short)Mathf.Clamp(height, -1000, 1000), // a setting: sent even while disarmed
|
||||||
|
cal_servo = 0xFF, // CAL_NO_SERVO: never calibrates
|
||||||
};
|
};
|
||||||
byte f = 0;
|
byte f = 0;
|
||||||
if (armed) f |= CmdPacket.FLAG_ARMED;
|
if (armed) f |= CmdPacket.FLAG_ARMED;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace HexapodSim
|
|||||||
Vector2 scroll_;
|
Vector2 scroll_;
|
||||||
GUIStyle mono_;
|
GUIStyle mono_;
|
||||||
|
|
||||||
static readonly string[] SourceNames = { "Joystick", "Keyboard", "Robot serial" };
|
static readonly string[] SourceNames = { "Keyboard", "Real remote (radio)" };
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
@@ -35,8 +35,10 @@ namespace HexapodSim
|
|||||||
if (mono_ == null)
|
if (mono_ == null)
|
||||||
mono_ = new GUIStyle(GUI.skin.label) { font = Font.CreateDynamicFontFromOSFont("Consolas", 12), fontSize = 12, wordWrap = false };
|
mono_ = new GUIStyle(GUI.skin.label) { font = Font.CreateDynamicFontFromOSFont("Consolas", 12), fontSize = 12, wordWrap = false };
|
||||||
|
|
||||||
GUILayout.BeginArea(new Rect(10, 10, 390, Screen.height - 20), GUI.skin.box);
|
GUILayout.BeginArea(new Rect(10, 10, 420, Screen.height - 20), GUI.skin.box);
|
||||||
scroll_ = GUILayout.BeginScrollView(scroll_);
|
// Vertical scrolling only: the monospace lines run a little past the
|
||||||
|
// width, and a sideways bar for that is just noise.
|
||||||
|
scroll_ = GUILayout.BeginScrollView(scroll_, false, false, GUIStyle.none, GUI.skin.verticalScrollbar);
|
||||||
|
|
||||||
GUILayout.Label("<b>Hexapod firmware simulation</b> (F1 hides)", new GUIStyle(GUI.skin.label) { richText = true });
|
GUILayout.Label("<b>Hexapod firmware simulation</b> (F1 hides)", new GUIStyle(GUI.skin.label) { richText = true });
|
||||||
if (sim_.LoadError != null)
|
if (sim_.LoadError != null)
|
||||||
@@ -65,18 +67,13 @@ namespace HexapodSim
|
|||||||
// ---- Input source ----
|
// ---- Input source ----
|
||||||
GUILayout.Space(6);
|
GUILayout.Space(6);
|
||||||
remote_.source = (SimRemote.InputSource)GUILayout.Toolbar((int)remote_.source, SourceNames);
|
remote_.source = (SimRemote.InputSource)GUILayout.Toolbar((int)remote_.source, SourceNames);
|
||||||
if (remote_.source == SimRemote.InputSource.RobotSerialHarness)
|
if (remote_.source == SimRemote.InputSource.RealRemote)
|
||||||
{
|
{
|
||||||
GUILayout.Label("Keys go to robot.ino's TEST_SERIAL_INPUT harness (no radio):\n" +
|
DongleSection();
|
||||||
"a arm s sit/stand w/x fwd/back q/e strafe L/R\n" +
|
|
||||||
"z/c yaw g gait m mode space stop", mono_);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (remote_.source == SimRemote.InputSource.Keyboard)
|
GUILayout.Label("WASD walk Q/E turn IJKL + U/O right stick\n1 arm 2 stand 3 gait 4 mode 5 R-stick 6/7 gyros\nBackspace disarm +/- speed PgUp/PgDn height", mono_);
|
||||||
GUILayout.Label("WASD walk Q/E turn IJKL + U/O right stick\n1 arm 2 stand 3 gait 4 mode 5 R-stick 6/7 gyros\nBackspace disarm +/- speed PgUp/PgDn height", mono_);
|
|
||||||
if (remote_.source == SimRemote.InputSource.Joystick && remote_.JoystickAxesMissing)
|
|
||||||
GUILayout.Label("Input axes \"1\"..\"6\" are missing from the Input Manager.");
|
|
||||||
|
|
||||||
// ---- Toggles: same set as the remote's touchscreen ----
|
// ---- Toggles: same set as the remote's touchscreen ----
|
||||||
GUILayout.BeginHorizontal();
|
GUILayout.BeginHorizontal();
|
||||||
@@ -116,11 +113,10 @@ namespace HexapodSim
|
|||||||
// ---- Live values ----
|
// ---- Live values ----
|
||||||
GUILayout.Space(6);
|
GUILayout.Space(6);
|
||||||
var st = remote_.sticks;
|
var st = remote_.sticks;
|
||||||
var raw = remote_.rawAxes;
|
|
||||||
var p = remote_.LastPacket;
|
var p = remote_.LastPacket;
|
||||||
GUILayout.Label(
|
GUILayout.Label(
|
||||||
$"sticks L {st[0],5:F2} {st[1],5:F2} {st[2],5:F2} R {st[3],5:F2} {st[4],5:F2} {st[5],5:F2}\n" +
|
(remote_.source == SimRemote.InputSource.Keyboard
|
||||||
$"axes 1-6 {raw[0],5:F2} {raw[1],5:F2} {raw[2],5:F2} {raw[3],5:F2} {raw[4],5:F2} {raw[5],5:F2}\n" +
|
? $"sticks L {st[0],5:F2} {st[1],5:F2} {st[2],5:F2} R {st[3],5:F2} {st[4],5:F2} {st[5],5:F2}\n" : "") +
|
||||||
$"packet #{p.seq,3} vx {p.vx,5} vy {p.vy,5} yaw {p.yaw_rate,5}\n" +
|
$"packet #{p.seq,3} vx {p.vx,5} vy {p.vy,5} yaw {p.yaw_rate,5}\n" +
|
||||||
$" r {p.rx,5} {p.ry,5} {p.rz,5} tilt {p.remote_roll,5} {p.remote_pitch,5}\n" +
|
$" r {p.rx,5} {p.ry,5} {p.rz,5} tilt {p.remote_roll,5} {p.remote_pitch,5}\n" +
|
||||||
$" height {p.body_height,5} speed {p.speed_scale,3} flags {System.Convert.ToString(p.flags, 2).PadLeft(8, '0')}",
|
$" height {p.body_height,5} speed {p.speed_scale,3} flags {System.Convert.ToString(p.flags, 2).PadLeft(8, '0')}",
|
||||||
@@ -136,6 +132,36 @@ namespace HexapodSim
|
|||||||
GUILayout.EndArea();
|
GUILayout.EndArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The real remote drives the simulation over the air through the USB dongle;
|
||||||
|
// every control is on the remote itself, so this only shows the link.
|
||||||
|
void DongleSection()
|
||||||
|
{
|
||||||
|
var d = remote_.Dongle;
|
||||||
|
var rich = new GUIStyle(GUI.skin.label) { richText = true, wordWrap = true };
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label("dongle port", GUILayout.Width(80));
|
||||||
|
remote_.donglePort = GUILayout.TextField(remote_.donglePort, GUILayout.Width(70));
|
||||||
|
if (GUILayout.Button("Reconnect")) remote_.ConnectDongle();
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
if (d == null) { GUILayout.Label("connecting..."); return; }
|
||||||
|
if (!d.IsOpen || d.Error != null)
|
||||||
|
{
|
||||||
|
GUILayout.Label("<color=#ff6060>" + (d.Error ?? "not open") + "</color>", rich);
|
||||||
|
if (!d.IsOpen) return;
|
||||||
|
}
|
||||||
|
float age = remote_.SecondsSinceRemotePacket;
|
||||||
|
string link = age < 0.5f ? "<color=#60ff60>receiving</color>" : "<color=#ffb040>no packets - is the remote on?</color>";
|
||||||
|
GUILayout.Label(
|
||||||
|
$"{d.PortName}: {link}\n" +
|
||||||
|
$"remote {remote_.RemotePacketsPerSec} pkt/s here, dongle {d.DonglePacketsPerSec} pkt/s, acks {d.DongleAcksPerSec}/s" +
|
||||||
|
(remote_.LastPacketLength != 0 && remote_.LastPacketLength != System.Runtime.InteropServices.Marshal.SizeOf<CmdPacket>()
|
||||||
|
? $"\n<color=#ff6060>packets are {remote_.LastPacketLength} bytes: remote and sim built from different protocol versions</color>" : "") +
|
||||||
|
(d.BadFrames > 0 ? $"\n{d.BadFrames} corrupt frames" : ""),
|
||||||
|
rich);
|
||||||
|
GUILayout.Label("Use the remote's sticks and touchscreen. Its display shows this simulated robot.", rich);
|
||||||
|
}
|
||||||
|
|
||||||
static string StanceString(int mask)
|
static string StanceString(int mask)
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder(6);
|
var sb = new StringBuilder(6);
|
||||||
|
|||||||
@@ -1,72 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Assets.JoyStick
|
|
||||||
{
|
|
||||||
class HandleHoystick : MonoBehaviour
|
|
||||||
{
|
|
||||||
public RotationControl bot;
|
|
||||||
public Walk walk;
|
|
||||||
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
float a2 = Remap(Input.GetAxis("1"), 1, -127, -1, 127);
|
|
||||||
float a1 = Remap(Input.GetAxis("2"), 1, -127, -1, 127);
|
|
||||||
float a3 = Remap(Input.GetAxis("3"), -1, -127, 1, 127);
|
|
||||||
|
|
||||||
float b2 = Remap(Input.GetAxis("4"), -1, -127, 1, 127);
|
|
||||||
float b3 = Remap(Input.GetAxis("5"), -1, -127, 1, 127);
|
|
||||||
float b1 = Remap(Input.GetAxis("6"), -1, -127, 1, 127);
|
|
||||||
|
|
||||||
//Debug.Log(Input.GetAxis("4"));
|
|
||||||
//Debug.Log(Remap(Input.GetAxis("4"), -1, -127, 1, 127));
|
|
||||||
|
|
||||||
bot.rotation = new Quaternion(limit(a2, -20, 20), -1 * limit(a3, -20, 20), -1 * limit(a1, -20, 20),
|
|
||||||
1);
|
|
||||||
|
|
||||||
float speed = (float)(Math.Sqrt(b1 * b1 + b2 * b2) / 127) * 3;
|
|
||||||
walk.walkspeed = speed < 0.5f ? 0 : speed;
|
|
||||||
|
|
||||||
float rotation = -1 * limit(b3 / 4, -5, 5);
|
|
||||||
walk.centerRotation = rotation < 0.5f && rotation > -0.5f ? 0 : rotation;
|
|
||||||
|
|
||||||
walk.walkDirection = (-1 * ConvertRadiansToDegrees((float)Math.Atan2(b2, b1)));
|
|
||||||
|
|
||||||
float rotationabs = Math.Abs(walk.centerRotation);
|
|
||||||
float speed2 = ((6 / 3) * walk.walkspeed) + ((6 / 5) * rotationabs);
|
|
||||||
speed2 = speed2 < 6 ? speed2 : 6;
|
|
||||||
walk.speed2 = (int)(10 - speed2);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float limit(float input, float min, float max)
|
|
||||||
{
|
|
||||||
input = input / 6;
|
|
||||||
return (input < max & input > min) ? input : input < min ? min : max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float ConvertRadiansToDegrees(float radians)
|
|
||||||
{
|
|
||||||
float degrees = (float)((180 / Math.PI) * radians);
|
|
||||||
return (degrees);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float Remap(float from, float fromMin, float toMin, float fromMax, float toMax)
|
|
||||||
{
|
|
||||||
var fromAbs = from - fromMin;
|
|
||||||
var fromMaxAbs = fromMax - fromMin;
|
|
||||||
|
|
||||||
var normal = fromAbs / fromMaxAbs;
|
|
||||||
|
|
||||||
var toMaxAbs = toMax - toMin;
|
|
||||||
var toAbs = toMaxAbs * normal;
|
|
||||||
|
|
||||||
var to = toAbs + toMin;
|
|
||||||
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c5ce8a2605d301e44a4a210aa345ed62
|
|
||||||
timeCreated: 1641405303
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -79,11 +79,8 @@ public class Leg : MonoBehaviour {
|
|||||||
// (int)Remap((float)a1, -90, 90, 2500, 500),
|
// (int)Remap((float)a1, -90, 90, 2500, 500),
|
||||||
// (int)Remap((float)a2, -90, 90, 2500, 500), // 0 is middel
|
// (int)Remap((float)a2, -90, 90, 2500, 500), // 0 is middel
|
||||||
// (int)Remap((float)a3, 90, -90, 2500, 500)); // 0 is middel
|
// (int)Remap((float)a3, 90, -90, 2500, 500)); // 0 is middel
|
||||||
if(false)
|
// (servo angles used to go out over USB serial here; dropped 2026-11-17,
|
||||||
Serial.Instance.send(startServo,
|
// the 2026 robot runs its own firmware and takes commands over the radio)
|
||||||
(int)Remap((float)a1, -90, 90, 0, 180),
|
|
||||||
(int)Remap((float)a2, 90, -90, 0, 180), // 0 is middel
|
|
||||||
(int)Remap((float)a3, -90, 90, 0, 180)); // 0 is middel
|
|
||||||
}
|
}
|
||||||
else if (invertForLeftLeg && startServo != -1)
|
else if (invertForLeftLeg && startServo != -1)
|
||||||
{
|
{
|
||||||
@@ -95,11 +92,6 @@ public class Leg : MonoBehaviour {
|
|||||||
// (int)Remap((float)a1, -90, 90, 500, 2500),
|
// (int)Remap((float)a1, -90, 90, 500, 2500),
|
||||||
// (int)Remap((float)a2, -90, 90, 500, 2500), // 0 is middel
|
// (int)Remap((float)a2, -90, 90, 500, 2500), // 0 is middel
|
||||||
// (int)Remap((float)a3, 90, -90, 500, 2500)); // 0 is middel
|
// (int)Remap((float)a3, 90, -90, 500, 2500)); // 0 is middel
|
||||||
if (false)
|
|
||||||
Serial.Instance.send(startServo,
|
|
||||||
(int)Remap((float)a1, 90, -90, 0, 180),
|
|
||||||
(int)Remap((float)a2, -90, 90, 0, 180), // 0 is middel
|
|
||||||
(int)Remap((float)a3, 90, -90, 0, 180)); // 0 is middel
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Hip1.transform.localRotation = Quaternion.Euler(0, (float)a1, 0);
|
Hip1.transform.localRotation = Quaternion.Euler(0, (float)a1, 0);
|
||||||
|
|||||||
@@ -12875,7 +12875,6 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 73925799}
|
- component: {fileID: 73925799}
|
||||||
- component: {fileID: 73925800}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: SerialIn
|
m_Name: SerialIn
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -12898,28 +12897,6 @@ Transform:
|
|||||||
m_Children: []
|
m_Children: []
|
||||||
m_Father: {fileID: 0}
|
m_Father: {fileID: 0}
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!114 &73925800
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 73925798}
|
|
||||||
m_Enabled: 0
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: 7fa025fa8dcb3a249b67fc0e2fe67b44, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
bot: {fileID: 311513962}
|
|
||||||
walk: {fileID: 311513965}
|
|
||||||
a1: 0
|
|
||||||
a2: 0
|
|
||||||
a3: 0
|
|
||||||
b1: 0
|
|
||||||
b2: 0
|
|
||||||
b3: 0
|
|
||||||
enabled: 0
|
|
||||||
enabled_send: 0
|
|
||||||
--- !u!1 &74230589
|
--- !u!1 &74230589
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -325049,7 +325026,6 @@ GameObject:
|
|||||||
serializedVersion: 6
|
serializedVersion: 6
|
||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1645933599}
|
- component: {fileID: 1645933599}
|
||||||
- component: {fileID: 1645933598}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: Input
|
m_Name: Input
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -325057,20 +325033,6 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!114 &1645933598
|
|
||||||
MonoBehaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_CorrespondingSourceObject: {fileID: 0}
|
|
||||||
m_PrefabInstance: {fileID: 0}
|
|
||||||
m_PrefabAsset: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1645933597}
|
|
||||||
m_Enabled: 1
|
|
||||||
m_EditorHideFlags: 0
|
|
||||||
m_Script: {fileID: 11500000, guid: c5ce8a2605d301e44a4a210aa345ed62, type: 3}
|
|
||||||
m_Name:
|
|
||||||
m_EditorClassIdentifier:
|
|
||||||
bot: {fileID: 311513962}
|
|
||||||
walk: {fileID: 311513965}
|
|
||||||
--- !u!4 &1645933599
|
--- !u!4 &1645933599
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -1,119 +0,0 @@
|
|||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
using System.Collections;
|
|
||||||
using System.IO.Ports;
|
|
||||||
using Random = System.Random;
|
|
||||||
|
|
||||||
public class Serial
|
|
||||||
{
|
|
||||||
private static Serial instance;
|
|
||||||
private int rnd = 0;
|
|
||||||
|
|
||||||
private Serial()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
~Serial()
|
|
||||||
{
|
|
||||||
serialPort.Close();
|
|
||||||
serialPort.Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Serial Instance
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (instance == null)
|
|
||||||
{
|
|
||||||
instance = new Serial();
|
|
||||||
}
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool enabled = false;
|
|
||||||
|
|
||||||
public SerialPort serialPort;
|
|
||||||
|
|
||||||
public int[] values = new int[18];
|
|
||||||
|
|
||||||
public static string ByteArrayToString(byte[] ba)
|
|
||||||
{
|
|
||||||
return BitConverter.ToString(ba).Replace("-", " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void send(int start, int a, int b, int c)
|
|
||||||
{
|
|
||||||
if (serialPort == null)
|
|
||||||
{
|
|
||||||
serialPort = new SerialPort(@"\\.\" + "COM4", 250000);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
serialPort.Parity = Parity.Even;
|
|
||||||
serialPort.StopBits = StopBits.One;
|
|
||||||
serialPort.DataBits = 8;
|
|
||||||
serialPort.Open();
|
|
||||||
serialPort.DiscardOutBuffer();
|
|
||||||
serialPort.DiscardInBuffer();
|
|
||||||
System.Threading.Thread.Sleep(1000);
|
|
||||||
|
|
||||||
enabled = true;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
values[start] = a;
|
|
||||||
values[++start] = b;
|
|
||||||
values[++start] = c;
|
|
||||||
|
|
||||||
if (serialPort is SerialPort && start == 17)
|
|
||||||
{
|
|
||||||
// string send = "s";
|
|
||||||
byte[] send = new byte[18+1+2];
|
|
||||||
send[18] = 0x00;
|
|
||||||
send[19] = 0xfe;
|
|
||||||
send[20] = 0xff;
|
|
||||||
// send[21] = 0xff;
|
|
||||||
|
|
||||||
// if (rnd == 0)
|
|
||||||
// {
|
|
||||||
//rnd = 1;
|
|
||||||
for (int i = 0; i < 18; i++)
|
|
||||||
{
|
|
||||||
//string crc = ((i) * (values[i])) + "";
|
|
||||||
//send = send + (i).ToString() + "_" + (values[i]).ToString() + "," + crc + "=";
|
|
||||||
byte[] intBytes = BitConverter.GetBytes(values[i]);
|
|
||||||
if (BitConverter.IsLittleEndian)
|
|
||||||
Array.Reverse(intBytes);
|
|
||||||
send[i] = intBytes[3];
|
|
||||||
send[18] += send[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Debug.Log(ByteArrayToString(send));
|
|
||||||
serialPort.Write(send, 0, 18+1+2);
|
|
||||||
serialPort.BaseStream.Flush();
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// rnd = 0;
|
|
||||||
// for (int i = 10; i < 18; i++)
|
|
||||||
// {
|
|
||||||
// string crc = ((i + 3) * (values[i])) + "";
|
|
||||||
//
|
|
||||||
// send = send + (i + 2).ToString() + "_" + (values[i]).ToString() + "," + crc + "=";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// Debug.Log(send);
|
|
||||||
// serialPort.Write(send);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: c99b6d9374ff6d3419c7692fdf3c1791
|
|
||||||
timeCreated: 1542057315
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
/*using System;
|
|
||||||
using UnityEngine;
|
|
||||||
using System.Collections;
|
|
||||||
using System.IO.Ports;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
public class Serial2 : MonoBehaviour{
|
|
||||||
|
|
||||||
public float x;
|
|
||||||
public float y;
|
|
||||||
|
|
||||||
public RotationControl bot;
|
|
||||||
|
|
||||||
~Serial2() {
|
|
||||||
serialPort.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool enabled = false;
|
|
||||||
|
|
||||||
SerialPort serialPort;
|
|
||||||
|
|
||||||
public void Update()
|
|
||||||
{
|
|
||||||
if (serialPort == null)
|
|
||||||
{
|
|
||||||
serialPort = new SerialPort(@"\\.\" + "COM7", 115200);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
serialPort.NewLine = "\n";
|
|
||||||
|
|
||||||
serialPort.Open();
|
|
||||||
serialPort.DiscardOutBuffer();
|
|
||||||
serialPort.DiscardInBuffer();
|
|
||||||
|
|
||||||
enabled = true;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
enabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
if (serialPort is SerialPort)
|
|
||||||
{
|
|
||||||
string received = serialPort.ReadLine();
|
|
||||||
string[] data = received.Split(',');
|
|
||||||
x = ConvertRadiansToDegrees(float.Parse(data.First()));
|
|
||||||
y = ConvertRadiansToDegrees(float.Parse(data.Last()));
|
|
||||||
|
|
||||||
bot.rotation = new Quaternion(-1* limit(y, -30, 30), 0, -1* limit(x, -30, 30), 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float limit(float input, float min, float max)
|
|
||||||
{
|
|
||||||
return (input < max & input > min) ? input : input < min ? min : max;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float ConvertRadiansToDegrees(float radians)
|
|
||||||
{
|
|
||||||
float degrees = (float) ((180 / Math.PI) * radians);
|
|
||||||
return (degrees);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: ac6468bb4d2734947a923ea42d6d8192
|
|
||||||
timeCreated: 1557262171
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,170 +0,0 @@
|
|||||||
//using System;
|
|
||||||
//using UnityEngine;
|
|
||||||
//using System.Collections;
|
|
||||||
//using System.IO.Ports;
|
|
||||||
//using System.Linq;
|
|
||||||
//using UnityEngine.UI;
|
|
||||||
|
|
||||||
//public class Serial3 : MonoBehaviour{
|
|
||||||
|
|
||||||
// public RotationControl bot;
|
|
||||||
// public Walk walk;
|
|
||||||
|
|
||||||
// public float a1, a2, a3, b1, b2, b3;
|
|
||||||
|
|
||||||
// // ~Serial3()
|
|
||||||
// // {
|
|
||||||
// // serialPort.Close();
|
|
||||||
// // serialPort.Dispose();
|
|
||||||
// // }
|
|
||||||
|
|
||||||
// public bool enabled = false;
|
|
||||||
// public bool enabled_send = false;
|
|
||||||
|
|
||||||
// SerialPort serialPort;
|
|
||||||
|
|
||||||
// public void Update()
|
|
||||||
// {
|
|
||||||
// if (serialPort == null)
|
|
||||||
// {
|
|
||||||
// serialPort = new SerialPort(@"\\.\" + "COM7", 230400);
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// serialPort.NewLine = "\r\n";
|
|
||||||
|
|
||||||
//// serialPort.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler);
|
|
||||||
|
|
||||||
// serialPort.Open();
|
|
||||||
// serialPort.DiscardOutBuffer();
|
|
||||||
// serialPort.DiscardInBuffer();
|
|
||||||
|
|
||||||
// enabled = true;
|
|
||||||
// }
|
|
||||||
// catch
|
|
||||||
// {
|
|
||||||
// enabled = false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (enabled)
|
|
||||||
// {
|
|
||||||
// serialPort = Serial.Instance.serialPort;
|
|
||||||
// Serial.Instance.enabled = enabled_send;
|
|
||||||
// if (serialPort is SerialPort)
|
|
||||||
// {
|
|
||||||
// string received = serialPort.ReadLine();
|
|
||||||
// string[] data = received.Split(',');
|
|
||||||
|
|
||||||
// foreach (string d in data)
|
|
||||||
// {
|
|
||||||
|
|
||||||
// string[] ch = d.Split('_');
|
|
||||||
|
|
||||||
// int channel = int.Parse(ch.First());
|
|
||||||
// float value = float.Parse(ch.Last());
|
|
||||||
|
|
||||||
// switch (channel)
|
|
||||||
// {
|
|
||||||
// case 0:
|
|
||||||
// a1 = value - 127;
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// a2 = value - 127;
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// a3 = value - 127;
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// b1 = value - 127;
|
|
||||||
// break;
|
|
||||||
// case 4:
|
|
||||||
// b2 = value - 127;
|
|
||||||
// break;
|
|
||||||
// case 5:
|
|
||||||
// b3 = value - 127;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// bot.rotation = new Quaternion(limit(a2, -20, 20), -1 * limit(a3, -20, 20), -1 * limit(a1, -20, 20),
|
|
||||||
// 1);
|
|
||||||
|
|
||||||
// float speed = (float) (Math.Sqrt(b1 * b1 + b2 * b2) / 127) * 3;
|
|
||||||
// walk.walkspeed = speed < 0.5f ? 0 : speed;
|
|
||||||
|
|
||||||
// float rotation = -1 * limit(b3/4, -5, 5);
|
|
||||||
// walk.centerRotation = rotation < 0.5f && rotation > -0.5f ? 0 : rotation;
|
|
||||||
|
|
||||||
// walk.walkDirection = (-1 * ConvertRadiansToDegrees((float) Math.Atan2(b2, b1)));
|
|
||||||
|
|
||||||
// float rotationabs = Math.Abs(walk.centerRotation);
|
|
||||||
// float speed2 = ((6 / 3) * walk.walkspeed) + ((6/5) * rotationabs);
|
|
||||||
// speed2 = speed2 < 6 ? speed2 : 6;
|
|
||||||
// walk.speed2 = (int)(10 - speed2);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// private void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e)
|
|
||||||
// {
|
|
||||||
// SerialPort serialPort = (SerialPort)sender;
|
|
||||||
|
|
||||||
// if (enabled)
|
|
||||||
// {
|
|
||||||
// if (serialPort is SerialPort)
|
|
||||||
// {
|
|
||||||
// string received = serialPort.ReadLine();
|
|
||||||
// string[] data = received.Split(',');
|
|
||||||
|
|
||||||
// foreach (string d in data)
|
|
||||||
// {
|
|
||||||
// // if (data == "\r")
|
|
||||||
// // continue;
|
|
||||||
|
|
||||||
// string[] ch = d.Split('_');
|
|
||||||
|
|
||||||
// int channel = int.Parse(ch.First());
|
|
||||||
// float value = float.Parse(ch.Last());
|
|
||||||
|
|
||||||
// switch (channel)
|
|
||||||
// {
|
|
||||||
// case 0:
|
|
||||||
// a1 = value;
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// a2 = value;
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// a3 = value;
|
|
||||||
// break;
|
|
||||||
// case 3:
|
|
||||||
// b1 = value;
|
|
||||||
// break;
|
|
||||||
// case 4:
|
|
||||||
// b2 = value;
|
|
||||||
// break;
|
|
||||||
// case 5:
|
|
||||||
// b3 = value;
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // bot.rotation = new Quaternion(-1* limit(y, -30, 30), 0, -1* limit(x, -30, 30), 1);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public float limit(float input, float min, float max)
|
|
||||||
// {
|
|
||||||
// input = input / 6;
|
|
||||||
// return (input < max & input > min) ? input : input < min ? min : max;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public float ConvertRadiansToDegrees(float radians)
|
|
||||||
// {
|
|
||||||
// float degrees = (float)((180 / Math.PI) * radians);
|
|
||||||
// return (degrees);
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 7fa025fa8dcb3a249b67fc0e2fe67b44
|
|
||||||
timeCreated: 1558207463
|
|
||||||
licenseType: Free
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
<projectSettings>
|
<projectSettings>
|
||||||
<projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False" />
|
<projectSetting name="Google.VersionHandler.VerboseLoggingEnabled" value="False" />
|
||||||
</projectSettings>
|
</projectSettings>
|
||||||
@@ -1 +1,5 @@
|
|||||||
Hexapod
|
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`.
|
||||||
+82
-7
@@ -1,16 +1,31 @@
|
|||||||
# Hexapod
|
# Hexapod
|
||||||
|
|
||||||
A six-legged walking robot (Teensy 3.6) and its handheld remote
|
A six-legged walking robot (Teensy 3.6) and its handheld remote
|
||||||
(Teensy 4.1 + 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.
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
The remote above is the new design (`hardware/openscad/remote_v2.scad`, not
|
||||||
|
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
|
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
|
servo centre calibration, telemetry
|
||||||
shared/ HexapodProtocol: the CmdPacket wire format + radio settings used by both
|
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
|
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
|
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
|
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
|
This is the `2026-current/` folder of the hexapod-robot repo; the earlier
|
||||||
@@ -37,6 +52,62 @@ From this `2026-current` folder in PowerShell (the dev PC is Windows):
|
|||||||
Then open `Hexapod_Simulation_Unity` and press Play. See
|
Then open `Hexapod_Simulation_Unity` and press Play. See
|
||||||
[sim/README.md](sim/README.md).
|
[sim/README.md](sim/README.md).
|
||||||
|
|
||||||
|
## Printing the remote (v2)
|
||||||
|
|
||||||
|
STLs in [hardware/openscad/stl/remote_v2/](hardware/openscad/stl/remote_v2/),
|
||||||
|
already in print orientation; everything prints in ASA without supports.
|
||||||
|
Regenerate them from `remote_v2.scad` with `-D 'PART="..."'`.
|
||||||
|
|
||||||
|
| File | Part | Notes |
|
||||||
|
|------|------|-------|
|
||||||
|
| `remote_v2_top_inlays.3mf` | top shell with both inlays | One object with three parts on filaments 1/2/3: case black, honeycomb red, ON/OFF white. The inlays are the first 3 layers (0.6 mm) of the face-down shell, so the colour swaps only happen there. Made by `hardware/openscad/export_3mf.py` from the three STLs below |
|
||||||
|
| `remote_v2_top.stl` + `_inlay.stl` + `_text.stl` | the same, as STLs | Load the three at once and keep them as one multi-part object |
|
||||||
|
| `remote_v2_top_multicolor.3mf` | OrcaSlicer project (owner) | all parts on two plates; after re-exporting STLs, update its parts with Orca's "Reload from disk" |
|
||||||
|
| `remote_v2_bottom.stl` | bottom shell | flat underside on the bed |
|
||||||
|
| `remote_v2_kickstand.stl` | table stand | |
|
||||||
|
| `remote_v2_eyelet.stl` | neck-strap eyelet | on the top face (slots to balance it) or on the front edge |
|
||||||
|
| `remote_v2_bail.stl` | body brace | swings down and back to rest against your body |
|
||||||
|
|
||||||
|
Hardware (besides the electronics of the old remote):
|
||||||
|
|
||||||
|
- 14 x M3 heat-set inserts (4.0 mm hole, ~5.7 mm long): 4 shell screws,
|
||||||
|
2 + 2 eyelet (top and front), 2 brace pivots, 4 main-board clamps
|
||||||
|
- M3 x 12 x 4 (shells), M3 x 8 button head x 2 (eyelet), M3 x 16 button
|
||||||
|
head + washer x 2 (brace), M3 x 8 button head + 7 mm washer x 4 (main
|
||||||
|
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)
|
||||||
|
- 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:** 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".
|
||||||
|
|
||||||
## Where to go next
|
## Where to go next
|
||||||
|
|
||||||
- **[robot/README.md](robot/README.md)**: placeholder geometry to measure,
|
- **[robot/README.md](robot/README.md)**: placeholder geometry to measure,
|
||||||
@@ -44,7 +115,11 @@ Then open `Hexapod_Simulation_Unity` and press Play. See
|
|||||||
robot without a remote.
|
robot without a remote.
|
||||||
- **[remote/README.md](remote/README.md)**: wiring, control scheme, stick
|
- **[remote/README.md](remote/README.md)**: wiring, control scheme, stick
|
||||||
calibration, and the remote's serial console.
|
calibration, and the remote's serial console.
|
||||||
- **[remote/NEXTION.md](remote/NEXTION.md)**: how to build the touchscreen
|
- **[remote/NEXTION.md](remote/NEXTION.md)**: the touchscreen HMI (generated
|
||||||
HMI.
|
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)**:
|
- **[shared/HexapodProtocol/HexapodProtocol.h](shared/HexapodProtocol/HexapodProtocol.h)**:
|
||||||
the protocol. Change it only by reflashing both boards.
|
the protocol. Change it only by reflashing both boards.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# build artifacts (regenerate with firmware/build.ps1)
|
||||||
|
build/
|
||||||
@@ -0,0 +1,222 @@
|
|||||||
|
# USB nRF24 dongle
|
||||||
|
|
||||||
|
A cheap "USB NRF24L01+ 2.4G" stick (AliExpress, board marked **USB_24RF
|
||||||
|
Ver 3.1**, Rainsun chip antenna) reflashed with our own firmware so it can be
|
||||||
|
the PC-side radio for the hexapod: same nRF24 air settings as the robot and the
|
||||||
|
remote, talking to Unity over USB serial.
|
||||||
|
|
||||||
|
It shipped with a closed "AT command" bridge firmware. We replaced that with the
|
||||||
|
two-stage firmware in `firmware/`. **The factory firmware could not be backed
|
||||||
|
up** (read-protected, see below), so this is a one-way change — done on the
|
||||||
|
owner's say-so.
|
||||||
|
|
||||||
|
## Hardware (reverse-engineered from the board)
|
||||||
|
|
||||||
|
| Part | Chip | Notes |
|
||||||
|
|------|------|-------|
|
||||||
|
| MCU | **STM32F030F4P6** | Cortex-M0, 16 KB flash, 4 KB RAM, TSSOP-20 |
|
||||||
|
| USB-serial | **CH330N** | shows up as "USB-SERIAL CH340" on Windows (COM port) |
|
||||||
|
| Radio | **Si24R1** | nRF24L01+ clone, driven over SPI; 16 MHz crystal |
|
||||||
|
| PA/LNA | **AT2401C** | 2.4 GHz power amp + low-noise amp (range booster) |
|
||||||
|
| antenna | Rainsun chip antenna | |
|
||||||
|
|
||||||
|
### Pin map (MCU)
|
||||||
|
|
||||||
|
Found by probing the board over SWD and confirmed at runtime by our firmware:
|
||||||
|
|
||||||
|
| Function | STM32 pin |
|
||||||
|
|----------|-----------|
|
||||||
|
| USB serial (USART1) TX / RX | PA9 / PA10 → CH330N |
|
||||||
|
| 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 distinguishable** (see below) |
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
Square pad = hole 1.
|
||||||
|
|
||||||
|
| Hole | Signal |
|
||||||
|
|------|--------|
|
||||||
|
| 1 | BOOT0 |
|
||||||
|
| 2 | 3V3 |
|
||||||
|
| 3 | GND |
|
||||||
|
| 4 | SWDIO (PA13) |
|
||||||
|
| 5 | SWCLK (PA14) |
|
||||||
|
|
||||||
|
The factory firmware repurposed PA13/PA14, so SWD only answered with **BOOT0
|
||||||
|
tied high** (hole 1 → hole 2) at power-up. With our firmware this header is not
|
||||||
|
needed at all — see flashing below.
|
||||||
|
|
||||||
|
### Flash readout protection
|
||||||
|
|
||||||
|
The STM32 was at **RDP level 1**: reads of flash are refused over both SWD and
|
||||||
|
the ROM bootloader, so the factory firmware cannot be dumped. Level 1 (not the
|
||||||
|
permanent level 2) still allows reflashing — unlocking does a mass-erase, which
|
||||||
|
is what wiped the factory firmware. The only way past RDP1 to read it would be
|
||||||
|
the F0 cold-boot stepping exploit (thousands of power cycles); not worth it.
|
||||||
|
|
||||||
|
## Firmware: two stages, so wire-free flashing can never break
|
||||||
|
|
||||||
|
The whole point of the design: **once installed, the dongle is reflashed over
|
||||||
|
USB forever, with no BOOT0 wire and no ST-Link — and no firmware update can take
|
||||||
|
that ability away.**
|
||||||
|
|
||||||
|
```
|
||||||
|
flash (16 KB):
|
||||||
|
0x08000000 +--------------------+ page 0
|
||||||
|
| safeboot (4 KB) | stage 1: permanent recovery bootloader
|
||||||
|
0x08001000 +--------------------+ page 4
|
||||||
|
| app (12 KB) | stage 2: the radio firmware
|
||||||
|
0x08004000 +--------------------+ page 16
|
||||||
|
RAM (4 KB): 0x20000000 = magic word (app -> safeboot signal); .data/.bss from +4
|
||||||
|
```
|
||||||
|
|
||||||
|
- **`safeboot`** (`firmware/safeboot.c`) runs first on every reset. It speaks a
|
||||||
|
tiny, fixed-baud (115200 8N1) flash protocol over USB and can always erase and
|
||||||
|
rewrite the app. It has no dependencies and is flashed once.
|
||||||
|
- **`app`** (`firmware/app.c`) is the actual radio firmware. It is the only part
|
||||||
|
future updates rewrite.
|
||||||
|
- **The app updater only erases pages 4-15 — never safeboot.** So a buggy app
|
||||||
|
can't remove the recovery path.
|
||||||
|
|
||||||
|
Recovery is guaranteed three ways, none needing the wire:
|
||||||
|
1. normal update — the running app resets into safeboot on the `b` command (the
|
||||||
|
CH330N keeps its USB power across an MCU reset, so the COM port doesn't drop);
|
||||||
|
2. a corrupt/missing app — safeboot sees the app's reset vector is invalid and
|
||||||
|
stays in flash mode;
|
||||||
|
3. a booting-but-wedged app — safeboot opens a 1.5 s knock window on every cold
|
||||||
|
boot; the updater spams `S` after a replug to catch it.
|
||||||
|
|
||||||
|
The only thing that could break it is corrupting safeboot itself, which the
|
||||||
|
updater never writes.
|
||||||
|
|
||||||
|
### safeboot flash protocol (115200 8N1)
|
||||||
|
|
||||||
|
Each command replies one byte, `K` = ok / `E` = error, unless noted.
|
||||||
|
|
||||||
|
| Cmd | Bytes | Action |
|
||||||
|
|-----|-------|--------|
|
||||||
|
| `P` | | ping |
|
||||||
|
| `V` | | prints `SBV1` (identify) |
|
||||||
|
| `E` | | erase app region (pages 4-15) |
|
||||||
|
| `W` | addr(LE32) n data[n] | program n bytes (n even, ≤128) |
|
||||||
|
| `R` | addr(LE32) n | read n bytes (returns n bytes, no `K`) |
|
||||||
|
| `G` | | `K`, then boot the app |
|
||||||
|
|
||||||
|
Banners: `SBF` = entered flash mode via the app; `SB1` = cold boot (knock
|
||||||
|
window open); `SBR` = no valid app, staying in flash mode.
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Needs the ARM toolchain PlatformIO ships:
|
||||||
|
|
||||||
|
```
|
||||||
|
C:\Users\you\.platformio\penv\Scripts\pio.exe pkg install -g -p ststm32
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, from `firmware/`:
|
||||||
|
|
||||||
|
```
|
||||||
|
.\build.ps1
|
||||||
|
```
|
||||||
|
|
||||||
|
Produces `build/safeboot.bin`, `build/app.bin`, and `build/dongle_combined.bin`
|
||||||
|
(safeboot padded to 4 KB + app), plus the sizes.
|
||||||
|
|
||||||
|
## Flashing
|
||||||
|
|
||||||
|
### One-time install (the only time the BOOT0 wire is used)
|
||||||
|
|
||||||
|
Puts safeboot + app on a stick that still has the factory (or any) firmware.
|
||||||
|
|
||||||
|
1. Wire **hole 1 → hole 2** (BOOT0 high) and plug the stick into USB.
|
||||||
|
2. `python tools/dongle_flash.py firmware/build/dongle_combined.bin`
|
||||||
|
- unlocks (mass-erase, the step that wipes the factory firmware),
|
||||||
|
- writes and verifies the combined image,
|
||||||
|
- starts it.
|
||||||
|
3. Remove the wire. Never needed again.
|
||||||
|
|
||||||
|
`dongle_flash.py` drives the STM32 **ROM** UART bootloader (one-shot auto-baud
|
||||||
|
per power-up, so power-cycle between attempts).
|
||||||
|
|
||||||
|
### App updates (normal, wire-free, forever after)
|
||||||
|
|
||||||
|
```
|
||||||
|
python tools/safeboot_flash.py firmware/build/app.bin
|
||||||
|
```
|
||||||
|
|
||||||
|
This resets the running app into safeboot and rewrites only the app region. If
|
||||||
|
the app is dead or doesn't answer, start it with `--knock` and then replug the
|
||||||
|
stick: it keeps knocking (reopening the port as it comes back) until it lands in
|
||||||
|
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, 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
|
||||||
|
- [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
|
||||||
|
- [ ] AT2401C pins: at desk range and even a few rooms away with the remote at
|
||||||
|
minimum power, every on/off combination of PA1/PB1/PF0/PF1 received
|
||||||
|
every packet, so they couldn't be told apart; the link works without
|
||||||
|
driving them
|
||||||
|
|
||||||
|
## Bridge mode (Unity ↔ real remote)
|
||||||
|
|
||||||
|
The app listens on the hexapod's air settings as if it were the robot
|
||||||
|
(ch 96, 250 kbps, `HXPD1`, auto-ack, dynamic payload lengths, ack payloads)
|
||||||
|
and passes everything to the PC. Framing both ways over the USB serial
|
||||||
|
(115200 8N1):
|
||||||
|
|
||||||
|
```
|
||||||
|
A5 type len payload[len] sum sum = type + len + payload bytes (mod 256)
|
||||||
|
```
|
||||||
|
|
||||||
|
| Direction | Type | Payload |
|
||||||
|
|-----------|------|---------|
|
||||||
|
| PC → dongle | `L` | — : start bridging (LED on) |
|
||||||
|
| PC → dongle | `X` | — : stop |
|
||||||
|
| PC → dongle | `A` | ≤ 32 bytes: the robot's `Telemetry`, sent back on the auto-ack of the remote's next packet (reloaded after every packet, like `robot/Comms.cpp`). Dropped if not refreshed for ~0.5 s, so the remote never shows stale telemetry as live |
|
||||||
|
| dongle → PC | `R` | a packet the remote sent (its `CmdPacket`, any length; the firmware checks it) |
|
||||||
|
| dongle → PC | `S` | once a "second": packets received (u16 LE), ack payloads loaded (u16 LE). Its second runs ~30% long (blocking UART sends miss SysTick ticks); it's only for display |
|
||||||
|
|
||||||
|
Plain text never contains `A5`, so the PC skips anything between frames;
|
||||||
|
while bridging the app prints no text and only takes frames (and `b` for a
|
||||||
|
reflash). USB serial input goes through DMA into a ring buffer (no
|
||||||
|
interrupts in this app), and the USART's overrun stall is disabled, so a
|
||||||
|
burst can't deafen it. Unity's side is
|
||||||
|
`Hexapod_Simulation_Unity/Assets/HexapodSim/DongleLink.cs`.
|
||||||
@@ -0,0 +1,356 @@
|
|||||||
|
/* Hexapod dongle - stage 2 "app" (bring-up / radio firmware).
|
||||||
|
*
|
||||||
|
* Links at 0x08001000 (after safeboot). Uses polling only (no interrupts), so
|
||||||
|
* no Cortex-M0 vector relocation is needed - safeboot jumps straight to it.
|
||||||
|
*
|
||||||
|
* This v0 brings up the hardware and helps map the last unknown pins:
|
||||||
|
* - USART1 PA9/PA10 115200 8N1 (USB serial via CH330N)
|
||||||
|
* - SPI1 PA5/6/7, nRF24 CSN PA3 CE PA4 IRQ PA2
|
||||||
|
* - free pins PA0 PA1 PB1 PF0 PF1 (LED + AT2401C control, still to identify)
|
||||||
|
* Serial commands: v=info r=nRF regs 0-4=toggle a free pin b=reflash (safeboot)
|
||||||
|
*/
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#define CSN_HI() BSRR(GPIOA) = (1u << 3)
|
||||||
|
#define CSN_LO() BSRR(GPIOA) = (1u << (3 + 16))
|
||||||
|
#define CE_HI() BSRR(GPIOA) = (1u << 4)
|
||||||
|
#define CE_LO() BSRR(GPIOA) = (1u << (4 + 16))
|
||||||
|
|
||||||
|
static void spi_init(void)
|
||||||
|
{
|
||||||
|
RCC_AHBENR |= (1u << 17); /* GPIOA */
|
||||||
|
RCC_APB2ENR |= (1u << 12); /* SPI1 */
|
||||||
|
MODER(GPIOA) = (MODER(GPIOA) & ~((3u << 10) | (3u << 12) | (3u << 14)))
|
||||||
|
| (2u << 10) | (2u << 12) | (2u << 14); /* PA5/6/7 AF0 */
|
||||||
|
MODER(GPIOA) = (MODER(GPIOA) & ~((3u << 6) | (3u << 8)))
|
||||||
|
| (1u << 6) | (1u << 8); /* PA3/PA4 out */
|
||||||
|
MODER(GPIOA) &= ~(3u << 4); /* PA2 in */
|
||||||
|
PUPDR(GPIOA) = (PUPDR(GPIOA) & ~(3u << 4)) | (1u << 4); /* PA2 pull-up */
|
||||||
|
CSN_HI(); CE_LO();
|
||||||
|
REG(0x40013000) = (1u << 2) | (1u << 9) | (1u << 8) | (2u << 3); /* CR1 */
|
||||||
|
REG(0x40013004) = (7u << 8) | (1u << 12); /* CR2 8-bit */
|
||||||
|
REG(0x40013000) |= (1u << 6); /* SPE */
|
||||||
|
}
|
||||||
|
static uint8_t spi_xfer(uint8_t b)
|
||||||
|
{
|
||||||
|
REG8(0x4001300C) = b;
|
||||||
|
while (!(REG(0x40013008) & (1u << 0))) {}
|
||||||
|
return REG8(0x4001300C);
|
||||||
|
}
|
||||||
|
static uint8_t nrf_read(uint8_t reg)
|
||||||
|
{
|
||||||
|
CSN_LO(); spi_xfer(reg & 0x1F); uint8_t v = spi_xfer(0xFF); CSN_HI();
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
static void nrf_write(uint8_t reg, uint8_t val)
|
||||||
|
{
|
||||||
|
CSN_LO(); spi_xfer(0x20 | (reg & 0x1F)); spi_xfer(val); CSN_HI();
|
||||||
|
}
|
||||||
|
static void nrf_write_buf(uint8_t reg, const uint8_t *d, int n)
|
||||||
|
{
|
||||||
|
CSN_LO(); spi_xfer(0x20 | (reg & 0x1F)); while (n--) spi_xfer(*d++); CSN_HI();
|
||||||
|
}
|
||||||
|
static void nrf_cmd(uint8_t c) { CSN_LO(); spi_xfer(c); CSN_HI(); }
|
||||||
|
|
||||||
|
/* Receive on the hexapod protocol (ch 96, 250 kbps, addr HXPD1). Protocol v4
|
||||||
|
* uses dynamic payload lengths (the remote's CmdPacket is 26 bytes, with ack
|
||||||
|
* payloads), so this does too and accepts any length. Auto-ack is on, so the
|
||||||
|
* remote's link % also shows whether our acks get back out (TX path). Lets us
|
||||||
|
* find the AT2401C enable pins: packets only arrive when the LNA path is on. */
|
||||||
|
static uint8_t rxmode;
|
||||||
|
static uint16_t rx_count;
|
||||||
|
static uint8_t rx_len;
|
||||||
|
static void rx_setup(void)
|
||||||
|
{
|
||||||
|
static const uint8_t addr[5] = { 0x48, 0x58, 0x50, 0x44, 0x31 }; /* "HXPD1" */
|
||||||
|
CE_LO();
|
||||||
|
nrf_write(0x00, 0x0F); /* CONFIG: PWR_UP, PRIM_RX, EN_CRC, CRCO=16 */
|
||||||
|
nrf_write(0x01, 0x01); /* EN_AA pipe0 */
|
||||||
|
nrf_write(0x02, 0x01); /* EN_RXADDR pipe0 */
|
||||||
|
nrf_write(0x03, 0x03); /* SETUP_AW = 5 bytes */
|
||||||
|
nrf_write(0x05, 96); /* RF_CH */
|
||||||
|
nrf_write(0x06, 0x26); /* RF_SETUP: 250 kbps, max power */
|
||||||
|
nrf_write_buf(0x0A, addr, 5); /* RX_ADDR_P0 */
|
||||||
|
nrf_write(0x1D, 0x04); /* FEATURE: EN_DPL */
|
||||||
|
nrf_write(0x1C, 0x01); /* DYNPD: pipe0 */
|
||||||
|
nrf_write(0x07, 0x70); /* clear status flags */
|
||||||
|
nrf_cmd(0xE2); /* FLUSH_RX */
|
||||||
|
rx_count = 0;
|
||||||
|
rx_len = 0;
|
||||||
|
CE_HI();
|
||||||
|
}
|
||||||
|
static void rx_poll(void)
|
||||||
|
{
|
||||||
|
while (nrf_read(0x07) & 0x40) { /* RX_DR */
|
||||||
|
CSN_LO(); spi_xfer(0x60); uint8_t n = spi_xfer(0xFF); CSN_HI(); /* R_RX_PL_WID */
|
||||||
|
if (n > 32) { nrf_cmd(0xE2); nrf_write(0x07, 0x40); break; } /* corrupt: flush */
|
||||||
|
CSN_LO(); spi_xfer(0x61); for (int i = 0; i < n; i++) spi_xfer(0xFF); CSN_HI();
|
||||||
|
nrf_write(0x07, 0x40); /* clear RX_DR */
|
||||||
|
rx_len = n;
|
||||||
|
rx_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct { uint32_t port; uint8_t pin; const char *name; } FREE[] = {
|
||||||
|
{ GPIOA, 0, "PA0" }, { GPIOA, 1, "PA1" }, { GPIOB, 1, "PB1" },
|
||||||
|
{ GPIOF, 0, "PF0" }, { GPIOF, 1, "PF1" },
|
||||||
|
};
|
||||||
|
#define NFREE 5
|
||||||
|
static uint8_t fst[NFREE];
|
||||||
|
static void free_init(void)
|
||||||
|
{
|
||||||
|
RCC_AHBENR |= (1u << 17) | (1u << 18) | (1u << 22);
|
||||||
|
for (int i = 0; i < NFREE; i++) {
|
||||||
|
MODER(FREE[i].port) = (MODER(FREE[i].port) & ~(3u << (FREE[i].pin * 2)))
|
||||||
|
| (1u << (FREE[i].pin * 2));
|
||||||
|
BSRR(FREE[i].port) = (1u << (FREE[i].pin + 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Every usable GPIO on the TSSOP-20 except PA9/PA10 (our serial). Sweep each
|
||||||
|
* HIGH ~3 s so the user can watch the LED. Disturbs the radio; re-init after. */
|
||||||
|
static const struct { uint32_t port; uint8_t pin; const char *name; } ALLPINS[] = {
|
||||||
|
{ GPIOA, 0, "PA0" }, { GPIOA, 1, "PA1" }, { GPIOA, 2, "PA2 IRQ" },
|
||||||
|
{ GPIOA, 3, "PA3 CSN" }, { GPIOA, 4, "PA4 CE" }, { GPIOA, 5, "PA5 SCK" },
|
||||||
|
{ GPIOA, 6, "PA6 MISO" }, { GPIOA, 7, "PA7 MOSI" }, { GPIOB, 1, "PB1" },
|
||||||
|
{ GPIOF, 0, "PF0" }, { GPIOF, 1, "PF1" }, { GPIOA, 13, "PA13 SWDIO" },
|
||||||
|
{ GPIOA, 14, "PA14 SWCLK" },
|
||||||
|
};
|
||||||
|
static void sweep_all(void)
|
||||||
|
{
|
||||||
|
uart_puts("sweeping ALL pins, 3 s each (radio will be disturbed):\r\n");
|
||||||
|
for (unsigned i = 0; i < sizeof(ALLPINS) / sizeof(ALLPINS[0]); i++) {
|
||||||
|
uint32_t p = ALLPINS[i].port; uint8_t n = ALLPINS[i].pin;
|
||||||
|
MODER(p) = (MODER(p) & ~(3u << (n * 2))) | (1u << (n * 2)); /* output */
|
||||||
|
BSRR(p) = (1u << n); /* HIGH */
|
||||||
|
uart_puts(">>> "); uart_puts(ALLPINS[i].name); uart_puts(" HIGH\r\n");
|
||||||
|
delay_ms(3000);
|
||||||
|
BSRR(p) = (1u << (n + 16)); /* LOW */
|
||||||
|
delay_ms(500);
|
||||||
|
}
|
||||||
|
uart_puts("sweep done; restoring radio\r\n");
|
||||||
|
spi_init();
|
||||||
|
nrf_write(0, 0x0E);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hex2(uint8_t b) { const char *h = "0123456789ABCDEF"; uart_putc(h[b >> 4]); uart_putc(h[b & 0xF]); }
|
||||||
|
static void banner(void)
|
||||||
|
{
|
||||||
|
uart_puts("\r\nhexapod dongle app v0 (@0x08001000)\r\n");
|
||||||
|
uart_puts("nRF CONFIG=0x"); hex2(nrf_read(0)); uart_puts(" STATUS=0x"); hex2(nrf_read(7));
|
||||||
|
uart_puts(" RF_CH=0x"); hex2(nrf_read(5)); uart_puts(" RF_SETUP=0x"); hex2(nrf_read(6));
|
||||||
|
uart_puts("\r\ncmds: v r 0-4(PA0/PA1/PB1/PF0/PF1) x=rx test b=reflash; bridge: frame A5 'L'\r\n");
|
||||||
|
}
|
||||||
|
static void regdump(void)
|
||||||
|
{
|
||||||
|
static const uint8_t rg[] = {0,1,2,3,4,5,6,7,8,9,0x17};
|
||||||
|
for (unsigned i = 0; i < sizeof(rg); i++) { uart_puts(" R"); hex2(rg[i]); uart_putc('='); hex2(nrf_read(rg[i])); }
|
||||||
|
uart_puts("\r\n");
|
||||||
|
}
|
||||||
|
/* Pin finder: sit in RX on a WiFi-busy channel and report the carrier-detect
|
||||||
|
* (RPD) bit. Toggling the real RXEN pin switches the AT2401C LNA on, which lifts
|
||||||
|
* ambient 2.4 GHz above the -64 dBm detect threshold -> RPD flips to 1. */
|
||||||
|
static uint8_t finder;
|
||||||
|
static uint8_t finder_ch = 62; /* 2462 MHz ~ WiFi ch 11 */
|
||||||
|
static void finder_rx(void)
|
||||||
|
{
|
||||||
|
CE_LO();
|
||||||
|
nrf_write(0x05, finder_ch); /* RF_CH */
|
||||||
|
nrf_write(0x06, 0x0F); /* RF_SETUP: keep it simple */
|
||||||
|
nrf_write(0x00, 0x0F); /* CONFIG: PWR_UP, PRIM_RX, CRC16 */
|
||||||
|
delay_ms(2);
|
||||||
|
CE_HI(); /* enter RX */
|
||||||
|
delay_ms(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- USART1 RX through circular DMA ------------------------------------
|
||||||
|
* The bridge moves ~100 frames/s each way at 115200 baud. Polled single-byte
|
||||||
|
* RX loses bytes while we block on a TX frame or an SPI read, and this M0 app
|
||||||
|
* runs without interrupts (no vector relocation), so DMA channel 3 (USART1_RX)
|
||||||
|
* writes every byte into a ring we drain at leisure. */
|
||||||
|
#define DMA_CCR3 REG(0x40020030)
|
||||||
|
#define DMA_CNDTR3 REG(0x40020034)
|
||||||
|
#define DMA_CPAR3 REG(0x40020038)
|
||||||
|
#define DMA_CMAR3 REG(0x4002003C)
|
||||||
|
#define USART1_CR3 REG(0x40013808)
|
||||||
|
#define RXRING 256u
|
||||||
|
static volatile uint8_t rxring[RXRING];
|
||||||
|
static uint16_t rxtail;
|
||||||
|
static void uart_dma_init(void)
|
||||||
|
{
|
||||||
|
RCC_AHBENR |= 1u; /* DMA1 */
|
||||||
|
while (!(USART1_ISR & (1u << 6))) {} /* let any TX finish */
|
||||||
|
USART1_CR1 &= ~1u; /* UE off: CR3 OVRDIS needs it */
|
||||||
|
USART1_CR3 = (1u << 6) | (1u << 12); /* DMAR, OVRDIS (never stall on overrun) */
|
||||||
|
USART1_CR1 |= 1u;
|
||||||
|
DMA_CCR3 = 0;
|
||||||
|
DMA_CPAR3 = 0x40013824u; /* USART1_RDR */
|
||||||
|
DMA_CMAR3 = (uint32_t)rxring;
|
||||||
|
DMA_CNDTR3 = RXRING;
|
||||||
|
DMA_CCR3 = (1u << 7) | (1u << 5) | 1u; /* MINC, CIRC, EN; 8-bit, periph -> mem */
|
||||||
|
}
|
||||||
|
static int rx_getc(void)
|
||||||
|
{
|
||||||
|
uint16_t head = (uint16_t)(RXRING - DMA_CNDTR3) % RXRING;
|
||||||
|
if (head == rxtail) return -1;
|
||||||
|
uint8_t c = rxring[rxtail];
|
||||||
|
rxtail = (uint16_t)((rxtail + 1) % RXRING);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ---- Bridge: the dongle stands in for the robot's radio ------------------
|
||||||
|
* Framing both ways: A5 type len payload[len] sum, sum = type+len+payload (mod 256).
|
||||||
|
* host -> dongle 'L' listen (enter bridge) 'X' leave
|
||||||
|
* 'A' ack payload (<= 32 B): goes back on the auto-ack of the
|
||||||
|
* next packet, like the robot's Comms::loadAckPayload.
|
||||||
|
* Dropped if the host stops refreshing it for 500 ms, so
|
||||||
|
* the remote doesn't see stale telemetry as live.
|
||||||
|
* dongle -> host 'R' a received packet (the remote's CmdPacket)
|
||||||
|
* 'S' once a second: packets received (u16 LE), acks loaded (u16 LE)
|
||||||
|
* Plain text never contains A5, so the host can skip anything between frames. */
|
||||||
|
static uint8_t bridge;
|
||||||
|
static uint8_t ack_buf[32], ack_len;
|
||||||
|
static uint32_t ack_ms;
|
||||||
|
static uint16_t br_rx, br_acks;
|
||||||
|
static void frame_send(uint8_t type, const uint8_t *d, uint8_t n)
|
||||||
|
{
|
||||||
|
uint8_t sum = (uint8_t)(type + n);
|
||||||
|
uart_putc((char)0xA5); uart_putc((char)type); uart_putc((char)n);
|
||||||
|
for (uint8_t i = 0; i < n; i++) { uart_putc((char)d[i]); sum = (uint8_t)(sum + d[i]); }
|
||||||
|
uart_putc((char)sum);
|
||||||
|
}
|
||||||
|
static void ack_load(void)
|
||||||
|
{
|
||||||
|
nrf_cmd(0xE1); /* FLUSH_TX: only the newest one */
|
||||||
|
if (!ack_len) return;
|
||||||
|
CSN_LO(); spi_xfer(0xA8); for (uint8_t i = 0; i < ack_len; i++) spi_xfer(ack_buf[i]); CSN_HI(); /* W_ACK_PAYLOAD pipe 0 */
|
||||||
|
br_acks++;
|
||||||
|
}
|
||||||
|
static void bridge_start(void)
|
||||||
|
{
|
||||||
|
rx_setup(); /* ch96 / 250k / HXPD1 / auto-ack / dynamic length */
|
||||||
|
CE_LO();
|
||||||
|
nrf_write(0x1D, 0x06); /* FEATURE: EN_DPL | EN_ACK_PAY */
|
||||||
|
nrf_write(0x1C, 0x01); /* DYNPD pipe 0 */
|
||||||
|
nrf_cmd(0xE1);
|
||||||
|
ack_len = 0; br_rx = br_acks = 0;
|
||||||
|
rxmode = 0; finder = 0; bridge = 1;
|
||||||
|
BSRR(GPIOA) = 1u; /* LED on while bridging */
|
||||||
|
CE_HI();
|
||||||
|
}
|
||||||
|
static void bridge_stop(void)
|
||||||
|
{
|
||||||
|
bridge = 0; ack_len = 0;
|
||||||
|
CE_LO(); nrf_write(0, 0x0E); nrf_cmd(0xE1);
|
||||||
|
BSRR(GPIOA) = 1u << 16;
|
||||||
|
}
|
||||||
|
static void bridge_poll(uint32_t now)
|
||||||
|
{
|
||||||
|
if (ack_len && now - ack_ms > 500) { ack_len = 0; nrf_cmd(0xE1); } /* host went quiet */
|
||||||
|
while (nrf_read(0x07) & 0x40) { /* RX_DR */
|
||||||
|
uint8_t buf[32];
|
||||||
|
CSN_LO(); spi_xfer(0x60); uint8_t n = spi_xfer(0xFF); CSN_HI(); /* R_RX_PL_WID */
|
||||||
|
if (n > 32) { nrf_cmd(0xE2); nrf_write(0x07, 0x40); break; }
|
||||||
|
CSN_LO(); spi_xfer(0x61); for (uint8_t i = 0; i < n; i++) buf[i] = spi_xfer(0xFF); CSN_HI();
|
||||||
|
nrf_write(0x07, 0x40);
|
||||||
|
ack_load(); /* the ack for the NEXT packet */
|
||||||
|
frame_send('R', buf, n);
|
||||||
|
br_rx++;
|
||||||
|
if ((br_rx & 31) == 0) BSRR(GPIOA) = (IDR(GPIOA) & 1u) ? (1u << 16) : 1u; /* LED flicker */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Host frame parser; returns 1 while inside a frame (so its bytes aren't
|
||||||
|
* taken as single-letter commands). */
|
||||||
|
static uint8_t fr_state, fr_type, fr_len, fr_got, fr_sum, fr_buf[32];
|
||||||
|
static int frame_rx(int c, uint32_t now)
|
||||||
|
{
|
||||||
|
/* if-chain, not switch: a switch becomes a jump table needing libgcc */
|
||||||
|
if (fr_state == 0) {
|
||||||
|
if (c != 0xA5) return 0;
|
||||||
|
fr_state = 1;
|
||||||
|
} else if (fr_state == 1) {
|
||||||
|
fr_type = (uint8_t)c;
|
||||||
|
fr_state = 2;
|
||||||
|
} else if (fr_state == 2) {
|
||||||
|
fr_len = (uint8_t)c; fr_got = 0; fr_sum = (uint8_t)(fr_type + fr_len);
|
||||||
|
fr_state = (fr_len > 32) ? 0 : (fr_len ? 3 : 4);
|
||||||
|
} else if (fr_state == 3) {
|
||||||
|
fr_buf[fr_got++] = (uint8_t)c; fr_sum = (uint8_t)(fr_sum + c);
|
||||||
|
if (fr_got == fr_len) fr_state = 4;
|
||||||
|
} else {
|
||||||
|
fr_state = 0;
|
||||||
|
if ((uint8_t)c != fr_sum) return 1; /* corrupt: drop */
|
||||||
|
if (fr_type == 'L') bridge_start();
|
||||||
|
else if (fr_type == 'X') bridge_stop();
|
||||||
|
else if (fr_type == 'A' && bridge) {
|
||||||
|
for (uint8_t i = 0; i < fr_len; i++) ack_buf[i] = fr_buf[i];
|
||||||
|
ack_len = fr_len; ack_ms = now;
|
||||||
|
ack_load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void reflash(void) /* ask safeboot to take over, no wire needed */
|
||||||
|
{
|
||||||
|
uart_puts("resetting into safeboot flash mode...\r\n");
|
||||||
|
while (!(USART1_ISR & (1u << 6))) {} /* TC */
|
||||||
|
REG(MAGIC_ADDR) = MAGIC_FLASH;
|
||||||
|
REG(0xE000ED0C) = 0x05FA0004; /* SCB AIRCR SYSRESETREQ */
|
||||||
|
for (;;) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
uart_init8n1();
|
||||||
|
uart_dma_init();
|
||||||
|
spi_init();
|
||||||
|
free_init();
|
||||||
|
nrf_write(0, 0x0E);
|
||||||
|
delay_ms(5);
|
||||||
|
banner();
|
||||||
|
|
||||||
|
uint32_t now = 0, t = 0;
|
||||||
|
systick_setup();
|
||||||
|
for (;;) {
|
||||||
|
uint32_t ctrl = STK_CTRL; /* one read: reading clears COUNTFLAG */
|
||||||
|
if (ctrl == 0) systick_setup(); /* delay_ms() (sweep, finder) stops it */
|
||||||
|
else if (ctrl & 0x10000) { now++; t++; } /* 1 ms ticks, polled */
|
||||||
|
if (bridge) bridge_poll(now);
|
||||||
|
int c = rx_getc();
|
||||||
|
if (c >= 0 && frame_rx(c, now)) c = -1; /* consumed by a host frame */
|
||||||
|
if (c < 0) {}
|
||||||
|
else if (bridge && c != 'b' && c != 'B') {} /* bridging: only frames (and reflash) */
|
||||||
|
else if (c == 'v' || c == 'V') banner();
|
||||||
|
else if (c == 'r' || c == 'R') regdump();
|
||||||
|
else if (c == 'b' || c == 'B') reflash();
|
||||||
|
else if (c == 'x' || c == 'X') { rxmode = !rxmode; finder = 0; if (rxmode) rx_setup(); else { CE_LO(); nrf_write(0, 0x0E); } uart_puts(rxmode ? "RX mode on (ch96/250k/HXPD1)\r\n" : "RX off\r\n"); }
|
||||||
|
else if (c == 'a' || c == 'A') sweep_all();
|
||||||
|
else if (c == 'f' || c == 'F') { finder = !finder; if (finder) finder_rx(); else { CE_LO(); nrf_write(0, 0x0E); } uart_puts(finder ? "finder RX on\r\n" : "finder off\r\n"); }
|
||||||
|
else if (c == 'n' || c == 'N') { finder_ch = (finder_ch == 62) ? 37 : (finder_ch == 37 ? 12 : 62); if (finder) finder_rx(); uart_puts("ch="); hex2(finder_ch); uart_puts("\r\n"); }
|
||||||
|
else if (c >= '0' && c <= '4') {
|
||||||
|
int i = c - '0';
|
||||||
|
fst[i] = !fst[i];
|
||||||
|
BSRR(FREE[i].port) = fst[i] ? (1u << FREE[i].pin) : (1u << (FREE[i].pin + 16));
|
||||||
|
uart_puts("pin "); uart_puts(FREE[i].name); uart_puts(fst[i] ? " HIGH" : " LOW");
|
||||||
|
if (finder) { delay_ms(2); uart_puts(" RPD="); hex2(nrf_read(9)); }
|
||||||
|
uart_puts("\r\n");
|
||||||
|
}
|
||||||
|
if (rxmode) rx_poll();
|
||||||
|
if (t >= 1000) {
|
||||||
|
t = 0;
|
||||||
|
if (bridge) {
|
||||||
|
uint8_t s[4] = { (uint8_t)br_rx, (uint8_t)(br_rx >> 8), (uint8_t)br_acks, (uint8_t)(br_acks >> 8) };
|
||||||
|
frame_send('S', s, 4);
|
||||||
|
br_rx = br_acks = 0;
|
||||||
|
}
|
||||||
|
else if (rxmode) { uart_puts("RX pkts="); hex2(rx_count >> 8); hex2(rx_count & 0xFF);
|
||||||
|
uart_puts(" len="); hex2(rx_len);
|
||||||
|
uart_puts(" pins="); for (int i = 0; i < NFREE; i++) uart_putc(fst[i] ? '1' : '0');
|
||||||
|
uart_puts(" (0=PA0LED,1=PA1,2=PB1,3=PF0,4=PF1)\r\n"); rx_count = 0; }
|
||||||
|
else if (finder) { uart_puts("finder ch=0x"); hex2(finder_ch); uart_puts(" RPD="); hex2(nrf_read(9));
|
||||||
|
uart_puts(" pins="); for (int i = 0; i < NFREE; i++) uart_putc(fst[i] ? '1' : '0'); uart_puts("\r\n"); }
|
||||||
|
else { uart_puts("hb STATUS=0x"); hex2(nrf_read(7)); uart_puts("\r\n"); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/* app: flash pages 4-15 (12 KB) after safeboot. RAM starts at +4 so the magic
|
||||||
|
* word at 0x20000000 (used to signal safeboot) is left alone. */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
FLASH (rx) : ORIGIN = 0x08001000, LENGTH = 12K
|
||||||
|
RAM (rwx) : ORIGIN = 0x20000004, LENGTH = 4092
|
||||||
|
}
|
||||||
|
_estack = 0x20001000;
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.isr_vector : { KEEP(*(.isr_vector)) } > FLASH
|
||||||
|
.text : { *(.text*) *(.rodata*) . = ALIGN(4); } > FLASH
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
.data : { . = ALIGN(4); _sdata = .; *(.data*) . = ALIGN(4); _edata = .; } > RAM AT > FLASH
|
||||||
|
.bss : { . = ALIGN(4); _sbss = .; *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; } > RAM
|
||||||
|
/DISCARD/ : { *(.ARM.exidx*) *(.ARM.extab*) }
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
/* Startup for the stage-2 app. Polling only, so no IRQ vectors are needed
|
||||||
|
* beyond SP/Reset; safeboot jumps here directly (no M0 vector relocation). */
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
extern uint32_t _sidata, _sdata, _edata, _sbss, _ebss, _estack;
|
||||||
|
int main(void);
|
||||||
|
|
||||||
|
void Reset_Handler(void)
|
||||||
|
{
|
||||||
|
uint32_t *src = &_sidata, *dst = &_sdata;
|
||||||
|
while (dst < &_edata) *dst++ = *src++;
|
||||||
|
for (dst = &_sbss; dst < &_ebss;) *dst++ = 0;
|
||||||
|
main();
|
||||||
|
for (;;) {}
|
||||||
|
}
|
||||||
|
void Default_Handler(void) { for (;;) {} }
|
||||||
|
|
||||||
|
__attribute__((section(".isr_vector"), used))
|
||||||
|
void (*const g_vectors[])(void) = {
|
||||||
|
(void (*)(void))&_estack, Reset_Handler, Default_Handler, Default_Handler,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, Default_Handler, 0, 0, Default_Handler, Default_Handler,
|
||||||
|
};
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
# Build the dongle firmware: safeboot.bin (stage 1), app.bin (stage 2), and
|
||||||
|
# dongle_combined.bin (safeboot padded to 4 KB + app) for the one-time install.
|
||||||
|
# Uses the ARM toolchain PlatformIO installed (pio pkg install -g -p ststm32).
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$bin = "$env:USERPROFILE\.platformio\packages\toolchain-gccarmnoneeabi\bin"
|
||||||
|
$gcc = (Get-ChildItem "$bin\arm-none-eabi-gcc*.exe" | Select-Object -First 1).FullName
|
||||||
|
$objcopy = (Get-ChildItem "$bin\arm-none-eabi-objcopy*.exe" | Select-Object -First 1).FullName
|
||||||
|
$size = (Get-ChildItem "$bin\arm-none-eabi-size*.exe" | Select-Object -First 1).FullName
|
||||||
|
$cf = "-mcpu=cortex-m0 -mthumb -Os -ffreestanding -nostdlib -ffunction-sections -fdata-sections -Wall -Wextra"
|
||||||
|
$here = $PSScriptRoot
|
||||||
|
Set-Location $here
|
||||||
|
$out = "$here\build"; New-Item -ItemType Directory -Force $out | Out-Null
|
||||||
|
|
||||||
|
$lf = @("-mcpu=cortex-m0", "-mthumb", "-nostdlib", "-Wl,--gc-sections")
|
||||||
|
# stage 1
|
||||||
|
& $gcc $cf.Split(' ') -c safeboot.c -o "$out\safeboot.o"
|
||||||
|
& $gcc $lf -T safeboot.ld "$out\safeboot.o" -o "$out\safeboot.elf"
|
||||||
|
& $objcopy -O binary "$out\safeboot.elf" "$out\safeboot.bin"
|
||||||
|
# stage 2
|
||||||
|
& $gcc $cf.Split(' ') -c app.c -o "$out\app.o"
|
||||||
|
& $gcc $cf.Split(' ') -c app_startup.c -o "$out\app_startup.o"
|
||||||
|
& $gcc $lf -T app.ld "$out\app.o" "$out\app_startup.o" -o "$out\app.elf"
|
||||||
|
& $objcopy -O binary "$out\app.elf" "$out\app.bin"
|
||||||
|
|
||||||
|
& $size "$out\safeboot.elf" "$out\app.elf"
|
||||||
|
|
||||||
|
# combined image: safeboot in [0,4KB), app at 4KB
|
||||||
|
$sb = [System.IO.File]::ReadAllBytes("$out\safeboot.bin")
|
||||||
|
$ap = [System.IO.File]::ReadAllBytes("$out\app.bin")
|
||||||
|
if ($sb.Length -gt 4096) { throw "safeboot is $($sb.Length) bytes, over the 4 KB reserved" }
|
||||||
|
$img = New-Object byte[] (4096 + $ap.Length)
|
||||||
|
for ($i = 0; $i -lt $img.Length; $i++) { $img[$i] = 0xFF }
|
||||||
|
[Array]::Copy($sb, 0, $img, 0, $sb.Length)
|
||||||
|
[Array]::Copy($ap, 0, $img, 4096, $ap.Length)
|
||||||
|
[System.IO.File]::WriteAllBytes("$out\dongle_combined.bin", $img)
|
||||||
|
Write-Host "safeboot $($sb.Length) B, app $($ap.Length) B, combined $($img.Length) B -> build\dongle_combined.bin"
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/* Shared register defs + helpers for the hexapod dongle (STM32F030F4 @ 8 MHz).
|
||||||
|
* Magic word at 0x20000000 survives a soft reset: the app sets it to ask
|
||||||
|
* safeboot to enter flash mode. Both linker scripts keep RAM clear of it
|
||||||
|
* (RAM ORIGIN 0x20000004). */
|
||||||
|
#ifndef DONGLE_COMMON_H
|
||||||
|
#define DONGLE_COMMON_H
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#define REG(a) (*(volatile uint32_t *)(a))
|
||||||
|
#define REG8(a) (*(volatile uint8_t *)(a))
|
||||||
|
|
||||||
|
#define MAGIC_ADDR 0x20000000u
|
||||||
|
#define MAGIC_FLASH 0xB00710ADu /* "BOOT LOAD": app -> safeboot flash */
|
||||||
|
|
||||||
|
#define APP_BASE 0x08001000u /* stage 2 starts here (page 4) */
|
||||||
|
#define APP_PAGE_LO 4
|
||||||
|
#define APP_PAGE_HI 15 /* 16 KB / 1 KB pages = 0..15 */
|
||||||
|
#define PAGE_SIZE 1024u
|
||||||
|
|
||||||
|
/* RCC */
|
||||||
|
#define RCC_AHBENR REG(0x40021014)
|
||||||
|
#define RCC_APB2ENR REG(0x40021018)
|
||||||
|
#define RCC_APB2RSTR REG(0x4002100C)
|
||||||
|
#define RCC_AHBRSTR REG(0x40021028)
|
||||||
|
/* GPIO */
|
||||||
|
#define GPIOA 0x48000000u
|
||||||
|
#define GPIOB 0x48000400u
|
||||||
|
#define GPIOF 0x48001400u
|
||||||
|
#define MODER(p) REG((p)+0x00)
|
||||||
|
#define OTYPER(p) REG((p)+0x04)
|
||||||
|
#define PUPDR(p) REG((p)+0x0C)
|
||||||
|
#define IDR(p) REG((p)+0x10)
|
||||||
|
#define BSRR(p) REG((p)+0x18)
|
||||||
|
#define AFRH(p) REG((p)+0x24)
|
||||||
|
/* USART1 */
|
||||||
|
#define USART1_CR1 REG(0x40013800)
|
||||||
|
#define USART1_BRR REG(0x4001380C)
|
||||||
|
#define USART1_ISR REG(0x4001381C)
|
||||||
|
#define USART1_ICR REG(0x40013820)
|
||||||
|
#define USART1_RDR REG(0x40013824)
|
||||||
|
#define USART1_TDR REG(0x40013828)
|
||||||
|
/* SysTick */
|
||||||
|
#define STK_CTRL REG(0xE000E010)
|
||||||
|
#define STK_LOAD REG(0xE000E014)
|
||||||
|
#define STK_VAL REG(0xE000E018)
|
||||||
|
/* FLASH */
|
||||||
|
#define FLASH_KEYR REG(0x40022004)
|
||||||
|
#define FLASH_SR REG(0x4002200C)
|
||||||
|
#define FLASH_CR REG(0x40022010)
|
||||||
|
#define FLASH_AR REG(0x40022014)
|
||||||
|
|
||||||
|
static inline void uart_init8n1(void) /* USART1 PA9/PA10, 115200 8N1, 8 MHz */
|
||||||
|
{
|
||||||
|
RCC_AHBENR |= (1u << 17); /* GPIOA */
|
||||||
|
RCC_APB2ENR |= (1u << 14); /* USART1 */
|
||||||
|
MODER(GPIOA) = (MODER(GPIOA) & ~((3u << 18) | (3u << 20)))
|
||||||
|
| (2u << 18) | (2u << 20);
|
||||||
|
AFRH(GPIOA) = (AFRH(GPIOA) & ~((0xFu << 4) | (0xFu << 8)))
|
||||||
|
| (1u << 4) | (1u << 8);
|
||||||
|
USART1_BRR = 69;
|
||||||
|
USART1_CR1 = (1u << 0) | (1u << 2) | (1u << 3);
|
||||||
|
}
|
||||||
|
static inline void uart_putc(char c)
|
||||||
|
{
|
||||||
|
while (!(USART1_ISR & (1u << 7))) {}
|
||||||
|
USART1_TDR = (uint8_t)c;
|
||||||
|
}
|
||||||
|
static inline void uart_puts(const char *s) { while (*s) uart_putc(*s++); }
|
||||||
|
/* Clear overrun / noise / framing / parity errors. While ORE is set the USART
|
||||||
|
* stops moving new bytes into RDR, so one burst the app didn't read in time
|
||||||
|
* (e.g. SignalRGB probing the COM port) used to deafen it until a replug. */
|
||||||
|
static inline void uart_clear_errors(void)
|
||||||
|
{
|
||||||
|
if (USART1_ISR & 0x0Fu) USART1_ICR = 0x0Fu; /* ORECF NCF FECF PECF */
|
||||||
|
}
|
||||||
|
static inline int uart_getc(void) /* non-blocking, -1 if none */
|
||||||
|
{
|
||||||
|
uart_clear_errors();
|
||||||
|
if (USART1_ISR & (1u << 5)) return (uint8_t)USART1_RDR;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
static inline uint8_t uart_getc_block(void)
|
||||||
|
{
|
||||||
|
while (!(USART1_ISR & (1u << 5))) uart_clear_errors();
|
||||||
|
return (uint8_t)USART1_RDR;
|
||||||
|
}
|
||||||
|
static inline void systick_setup(void) { STK_LOAD = 8000 - 1; STK_VAL = 0; STK_CTRL = 5; }
|
||||||
|
static inline void delay_ms(uint32_t ms) { systick_setup(); while (ms--) { while (!(STK_CTRL & 0x10000)) {} } STK_CTRL = 0; }
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,154 @@
|
|||||||
|
/* Hexapod dongle - stage 1 "safeboot" (permanent recovery bootloader).
|
||||||
|
*
|
||||||
|
* Lives in the first 4 KB of flash (pages 0-3) and runs first on every reset.
|
||||||
|
* It speaks a tiny fixed-baud (115200 8N1) flashing protocol over USB and can
|
||||||
|
* always erase/rewrite the application (pages 4-15). It is flashed ONCE and the
|
||||||
|
* host flasher never erases it, so no application update can remove the
|
||||||
|
* wire-free recovery path. See ../README.md.
|
||||||
|
*
|
||||||
|
* Entry decisions:
|
||||||
|
* - soft reset with MAGIC_FLASH set -> enter flash mode immediately
|
||||||
|
* - else print banner, open a knock window; host 'S' -> flash mode
|
||||||
|
* - else if the app looks valid -> jump to it
|
||||||
|
* - else (no valid app) -> stay in flash mode (recovery)
|
||||||
|
*
|
||||||
|
* Flash-mode protocol (host -> safeboot, each replies one byte 'K' ok / 'E' err
|
||||||
|
* unless noted):
|
||||||
|
* 'P' ping -> 'K'
|
||||||
|
* 'E' erase app region (pages 4-15)
|
||||||
|
* 'W' a0 a1 a2 a3 n d[n] write n bytes (n even, <=128) at little-endian addr
|
||||||
|
* 'R' a0 a1 a2 a3 n read n bytes at addr -> sends n bytes (no K)
|
||||||
|
* 'G' 'K', then boot the app (or reset)
|
||||||
|
* 'V' -> prints "SBV1\n" (identify)
|
||||||
|
*/
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
|
#define KNOCK_MS 1500
|
||||||
|
|
||||||
|
/* ---- startup (custom: read the magic word before touching RAM) ---- */
|
||||||
|
extern uint32_t _sidata, _sdata, _edata, _sbss, _ebss, _estack;
|
||||||
|
int sb_main(int forced);
|
||||||
|
|
||||||
|
void Reset_Handler(void)
|
||||||
|
{
|
||||||
|
uint32_t m = REG(MAGIC_ADDR);
|
||||||
|
REG(MAGIC_ADDR) = 0;
|
||||||
|
uint32_t *src = &_sidata, *dst = &_sdata;
|
||||||
|
while (dst < &_edata) *dst++ = *src++;
|
||||||
|
for (dst = &_sbss; dst < &_ebss;) *dst++ = 0;
|
||||||
|
sb_main(m == MAGIC_FLASH);
|
||||||
|
for (;;) {}
|
||||||
|
}
|
||||||
|
void Default_Handler(void) { for (;;) {} }
|
||||||
|
__attribute__((section(".isr_vector"), used))
|
||||||
|
void (*const g_vectors[])(void) = {
|
||||||
|
(void (*)(void))&_estack, Reset_Handler, Default_Handler, Default_Handler,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, Default_Handler, 0, 0, Default_Handler, Default_Handler,
|
||||||
|
};
|
||||||
|
|
||||||
|
/* ---- flash programming ---- */
|
||||||
|
static void flash_unlock(void)
|
||||||
|
{
|
||||||
|
if (FLASH_CR & (1u << 7)) { FLASH_KEYR = 0x45670123; FLASH_KEYR = 0xCDEF89AB; }
|
||||||
|
}
|
||||||
|
static int flash_wait(void)
|
||||||
|
{
|
||||||
|
while (FLASH_SR & (1u << 0)) {} /* BSY */
|
||||||
|
uint32_t sr = FLASH_SR;
|
||||||
|
FLASH_SR = (1u << 5) | (1u << 2) | (1u << 4); /* clear EOP/PGERR/WRPRT */
|
||||||
|
return !(sr & ((1u << 2) | (1u << 4))); /* ok if no error bits */
|
||||||
|
}
|
||||||
|
static int flash_erase_page(uint32_t addr)
|
||||||
|
{
|
||||||
|
flash_wait();
|
||||||
|
FLASH_CR |= (1u << 1); /* PER */
|
||||||
|
FLASH_AR = addr;
|
||||||
|
FLASH_CR |= (1u << 6); /* STRT */
|
||||||
|
int ok = flash_wait();
|
||||||
|
FLASH_CR &= ~(1u << 1);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
static int flash_prog_hw(uint32_t addr, uint16_t hw)
|
||||||
|
{
|
||||||
|
flash_wait();
|
||||||
|
FLASH_CR |= (1u << 0); /* PG */
|
||||||
|
*(volatile uint16_t *)addr = hw;
|
||||||
|
int ok = flash_wait();
|
||||||
|
FLASH_CR &= ~(1u << 0);
|
||||||
|
return ok && (*(volatile uint16_t *)addr == hw);
|
||||||
|
}
|
||||||
|
static int erase_app(void)
|
||||||
|
{
|
||||||
|
flash_unlock();
|
||||||
|
for (int p = APP_PAGE_LO; p <= APP_PAGE_HI; p++)
|
||||||
|
if (!flash_erase_page(0x08000000u + p * PAGE_SIZE)) return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static uint32_t rd4(void)
|
||||||
|
{
|
||||||
|
uint32_t v = uart_getc_block();
|
||||||
|
v |= (uint32_t)uart_getc_block() << 8;
|
||||||
|
v |= (uint32_t)uart_getc_block() << 16;
|
||||||
|
v |= (uint32_t)uart_getc_block() << 24;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void boot_app(void)
|
||||||
|
{
|
||||||
|
uint32_t sp = *(volatile uint32_t *)APP_BASE;
|
||||||
|
uint32_t pc = *(volatile uint32_t *)(APP_BASE + 4);
|
||||||
|
if (sp >= 0x20000000u && sp <= 0x20001000u) {
|
||||||
|
__asm volatile("msr msp, %0" : : "r"(sp));
|
||||||
|
((void (*)(void))pc)();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void flash_loop(void)
|
||||||
|
{
|
||||||
|
flash_unlock();
|
||||||
|
for (;;) {
|
||||||
|
int c = uart_getc_block();
|
||||||
|
if (c == 'P') uart_putc('K');
|
||||||
|
else if (c == 'V') uart_puts("SBV1\r\n");
|
||||||
|
else if (c == 'E') uart_putc(erase_app() ? 'K' : 'E');
|
||||||
|
else if (c == 'W') {
|
||||||
|
uint32_t a = rd4();
|
||||||
|
uint8_t n = uart_getc_block();
|
||||||
|
uint8_t buf[128];
|
||||||
|
for (uint8_t i = 0; i < n; i++) buf[i] = uart_getc_block();
|
||||||
|
int ok = (n <= 128) && !(n & 1) && a >= APP_BASE && (a + n) <= 0x08004000u;
|
||||||
|
for (uint8_t i = 0; ok && i < n; i += 2)
|
||||||
|
ok = flash_prog_hw(a + i, (uint16_t)(buf[i] | (buf[i + 1] << 8)));
|
||||||
|
uart_putc(ok ? 'K' : 'E');
|
||||||
|
}
|
||||||
|
else if (c == 'R') {
|
||||||
|
uint32_t a = rd4();
|
||||||
|
uint8_t n = uart_getc_block();
|
||||||
|
for (uint8_t i = 0; i < n; i++) uart_putc(*(volatile uint8_t *)(a + i));
|
||||||
|
}
|
||||||
|
else if (c == 'G') { uart_putc('K'); boot_app(); /* if it returns, stay */ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int sb_main(int forced)
|
||||||
|
{
|
||||||
|
uart_init8n1();
|
||||||
|
|
||||||
|
if (forced) { uart_puts("SBF\r\n"); flash_loop(); }
|
||||||
|
|
||||||
|
uart_puts("SB1\r\n"); /* cold boot: offer a knock window */
|
||||||
|
systick_setup();
|
||||||
|
uint32_t ms = 0;
|
||||||
|
while (ms < KNOCK_MS) {
|
||||||
|
int c = uart_getc();
|
||||||
|
if (c == 'S') { uart_putc('K'); flash_loop(); }
|
||||||
|
if (STK_CTRL & 0x10000) ms++;
|
||||||
|
}
|
||||||
|
STK_CTRL = 0;
|
||||||
|
|
||||||
|
boot_app(); /* valid app -> never returns */
|
||||||
|
uart_puts("SBR\r\n"); /* no app -> recovery flash mode */
|
||||||
|
flash_loop();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
/* safeboot: first 4 KB of flash. RAM starts at +4 so the magic word at
|
||||||
|
* 0x20000000 is never touched by .data/.bss. */
|
||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 4K
|
||||||
|
RAM (rwx) : ORIGIN = 0x20000004, LENGTH = 4092
|
||||||
|
}
|
||||||
|
_estack = 0x20001000;
|
||||||
|
|
||||||
|
SECTIONS
|
||||||
|
{
|
||||||
|
.isr_vector : { KEEP(*(.isr_vector)) } > FLASH
|
||||||
|
.text : { *(.text*) *(.rodata*) . = ALIGN(4); } > FLASH
|
||||||
|
_sidata = LOADADDR(.data);
|
||||||
|
.data : { . = ALIGN(4); _sdata = .; *(.data*) . = ALIGN(4); _edata = .; } > RAM AT > FLASH
|
||||||
|
.bss : { . = ALIGN(4); _sbss = .; *(.bss*) *(COMMON) . = ALIGN(4); _ebss = .; } > RAM
|
||||||
|
/DISCARD/ : { *(.ARM.exidx*) *(.ARM.extab*) }
|
||||||
|
}
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
"""Flash a .bin to the dongle's STM32F030 over the ROM UART bootloader (COM16).
|
||||||
|
First run unlocks (readout-unprotect = mass erase + drop RDP), then writes & verifies.
|
||||||
|
usage: dongle_flash.py firmware.bin [--port COM16]"""
|
||||||
|
import sys, time, serial
|
||||||
|
|
||||||
|
ACK, NACK = 0x79, 0x1F
|
||||||
|
FLASH = 0x08000000
|
||||||
|
|
||||||
|
|
||||||
|
def open_racing(port, open_timeout=20.0):
|
||||||
|
"""Keep retrying to open the port - wins the race against programs (e.g.
|
||||||
|
SignalRGB) that also grab CH340 COM ports on enumeration."""
|
||||||
|
t = time.time()
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
return serial.Serial(port, 115200, parity=serial.PARITY_EVEN,
|
||||||
|
stopbits=1, bytesize=8, timeout=1.0)
|
||||||
|
except serial.SerialException:
|
||||||
|
if time.time() - t > open_timeout:
|
||||||
|
raise
|
||||||
|
time.sleep(0.02)
|
||||||
|
|
||||||
|
|
||||||
|
class BL:
|
||||||
|
def __init__(self, port):
|
||||||
|
self.port = port
|
||||||
|
self.s = open_racing(port)
|
||||||
|
|
||||||
|
def reopen(self):
|
||||||
|
self.s.close(); time.sleep(0.3)
|
||||||
|
self.s = open_racing(self.port)
|
||||||
|
|
||||||
|
def _wait_ack(self, what, tmo=3.0):
|
||||||
|
self.s.timeout = tmo
|
||||||
|
b = self.s.read(1)
|
||||||
|
self.s.timeout = 1.0
|
||||||
|
if b == bytes([ACK]):
|
||||||
|
return True
|
||||||
|
if b == bytes([NACK]):
|
||||||
|
raise RuntimeError("%s: NACK" % what)
|
||||||
|
raise RuntimeError("%s: no answer (%r)" % (what, b))
|
||||||
|
|
||||||
|
def _probe_get(self):
|
||||||
|
"""Already synced? A GET (0x00) ACKs and returns the command list."""
|
||||||
|
self.s.reset_input_buffer()
|
||||||
|
self.s.write(bytes([0x00, 0xFF])); time.sleep(0.15)
|
||||||
|
b = self.s.read(1)
|
||||||
|
if b == bytes([ACK]):
|
||||||
|
n = self.s.read(1)[0]; self.s.read(n + 1); self.s.read(1)
|
||||||
|
return True
|
||||||
|
return b == bytes([NACK])
|
||||||
|
|
||||||
|
def sync(self):
|
||||||
|
# autobaud (works once per power-up)
|
||||||
|
self.s.reset_input_buffer()
|
||||||
|
self.s.write(b"\x7f"); time.sleep(0.15)
|
||||||
|
b = self.s.read(1)
|
||||||
|
if b in (bytes([ACK]), bytes([NACK])):
|
||||||
|
return True
|
||||||
|
# already synced this power cycle?
|
||||||
|
if self._probe_get():
|
||||||
|
return True
|
||||||
|
raise RuntimeError("no bootloader sync (BOOT0 high? on USB power? replug it)")
|
||||||
|
|
||||||
|
def cmd(self, c):
|
||||||
|
self.s.write(bytes([c, c ^ 0xFF]))
|
||||||
|
return self._wait_ack("cmd 0x%02X" % c)
|
||||||
|
|
||||||
|
def get(self):
|
||||||
|
self.cmd(0x00)
|
||||||
|
n = self.s.read(1)[0]
|
||||||
|
data = self.s.read(n + 1)
|
||||||
|
self.s.read(1)
|
||||||
|
return data
|
||||||
|
|
||||||
|
def readable(self):
|
||||||
|
self.s.write(bytes([0x11, 0xEE]))
|
||||||
|
b = self.s.read(1)
|
||||||
|
if b == bytes([ACK]):
|
||||||
|
# send a dummy address so the bootloader doesn't hang mid-command
|
||||||
|
self._addr(FLASH); self.s.write(bytes([0, 0xFF])); self.s.read(1)
|
||||||
|
self.s.read(1)
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def _addr(self, addr):
|
||||||
|
a = addr.to_bytes(4, "big")
|
||||||
|
self.s.write(a + bytes([a[0] ^ a[1] ^ a[2] ^ a[3]]))
|
||||||
|
self._wait_ack("address 0x%08X" % addr)
|
||||||
|
|
||||||
|
def unprotect(self):
|
||||||
|
"""Readout-unprotect: mass-erase + drop RDP to 0. Erases factory firmware."""
|
||||||
|
self.s.write(bytes([0x92, 0x6D]))
|
||||||
|
self._wait_ack("readout-unprotect start")
|
||||||
|
self._wait_ack("readout-unprotect erase", tmo=6.0)
|
||||||
|
time.sleep(1.0) # chip resets; BOOT0 still high -> bootloader again
|
||||||
|
self.reopen(); self.sync()
|
||||||
|
|
||||||
|
def mass_erase(self):
|
||||||
|
self.s.write(bytes([0x44, 0xBB]))
|
||||||
|
self._wait_ack("ext-erase start")
|
||||||
|
self.s.write(bytes([0xFF, 0xFF, 0x00])) # 0xFFFF = global mass erase, cksum 0
|
||||||
|
self._wait_ack("mass erase", tmo=8.0)
|
||||||
|
|
||||||
|
def write(self, addr, data):
|
||||||
|
self.cmd(0x31)
|
||||||
|
self._addr(addr)
|
||||||
|
n = len(data) - 1
|
||||||
|
cs = n
|
||||||
|
for b in data:
|
||||||
|
cs ^= b
|
||||||
|
self.s.write(bytes([n]) + data + bytes([cs]))
|
||||||
|
self._wait_ack("write @0x%08X" % addr, tmo=3.0)
|
||||||
|
|
||||||
|
def read(self, addr, n):
|
||||||
|
self.cmd(0x11)
|
||||||
|
self._addr(addr)
|
||||||
|
self.s.write(bytes([n - 1, (n - 1) ^ 0xFF]))
|
||||||
|
self._wait_ack("read @0x%08X" % addr)
|
||||||
|
return self.s.read(n)
|
||||||
|
|
||||||
|
def go(self, addr):
|
||||||
|
self.cmd(0x21)
|
||||||
|
self._addr(addr)
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = [a for a in sys.argv[1:] if not a.startswith("--")]
|
||||||
|
port = "COM16"
|
||||||
|
if "--port" in sys.argv:
|
||||||
|
port = sys.argv[sys.argv.index("--port") + 1]
|
||||||
|
data = open(args[0], "rb").read()
|
||||||
|
if len(data) % 4:
|
||||||
|
data += b"\xFF" * (4 - len(data) % 4)
|
||||||
|
print("firmware %s: %d bytes" % (args[0], len(data)))
|
||||||
|
|
||||||
|
bl = BL(port)
|
||||||
|
bl.sync()
|
||||||
|
time.sleep(0.1)
|
||||||
|
bl.s.reset_input_buffer()
|
||||||
|
print("sync ok")
|
||||||
|
|
||||||
|
# Safety gate: the ROM bootloader auto-baud can come back garbled after a
|
||||||
|
# software jump. Prove the link is solid (several clean GETs) BEFORE erasing,
|
||||||
|
# so a flaky link aborts without wiping a working firmware.
|
||||||
|
good = 0
|
||||||
|
for _ in range(8):
|
||||||
|
try:
|
||||||
|
d = bl.get()
|
||||||
|
if len(d) >= 2 and d[1:].count(0x44) and d[1:].count(0x31):
|
||||||
|
good += 1
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
time.sleep(0.02)
|
||||||
|
if good < 8:
|
||||||
|
print("link not reliable (%d/8 clean) - aborting BEFORE erase." % good)
|
||||||
|
print("use the BOOT0 wire + a power-cycle for a clean ROM-bootloader link.")
|
||||||
|
return 2
|
||||||
|
print("link solid (%d/8)." % good)
|
||||||
|
|
||||||
|
# Erase. On an unlocked chip a mass-erase is enough; if it's still locked
|
||||||
|
# (factory RDP1) the erase NACKs, so fall back to readout-unprotect.
|
||||||
|
try:
|
||||||
|
bl.mass_erase()
|
||||||
|
print("mass-erased.")
|
||||||
|
except RuntimeError:
|
||||||
|
print("locked -> readout-unprotect (ERASES factory firmware)...")
|
||||||
|
bl.unprotect()
|
||||||
|
print("unlocked and erased.")
|
||||||
|
|
||||||
|
print("writing...")
|
||||||
|
for off in range(0, len(data), 256):
|
||||||
|
chunk = data[off:off + 256]
|
||||||
|
bl.write(FLASH + off, chunk)
|
||||||
|
print("verifying...")
|
||||||
|
bad = 0
|
||||||
|
for off in range(0, len(data), 256):
|
||||||
|
chunk = data[off:off + 256]
|
||||||
|
rb = bl.read(FLASH + off, len(chunk))
|
||||||
|
if rb != chunk:
|
||||||
|
bad += 1
|
||||||
|
print(" mismatch at +0x%X" % off)
|
||||||
|
if bad:
|
||||||
|
print("VERIFY FAILED (%d blocks)" % bad); return 1
|
||||||
|
print("verify OK. starting firmware...")
|
||||||
|
bl.go(FLASH)
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
"""Update the dongle application over USB via the permanent 'safeboot' stage 1.
|
||||||
|
No BOOT0 wire, no ST-Link, no ROM bootloader. Writes only the app region
|
||||||
|
(pages 4-15); safeboot itself is never touched.
|
||||||
|
|
||||||
|
usage: safeboot_flash.py app.bin [--port COM16] [--knock]
|
||||||
|
|
||||||
|
How it enters flash mode:
|
||||||
|
1) if the app is running, 'b' makes it soft-reset into safeboot flash mode;
|
||||||
|
2) otherwise (dead/absent app) replug the dongle and this spams 'S' to catch
|
||||||
|
safeboot's cold-boot knock window.
|
||||||
|
--knock skips 1) and keeps knocking for 2 minutes, reopening the port as it
|
||||||
|
comes and goes: start it, then replug. Use it when the app doesn't answer.
|
||||||
|
"""
|
||||||
|
import sys, time, serial
|
||||||
|
|
||||||
|
APP_BASE = 0x08001000
|
||||||
|
PORT = "COM16"
|
||||||
|
|
||||||
|
|
||||||
|
def open_port(port, open_timeout=20.0):
|
||||||
|
"""Retry the open to win the race against programs (SignalRGB) that grab
|
||||||
|
CH340 COM ports on enumeration. Once held, the handle stays ours."""
|
||||||
|
t = time.time()
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
return serial.Serial(port, 115200, timeout=0.3)
|
||||||
|
except serial.SerialException:
|
||||||
|
if time.time() - t > open_timeout:
|
||||||
|
raise
|
||||||
|
time.sleep(0.02)
|
||||||
|
|
||||||
|
|
||||||
|
def enter_flash(s):
|
||||||
|
# path 1: tell a running app to reset into safeboot
|
||||||
|
s.reset_input_buffer()
|
||||||
|
s.write(b"b")
|
||||||
|
t = time.time()
|
||||||
|
buf = b""
|
||||||
|
while time.time() - t < 1.5:
|
||||||
|
buf += s.read(64)
|
||||||
|
if b"SBF" in buf:
|
||||||
|
return True
|
||||||
|
time.sleep(0.05)
|
||||||
|
# path 2: knock (works during safeboot's cold-boot window, after a replug)
|
||||||
|
t = time.time()
|
||||||
|
while time.time() - t < 6.0:
|
||||||
|
s.write(b"S")
|
||||||
|
r = s.read(16)
|
||||||
|
if b"K" in r or b"SBF" in r or b"SB1" in r:
|
||||||
|
# drain, then confirm we're in flash mode
|
||||||
|
time.sleep(0.1); s.reset_input_buffer()
|
||||||
|
s.write(b"V"); time.sleep(0.1)
|
||||||
|
if b"SBV" in s.read(16):
|
||||||
|
return True
|
||||||
|
time.sleep(0.1)
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def knock_until_caught(port, timeout=120.0):
|
||||||
|
"""--knock: for an app that doesn't answer 'b' (dead or deaf). Keeps the
|
||||||
|
port open and spams 'S' for up to `timeout` s, reopening whenever the port
|
||||||
|
vanishes, so replugging the dongle at any moment lands in safeboot's 1.5 s
|
||||||
|
cold-boot knock window. Returns the open port in flash mode, or None."""
|
||||||
|
t = time.time()
|
||||||
|
s = None
|
||||||
|
while time.time() - t < timeout:
|
||||||
|
try:
|
||||||
|
if s is None:
|
||||||
|
s = serial.Serial(port, 115200, timeout=0.02)
|
||||||
|
s.write(b"S")
|
||||||
|
r = s.read(16)
|
||||||
|
if b"K" in r or b"SB1" in r or b"SBR" in r:
|
||||||
|
time.sleep(0.1); s.reset_input_buffer(); s.timeout = 0.3
|
||||||
|
s.write(b"V"); time.sleep(0.1)
|
||||||
|
if b"SBV" in s.read(16):
|
||||||
|
return s
|
||||||
|
s.timeout = 0.02
|
||||||
|
except (serial.SerialException, OSError):
|
||||||
|
try:
|
||||||
|
if s is not None:
|
||||||
|
s.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
s = None
|
||||||
|
time.sleep(0.02)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def expect(s, ch, what):
|
||||||
|
r = s.read(1)
|
||||||
|
if r != ch:
|
||||||
|
raise RuntimeError("%s: expected %r got %r" % (what, ch, r))
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = [a for a in sys.argv[1:] if not a.startswith("--")]
|
||||||
|
port = sys.argv[sys.argv.index("--port") + 1] if "--port" in sys.argv else PORT
|
||||||
|
data = open(args[0], "rb").read()
|
||||||
|
if len(data) % 2:
|
||||||
|
data += b"\xFF"
|
||||||
|
print("app %s: %d bytes -> 0x%08X" % (args[0], len(data), APP_BASE))
|
||||||
|
|
||||||
|
if "--knock" in sys.argv:
|
||||||
|
print("knock mode: replug the dongle now (waiting up to 2 min)...")
|
||||||
|
s = knock_until_caught(port)
|
||||||
|
if s is None:
|
||||||
|
print("no knock window caught")
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
s = open_port(port)
|
||||||
|
print("entering safeboot flash mode...")
|
||||||
|
if not enter_flash(s):
|
||||||
|
print("could not enter flash mode (app not running? replug and retry with --knock)")
|
||||||
|
return 1
|
||||||
|
s.reset_input_buffer()
|
||||||
|
s.write(b"V"); time.sleep(0.1)
|
||||||
|
print("safeboot:", s.read(16).decode("ascii", "replace").strip())
|
||||||
|
|
||||||
|
print("erasing app region...")
|
||||||
|
s.write(b"E"); s.timeout = 3.0; expect(s, b"K", "erase"); s.timeout = 0.5
|
||||||
|
|
||||||
|
print("writing...")
|
||||||
|
for off in range(0, len(data), 128):
|
||||||
|
chunk = data[off:off + 128]
|
||||||
|
addr = APP_BASE + off
|
||||||
|
s.write(b"W" + addr.to_bytes(4, "little") + bytes([len(chunk)]) + chunk)
|
||||||
|
expect(s, b"K", "write @0x%08X" % addr)
|
||||||
|
|
||||||
|
print("verifying...")
|
||||||
|
bad = 0
|
||||||
|
for off in range(0, len(data), 128):
|
||||||
|
chunk = data[off:off + 128]
|
||||||
|
addr = APP_BASE + off
|
||||||
|
s.write(b"R" + addr.to_bytes(4, "little") + bytes([len(chunk)]))
|
||||||
|
rb = s.read(len(chunk))
|
||||||
|
if rb != chunk:
|
||||||
|
bad += 1
|
||||||
|
print(" mismatch @0x%08X" % addr)
|
||||||
|
if bad:
|
||||||
|
print("VERIFY FAILED (%d blocks)" % bad); return 1
|
||||||
|
|
||||||
|
print("verify OK; booting app.")
|
||||||
|
s.write(b"G"); expect(s, b"K", "go")
|
||||||
|
time.sleep(0.3)
|
||||||
|
print(s.read(256).decode("ascii", "replace").strip())
|
||||||
|
s.close()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
||||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
|||||||
|
newmtl mtl1
|
||||||
|
Ka 0.62 0.62 0.36
|
||||||
|
Kd 0.62 0.62 0.36
|
||||||
|
Ks 0.00 0.00 0.00
|
||||||
|
endmtl
|
||||||
Binary file not shown.
@@ -0,0 +1,315 @@
|
|||||||
|
{
|
||||||
|
"head": {
|
||||||
|
"docType": "3",
|
||||||
|
"editorVersion": "6.5.61",
|
||||||
|
"bindSCHId": [
|
||||||
|
"cf39ffd262df437f9c6c38dcd7f40de8"
|
||||||
|
],
|
||||||
|
"c_para": {},
|
||||||
|
"hasIdFlag": true,
|
||||||
|
"x": "4000",
|
||||||
|
"y": "3000",
|
||||||
|
"importFlag": 0,
|
||||||
|
"transformList": ""
|
||||||
|
},
|
||||||
|
"canvas": "CA~1000~1000~#000000~yes~#FFFFFF~10~1000~1000~line~3.937008~mm~2.3622~45~visible~0.5~4000~3000~1~yes",
|
||||||
|
"shape": [
|
||||||
|
"TRACK~2.3622~2~GND~4125.9843 3020.79 4138.9002 3020.79 4145.6693 3027.5591 4145.6693 3035.4067 4129.921 3051.155~gge609~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_39~4099.37 3129.37 4110.36 3140.36 4110.36 3173.35 4111.63 3174.62 4111.63 3193.92 4110.36 3195.19 4110.36 3232.41 4129.92 3251.97~gge594~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_36~4099.37 3159.37 4084.37 3174.38~gge589~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_37~4099.37 3149.37 4107.2 3157.2 4107.2 3174.43 4108.63 3175.86 4108.63 3192.68 4107.2 3194.11 4107.2 3274.42 4090.37 3291.25 4090.37 3299.39 4085.55 3304.21~gge585~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_8~4039.37 3109.37 4021.13 3127.61 4021.13 3148.14 4015.75 3153.52~gge584~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_46~4099.37 3059.37 4094.19 3064.55 4094.19 3071.48 4091.31 3074.37 4087.19 3074.37 4046.71 3114.85 4046.71 3181.75 4054.57 3189.61 4055.98 3189.61~gge581~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_7~4039.37 3099.37 4015.75 3122.99 4015.75 3145.72~gge579~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_31~4099.37 3209.37 4104.19 3214.19 4104.19 3272.69 4085.55 3291.33 4085.55 3294.21~gge577~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_28~4099.37 3239.37 4094.38 3234.38 4094.38 3196.98 4096.98 3194.37 4101.26 3194.37 4105.61 3190.03 4105.61 3182.49~gge575~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_41~4055.98 3169.61 4057.92 3169.61 4094.19 3133.34 4094.19 3114.55 4099.37 3109.37~gge573~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_14~4039.37 3169.37 4033.79 3174.95 4033.79 3191.11 4037.06 3194.37 4041.51 3194.37 4061.69 3214.55 4071.99 3214.55 4074.37 3216.93 4074.37 3275.79 4080.55 3281.97 4080.55 3306.08 4083.84 3309.37 4097.26 3309.37 4100.55 3306.08 4100.55 3299.22 4105.55 3294.21~gge572~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_48~4099.37 3039.37 4094.37 3044.37 4094.37 3051.78 4079.27 3066.88 4073.38 3066.88~gge571~0",
|
||||||
|
"TRACK~2.3622~2~7805_2~4060.48 3062.21 4059.52 3061.25 4059.52 3041.91 4061.87 3039.56~gge568~0",
|
||||||
|
"TRACK~2.3622~2~7805_2~4060.48 3066.98 4060.48 3062.21~gge567~0",
|
||||||
|
"TRACK~2.3622~2~7805_2~4061.87 3034.04 4061.87 3039.56~gge566~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_42~4099.37 3099.37 4114.44 3114.44 4114.44 3141.99 4129.92 3157.48~gge565~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_29~4113.46 3199.93 4129.92 3183.47 4129.92 3173.18~gge562~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_45~4099.37 3069.37 4119.61 3069.37 4129.92 3059.06~gge561~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_44~4099.37 3079.37 4117.51 3079.37 4129.92 3066.96~gge560~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_43~4099.37 3089.37 4115.31 3089.37 4129.92 3074.76~gge559~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_10~4039.37 3129.37 4027.67 3141.07 4027.67 3224.35 4015.75 3236.27~gge558~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_9~4039.37 3119.37 4024.67 3134.08 4024.67 3152.5 4015.75 3161.42~gge557~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_6~4039.37 3089.37 4026.96 3076.96 4026.96 3070.27 4015.75 3059.06~gge556~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_5~4039.37 3079.37 4039.37 3078.43 4027.82 3066.88 4027.82 3063.23 4015.75 3051.16~gge555~0",
|
||||||
|
"TRACK~2.3622~2~TEENSY-3_4~4039.37 3069.37 4039.37 3066.98 4015.75 3043.36~gge554~0",
|
||||||
|
"TRACK~2.3622~2~GND~4055.98 3179.61 4099.13 3179.61 4099.37 3179.37~gge553~0",
|
||||||
|
"TRACK~2.3622~2~GND~4075.55 3294.21 4070.18 3294.21~gge551~0",
|
||||||
|
"TRACK~2.3622~2~GND~4043.27 3295.28 4046.96 3295.28 4048.03 3294.21~gge549~0",
|
||||||
|
"TRACK~2.3622~2~GND~4048.03 3294.21 4048.03 3292.15 4015.75 3259.87~gge548~0",
|
||||||
|
"TRACK~2.3622~2~GND~4057.87 3005.34 4057.87 3020.87 4039.37 3039.37~gge547~0",
|
||||||
|
"TRACK~2.3622~2~GND~4070.87 3005.34 4057.87 3005.34~gge546~0",
|
||||||
|
"TRACK~2.3622~2~GND~4129.92 3051.16 4134.99 3046.09 4134.99 3040.77 4099.56 3005.34 4070.87 3005.34~gge540~0",
|
||||||
|
"TRACK~2.3622~2~VCC~4079.87 3034.04 4079.87 3036.8~gge533~0",
|
||||||
|
"TRACK~2.3622~2~VCC~4079.87 3036.8 4082.63 3034.04 4120.61 3034.04 4129.92 3043.36~gge532~0",
|
||||||
|
"TRACK~2.3622~2~VCC~4015.75 3177.12 4010.72 3172.09 4010.72 3119.01 4035.36 3094.37~gge530~0",
|
||||||
|
"TRACK~2.3622~2~VCC~4079.87 3036.8 4069.37 3047.3 4069.37 3071.19 4051.37 3089.19 4047.05 3089.19 4041.87 3094.37 4035.36 3094.37~gge529~0",
|
||||||
|
"TRACK~2.3622~2~VCC~4035.36 3094.37 4015.75 3074.76~gge528~0",
|
||||||
|
"COPPERAREA~1~2~GND~M 3968.504 2964.567 L 4200.787 2960.63 L 4185.039 3370.079 L 3972.441 3370.0788 Z~1~solid~gge39~spoke~none~[[\"M 3980.735 3330.6887 L 3980.58193 3330.65825 3980.45216 3330.57154 3980.36545 3330.44177 3980.335 3330.2887 3980.335 2980.735 3980.36545 2980.58193 3980.45216 2980.45216 3980.58193 2980.36545 3980.735 2980.335 4160.9973 2980.335 4161.15037 2980.36545 4161.28014 2980.45216 4161.36685 2980.58193 4161.3973 2980.735 4161.3973 3330.2887 4161.36685 3330.44177 4161.28014 3330.57154 4161.15037 3330.65825 4160.9973 3330.6887 3980.735 3330.6887 Z M 4019.48659 3258.0435 L 4019.35858 3257.78393 4019.0556 3257.33049 4018.69603 3256.92047 4018.28601 3256.5609 4017.82235 3256.25109 4017.71199 3256.14073 4017.65226 3255.99654 4017.65226 3255.84046 4017.71199 3255.69627 4017.82235 3255.58591 4018.28601 3255.2761 4018.69603 3254.91653 4019.0556 3254.50651 4019.35858 3254.05307 4019.59978 3253.56396 4019.77508 3253.04755 4019.88147 3252.51268 4019.91714 3251.9685 4019.88147 3251.42432 4019.77508 3250.88945 4019.59978 3250.37304 4019.35858 3249.88393 4019.0556 3249.43049 4018.69603 3249.02047 4018.28601 3248.6609 4017.82235 3248.35109 4017.71199 3248.24073 4017.65226 3248.09654 4017.65226 3247.94046 4017.71199 3247.79627 4017.82235 3247.68591 4018.28601 3247.3761 4018.69603 3247.01653 4019.0556 3246.60651 4019.35858 3246.15307 4019.59978 3245.66396 4019.77508 3245.14755 4019.88147 3244.61268 4019.91714 3244.0685 4019.88147 3243.52432 4019.77508 3242.98945 4019.59978 3242.47304 4019.35858 3241.98393 4019.0556 3241.53049 4018.69603 3241.12047 4018.28601 3240.7609 4017.89718 3240.50109 4017.78682 3240.39073 4017.72709 3240.24654 4017.72709 3240.09046 4017.78682 3239.94627 4017.89718 3239.83591 4018.28601 3239.5761 4018.69603 3239.21653 4019.0556 3238.80651 4019.35858 3238.35307 4019.59978 3237.86396 4019.77508 3237.34755 4019.88147 3236.81268 4019.91714 3236.2685 4019.88147 3235.72432 4019.84472 3235.53952 4019.84045 3235.40927 4019.87828 3235.28457 4019.95419 3235.17864 4029.22024 3225.91258 4029.35585 3225.76459 4029.47272 3225.61228 4029.57588 3225.45036 4029.66453 3225.28006 4029.738 3225.10269 4029.79573 3224.91959 4029.83729 3224.73215 4029.86234 3224.54181 4029.8711 3224.34127 4029.8711 3142.14741 4029.90155 3141.99434 4029.98826 3141.86457 4038.40219 3133.45064 4038.55067 3133.35672 4038.72507 3133.33549 4039.2357 3133.38686 4039.7723 3133.36892 4040.30171 3133.27962 4040.8145 3133.12055 4041.30151 3132.89455 4041.75405 3132.60566 4042.16405 3132.25903 4042.52419 3131.86084 4042.82804 3131.4182 4043.07019 3130.93902 4043.2463 3130.43183 4043.35324 3129.90569 4043.3891 3129.37 4043.35324 3128.83431 4043.2463 3128.30817 4043.07019 3127.80098 4042.82804 3127.3218 4042.52419 3126.87916 4042.16405 3126.48097 4041.75405 3126.13434 4041.30151 3125.84545 4040.8145 3125.61945 4040.30171 3125.46038 4039.7723 3125.37108 4039.2357 3125.35314 4038.7015 3125.40688 4038.17924 3125.53134 4037.67822 3125.72431 4037.20739 3125.98233 4036.77515 3126.3008 4036.38922 3126.67405 4036.05648 3127.0954 4035.78287 3127.55734 4035.57328 3128.05163 4035.43143 3128.56945 4035.35987 3129.10155 4035.35987 3129.63845 4035.40803 3129.99657 4035.40565 3130.11861 4035.36658 3130.23426 4035.29445 3130.33273 4027.55394 3138.07323 4027.42417 3138.15994 4027.2711 3138.19039 4027.11803 3138.15994 4026.98826 3138.07323 4026.90155 3137.94346 4026.8711 3137.79039 4026.8711 3135.15689 4026.90152 3135.00388 4026.98816 3134.87415 4038.40365 3123.45089 4038.55216 3123.3569 4038.72663 3123.33565 4039.2357 3123.38686 4039.7723 3123.36892 4040.30171 3123.27962 4040.8145 3123.12055 4041.30151 3122.89455 4041.75405 3122.60566 4042.16405 3122.25903 4042.52419 3121.86084 4042.82804 3121.4182 4043.07019 3120.93902 4043.2463 3120.43183 4043.35324 3119.90569 4043.3891 3119.37 4043.35324 3118.83431 4043.2463 3118.30817 4043.07019 3117.80098 4042.82804 3117.3218 4042.52419 3116.87916 4042.16405 3116.48097 4041.75405 3116.13434 4041.30151 3115.84545 4040.8145 3115.61945 4040.30171 3115.46038 4039.7723 3115.37108 4039.2357 3115.35314 4038.7015 3115.40688 4038.17924 3115.53134 4037.67822 3115.72431 4037.20739 3115.98233 4036.77515 3116.3008 4036.38922 3116.67405 4036.05648 3117.0954 4035.78287 3117.55734 4035.57328 3118.05163 4035.43143 3118.56945 4035.35987 3119.10155 4035.35987 3119.63845 4035.40824 3119.99808 4035.40586 3120.12008 4035.36682 3120.23569 4035.29474 3120.33414 4024.01404 3131.62252 4023.88428 3131.70928 4023.73119 3131.73978 4023.57809 3131.70935 4023.44829 3131.62265 4023.36156 3131.49287 4023.3311 3131.33978 4023.3311 3128.68741 4023.36155 3128.53434 4023.44826 3128.40457 4038.40219 3113.45064 4038.55067 3113.35672 4038.72507 3113.33549 4039.2357 3113.38686 4039.7723 3113.36892 4040.30171 3113.27962 4040.8145 3113.12055 4041.30151 3112.89455 4041.75405 3112.60566 4042.16405 3112.25903 4042.52419 3111.86084 4042.82804 3111.4182 4043.07019 3110.93902 4043.2463 3110.43183 4043.35324 3109.90569 4043.3891 3109.37 4043.35324 3108.83431 Line truncated
|
||||||
|
"TEXT~L~4026.23~3294.614~0.8~0~1~4~~8~+~M 4022.9551 3291.3386 L 4022.9551 3297.8886 M 4026.2251 3294.6186 L 4019.6851 3294.6186~~gge40~~0~",
|
||||||
|
"TEXT~L~4057.73~3295.271~0.8~0~1~4~~8~-~M 4057.731 3295.2756 L 4051.181 3295.2756~~gge41~~0~",
|
||||||
|
"TEXT~L~4010.482~3267.055~0.8~0~1~4~~8~+~M 4007.2069 3263.7794 L 4007.2069 3270.3294 M 4010.4769 3267.0594 L 4003.9369 3267.0594~~gge42~~0~",
|
||||||
|
"TEXT~L~4010.482~3176.504~0.8~0~1~4~~8~+~M 4007.207 3173.2283 L 4007.207 3179.7783 M 4010.477 3176.5083 L 4003.937 3176.5083~~gge43~~0~",
|
||||||
|
"TEXT~L~4010.482~3074.142~0.8~0~1~4~~8~+~M 4007.2069 3070.8661 L 4007.2069 3077.4161 M 4010.4769 3074.1461 L 4003.9369 3074.1461~~gge44~~0~",
|
||||||
|
"TEXT~L~4140.403~3042.646~0.8~0~1~4~~8~+~M 4137.1285 3039.3702 L 4137.1285 3045.9202 M 4140.3985 3042.6502 L 4133.8585 3042.6502~~gge45~~0~",
|
||||||
|
"TEXT~L~4144.34~3141.071~0.8~0~1~4~~8~+~M 4141.0651 3137.7952 L 4141.0651 3144.3452 M 4144.3351 3141.0752 L 4137.7951 3141.0752~~gge46~~0~",
|
||||||
|
"TEXT~L~4140.403~3235.559~0.8~0~1~4~~8~+~M 4137.1285 3232.2834 L 4137.1285 3238.8334 M 4140.3985 3235.5634 L 4133.8585 3235.5634~~gge47~~0~",
|
||||||
|
"TRACK~1~10~S$1763~3980.315 2980.315 4161.4173 2980.315 4161.4173 3330.7087 3980.315 3330.7087 3980.315 2980.315~gge362~0",
|
||||||
|
"TRACK~2.3622~1~GND~4118.1 3020.79 4125.9843 3020.79~gge602~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_40~4055.98 3159.61 4059.13 3159.61 4099.37 3119.37~gge595~0",
|
||||||
|
"TRACK~2.3622~1~510_2~4103.94 3009.85 4100.29 3013.5 4098.8 3013.5~gge593~0",
|
||||||
|
"TRACK~2.3622~1~510_2~4103.94 3003.94 4103.94 3009.85~gge592~0",
|
||||||
|
"TRACK~2.3622~1~510_2~4098.8 3020.79 4098.8 3013.5~gge591~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_36~4095.55 3294.21 4084.37 3283.03 4084.37 3174.38~gge588~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_12~4039.37 3149.37 4028.24 3160.51 4028.24 3239.48 4015.75 3251.97~gge587~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_11~4039.37 3139.37 4024.38 3154.36 4024.38 3235.43 4015.75 3244.07~gge586~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_13~4039.37 3159.37 4045.65 3165.65 4045.65 3197.17 4054.29 3205.81 4054.29 3289.93 4073.93 3309.57 4090.19 3309.57 4095.55 3304.21~gge583~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_46~4055.98 3189.61 4060.93 3194.55 4071.85 3194.55 4074.37 3197.07 4074.37 3275.79 4080.56 3281.97 4080.56 3299.21 4075.55 3304.21~gge582~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_38~4099.37 3139.37 4093.79 3144.95 4093.79 3181.11 4097.06 3184.37 4102.18 3184.37 4118.27 3200.47 4118.27 3248.22 4129.92 3259.87~gge580~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_30~4099.37 3219.37 4114.29 3234.29 4114.29 3252.04 4129.92 3267.67~gge578~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_28~4129.92 3165.38 4112.82 3182.49 4105.61 3182.49~gge574~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_48~4116.54 3009.85 4111.21 3015.18 4111.21 3027.53 4099.37 3039.37~gge570~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_48~4116.54 3003.94 4116.54 3009.85~gge569~0",
|
||||||
|
"TRACK~2.3622~1~TEENSY-3_29~4099.37 3229.37 4094.55 3224.55 4094.55 3217.26 4097.44 3214.37 4101.6 3214.37 4113.46 3202.52 4113.46 3199.93~gge563~0",
|
||||||
|
"COPPERAREA~1~1~VCC~M 3972.441 3370.0791 L 3960.63 2972.441 L 4173.228 2960.63 L 4188.976 3366.142 Z~1~solid~gge78~spoke~none~[[\"M 3980.735 3330.6887 L 3980.58193 3330.65825 3980.45216 3330.57154 3980.36545 3330.44177 3980.335 3330.2887 3980.335 2980.735 3980.36545 2980.58193 3980.45216 2980.45216 3980.58193 2980.36545 3980.735 2980.335 4160.9973 2980.335 4161.15037 2980.36545 4161.28014 2980.45216 4161.36685 2980.58193 4161.3973 2980.735 4161.3973 3330.2887 4161.36685 3330.44177 4161.28014 3330.57154 4161.15037 3330.65825 4160.9973 3330.6887 3980.735 3330.6887 Z M 4073.73819 3311.76234 L 4073.93873 3311.7711 4090.18127 3311.7711 4090.38181 3311.76234 4090.57215 3311.73729 4090.75959 3311.69573 4090.94269 3311.638 4091.12006 3311.56453 4091.29036 3311.47588 4091.45228 3311.37272 4091.60459 3311.25585 4091.75258 3311.12024 4094.58726 3308.28557 4094.68573 3308.21343 4094.80137 3308.17436 4094.92342 3308.17198 4095.28145 3308.22013 4095.81835 3308.22013 4096.35045 3308.14857 4096.86827 3308.00672 4097.36256 3307.79713 4097.8245 3307.52352 4098.24585 3307.19078 4098.6191 3306.80485 4098.93757 3306.37261 4099.19559 3305.90178 4099.38856 3305.40076 4099.51302 3304.8785 4099.56676 3304.3443 4099.54882 3303.8077 4099.45952 3303.27829 4099.30045 3302.7655 4099.07445 3302.27849 4098.78556 3301.82595 4098.43893 3301.41595 4098.04074 3301.05581 4097.5981 3300.75196 4097.11892 3300.50981 4096.61173 3300.3337 4096.08559 3300.22676 4095.5499 3300.1909 4095.01421 3300.22676 4094.48807 3300.3337 4093.98088 3300.50981 4093.5017 3300.75196 4093.05906 3301.05581 4092.66087 3301.41595 4092.31424 3301.82595 4092.02535 3302.27849 4091.79935 3302.7655 4091.64028 3303.27829 4091.55098 3303.8077 4091.53304 3304.3443 4091.58442 3304.85502 4091.56319 3305.02942 4091.46927 3305.1779 4089.39543 3307.25174 4089.26566 3307.33845 4089.11259 3307.3689 4088.99507 3307.3689 4088.82428 3307.3306 4088.68619 3307.22304 4088.60724 3307.06682 4088.60257 3306.89185 4088.67305 3306.73163 4088.93757 3306.37261 4089.19559 3305.90178 4089.38856 3305.40076 4089.51302 3304.8785 4089.56676 3304.3443 4089.54882 3303.8077 4089.45952 3303.27829 4089.30045 3302.7655 4089.07445 3302.27849 4088.78556 3301.82595 4088.43893 3301.41595 4088.04074 3301.05581 4087.5981 3300.75196 4087.11892 3300.50981 4086.61173 3300.3337 4086.08559 3300.22676 4085.5499 3300.1909 4085.01421 3300.22676 4084.48807 3300.3337 4083.98088 3300.50981 4083.5017 3300.75196 4083.05906 3301.05581 4082.66087 3301.41595 4082.31424 3301.82595 4082.02535 3302.27849 4081.79935 3302.7655 4081.64028 3303.27829 4081.55098 3303.8077 4081.53304 3304.3443 4081.58678 3304.8785 4081.71124 3305.40076 4081.90421 3305.90178 4082.16223 3306.37261 4082.42675 3306.73163 4082.49723 3306.89185 4082.49256 3307.06682 4082.41361 3307.22304 4082.27552 3307.3306 4082.10473 3307.3689 4078.99507 3307.3689 4078.82428 3307.3306 4078.68619 3307.22304 4078.60724 3307.06682 4078.60257 3306.89185 4078.67305 3306.73163 4078.93757 3306.37261 4079.19559 3305.90178 4079.38856 3305.40076 4079.51302 3304.8785 4079.56676 3304.3443 4079.54882 3303.8077 4079.51405 3303.60159 4079.51302 3303.475 4079.55159 3303.35442 4079.62592 3303.25193 4082.10861 3300.7742 4082.24598 3300.62444 4082.36135 3300.47424 4082.46598 3300.31019 4082.55351 3300.14224 4082.62807 3299.9625 4082.68511 3299.7819 4082.72732 3299.59195 4082.75213 3299.40419 4082.7611 3299.20117 4082.7611 3297.92078 4082.79605 3297.75727 4082.89478 3297.62233 4083.04004 3297.53954 4083.20646 3297.52336 4083.36495 3297.57662 4083.73724 3297.79713 4084.23153 3298.00672 4084.74935 3298.14857 4085.28145 3298.22013 4085.81835 3298.22013 4086.35045 3298.14857 4086.86827 3298.00672 4087.36256 3297.79713 4087.8245 3297.52352 4088.24585 3297.19078 4088.6191 3296.80485 4088.93757 3296.37261 4089.19559 3295.90178 4089.38856 3295.40076 4089.51302 3294.8785 4089.56676 3294.3443 4089.54882 3293.8077 4089.45952 3293.27829 4089.30045 3292.7655 4089.07445 3292.27849 4088.78556 3291.82595 4088.43893 3291.41595 4088.04074 3291.05581 4087.5981 3290.75196 4087.11892 3290.50981 4086.61173 3290.3337 4086.08559 3290.22676 4085.5499 3290.1909 4085.01421 3290.22676 4084.48807 3290.3337 4083.98088 3290.50981 4083.5017 3290.75196 4083.38748 3290.83036 4083.22763 3290.89501 4083.05542 3290.88637 4082.90285 3290.80605 4082.79826 3290.66896 4082.7611 3290.50059 4082.7611 3285.49961 4082.79155 3285.34654 4082.87826 3285.21677 4083.00803 3285.13006 4083.1611 3285.09961 4083.31417 3285.13006 4083.44394 3285.21677 4091.47492 3293.24774 4091.54908 3293.35018 4091.58756 3293.47065 4091.5865 3293.59712 4091.55098 3293.8077 4091.53304 3294.3443 4091.58678 3294.8785 4091.71124 3295.40076 4091.90421 3295.90178 4092.16223 3296.37261 4092.4807 3296.80485 4092.85395 3297.19078 4093.2753 3297.52352 4093.73724 3297.79713 4094.23153 3298.00672 4094.74935 3298.14857 4095.28145 3298.22013 4095.81835 3298.22013 4096.35045 3298.14857 4096.86827 3298.00672 4097.36256 3297.79713 4097.8245 3297.52352 4098.24585 3297.19078 4098.Line truncated
|
||||||
|
"SVGNODE~{\"gId\":\"gge356\",\"nodeName\":\"path\",\"nodeType\":1,\"layerid\":\"3\",\"attrs\":{\"d\":\"M 4078.7402 3141.7323 C 4078.6968 3141.811 4078.2895 3142.8971 4077.8349 3144.1458 C 4077.3804 3145.3945 4076.8613 3146.7321 4076.6815 3147.1183 C 4076.377 3147.7723 4076.1002 3149.5961 4075.3607 3155.8209 C 4075.1676 3157.446 4075.1585 3157.4694 4074.7199 3157.4694 C 4074.1975 3157.4694 4074.0037 3157.2493 4073.7778 3156.4001 C 4072.4701 3151.4822 4070.6475 3147.3703 4068.9553 3145.52 C 4068.4218 3144.9368 4067.9255 3144.4595 4067.8523 3144.4595 C 4067.7115 3144.4595 4068.4283 3145.9658 4068.7852 3146.4199 C 4068.9008 3146.567 4069.3621 3147.4892 4069.8104 3148.4694 C 4070.2587 3149.4496 4070.8106 3150.548 4071.037 3150.9102 C 4071.4434 3151.5607 4072.6088 3155.9513 4072.6088 3156.8321 C 4072.6088 3157.1926 4072.4968 3157.29 4071.9176 3157.4332 C 4071.5374 3157.5272 4071.0983 3157.6625 4070.9417 3157.734 C 4070.7701 3157.8123 4070.6571 3157.7852 4070.6571 3157.6656 C 4070.6571 3157.2357 4068.3581 3154.8453 4067.7537 3154.6469 C 4067.4217 3154.5379 4066.2741 3153.8745 4065.2035 3153.1727 C 4063.079 3151.7801 4063.1847 3151.8104 4059.3536 3151.4974 C 4057.0855 3151.3121 4057.849 3151.6744 4060.6547 3152.1148 C 4062.2984 3152.3727 4063.2753 3152.6145 4063.6489 3152.8557 C 4064.4812 3153.3931 4067.2656 3155.7263 4067.3449 3155.9529 C 4067.383 3156.0617 4067.9611 3156.6609 4068.6297 3157.2846 C 4070.0893 3158.6462 4070.0764 3158.8332 4068.5888 3157.8777 C 4066.4697 3156.5165 4066.1357 3156.456 4065.0863 3157.243 C 4064.6169 3157.595 4063.7772 3158.2225 4063.2204 3158.6376 C 4061.963 3159.5747 4059.3071 3161.0676 4058.1886 3161.4659 C 4057.7268 3161.6303 4057.3068 3161.8853 4057.2553 3162.0324 C 4057.0643 3162.5778 4056.8073 3169.8099 4056.9725 3169.9909 C 4057.2223 3170.2646 4057.4409 3169.0507 4057.5585 3166.7367 C 4057.7222 3163.5167 4057.6843 3163.626 4058.8417 3163.0325 C 4059.8445 3162.5182 4061.8292 3161.1437 4063.5009 3159.8058 C 4063.9929 3159.412 4064.8177 3158.7987 4065.3337 3158.4429 L 4066.272 3157.7959 L 4066.9865 3158.2547 C 4067.3795 3158.5071 4067.9233 3158.9185 4068.1949 3159.1689 L 4068.6887 3159.6243 L 4068.0658 3160.6803 C 4066.6605 3163.0629 4066.6285 3166.9129 4067.9992 3168.6979 C 4069.6854 3170.8938 4074.3469 3169.1106 4076.2708 3165.5337 C 4076.61 3164.903 4076.6449 3164.8828 4076.9873 3165.1203 C 4077.2376 3165.2939 4077.2935 3165.0743 4075.9634 3169.1426 C 4075.6429 3170.1228 4075.3791 3171.1731 4075.3772 3171.4767 C 4075.3753 3171.7803 4075.0397 3172.9832 4074.6316 3174.1499 C 4072.7027 3179.6636 4072.2953 3180.8882 4072.3648 3180.9643 C 4072.4708 3181.0804 4075.1561 3174.7823 4075.7716 3172.9742 C 4075.8883 3172.6312 4076.1311 3172.0698 4076.3111 3171.7267 C 4076.6514 3171.0781 4077.5166 3166.5069 4077.5502 3165.1806 C 4077.5649 3164.6006 4077.6256 3164.4443 4077.8133 3164.5038 C 4077.9474 3164.5463 4078.2488 3164.6311 4078.4829 3164.6921 C 4079.0501 3164.8399 4079.3789 3165.3622 4080.6371 3168.1134 C 4081.2214 3169.3912 4081.9177 3170.6985 4082.1845 3171.0185 C 4082.482 3171.3754 4082.8403 3172.1758 4083.1114 3173.0892 C 4083.6135 3174.7803 4083.7383 3174.9532 4083.5752 3173.7317 C 4083.3325 3171.9129 4082.5268 3169.5133 4081.6457 3167.9842 C 4080.8523 3166.6073 4080.2452 3165.3147 4079.79 3164.033 C 4079.6426 3163.6178 4079.5004 3163.5409 4078.6765 3163.4315 C 4077.0941 3163.2213 4077.0176 3163.2746 4081.5947 3161.3974 C 4082.6231 3160.9755 4082.9524 3160.9112 4083.3837 3161.0477 C 4083.6744 3161.1397 4084.5344 3161.3412 4085.2947 3161.4955 C 4089.0366 3162.2549 4090.8282 3162.9601 4091.8263 3164.0663 C 4092.3325 3164.6273 4092.8996 3165.3976 4093.0865 3165.7779 C 4093.4023 3166.4204 4093.4193 3166.4315 4093.3265 3165.9347 C 4093.0969 3164.7049 4091.5448 3162.165 4090.9325 3162.017 C 4090.7389 3161.9703 4089.7144 3161.7243 4088.6557 3161.4705 C 4087.597 3161.2167 4086.1355 3160.7339 4085.4078 3160.3976 C 4083.6923 3159.6048 4083.1347 3159.6179 4080.4525 3160.5139 C 4079.2543 3160.9141 4078.2346 3161.1984 4078.1865 3161.1457 C 4078.1384 3161.0929 4078.714 3160.184 4079.4657 3159.1259 C 4080.2173 3158.0678 4081.4146 3156.3379 4082.1262 3155.2817 C 4083.2677 3153.5876 4083.497 3153.3399 4084.0728 3153.1794 C 4085.8289 3152.6897 4086.7535 3152.2714 4089.6624 3150.6503 L 4092.8104 3148.8961 L 4094.3389 3150.5473 C 4096.9903 3153.4114 4096.9174 3152.7811 4094.2515 3149.7911 L 4092.8575 3148.2276 L 4090.0926 3149.5383 C 4087.5529 3150.7423 4085.2791 3151.6403 4083.5585 3152.1188 C 4082.9834 3152.2787 4082.7603 3152.4905 4082.1021 3153.5013 C 4081.252 3154.8067 4078.347 3158.6707 4077.9446 3159.0312 C 4077.7329 3159.2209 4077.5865 3159.1394 4077.0148 3158.5129 L 4076.3362 3157.7693 L 4076.5066 3155.258 C 4076.9507 3148.7121 4077.0179 3148.167 4077.4965 3147.2219 C 4077.7447 3146.7318 4078.1544 3145.6892 4078.4071 3144.9051 L 4078.8664 3143.4793 L 4079.094 3145.3061 C 4079.3727 3147.5437 4079.6084 3147.6721 4079.5848 3145.5734 C 4079.5562 3143.0403 4079.1178 3141.0464 4078.7402 3141.Line truncated
|
||||||
|
"TEXT~L~4003.933~3012.242~0.8~0~0~3~~8~Hexapod v1~M 4003.937 3007.874 L 4003.937 3015.514 M 4009.027 3007.874 L 4009.027 3015.514 M 4003.937 3011.514 L 4009.027 3011.514 M 4011.427 3012.604 L 4015.787 3012.604 L 4015.787 3011.874 L 4015.427 3011.154 L 4015.057 3010.784 L 4014.337 3010.424 L 4013.237 3010.424 L 4012.517 3010.784 L 4011.787 3011.514 L 4011.427 3012.604 L 4011.427 3013.334 L 4011.787 3014.424 L 4012.517 3015.154 L 4013.237 3015.514 L 4014.337 3015.514 L 4015.057 3015.154 L 4015.787 3014.424 M 4018.187 3010.424 L 4022.187 3015.514 M 4022.187 3010.424 L 4018.187 3015.514 M 4028.947 3010.424 L 4028.947 3015.514 M 4028.947 3011.514 L 4028.227 3010.784 L 4027.497 3010.424 L 4026.407 3010.424 L 4025.677 3010.784 L 4024.947 3011.514 L 4024.587 3012.604 L 4024.587 3013.334 L 4024.947 3014.424 L 4025.677 3015.154 L 4026.407 3015.514 L 4027.497 3015.514 L 4028.227 3015.154 L 4028.947 3014.424 M 4031.347 3010.424 L 4031.347 3018.064 M 4031.347 3011.514 L 4032.077 3010.784 L 4032.807 3010.424 L 4033.897 3010.424 L 4034.627 3010.784 L 4035.347 3011.514 L 4035.717 3012.604 L 4035.717 3013.334 L 4035.347 3014.424 L 4034.627 3015.154 L 4033.897 3015.514 L 4032.807 3015.514 L 4032.077 3015.154 L 4031.347 3014.424 M 4039.937 3010.424 L 4039.207 3010.784 L 4038.477 3011.514 L 4038.117 3012.604 L 4038.117 3013.334 L 4038.477 3014.424 L 4039.207 3015.154 L 4039.937 3015.514 L 4041.027 3015.514 L 4041.747 3015.154 L 4042.477 3014.424 L 4042.837 3013.334 L 4042.837 3012.604 L 4042.477 3011.514 L 4041.747 3010.784 L 4041.027 3010.424 L 4039.937 3010.424 M 4049.607 3007.874 L 4049.607 3015.514 M 4049.607 3011.514 L 4048.877 3010.784 L 4048.147 3010.424 L 4047.057 3010.424 L 4046.337 3010.784 L 4045.607 3011.514 L 4045.237 3012.604 L 4045.237 3013.334 L 4045.607 3014.424 L 4046.337 3015.154 L 4047.057 3015.514 L 4048.147 3015.514 L 4048.877 3015.154 L 4049.607 3014.424 M 4057.607 3010.424 L 4059.787 3015.514 M 4061.967 3010.424 L 4059.787 3015.514 M 4064.367 3009.334 L 4065.097 3008.974 L 4066.187 3007.874 L 4066.187 3015.514~~gge357~~0~",
|
||||||
|
"LIB~4015.748~3059.0551~package`JST-5-PTH`~90~~gge4fe8deccf3ecd12b~2~a6310c0b8f314d1f9ced5824a48b26cb~1541594691~0~~yes~~#@$TEXT~P~3989.308~3059.055~0.6~90~1~4~~4.5~JP1~M 3986.858 3061.1051 L 3990.128 3061.1051 L 3990.738 3060.8951 L 3990.948 3060.6951 L 3991.148 3060.2851 L 3991.148 3059.8751 L 3990.948 3059.4651 L 3990.738 3059.2551 L 3990.128 3059.0551 L 3989.718 3059.0551 M 3986.858 3062.4551 L 3991.148 3062.4551 M 3986.858 3062.4551 L 3986.858 3064.2951 L 3987.058 3064.9051 L 3987.258 3065.1051 L 3987.668 3065.3151 L 3988.288 3065.3151 L 3988.698 3065.1051 L 3988.898 3064.9051 L 3989.108 3064.2951 L 3989.108 3062.4551 M 3987.668 3066.6651 L 3987.468 3067.0751 L 3986.858 3067.6851 L 3991.148 3067.6851~~gge80~~0~#@$TEXT~N~3983.808~3059.055~0.6~90~1~4~~4.5~M05JST~M 3981.358 3059.0551 L 3985.648 3059.0551 M 3981.358 3059.0551 L 3985.648 3060.6951 M 3981.358 3062.3251 L 3985.648 3060.6951 M 3981.358 3062.3251 L 3985.648 3062.3251 M 3981.358 3064.9051 L 3981.558 3064.2951 L 3982.168 3063.8851 L 3983.198 3063.6751 L 3983.808 3063.6751 L 3984.828 3063.8851 L 3985.448 3064.2951 L 3985.648 3064.9051 L 3985.648 3065.3151 L 3985.448 3065.9251 L 3984.828 3066.3351 L 3983.808 3066.5451 L 3983.198 3066.5451 L 3982.168 3066.3351 L 3981.558 3065.9251 L 3981.358 3065.3151 L 3981.358 3064.9051 M 3981.358 3070.3451 L 3981.358 3068.3051 L 3983.198 3068.0951 L 3982.988 3068.3051 L 3982.788 3068.9151 L 3982.788 3069.5251 L 3982.988 3070.1451 L 3983.398 3070.5551 L 3984.008 3070.7551 L 3984.418 3070.7551 L 3985.038 3070.5551 L 3985.448 3070.1451 L 3985.648 3069.5251 L 3985.648 3068.9151 L 3985.448 3068.3051 L 3985.238 3068.0951 L 3984.828 3067.8951 M 3981.358 3074.1551 L 3984.628 3074.1551 L 3985.238 3073.9451 L 3985.448 3073.7451 L 3985.648 3073.3351 L 3985.648 3072.9251 L 3985.448 3072.5151 L 3985.238 3072.3051 L 3984.628 3072.1051 L 3984.218 3072.1051 M 3981.968 3078.3651 L 3981.558 3077.9551 L 3981.358 3077.3451 L 3981.358 3076.5251 L 3981.558 3075.9051 L 3981.968 3075.5051 L 3982.378 3075.5051 L 3982.788 3075.7051 L 3982.988 3075.9051 L 3983.198 3076.3151 L 3983.608 3077.5451 L 3983.808 3077.9551 L 3984.008 3078.1551 L 3984.418 3078.3651 L 3985.038 3078.3651 L 3985.448 3077.9551 L 3985.648 3077.3451 L 3985.648 3076.5251 L 3985.448 3075.9051 L 3985.038 3075.5051 M 3981.358 3081.1451 L 3985.648 3081.1451 M 3981.358 3079.7151 L 3981.358 3082.5751~none~gge81~~0~#@$TRACK~1~4~~4015.748 3038.1551 4022.048 3038.1551 4022.048 3035.6551 3992.148 3035.6551 3992.148 3082.4551 4022.048 3082.4551 4022.048 3079.9551 4015.748 3079.9551~gge82~0#@$PAD~ELLIPSE~4015.748~3043.355~6.3~6.3~11~TEENSY-3_4~1~1.38~~90~gge83~0~~Y~0~0~0.4~4015.748,3043.3551#@$PAD~ELLIPSE~4015.748~3051.155~6.3~6.3~11~TEENSY-3_5~2~1.38~~90~gge84~0~~Y~0~0~0.4~4015.748,3051.1551#@$PAD~ELLIPSE~4015.748~3059.055~6.3~6.3~11~TEENSY-3_6~3~1.38~~90~gge85~0~~Y~0~0~0.4~4015.748,3059.0551#@$PAD~ELLIPSE~4015.748~3066.955~6.3~6.3~11~GND~4~1.38~~90~gge86~0~~Y~0~0~0.4~4015.748,3066.9551#@$PAD~ELLIPSE~4015.748~3074.755~6.3~6.3~11~VCC~5~1.38~~90~gge87~0~~Y~0~0~0.4~4015.748,3074.7551",
|
||||||
|
"LIB~4015.7481~3161.4174~package`JST-5-PTH`~90~~gge12cb931c49908c91~2~a6310c0b8f314d1f9ced5824a48b26cb~1541594691~0~~yes~~#@$TEXT~P~3989.308~3161.417~0.6~90~1~4~~4.5~JP2~M 3986.8581 3163.4674 L 3990.1281 3163.4674 L 3990.7381 3163.2574 L 3990.9481 3163.0574 L 3991.1481 3162.6474 L 3991.1481 3162.2374 L 3990.9481 3161.8274 L 3990.7381 3161.6174 L 3990.1281 3161.4174 L 3989.7181 3161.4174 M 3986.8581 3164.8174 L 3991.1481 3164.8174 M 3986.8581 3164.8174 L 3986.8581 3166.6574 L 3987.0581 3167.2674 L 3987.2581 3167.4674 L 3987.6681 3167.6774 L 3988.2881 3167.6774 L 3988.6981 3167.4674 L 3988.8981 3167.2674 L 3989.1081 3166.6574 L 3989.1081 3164.8174 M 3987.8781 3169.2274 L 3987.6681 3169.2274 L 3987.2581 3169.4374 L 3987.0581 3169.6374 L 3986.8581 3170.0474 L 3986.8581 3170.8674 L 3987.0581 3171.2774 L 3987.2581 3171.4774 L 3987.6681 3171.6874 L 3988.0781 3171.6874 L 3988.4881 3171.4774 L 3989.1081 3171.0674 L 3991.1481 3169.0274 L 3991.1481 3171.8874~~gge89~~0~#@$TEXT~N~3983.808~3161.417~0.6~90~1~4~~4.5~M05JST~M 3981.3581 3161.4174 L 3985.6481 3161.4174 M 3981.3581 3161.4174 L 3985.6481 3163.0574 M 3981.3581 3164.6874 L 3985.6481 3163.0574 M 3981.3581 3164.6874 L 3985.6481 3164.6874 M 3981.3581 3167.2674 L 3981.5581 3166.6574 L 3982.1681 3166.2474 L 3983.1981 3166.0374 L 3983.8081 3166.0374 L 3984.8281 3166.2474 L 3985.4481 3166.6574 L 3985.6481 3167.2674 L 3985.6481 3167.6774 L 3985.4481 3168.2874 L 3984.8281 3168.6974 L 3983.8081 3168.9074 L 3983.1981 3168.9074 L 3982.1681 3168.6974 L 3981.5581 3168.2874 L 3981.3581 3167.6774 L 3981.3581 3167.2674 M 3981.3581 3172.7074 L 3981.3581 3170.6674 L 3983.1981 3170.4574 L 3982.9881 3170.6674 L 3982.7881 3171.2774 L 3982.7881 3171.8874 L 3982.9881 3172.5074 L 3983.3981 3172.9174 L 3984.0081 3173.1174 L 3984.4181 3173.1174 L 3985.0381 3172.9174 L 3985.4481 3172.5074 L 3985.6481 3171.8874 L 3985.6481 3171.2774 L 3985.4481 3170.6674 L 3985.2381 3170.4574 L 3984.8281 3170.2574 M 3981.3581 3176.5174 L 3984.6281 3176.5174 L 3985.2381 3176.3074 L 3985.4481 3176.1074 L 3985.6481 3175.6974 L 3985.6481 3175.2874 L 3985.4481 3174.8774 L 3985.2381 3174.6674 L 3984.6281 3174.4674 L 3984.2181 3174.4674 M 3981.9681 3180.7274 L 3981.5581 3180.3174 L 3981.3581 3179.7074 L 3981.3581 3178.8874 L 3981.5581 3178.2674 L 3981.9681 3177.8674 L 3982.3781 3177.8674 L 3982.7881 3178.0674 L 3982.9881 3178.2674 L 3983.1981 3178.6774 L 3983.6081 3179.9074 L 3983.8081 3180.3174 L 3984.0081 3180.5174 L 3984.4181 3180.7274 L 3985.0381 3180.7274 L 3985.4481 3180.3174 L 3985.6481 3179.7074 L 3985.6481 3178.8874 L 3985.4481 3178.2674 L 3985.0381 3177.8674 M 3981.3581 3183.5074 L 3985.6481 3183.5074 M 3981.3581 3182.0774 L 3981.3581 3184.9374~none~gge90~~0~#@$TRACK~1~4~~4015.7481 3140.5174 4022.0481 3140.5174 4022.0481 3138.0174 3992.1481 3138.0174 3992.1481 3184.8174 4022.0481 3184.8174 4022.0481 3182.3174 4015.7481 3182.3174~gge91~0#@$PAD~ELLIPSE~4015.748~3145.717~6.3~6.3~11~TEENSY-3_7~1~1.38~~90~gge92~0~~Y~0~0~0.4~4015.748,3145.7173#@$PAD~ELLIPSE~4015.748~3153.517~6.3~6.3~11~TEENSY-3_8~2~1.38~~90~gge93~0~~Y~0~0~0.4~4015.748,3153.5173#@$PAD~ELLIPSE~4015.748~3161.417~6.3~6.3~11~TEENSY-3_9~3~1.38~~90~gge94~0~~Y~0~0~0.4~4015.748,3161.4173#@$PAD~ELLIPSE~4015.748~3169.317~6.3~6.3~11~GND~4~1.38~~90~gge95~0~~Y~0~0~0.4~4015.748,3169.3173#@$PAD~ELLIPSE~4015.748~3177.117~6.3~6.3~11~VCC~5~1.38~~90~gge96~0~~Y~0~0~0.4~4015.748,3177.1173",
|
||||||
|
"LIB~4015.748~3251.9685~package`JST-5-PTH`~90~~gge4577e3d3da87c365~2~a6310c0b8f314d1f9ced5824a48b26cb~1541594691~0~~yes~~#@$TEXT~P~3989.308~3251.969~0.6~90~1~4~~4.5~JP3~M 3986.858 3254.0185 L 3990.128 3254.0185 L 3990.738 3253.8085 L 3990.948 3253.6085 L 3991.148 3253.1985 L 3991.148 3252.7885 L 3990.948 3252.3785 L 3990.738 3252.1685 L 3990.128 3251.9685 L 3989.718 3251.9685 M 3986.858 3255.3685 L 3991.148 3255.3685 M 3986.858 3255.3685 L 3986.858 3257.2085 L 3987.058 3257.8185 L 3987.258 3258.0185 L 3987.668 3258.2285 L 3988.288 3258.2285 L 3988.698 3258.0185 L 3988.898 3257.8185 L 3989.108 3257.2085 L 3989.108 3255.3685 M 3986.858 3259.9885 L 3986.858 3262.2385 L 3988.488 3261.0085 L 3988.488 3261.6185 L 3988.698 3262.0285 L 3988.898 3262.2385 L 3989.508 3262.4385 L 3989.918 3262.4385 L 3990.538 3262.2385 L 3990.948 3261.8285 L 3991.148 3261.2185 L 3991.148 3260.5985 L 3990.948 3259.9885 L 3990.738 3259.7785 L 3990.328 3259.5785~~gge98~~0~#@$TEXT~N~3983.808~3251.969~0.6~90~1~4~~4.5~M05JST~M 3981.358 3251.9685 L 3985.648 3251.9685 M 3981.358 3251.9685 L 3985.648 3253.6085 M 3981.358 3255.2385 L 3985.648 3253.6085 M 3981.358 3255.2385 L 3985.648 3255.2385 M 3981.358 3257.8185 L 3981.558 3257.2085 L 3982.168 3256.7985 L 3983.198 3256.5885 L 3983.808 3256.5885 L 3984.828 3256.7985 L 3985.448 3257.2085 L 3985.648 3257.8185 L 3985.648 3258.2285 L 3985.448 3258.8385 L 3984.828 3259.2485 L 3983.808 3259.4585 L 3983.198 3259.4585 L 3982.168 3259.2485 L 3981.558 3258.8385 L 3981.358 3258.2285 L 3981.358 3257.8185 M 3981.358 3263.2585 L 3981.358 3261.2185 L 3983.198 3261.0085 L 3982.988 3261.2185 L 3982.788 3261.8285 L 3982.788 3262.4385 L 3982.988 3263.0585 L 3983.398 3263.4685 L 3984.008 3263.6685 L 3984.418 3263.6685 L 3985.038 3263.4685 L 3985.448 3263.0585 L 3985.648 3262.4385 L 3985.648 3261.8285 L 3985.448 3261.2185 L 3985.238 3261.0085 L 3984.828 3260.8085 M 3981.358 3267.0685 L 3984.628 3267.0685 L 3985.238 3266.8585 L 3985.448 3266.6585 L 3985.648 3266.2485 L 3985.648 3265.8385 L 3985.448 3265.4285 L 3985.238 3265.2185 L 3984.628 3265.0185 L 3984.218 3265.0185 M 3981.968 3271.2785 L 3981.558 3270.8685 L 3981.358 3270.2585 L 3981.358 3269.4385 L 3981.558 3268.8185 L 3981.968 3268.4185 L 3982.378 3268.4185 L 3982.788 3268.6185 L 3982.988 3268.8185 L 3983.198 3269.2285 L 3983.608 3270.4585 L 3983.808 3270.8685 L 3984.008 3271.0685 L 3984.418 3271.2785 L 3985.038 3271.2785 L 3985.448 3270.8685 L 3985.648 3270.2585 L 3985.648 3269.4385 L 3985.448 3268.8185 L 3985.038 3268.4185 M 3981.358 3274.0585 L 3985.648 3274.0585 M 3981.358 3272.6285 L 3981.358 3275.4885~none~gge99~~0~#@$TRACK~1~4~~4015.748 3231.0685 4022.048 3231.0685 4022.048 3228.5685 3992.148 3228.5685 3992.148 3275.3685 4022.048 3275.3685 4022.048 3272.8685 4015.748 3272.8685~gge100~0#@$PAD~ELLIPSE~4015.748~3236.269~6.3~6.3~11~TEENSY-3_10~1~1.38~~90~gge101~0~~Y~0~0~0.4~4015.748,3236.2685#@$PAD~ELLIPSE~4015.748~3244.069~6.3~6.3~11~TEENSY-3_11~2~1.38~~90~gge102~0~~Y~0~0~0.4~4015.748,3244.0685#@$PAD~ELLIPSE~4015.748~3251.969~6.3~6.3~11~TEENSY-3_12~3~1.38~~90~gge103~0~~Y~0~0~0.4~4015.748,3251.9685#@$PAD~ELLIPSE~4015.748~3259.869~6.3~6.3~11~GND~4~1.38~~90~gge104~0~~Y~0~0~0.4~4015.748,3259.8685#@$PAD~ELLIPSE~4015.748~3267.669~6.3~6.3~11~VCC~5~1.38~~90~gge105~0~~Y~0~0~0.4~4015.748,3267.6685",
|
||||||
|
"LIB~4129.9213~3059.0551~package`JST-5-PTH`~270~~gged84cd54a2cd93ea0~2~a6310c0b8f314d1f9ced5824a48b26cb~1541594691~0~~yes~~#@$TEXT~P~4156.361~3059.055~0.6~90~1~4~~4.5~JP4~M 4153.9113 3061.1051 L 4157.1813 3061.1051 L 4157.7913 3060.8951 L 4158.0013 3060.6951 L 4158.2013 3060.2851 L 4158.2013 3059.8751 L 4158.0013 3059.4651 L 4157.7913 3059.2551 L 4157.1813 3059.0551 L 4156.7713 3059.0551 M 4153.9113 3062.4551 L 4158.2013 3062.4551 M 4153.9113 3062.4551 L 4153.9113 3064.2951 L 4154.1113 3064.9051 L 4154.3113 3065.1051 L 4154.7213 3065.3151 L 4155.3413 3065.3151 L 4155.7513 3065.1051 L 4155.9513 3064.9051 L 4156.1613 3064.2951 L 4156.1613 3062.4551 M 4153.9113 3068.7051 L 4156.7713 3066.6651 L 4156.7713 3069.7351 M 4153.9113 3068.7051 L 4158.2013 3068.7051~~gge107~~0~#@$TEXT~N~4161.861~3059.055~0.6~270~1~4~~4.5~M05JST~M 4164.3113 3059.0551 L 4160.0213 3059.0551 M 4164.3113 3059.0551 L 4160.0213 3057.4151 M 4164.3113 3055.7851 L 4160.0213 3057.4151 M 4164.3113 3055.7851 L 4160.0213 3055.7851 M 4164.3113 3053.2051 L 4164.1113 3053.8151 L 4163.5013 3054.2251 L 4162.4713 3054.4351 L 4161.8613 3054.4351 L 4160.8413 3054.2251 L 4160.2213 3053.8151 L 4160.0213 3053.2051 L 4160.0213 3052.7951 L 4160.2213 3052.1851 L 4160.8413 3051.7751 L 4161.8613 3051.5651 L 4162.4713 3051.5651 L 4163.5013 3051.7751 L 4164.1113 3052.1851 L 4164.3113 3052.7951 L 4164.3113 3053.2051 M 4164.3113 3047.7651 L 4164.3113 3049.8051 L 4162.4713 3050.0151 L 4162.6813 3049.8051 L 4162.8813 3049.1951 L 4162.8813 3048.5851 L 4162.6813 3047.9651 L 4162.2713 3047.5551 L 4161.6613 3047.3551 L 4161.2513 3047.3551 L 4160.6313 3047.5551 L 4160.2213 3047.9651 L 4160.0213 3048.5851 L 4160.0213 3049.1951 L 4160.2213 3049.8051 L 4160.4313 3050.0151 L 4160.8413 3050.2151 M 4164.3113 3043.9551 L 4161.0413 3043.9551 L 4160.4313 3044.1651 L 4160.2213 3044.3651 L 4160.0213 3044.7751 L 4160.0213 3045.1851 L 4160.2213 3045.5951 L 4160.4313 3045.8051 L 4161.0413 3046.0051 L 4161.4513 3046.0051 M 4163.7013 3039.7451 L 4164.1113 3040.1551 L 4164.3113 3040.7651 L 4164.3113 3041.5851 L 4164.1113 3042.2051 L 4163.7013 3042.6051 L 4163.2913 3042.6051 L 4162.8813 3042.4051 L 4162.6813 3042.2051 L 4162.4713 3041.7951 L 4162.0613 3040.5651 L 4161.8613 3040.1551 L 4161.6613 3039.9551 L 4161.2513 3039.7451 L 4160.6313 3039.7451 L 4160.2213 3040.1551 L 4160.0213 3040.7651 L 4160.0213 3041.5851 L 4160.2213 3042.2051 L 4160.6313 3042.6051 M 4164.3113 3036.9651 L 4160.0213 3036.9651 M 4164.3113 3038.3951 L 4164.3113 3035.5351~none~gge108~~0~#@$TRACK~1~4~~4129.9213 3079.9551 4123.6213 3079.9551 4123.6213 3082.4551 4153.5213 3082.4551 4153.5213 3035.6551 4123.6213 3035.6551 4123.6213 3038.1551 4129.9213 3038.1551~gge109~0#@$PAD~ELLIPSE~4129.921~3074.755~6.3~6.3~11~TEENSY-3_43~1~1.38~~270~gge110~0~~Y~0~0~0.4~4129.9213,3074.7551#@$PAD~ELLIPSE~4129.921~3066.955~6.3~6.3~11~TEENSY-3_44~2~1.38~~270~gge111~0~~Y~0~0~0.4~4129.9213,3066.9551#@$PAD~ELLIPSE~4129.921~3059.055~6.3~6.3~11~TEENSY-3_45~3~1.38~~270~gge112~0~~Y~0~0~0.4~4129.9213,3059.0551#@$PAD~ELLIPSE~4129.921~3051.155~6.3~6.3~11~GND~4~1.38~~270~gge113~0~~Y~0~0~0.4~4129.9213,3051.1551#@$PAD~ELLIPSE~4129.921~3043.355~6.3~6.3~11~VCC~5~1.38~~270~gge114~0~~Y~0~0~0.4~4129.9213,3043.3551",
|
||||||
|
"LIB~4129.9213~3251.9685~package`JST-5-PTH`~270~~gge1e4a53fbbd604e66~2~a6310c0b8f314d1f9ced5824a48b26cb~1541594691~0~~yes~~#@$TEXT~P~4156.361~3251.969~0.6~90~1~4~~4.5~JP6~M 4153.9113 3254.0185 L 4157.1813 3254.0185 L 4157.7913 3253.8085 L 4158.0013 3253.6085 L 4158.2013 3253.1985 L 4158.2013 3252.7885 L 4158.0013 3252.3785 L 4157.7913 3252.1685 L 4157.1813 3251.9685 L 4156.7713 3251.9685 M 4153.9113 3255.3685 L 4158.2013 3255.3685 M 4153.9113 3255.3685 L 4153.9113 3257.2085 L 4154.1113 3257.8185 L 4154.3113 3258.0185 L 4154.7213 3258.2285 L 4155.3413 3258.2285 L 4155.7513 3258.0185 L 4155.9513 3257.8185 L 4156.1613 3257.2085 L 4156.1613 3255.3685 M 4154.5213 3262.0285 L 4154.1113 3261.8285 L 4153.9113 3261.2185 L 4153.9113 3260.8085 L 4154.1113 3260.1885 L 4154.7213 3259.7785 L 4155.7513 3259.5785 L 4156.7713 3259.5785 L 4157.5913 3259.7785 L 4158.0013 3260.1885 L 4158.2013 3260.8085 L 4158.2013 3261.0085 L 4158.0013 3261.6185 L 4157.5913 3262.0285 L 4156.9713 3262.2385 L 4156.7713 3262.2385 L 4156.1613 3262.0285 L 4155.7513 3261.6185 L 4155.5413 3261.0085 L 4155.5413 3260.8085 L 4155.7513 3260.1885 L 4156.1613 3259.7785 L 4156.7713 3259.5785~~gge116~~0~#@$TEXT~N~4161.859~3251.964~0.6~270~1~4~~4.5~M05JST~M 4164.3138 3251.9639 L 4160.0184 3251.9639 M 4164.3138 3251.9639 L 4160.0184 3250.3275 M 4164.3138 3248.6912 L 4160.0184 3250.3275 M 4164.3138 3248.6912 L 4160.0184 3248.6912 M 4164.3138 3246.1139 L 4164.1093 3246.7275 L 4163.4957 3247.1366 L 4162.4729 3247.3412 L 4161.8593 3247.3412 L 4160.8366 3247.1366 L 4160.2229 3246.7275 L 4160.0184 3246.1139 L 4160.0184 3245.7048 L 4160.2229 3245.0912 L 4160.8366 3244.6821 L 4161.8593 3244.4775 L 4162.4729 3244.4775 L 4163.4957 3244.6821 L 4164.1093 3245.0912 L 4164.3138 3245.7048 L 4164.3138 3246.1139 M 4164.3138 3240.673 L 4164.3138 3242.7184 L 4162.4729 3242.923 L 4162.6775 3242.7184 L 4162.882 3242.1048 L 4162.882 3241.4912 L 4162.6775 3240.8775 L 4162.2684 3240.4684 L 4161.6548 3240.2639 L 4161.2457 3240.2639 L 4160.632 3240.4684 L 4160.2229 3240.8775 L 4160.0184 3241.4912 L 4160.0184 3242.1048 L 4160.2229 3242.7184 L 4160.4275 3242.923 L 4160.8366 3243.1275 M 4164.3138 3236.8684 L 4161.0411 3236.8684 L 4160.4275 3237.073 L 4160.2229 3237.2775 L 4160.0184 3237.6866 L 4160.0184 3238.0957 L 4160.2229 3238.5048 L 4160.4275 3238.7094 L 4161.0411 3238.9139 L 4161.4502 3238.9139 M 4163.7002 3232.6548 L 4164.1093 3233.0639 L 4164.3138 3233.6775 L 4164.3138 3234.4957 L 4164.1093 3235.1094 L 4163.7002 3235.5184 L 4163.2911 3235.5184 L 4162.882 3235.3139 L 4162.6775 3235.1094 L 4162.4729 3234.7003 L 4162.0638 3233.473 L 4161.8593 3233.0639 L 4161.6548 3232.8594 L 4161.2457 3232.6548 L 4160.632 3232.6548 L 4160.2229 3233.0639 L 4160.0184 3233.6775 L 4160.0184 3234.4957 L 4160.2229 3235.1094 L 4160.632 3235.5184 M 4164.3138 3229.873 L 4160.0184 3229.873 M 4164.3138 3231.3048 L 4164.3138 3228.4412~none~gge117~~0~#@$TRACK~1~4~~4129.9213 3272.8685 4123.6213 3272.8685 4123.6213 3275.3685 4153.5213 3275.3685 4153.5213 3228.5685 4123.6213 3228.5685 4123.6213 3231.0685 4129.9213 3231.0685~gge118~0#@$PAD~ELLIPSE~4129.921~3267.669~6.3~6.3~11~TEENSY-3_30~1~1.38~~270~gge119~0~~Y~0~0~0.4~4129.9213,3267.6685#@$PAD~ELLIPSE~4129.921~3259.869~6.3~6.3~11~TEENSY-3_38~2~1.38~~270~gge120~0~~Y~0~0~0.4~4129.9213,3259.8685#@$PAD~ELLIPSE~4129.921~3251.969~6.3~6.3~11~TEENSY-3_39~3~1.38~~270~gge121~0~~Y~0~0~0.4~4129.9213,3251.9685#@$PAD~ELLIPSE~4129.921~3244.069~6.3~6.3~11~GND~4~1.38~~270~gge122~0~~Y~0~0~0.4~4129.9213,3244.0685#@$PAD~ELLIPSE~4129.921~3236.269~6.3~6.3~11~VCC~5~1.38~~270~gge123~0~~Y~0~0~0.4~4129.9213,3236.2685",
|
||||||
|
"LIB~4129.9214~3157.4804~package`JST-5-PTH`~270~~gge7ff5f6d6ea161ff3~2~a6310c0b8f314d1f9ced5824a48b26cb~1541594691~0~~yes~~#@$TEXT~P~4156.361~3157.48~0.6~90~1~4~~4.5~JP5~M 4153.9114 3159.5304 L 4157.1814 3159.5304 L 4157.7914 3159.3204 L 4158.0014 3159.1204 L 4158.2014 3158.7104 L 4158.2014 3158.3004 L 4158.0014 3157.8904 L 4157.7914 3157.6804 L 4157.1814 3157.4804 L 4156.7714 3157.4804 M 4153.9114 3160.8804 L 4158.2014 3160.8804 M 4153.9114 3160.8804 L 4153.9114 3162.7204 L 4154.1114 3163.3304 L 4154.3114 3163.5304 L 4154.7214 3163.7404 L 4155.3414 3163.7404 L 4155.7514 3163.5304 L 4155.9514 3163.3304 L 4156.1614 3162.7204 L 4156.1614 3160.8804 M 4153.9114 3167.5404 L 4153.9114 3165.5004 L 4155.7514 3165.2904 L 4155.5414 3165.5004 L 4155.3414 3166.1104 L 4155.3414 3166.7304 L 4155.5414 3167.3404 L 4155.9514 3167.7504 L 4156.5614 3167.9504 L 4156.9714 3167.9504 L 4157.5914 3167.7504 L 4158.0014 3167.3404 L 4158.2014 3166.7304 L 4158.2014 3166.1104 L 4158.0014 3165.5004 L 4157.7914 3165.2904 L 4157.3814 3165.0904~~gge125~~0~#@$TEXT~N~4161.859~3157.476~0.6~270~1~4~~4.5~M05JST~M 4164.3139 3157.4758 L 4160.0185 3157.4758 M 4164.3139 3157.4758 L 4160.0185 3155.8394 M 4164.3139 3154.2031 L 4160.0185 3155.8394 M 4164.3139 3154.2031 L 4160.0185 3154.2031 M 4164.3139 3151.6258 L 4164.1094 3152.2394 L 4163.4958 3152.6485 L 4162.473 3152.8531 L 4161.8594 3152.8531 L 4160.8367 3152.6485 L 4160.223 3152.2394 L 4160.0185 3151.6258 L 4160.0185 3151.2167 L 4160.223 3150.6031 L 4160.8367 3150.194 L 4161.8594 3149.9894 L 4162.473 3149.9894 L 4163.4958 3150.194 L 4164.1094 3150.6031 L 4164.3139 3151.2167 L 4164.3139 3151.6258 M 4164.3139 3146.1849 L 4164.3139 3148.2303 L 4162.473 3148.4349 L 4162.6776 3148.2303 L 4162.8821 3147.6167 L 4162.8821 3147.0031 L 4162.6776 3146.3894 L 4162.2685 3145.9803 L 4161.6549 3145.7758 L 4161.2458 3145.7758 L 4160.6321 3145.9803 L 4160.223 3146.3894 L 4160.0185 3147.0031 L 4160.0185 3147.6167 L 4160.223 3148.2303 L 4160.4276 3148.4349 L 4160.8367 3148.6394 M 4164.3139 3142.3803 L 4161.0412 3142.3803 L 4160.4276 3142.5849 L 4160.223 3142.7894 L 4160.0185 3143.1985 L 4160.0185 3143.6076 L 4160.223 3144.0167 L 4160.4276 3144.2213 L 4161.0412 3144.4258 L 4161.4503 3144.4258 M 4163.7003 3138.1667 L 4164.1094 3138.5758 L 4164.3139 3139.1894 L 4164.3139 3140.0076 L 4164.1094 3140.6213 L 4163.7003 3141.0303 L 4163.2912 3141.0303 L 4162.8821 3140.8258 L 4162.6776 3140.6213 L 4162.473 3140.2122 L 4162.0639 3138.9849 L 4161.8594 3138.5758 L 4161.6549 3138.3713 L 4161.2458 3138.1667 L 4160.6321 3138.1667 L 4160.223 3138.5758 L 4160.0185 3139.1894 L 4160.0185 3140.0076 L 4160.223 3140.6213 L 4160.6321 3141.0303 M 4164.3139 3135.3849 L 4160.0185 3135.3849 M 4164.3139 3136.8167 L 4164.3139 3133.9531~none~gge126~~0~#@$TRACK~1~4~~4129.9214 3178.3804 4123.6214 3178.3804 4123.6214 3180.8804 4153.5214 3180.8804 4153.5214 3134.0804 4123.6214 3134.0804 4123.6214 3136.5804 4129.9214 3136.5804~gge127~0#@$PAD~ELLIPSE~4129.921~3173.18~6.3~6.3~11~TEENSY-3_29~1~1.38~~270~gge128~0~~Y~0~0~0.4~4129.9213,3173.1803#@$PAD~ELLIPSE~4129.921~3165.38~6.3~6.3~11~TEENSY-3_28~2~1.38~~270~gge129~0~~Y~0~0~0.4~4129.9213,3165.3803#@$PAD~ELLIPSE~4129.921~3157.48~6.3~6.3~11~TEENSY-3_42~3~1.38~~270~gge130~0~~Y~0~0~0.4~4129.9213,3157.4803#@$PAD~ELLIPSE~4129.921~3149.58~6.3~6.3~11~GND~4~1.38~~270~gge131~0~~Y~0~0~0.4~4129.9213,3149.5803#@$PAD~ELLIPSE~4129.921~3141.78~6.3~6.3~11~VCC~5~1.38~~270~gge132~0~~Y~0~0~0.4~4129.9213,3141.7803",
|
||||||
|
"LIB~4070.87~3019.69~package`TO252`~~~gge811f1eaf3244a63a~2~6c4ba2dae4824c17b8da3e09711ad730~1541675639~0~~yes~~#@$PAD~RECT~4070.87~3005.34~21.26~24.41~2~GND~3~0~4081.5 2993.135 4060.24 2993.135 4060.24 3017.545 4081.5 3017.545~0~gge134~0~~Y~0~0~0.4~4070.87,3005.34#@$PAD~RECT~4079.87~3034.04~3.94~6.3~2~VCC~1~0~4081.84 3030.89 4077.9 3030.89 4077.9 3037.19 4081.84 3037.19~0~gge135~0~~Y~0~0~0.4~4079.87,3034.04#@$PAD~RECT~4061.87~3034.04~3.94~6.3~2~7805_2~2~0~4063.84 3030.89 4059.9 3030.89 4059.9 3037.19 4063.84 3037.19~0~gge136~0~~Y~0~0~0.4~4061.87,3034.04#@$TEXT~P~4078.492~2986.707~0.6~0~1~4~~4.5~7805~M 4075.632 2984.2519 L 4077.672 2988.5519 M 4078.492 2984.2519 L 4075.632 2984.2519 M 4073.252 2984.2519 L 4073.872 2984.4519 L 4074.072 2984.8619 L 4074.072 2985.2719 L 4073.872 2985.6819 L 4073.462 2985.8919 L 4072.642 2986.0919 L 4072.032 2986.3019 L 4071.622 2986.7019 L 4071.412 2987.1119 L 4071.412 2987.7319 L 4071.622 2988.1419 L 4071.822 2988.3419 L 4072.442 2988.5519 L 4073.252 2988.5519 L 4073.872 2988.3419 L 4074.072 2988.1419 L 4074.282 2987.7319 L 4074.282 2987.1119 L 4074.072 2986.7019 L 4073.662 2986.3019 L 4073.052 2986.0919 L 4072.232 2985.8919 L 4071.822 2985.6819 L 4071.622 2985.2719 L 4071.622 2984.8619 L 4071.822 2984.4519 L 4072.442 2984.2519 L 4073.252 2984.2519 M 4068.842 2984.2519 L 4069.452 2984.4519 L 4069.862 2985.0719 L 4070.062 2986.0919 L 4070.062 2986.7019 L 4069.862 2987.7319 L 4069.452 2988.3419 L 4068.842 2988.5519 L 4068.432 2988.5519 L 4067.812 2988.3419 L 4067.402 2987.7319 L 4067.202 2986.7019 L 4067.202 2986.0919 L 4067.402 2985.0719 L 4067.812 2984.4519 L 4068.432 2984.2519 L 4068.842 2984.2519 M 4063.392 2984.2519 L 4065.442 2984.2519 L 4065.642 2986.0919 L 4065.442 2985.8919 L 4064.832 2985.6819 L 4064.212 2985.6819 L 4063.602 2985.8919 L 4063.192 2986.3019 L 4062.992 2986.9119 L 4062.992 2987.3219 L 4063.192 2987.9319 L 4063.602 2988.3419 L 4064.212 2988.5519 L 4064.832 2988.5519 L 4065.442 2988.3419 L 4065.642 2988.1419 L 4065.852 2987.7319~~gge137~~0~#@$TEXT~N~4070.866~2984.79~0.6~0~1~4~~4.5~7805~M4068.0025 2982.3355L4070.0479 2986.6309M4070.8661 2982.3355L4068.0025 2982.3355M4065.6297 2982.3355L4066.2434 2982.54 4066.4479 2982.9491 4066.4479 2983.3582 4066.2434 2983.7673 4065.8343 2983.9718 4065.0161 2984.1764 4064.4025 2984.3809 4063.9934 2984.79 4063.7888 2985.1991 4063.7888 2985.8127 4063.9934 2986.2218 4064.1979 2986.4264 4064.8116 2986.6309 4065.6297 2986.6309 4066.2434 2986.4264 4066.4479 2986.2218 4066.6525 2985.8127 4066.6525 2985.1991 4066.4479 2984.79 4066.0388 2984.3809 4065.4252 2984.1764 4064.607 2983.9718 4064.1979 2983.7673 4063.9934 2983.3582 4063.9934 2982.9491 4064.1979 2982.54 4064.8116 2982.3355 4065.6297 2982.3355M4061.2116 2982.3355L4061.8252 2982.54 4062.2343 2983.1536 4062.4388 2984.1764 4062.4388 2984.79 4062.2343 2985.8127 4061.8252 2986.4264 4061.2116 2986.6309 4060.8025 2986.6309 4060.1888 2986.4264 4059.7797 2985.8127 4059.5752 2984.79 4059.5752 2984.1764 4059.7797 2983.1536 4060.1888 2982.54 4060.8025 2982.3355 4061.2116 2982.3355M4055.7706 2982.3355L4057.8161 2982.3355 4058.0206 2984.1764 4057.8161 2983.9718 4057.2025 2983.7673 4056.5888 2983.7673 4055.9752 2983.9718 4055.5661 2984.3809 4055.3616 2984.9945 4055.3616 2985.4036 4055.5661 2986.0173 4055.9752 2986.4264 4056.5888 2986.6309 4057.2025 2986.6309 4057.8161 2986.4264 4058.0206 2986.2218 4058.2252 2985.8127~none~gge138~~0~#@$TRACK~1~4~~4057.97 3000.04 4057.97 3023.64~gge139~0#@$TRACK~1~4~~4057.97 3023.64 4083.77 3023.64~gge140~0#@$TRACK~1~4~~4083.77 3023.64 4083.77 3000.04~gge141~0#@$TRACK~1~12~~4057.97 3000.04 4083.77 3000.04~gge142~0#@$TRACK~1~12~~4060.77 2999.64 4060.77 2996.84~gge143~0#@$TRACK~1~12~~4060.77 2996.84 4062.57 2995.04~gge144~0#@$TRACK~1~12~~4062.57 2995.04 4079.17 2995.04~gge145~0#@$TRACK~1~12~~4079.17 2995.04 4080.97 2996.84~gge146~0#@$TRACK~1~12~~4080.97 2996.84 4080.97 2999.64~gge147~0#@$TRACK~1~12~~4080.97 2999.64 4060.77 2999.64~gge148~0",
|
||||||
|
"LIB~4066.93~3066.93~package`SM5817PL`~180~~ggee91958db46843a18~2~0238efd30e02497a859cbe4c0b7b0219~1541592493~0~~yes~~#@$PAD~RECT~4060.48~3066.98~4.8~3.6~2~7805_2~A~0~4058.68 3064.58 4058.68 3069.38 4062.28 3069.38 4062.28 3064.58~90~gge150~0~~Y~0~0~0.4~4060.48,3066.98#@$PAD~RECT~4073.38~3066.88~4.8~3.6~2~TEENSY-3_48~C~0~4071.58 3064.48 4071.58 3069.28 4075.18 3069.28 4075.18 3064.48~90~gge151~0~~Y~0~0~0.4~4073.38,3066.88#@$TEXT~P~4078.365~3077.253~0.6~0~1~4~~4.5~ZENER~M 4075.5048 3074.8029 L 4078.3648 3079.0929 M 4078.3648 3074.8029 L 4075.5048 3074.8029 M 4078.3648 3079.0929 L 4075.5048 3079.0929 M 4074.1548 3074.8029 L 4074.1548 3079.0929 M 4074.1548 3074.8029 L 4071.4948 3074.8029 M 4074.1548 3076.8429 L 4072.5148 3076.8429 M 4074.1548 3079.0929 L 4071.4948 3079.0929 M 4070.1448 3074.8029 L 4070.1448 3079.0929 M 4070.1448 3074.8029 L 4067.2748 3079.0929 M 4067.2748 3074.8029 L 4067.2748 3079.0929 M 4065.9248 3074.8029 L 4065.9248 3079.0929 M 4065.9248 3074.8029 L 4063.2648 3074.8029 M 4065.9248 3076.8429 L 4064.2948 3076.8429 M 4065.9248 3079.0929 L 4063.2648 3079.0929 M 4061.9148 3074.8029 L 4061.9148 3079.0929 M 4061.9148 3074.8029 L 4060.0748 3074.8029 L 4059.4648 3075.0029 L 4059.2648 3075.2029 L 4059.0548 3075.6129 L 4059.0548 3076.0229 L 4059.2648 3076.4329 L 4059.4648 3076.6429 L 4060.0748 3076.8429 L 4061.9148 3076.8429 M 4060.4848 3076.8429 L 4059.0548 3079.0929~~gge152~~0~#@$TEXT~N~4066.679~3077.919~0.6~180~1~4~~4.5~SM5817PL~M4069.5427 3079.76L4069.1336 3080.1691 4068.52 3080.3736 4067.7018 3080.3736 4067.0882 3080.1691 4066.6791 3079.76 4066.6791 3079.3509 4066.8836 3078.9418 4067.0882 3078.7373 4067.4973 3078.5327 4068.7246 3078.1236 4069.1336 3077.9191 4069.3382 3077.7146 4069.5427 3077.3055 4069.5427 3076.6918 4069.1336 3076.2827 4068.52 3076.0782 4067.7018 3076.0782 4067.0882 3076.2827 4066.6791 3076.6918M4070.8927 3080.3736L4070.8927 3076.0782M4070.8927 3080.3736L4072.5291 3076.0782M4074.1655 3080.3736L4072.5291 3076.0782M4074.1655 3080.3736L4074.1655 3076.0782M4077.97 3080.3736L4075.9246 3080.3736 4075.72 3078.5327 4075.9246 3078.7373 4076.5382 3078.9418 4077.1518 3078.9418 4077.7655 3078.7373 4078.1746 3078.3282 4078.3791 3077.7146 4078.3791 3077.3055 4078.1746 3076.6918 4077.7655 3076.2827 4077.1518 3076.0782 4076.5382 3076.0782 4075.9246 3076.2827 4075.72 3076.4873 4075.5155 3076.8964M4080.7518 3080.3736L4080.1382 3080.1691 4079.9336 3079.76 4079.9336 3079.3509 4080.1382 3078.9418 4080.5473 3078.7373 4081.3655 3078.5327 4081.9791 3078.3282 4082.3882 3077.9191 4082.5927 3077.51 4082.5927 3076.8964 4082.3882 3076.4873 4082.1836 3076.2827 4081.57 3076.0782 4080.7518 3076.0782 4080.1382 3076.2827 4079.9336 3076.4873 4079.7291 3076.8964 4079.7291 3077.51 4079.9336 3077.9191 4080.3427 3078.3282 4080.9564 3078.5327 4081.7746 3078.7373 4082.1836 3078.9418 4082.3882 3079.3509 4082.3882 3079.76 4082.1836 3080.1691 4081.57 3080.3736 4080.7518 3080.3736M4083.9427 3079.5555L4084.3518 3079.76 4084.9655 3080.3736 4084.9655 3076.0782M4089.1791 3080.3736L4087.1336 3076.0782M4086.3155 3080.3736L4089.1791 3080.3736M4090.5291 3080.3736L4090.5291 3076.0782M4090.5291 3080.3736L4092.37 3080.3736 4092.9836 3080.1691 4093.1882 3079.9646 4093.3927 3079.5555 4093.3927 3078.9418 4093.1882 3078.5327 4092.9836 3078.3282 4092.37 3078.1236 4090.5291 3078.1236M4094.7427 3080.3736L4094.7427 3076.0782M4094.7427 3076.0782L4097.1973 3076.0782~none~gge153~~0~#@$TRACK~1~4~~4063.68 3069.58 4069.68 3069.58~gge154~0#@$TRACK~1~4~~4063.68 3064.58 4069.68 3064.58~gge155~0#@$TRACK~1~4~~4069.78 3068.58 4069.78 3067.28 4069.78 3065.68~gge156~0#@$TRACK~1~4~~4068.38 3065.88 4069.78 3067.28 4068.38 3068.58~gge157~0",
|
||||||
|
"LIB~4090.5499~3299.21~package`NRF24L01_BREAKOUT`~90~~ggefb8212f5c2b986e6~2~78622ede286a49af8fcc475616e242e3~1541603649~0~~yes~~#@$TRACK~0.1968~15~~4066.6899 3287.32 4066.6899 3403.46 4128.6999 3403.46 4128.6999 3287.32 4066.6899 3287.32~gge159~0#@$TEXT~P~4077.641~3318.205~0.6~0~1~4~~4.5~NRF24L01~M 4107.7512 3316.0601 L 4107.7512 3320.3501 M 4107.7512 3316.0601 L 4104.8912 3320.3501 M 4104.8912 3316.0601 L 4104.8912 3320.3501 M 4103.5412 3316.0601 L 4103.5412 3320.3501 M 4103.5412 3316.0601 L 4101.7012 3316.0601 L 4101.0812 3316.2601 L 4100.8812 3316.4601 L 4100.6712 3316.8701 L 4100.6712 3317.2801 L 4100.8812 3317.6901 L 4101.0812 3317.9001 L 4101.7012 3318.1001 L 4103.5412 3318.1001 M 4102.1012 3318.1001 L 4100.6712 3320.3501 M 4099.3212 3316.0601 L 4099.3212 3320.3501 M 4099.3212 3316.0601 L 4096.6612 3316.0601 M 4099.3212 3318.1001 L 4097.6912 3318.1001 M 4095.1112 3317.0801 L 4095.1112 3316.8701 L 4094.9012 3316.4601 L 4094.7012 3316.2601 L 4094.2912 3316.0601 L 4093.4712 3316.0601 L 4093.0612 3316.2601 L 4092.8612 3316.4601 L 4092.6512 3316.8701 L 4092.6512 3317.2801 L 4092.8612 3317.6901 L 4093.2712 3318.3101 L 4095.3112 3320.3501 L 4092.4512 3320.3501 M 4089.0512 3316.0601 L 4091.1012 3318.9201 L 4088.0312 3318.9201 M 4089.0512 3316.0601 L 4089.0512 3320.3501 M 4086.6812 3316.0601 L 4086.6812 3320.3501 M 4086.6812 3320.3501 L 4084.2312 3320.3501 M 4081.6512 3316.0601 L 4082.2612 3316.2601 L 4082.6712 3316.8701 L 4082.8812 3317.9001 L 4082.8812 3318.5101 L 4082.6712 3319.5301 L 4082.2612 3320.1501 L 4081.6512 3320.3501 L 4081.2412 3320.3501 L 4080.6312 3320.1501 L 4080.2212 3319.5301 L 4080.0112 3318.5101 L 4080.0112 3317.9001 L 4080.2212 3316.8701 L 4080.6312 3316.2601 L 4081.2412 3316.0601 L 4081.6512 3316.0601 M 4078.6612 3316.8701 L 4078.2512 3316.6701 L 4077.6412 3316.0601 L 4077.6412 3320.3501~~gge160~~0~#@$TEXT~N~4058.941~3345.213~0.6~90~1~4~~4.5~NRF24L01_Breakout~M 4056.4866 3345.2126 L 4060.782 3345.2126 M 4056.4866 3345.2126 L 4060.782 3348.0762 M 4056.4866 3348.0762 L 4060.782 3348.0762 M 4056.4866 3349.4262 L 4060.782 3349.4262 M 4056.4866 3349.4262 L 4056.4866 3351.2671 L 4056.6911 3351.8807 L 4056.8957 3352.0853 L 4057.3047 3352.2898 L 4057.7138 3352.2898 L 4058.1229 3352.0853 L 4058.3275 3351.8807 L 4058.532 3351.2671 L 4058.532 3349.4262 M 4058.532 3350.858 L 4060.782 3352.2898 M 4056.4866 3353.6398 L 4060.782 3353.6398 M 4056.4866 3353.6398 L 4056.4866 3356.2989 M 4058.532 3353.6398 L 4058.532 3355.2762 M 4057.5093 3357.8535 L 4057.3047 3357.8535 L 4056.8957 3358.058 L 4056.6911 3358.2626 L 4056.4866 3358.6717 L 4056.4866 3359.4898 L 4056.6911 3359.8989 L 4056.8957 3360.1035 L 4057.3047 3360.308 L 4057.7138 3360.308 L 4058.1229 3360.1035 L 4058.7366 3359.6944 L 4060.782 3357.6489 L 4060.782 3360.5126 M 4056.4866 3363.908 L 4059.3502 3361.8626 L 4059.3502 3364.9307 M 4056.4866 3363.908 L 4060.782 3363.908 M 4056.4866 3366.2807 L 4060.782 3366.2807 M 4060.782 3366.2807 L 4060.782 3368.7353 M 4056.4866 3371.3126 L 4056.6911 3370.6989 L 4057.3047 3370.2898 L 4058.3275 3370.0853 L 4058.9411 3370.0853 L 4059.9638 3370.2898 L 4060.5775 3370.6989 L 4060.782 3371.3126 L 4060.782 3371.7217 L 4060.5775 3372.3353 L 4059.9638 3372.7444 L 4058.9411 3372.9489 L 4058.3275 3372.9489 L 4057.3047 3372.7444 L 4056.6911 3372.3353 L 4056.4866 3371.7217 L 4056.4866 3371.3126 M 4057.3047 3374.2989 L 4057.1002 3374.708 L 4056.4866 3375.3217 L 4060.782 3375.3217 M 4062.2138 3376.6717 L 4062.2138 3380.3535 M 4056.4866 3381.7035 L 4060.782 3381.7035 M 4056.4866 3381.7035 L 4056.4866 3383.5444 L 4056.6911 3384.158 L 4056.8957 3384.3626 L 4057.3047 3384.5671 L 4057.7138 3384.5671 L 4058.1229 3384.3626 L 4058.3275 3384.158 L 4058.532 3383.5444 M 4058.532 3381.7035 L 4058.532 3383.5444 L 4058.7366 3384.158 L 4058.9411 3384.3626 L 4059.3502 3384.5671 L 4059.9638 3384.5671 L 4060.3729 3384.3626 L 4060.5775 3384.158 L 4060.782 3383.5444 L 4060.782 3381.7035 M 4057.9184 3385.9171 L 4060.782 3385.9171 M 4059.1457 3385.9171 L 4058.532 3386.1217 L 4058.1229 3386.5307 L 4057.9184 3386.9398 L 4057.9184 3387.5535 M 4059.1457 3388.9035 L 4059.1457 3391.358 L 4058.7366 3391.358 L 4058.3275 3391.1535 L 4058.1229 3390.9489 L 4057.9184 3390.5398 L 4057.9184 3389.9262 L 4058.1229 3389.5171 L 4058.532 3389.108 L 4059.1457 3388.9035 L 4059.5547 3388.9035 L 4060.1684 3389.108 L 4060.5775 3389.5171 L 4060.782 3389.9262 L 4060.782 3390.5398 L 4060.5775 3390.9489 L 4060.1684 3391.358 M 4057.9184 3395.1626 L 4060.782 3395.1626 M 4058.532 3395.1626 L 4058.1229 3394.7535 L 4057.9184 3394.3444 L 4057.9184 3393.7307 L 4058.1229 3393.3217 L 4058.532 3392.9126 L 4059.1457 3392.708 L 4059.5547 3392.708 L 4060.1684 3392.9126 L 4060.5775 3393.3217 L 4060.782 3393.7307 L 4060.782 3394.3444 L 4060.5775 3394.7535 L 4060.1684 3395.1626 M 4056.4866 3396.5126 L 4060.782 3396.5126 M 4057.9184 3398.558 L 4059.9638 3396.5126 M 4059.1457 3397.3307 L 4060.782 3398.7626 M 4057.9184 3401.1353 L 4058.1229 3400.7262 L 4058.532 3400.3171 L 4059.1457 3400.11Line truncated
|
||||||
|
"LIB~4039.37~3295.28~package`JST-2-PTH`~180~~gge2c2198ed19c983b6~2~d5d324077a0d412bb6b8ac3dd617416a~1541738954~0~~yes~~#@$TEXT~P~4039.37~3321.72~0.6~180~1~4~~4.5~JP7~M 4041.42 3324.17 L 4041.42 3320.9 L 4041.21 3320.29 L 4041.01 3320.08 L 4040.6 3319.88 L 4040.19 3319.88 L 4039.78 3320.08 L 4039.57 3320.29 L 4039.37 3320.9 L 4039.37 3321.31 M 4042.77 3324.17 L 4042.77 3319.88 M 4042.77 3324.17 L 4044.61 3324.17 L 4045.22 3323.97 L 4045.42 3323.77 L 4045.63 3323.36 L 4045.63 3322.74 L 4045.42 3322.33 L 4045.22 3322.13 L 4044.61 3321.92 L 4042.77 3321.92 M 4049.84 3324.17 L 4047.8 3319.88 M 4046.98 3324.17 L 4049.84 3324.17~~gge176~~0~#@$TEXT~N~4039.37~3327.216~0.6~180~1~4~~4.5~M02JST-PTH-2~M4039.37 3329.6705L4039.37 3325.3751M4039.37 3329.6705L4041.0064 3325.3751M4042.6427 3329.6705L4041.0064 3325.3751M4042.6427 3329.6705L4042.6427 3325.3751M4045.22 3329.6705L4044.6064 3329.466 4044.1973 3328.8524 4043.9927 3327.8296 4043.9927 3327.216 4044.1973 3326.1933 4044.6064 3325.5796 4045.22 3325.3751 4045.6291 3325.3751 4046.2427 3325.5796 4046.6518 3326.1933 4046.8564 3327.216 4046.8564 3327.8296 4046.6518 3328.8524 4046.2427 3329.466 4045.6291 3329.6705 4045.22 3329.6705M4048.4109 3328.6478L4048.4109 3328.8524 4048.6155 3329.2615 4048.82 3329.466 4049.2291 3329.6705 4050.0473 3329.6705 4050.4564 3329.466 4050.6609 3329.2615 4050.8655 3328.8524 4050.8655 3328.4433 4050.6609 3328.0342 4050.2518 3327.4205 4048.2064 3325.3751 4051.07 3325.3751M4054.4655 3329.6705L4054.4655 3326.3978 4054.2609 3325.7842 4054.0564 3325.5796 4053.6473 3325.3751 4053.2382 3325.3751 4052.8291 3325.5796 4052.6245 3325.7842 4052.42 3326.3978 4052.42 3326.8069M4058.6791 3329.0569L4058.27 3329.466 4057.6564 3329.6705 4056.8382 3329.6705 4056.2245 3329.466 4055.8155 3329.0569 4055.8155 3328.6478 4056.02 3328.2387 4056.2245 3328.0342 4056.6336 3327.8296 4057.8609 3327.4205 4058.27 3327.216 4058.4745 3327.0115 4058.6791 3326.6024 4058.6791 3325.9887 4058.27 3325.5796 4057.6564 3325.3751 4056.8382 3325.3751 4056.2245 3325.5796 4055.8155 3325.9887M4061.4609 3329.6705L4061.4609 3325.3751M4060.0291 3329.6705L4062.8927 3329.6705M4064.2427 3327.216L4067.9245 3327.216M4069.2745 3329.6705L4069.2745 3325.3751M4069.2745 3329.6705L4071.1155 3329.6705 4071.7291 3329.466 4071.9336 3329.2615 4072.1382 3328.8524 4072.1382 3328.2387 4071.9336 3327.8296 4071.7291 3327.6251 4071.1155 3327.4205 4069.2745 3327.4205M4074.92 3329.6705L4074.92 3325.3751M4073.4882 3329.6705L4076.3518 3329.6705M4077.7018 3329.6705L4077.7018 3325.3751M4080.5655 3329.6705L4080.5655 3325.3751M4077.7018 3327.6251L4080.5655 3327.6251M4081.9155 3327.216L4085.5973 3327.216M4087.1518 3328.6478L4087.1518 3328.8524 4087.3564 3329.2615 4087.5609 3329.466 4087.97 3329.6705 4088.7882 3329.6705 4089.1973 3329.466 4089.4018 3329.2615 4089.6064 3328.8524 4089.6064 3328.4433 4089.4018 3328.0342 4088.9927 3327.4205 4086.9473 3325.3751 4089.8109 3325.3751~none~gge177~~0~#@$TRACK~1~4~~4031.47 3295.28 4031.47 3288.98~gge178~0#@$TRACK~1~4~~4031.47 3288.98 4027.77 3288.98~gge179~0#@$TRACK~1~4~~4027.77 3288.98 4027.77 3318.88~gge180~0#@$TRACK~1~4~~4027.77 3318.88 4050.97 3318.88~gge181~0#@$TRACK~1~4~~4050.97 3318.88 4050.97 3288.98~gge182~0#@$TRACK~1~4~~4050.97 3288.98 4047.27 3288.98~gge183~0#@$TRACK~1~4~~4047.27 3288.98 4047.27 3295.28~gge184~0#@$PAD~ELLIPSE~4035.47~3295.28~5.7~5.7~11~VCC~1~1.38~~180~gge185~0~~Y~0~0~0.4~4035.47,3295.28#@$PAD~ELLIPSE~4043.27~3295.28~5.7~5.7~11~GND~2~1.38~~180~gge186~0~~Y~0~0~0.4~4043.27,3295.28#@$TEXT~L~4033.87~3298.08~0.6~180~0~12~~3~+~M 4032.64 3299.31 L 4032.64 3296.85 M 4033.87 3298.08 L 4031.42 3298.08~~gge187~~0~#@$TEXT~L~4041.77~3298.08~0.6~180~0~12~~3~-~M 4041.77 3298.08 L 4039.32 3298.08~~gge188~~0~",
|
||||||
|
"LIB~4078.7402~3153.5433~package`GY-521`~180~~gge1bdc0ab44f99f92d~2~8f42f8439214478783bdf5ebbab00e6a~1547748350~0~~yes~~#@$TEXT~P~4076.74~3199.946~0.6~0~1~4~~4.5~U1~M 4076.7402 3197.4895 L 4076.7402 3200.5595 L 4076.5402 3201.1695 L 4076.1302 3201.5795 L 4075.5102 3201.7895 L 4075.1002 3201.7895 L 4074.4902 3201.5795 L 4074.0802 3201.1695 L 4073.8802 3200.5595 L 4073.8802 3197.4895 M 4072.5302 3198.3095 L 4072.1202 3198.1095 L 4071.5002 3197.4895 L 4071.5002 3201.7895~~gge304~~0~#@$TEXT~N~4076.74~3205.446~0.6~180~1~4~~4.5~GY-521MPU6050~M 4079.8102 3206.8733 L 4079.6002 3207.2833 L 4079.1902 3207.6933 L 4078.7902 3207.9033 L 4077.9702 3207.9033 L 4077.5602 3207.6933 L 4077.1502 3207.2833 L 4076.9402 3206.8733 L 4076.7402 3206.2633 L 4076.7402 3205.2433 L 4076.9402 3204.6233 L 4077.1502 3204.2233 L 4077.5602 3203.8133 L 4077.9702 3203.6033 L 4078.7902 3203.6033 L 4079.1902 3203.8133 L 4079.6002 3204.2233 L 4079.8102 3204.6233 L 4079.8102 3205.2433 M 4078.7902 3205.2433 L 4079.8102 3205.2433 M 4081.1602 3207.9033 L 4082.7902 3205.8533 L 4082.7902 3203.6033 M 4084.4302 3207.9033 L 4082.7902 3205.8533 M 4085.7802 3205.4433 L 4089.4602 3205.4433 M 4093.2702 3207.9033 L 4091.2202 3207.9033 L 4091.0202 3206.0633 L 4091.2202 3206.2633 L 4091.8402 3206.4733 L 4092.4502 3206.4733 L 4093.0602 3206.2633 L 4093.4702 3205.8533 L 4093.6802 3205.2433 L 4093.6802 3204.8333 L 4093.4702 3204.2233 L 4093.0602 3203.8133 L 4092.4502 3203.6033 L 4091.8402 3203.6033 L 4091.2202 3203.8133 L 4091.0202 3204.0133 L 4090.8102 3204.4233 M 4095.2302 3206.8733 L 4095.2302 3207.0833 L 4095.4402 3207.4933 L 4095.6402 3207.6933 L 4096.0502 3207.9033 L 4096.8702 3207.9033 L 4097.2802 3207.6933 L 4097.4802 3207.4933 L 4097.6902 3207.0833 L 4097.6902 3206.6733 L 4097.4802 3206.2633 L 4097.0702 3205.6533 L 4095.0302 3203.6033 L 4097.8902 3203.6033 M 4099.2402 3207.0833 L 4099.6502 3207.2833 L 4100.2602 3207.9033 L 4100.2602 3203.6033 M 4101.6102 3207.9033 L 4101.6102 3203.6033 M 4101.6102 3207.9033 L 4103.2502 3203.6033 M 4104.8902 3207.9033 L 4103.2502 3203.6033 M 4104.8902 3207.9033 L 4104.8902 3203.6033 M 4106.2402 3207.9033 L 4106.2402 3203.6033 M 4106.2402 3207.9033 L 4108.0802 3207.9033 L 4108.6902 3207.6933 L 4108.8902 3207.4933 L 4109.1002 3207.0833 L 4109.1002 3206.4733 L 4108.8902 3206.0633 L 4108.6902 3205.8533 L 4108.0802 3205.6533 L 4106.2402 3205.6533 M 4110.4502 3207.9033 L 4110.4502 3204.8333 L 4110.6502 3204.2233 L 4111.0602 3203.8133 L 4111.6802 3203.6033 L 4112.0902 3203.6033 L 4112.7002 3203.8133 L 4113.1102 3204.2233 L 4113.3102 3204.8333 L 4113.3102 3207.9033 M 4117.1202 3207.2833 L 4116.9102 3207.6933 L 4116.3002 3207.9033 L 4115.8902 3207.9033 L 4115.2802 3207.6933 L 4114.8702 3207.0833 L 4114.6602 3206.0633 L 4114.6602 3205.0333 L 4114.8702 3204.2233 L 4115.2802 3203.8133 L 4115.8902 3203.6033 L 4116.0902 3203.6033 L 4116.7102 3203.8133 L 4117.1202 3204.2233 L 4117.3202 3204.8333 L 4117.3202 3205.0333 L 4117.1202 3205.6533 L 4116.7102 3206.0633 L 4116.0902 3206.2633 L 4115.8902 3206.2633 L 4115.2802 3206.0633 L 4114.8702 3205.6533 L 4114.6602 3205.0333 M 4119.9002 3207.9033 L 4119.2902 3207.6933 L 4118.8802 3207.0833 L 4118.6702 3206.0633 L 4118.6702 3205.4433 L 4118.8802 3204.4233 L 4119.2902 3203.8133 L 4119.9002 3203.6033 L 4120.3102 3203.6033 L 4120.9202 3203.8133 L 4121.3302 3204.4233 L 4121.5402 3205.4433 L 4121.5402 3206.0633 L 4121.3302 3207.0833 L 4120.9202 3207.6933 L 4120.3102 3207.9033 L 4119.9002 3207.9033 M 4125.3402 3207.9033 L 4123.2902 3207.9033 L 4123.0902 3206.0633 L 4123.2902 3206.2633 L 4123.9102 3206.4733 L 4124.5202 3206.4733 L 4125.1402 3206.2633 L 4125.5402 3205.8533 L 4125.7502 3205.2433 L 4125.7502 3204.8333 L 4125.5402 3204.2233 L 4125.1402 3203.8133 L 4124.5202 3203.6033 L 4123.9102 3203.6033 L 4123.2902 3203.8133 L 4123.0902 3204.0133 L 4122.8902 3204.4233 M 4128.3302 3207.9033 L 4127.7102 3207.6933 L 4127.3002 3207.0833 L 4127.1002 3206.0633 L 4127.1002 3205.4433 L 4127.3002 3204.4233 L 4127.7102 3203.8133 L 4128.3302 3203.6033 L 4128.7402 3203.6033 L 4129.3502 3203.8133 L 4129.7602 3204.4233 L 4129.9602 3205.4433 L 4129.9602 3206.0633 L 4129.7602 3207.0833 L 4129.3502 3207.6933 L 4128.7402 3207.9033 L 4128.3302 3207.9033~none~gge306~~0~#@$PAD~OVAL~4055.984~3159.606~14~7~11~TEENSY-3_40~SDA~1.575~4059.484 3159.606 4052.484 3159.606~180~gge308~3.17~4055.9742 3159.6063 4055.9942 3159.6063~Y~0~0~0.4~4055.9842,3159.6063#@$PAD~OVAL~4055.984~3149.606~14~7~11~U1_XDA~XDA~1.575~4059.484 3149.606 4052.484 3149.606~180~gge313~3.17~4055.9742 3149.6063 4055.9942 3149.6063~Y~0~0~0.4~4055.9842,3149.6063#@$PAD~OVAL~4055.984~3169.606~14~7~11~TEENSY-3_41~SCL~1.575~4059.484 3169.606 4052.484 3169.606~180~gge318~3.17~4055.9742 3169.6063 4055.9942 3169.6063~Y~0~0~0.4~4055.9842,3169.6063#@$PAD~OVAL~4055.984~3179.606~14~7~11~GND~GND~1.575~4059.484 3179.606 4052.484 3179.606~180~gge323~3.17~4055.9742 3179.6063 4055.9942 3179.6063~Y~0~0~0.4~4055.9842,3179.6063#@$PAD~OVAL~4055.984~3189.606~14~7~11~TEENSY-3_46~VCCLine truncated
|
||||||
|
"LIB~4108.45~3020.79~package`2010`~180~~gge2c31eeb1f982bc0e~1~31f65623d5a5430b81b3e84f2b567edd~1541683795~0~~yes~~#@$PAD~RECT~4098.8~3020.79~5.51~9.84~1~510_2~2~0~4101.555 3025.71 4096.045 3025.71 4096.045 3015.87 4101.555 3015.87~180~gge190~0~~Y~0~0~0.4~4098.8,3020.79#@$PAD~RECT~4118.1~3020.79~5.51~9.84~1~GND~1~0~4120.855 3025.71 4115.345 3025.71 4115.345 3015.87 4120.855 3015.87~180~gge191~0~~Y~0~0~0.4~4118.1,3020.79#@$TEXT~P~4103.938~3021.525~0.6~0~0~3~~4.5~510~M 4106.3882 3019.075 L 4104.3482 3019.075 L 4104.1382 3020.915 L 4104.3482 3020.705 L 4104.9582 3020.505 L 4105.5782 3020.505 L 4106.1882 3020.705 L 4106.5982 3021.115 L 4106.7982 3021.725 L 4106.7982 3022.135 L 4106.5982 3022.755 L 4106.1882 3023.165 L 4105.5782 3023.365 L 4104.9582 3023.365 L 4104.3482 3023.165 L 4104.1382 3022.955 L 4103.9382 3022.545 M 4108.1482 3019.885 L 4108.5582 3019.685 L 4109.1782 3019.075 L 4109.1782 3023.365 M 4111.7482 3019.075 L 4111.1382 3019.275 L 4110.7282 3019.885 L 4110.5282 3020.915 L 4110.5282 3021.525 L 4110.7282 3022.545 L 4111.1382 3023.165 L 4111.7482 3023.365 L 4112.1582 3023.365 L 4112.7782 3023.165 L 4113.1882 3022.545 L 4113.3882 3021.525 L 4113.3882 3020.915 L 4113.1882 3019.885 L 4112.7782 3019.275 L 4112.1582 3019.075 L 4111.7482 3019.075~~gge192~~0~#@$TEXT~N~4083.677~3034.129~0.6~180~0~3~~4.5~510~M 4081.2242 3036.588L4083.2642 3036.588 L4083.4742 3034.738 L4083.2642 3034.948 L4082.6542 3035.148 L4082.0442 3035.148 L4081.4242 3034.948 L4081.0142 3034.538 L4080.8142 3033.928 L4080.8142 3033.518 L4081.0142 3032.898 L4081.4242 3032.488 L4082.0442 3032.288 L4082.6542 3032.288 L4083.2642 3032.488 L4083.4742 3032.698 L4083.6742 3033.108 M 4079.4642 3035.768L4079.0542 3035.968 L4078.4442 3036.588 L4078.4442 3032.288 M 4075.8642 3036.588L4076.4742 3036.378 L4076.8842 3035.768 L4077.0942 3034.738 L4077.0942 3034.128 L4076.8842 3033.108 L4076.4742 3032.488 L4075.8642 3032.288 L4075.4542 3032.288 L4074.8442 3032.488 L4074.4342 3033.108 L4074.2242 3034.128 L4074.2242 3034.738 L4074.4342 3035.768 L4074.8442 3036.378 L4075.4542 3036.588 L4075.8642 3036.588 ~none~gge193~~0~#@$TRACK~0.5~3~~4101.45 3025.79 4101.45 3015.79~gge194~0#@$TRACK~0.5~3~~4115.45 3025.79 4115.45 3015.79~gge195~0#@$TRACK~0.5~3~~4118.45 3025.79 4098.45 3025.79~gge196~0#@$TRACK~0.5~3~~4098.45 3025.79 4098.45 3015.79~gge197~0#@$TRACK~0.5~3~~4098.45 3015.79 4118.45 3015.79~gge198~0#@$TRACK~0.5~3~~4118.45 3015.79 4118.45 3025.79~gge199~0",
|
||||||
|
"LIB~4110.24~3003.935~package`LED-1206`~~~ggec630ca5ef9197c73~1~62ddd832b4204f5fb6ccf017f43de83b~1541686983~0~~yes~~#@$PAD~RECT~4116.54~3003.935~6.3~7.09~1~TEENSY-3_48~1~0~4119.69 3007.48 4113.39 3007.48 4113.39 3000.39 4119.69 3000.39~180~gge201~0~~Y~0~0~0.4~4116.54,3003.935#@$PAD~RECT~4103.94~3003.935~6.3~7.09~1~510_2~2~0~4107.09 3007.48 4100.79 3007.48 4100.79 3000.39 4107.09 3000.39~180~gge202~0~~Y~0~0~0.4~4103.94,3003.935#@$TEXT~P~4109.34~2996.4~0.6~0~0~3~~4.5~POWER~M 4109.34 2993.95 L 4109.34 2998.24 M 4109.34 2993.95 L 4111.18 2993.95 L 4111.79 2994.15 L 4112 2994.35 L 4112.2 2994.76 L 4112.2 2995.38 L 4112 2995.79 L 4111.79 2995.99 L 4111.18 2996.2 L 4109.34 2996.2 M 4114.78 2993.95 L 4114.37 2994.15 L 4113.96 2994.56 L 4113.76 2994.97 L 4113.55 2995.58 L 4113.55 2996.6 L 4113.76 2997.22 L 4113.96 2997.63 L 4114.37 2998.04 L 4114.78 2998.24 L 4115.6 2998.24 L 4116.01 2998.04 L 4116.42 2997.63 L 4116.62 2997.22 L 4116.83 2996.6 L 4116.83 2995.58 L 4116.62 2994.97 L 4116.42 2994.56 L 4116.01 2994.15 L 4115.6 2993.95 L 4114.78 2993.95 M 4118.18 2993.95 L 4119.2 2998.24 M 4120.22 2993.95 L 4119.2 2998.24 M 4120.22 2993.95 L 4121.24 2998.24 M 4122.27 2993.95 L 4121.24 2998.24 M 4123.62 2993.95 L 4123.62 2998.24 M 4123.62 2993.95 L 4126.28 2993.95 M 4123.62 2995.99 L 4125.25 2995.99 M 4123.62 2998.24 L 4126.28 2998.24 M 4127.63 2993.95 L 4127.63 2998.24 M 4127.63 2993.95 L 4129.47 2993.95 L 4130.08 2994.15 L 4130.29 2994.35 L 4130.49 2994.76 L 4130.49 2995.17 L 4130.29 2995.58 L 4130.08 2995.79 L 4129.47 2995.99 L 4127.63 2995.99 M 4129.06 2995.99 L 4130.49 2998.24~~gge203~~0~#@$TEXT~N~4109.336~2990.902~0.6~0~0~3~~4.5~led Green~M 4109.34 2988.45L4109.34 2992.74 M 4110.69 2991.11L4113.14 2991.11 L4113.14 2990.7 L4112.94 2990.29 L4112.73 2990.08 L4112.32 2989.88 L4111.71 2989.88 L4111.3 2990.08 L4110.89 2990.49 L4110.69 2991.11 L4110.69 2991.52 L4110.89 2992.13 L4111.3 2992.54 L4111.71 2992.74 L4112.32 2992.74 L4112.73 2992.54 L4113.14 2992.13 M 4116.95 2988.45L4116.95 2992.74 M 4116.95 2990.49L4116.54 2990.08 L4116.13 2989.88 L4115.51 2989.88 L4115.1 2990.08 L4114.7 2990.49 L4114.49 2991.11 L4114.49 2991.52 L4114.7 2992.13 L4115.1 2992.54 L4115.51 2992.74 L4116.13 2992.74 L4116.54 2992.54 L4116.95 2992.13 M 4124.51 2989.47L4124.31 2989.06 L4123.9 2988.65 L4123.49 2988.45 L4122.67 2988.45 L4122.26 2988.65 L4121.85 2989.06 L4121.65 2989.47 L4121.45 2990.08 L4121.45 2991.11 L4121.65 2991.72 L4121.85 2992.13 L4122.26 2992.54 L4122.67 2992.74 L4123.49 2992.74 L4123.9 2992.54 L4124.31 2992.13 L4124.51 2991.72 L4124.51 2991.11 M 4123.49 2991.11L4124.51 2991.11 M 4125.86 2989.88L4125.86 2992.74 M 4125.86 2991.11L4126.07 2990.49 L4126.48 2990.08 L4126.89 2989.88 L4127.5 2989.88 M 4128.85 2991.11L4131.3 2991.11 L4131.3 2990.7 L4131.1 2990.29 L4130.9 2990.08 L4130.49 2989.88 L4129.87 2989.88 L4129.46 2990.08 L4129.05 2990.49 L4128.85 2991.11 L4128.85 2991.52 L4129.05 2992.13 L4129.46 2992.54 L4129.87 2992.74 L4130.49 2992.74 L4130.9 2992.54 L4131.3 2992.13 M 4132.65 2991.11L4135.11 2991.11 L4135.11 2990.7 L4134.9 2990.29 L4134.7 2990.08 L4134.29 2989.88 L4133.68 2989.88 L4133.27 2990.08 L4132.86 2990.49 L4132.65 2991.11 L4132.65 2991.52 L4132.86 2992.13 L4133.27 2992.54 L4133.68 2992.74 L4134.29 2992.74 L4134.7 2992.54 L4135.11 2992.13 M 4136.46 2989.88L4136.46 2992.74 M 4136.46 2990.7L4137.07 2990.08 L4137.48 2989.88 L4138.1 2989.88 L4138.5 2990.08 L4138.71 2990.7 L4138.71 2992.74 ~none~gge204~~0~#@$TRACK~1.06299~3~~4111.94 3008.74 4121.04 3008.74 4121.04 2999.24 4111.94 2999.24 4111.94 2999.24~gge205~0#@$TRACK~1.06299~3~~4108.64 2999.24 4099.34 2999.24 4097.74 3000.84 4097.74 3007.14 4099.34 3008.74 4108.64 3008.74~gge206~0",
|
||||||
|
"LIB~4039.37~3039.37~package`TEENSY 3.6 ALL PINS&PADS`~~~gge1eae9a454078a4d1~1~5a9ed4268de54183af00679c926d8fb7~1514912116~0~~yes~~#@$TEXT~P~4069.37~3026.53~0.6~0~0~3~~4.5~TEENSY-3~M 4070.8 3024.08L4070.8 3028.37 M 4069.37 3024.08L4072.23 3024.08 M 4073.58 3024.08L4073.58 3028.37 M 4073.58 3024.08L4076.24 3024.08 M 4073.58 3026.12L4075.22 3026.12 M 4073.58 3028.37L4076.24 3028.37 M 4077.59 3024.08L4077.59 3028.37 M 4077.59 3024.08L4080.25 3024.08 M 4077.59 3026.12L4079.23 3026.12 M 4077.59 3028.37L4080.25 3028.37 M 4081.6 3024.08L4081.6 3028.37 M 4081.6 3024.08L4084.47 3028.37 M 4084.47 3024.08L4084.47 3028.37 M 4088.68 3024.69L4088.27 3024.28 L4087.66 3024.08 L4086.84 3024.08 L4086.22 3024.28 L4085.82 3024.69 L4085.82 3025.1 L4086.02 3025.51 L4086.22 3025.71 L4086.63 3025.92 L4087.86 3026.33 L4088.27 3026.53 L4088.47 3026.73 L4088.68 3027.14 L4088.68 3027.76 L4088.27 3028.17 L4087.66 3028.37 L4086.84 3028.37 L4086.22 3028.17 L4085.82 3027.76 M 4090.03 3024.08L4091.67 3026.12 L4091.67 3028.37 M 4093.3 3024.08L4091.67 3026.12 M 4094.65 3026.53L4098.33 3026.53 M 4100.09 3024.08L4102.34 3024.08 L4101.12 3025.71 L4101.73 3025.71 L4102.14 3025.92 L4102.34 3026.12 L4102.55 3026.73 L4102.55 3027.14 L4102.34 3027.76 L4101.93 3028.17 L4101.32 3028.37 L4100.71 3028.37 L4100.09 3028.17 L4099.89 3027.96 L4099.68 3027.55 ~none~gge208~~0~#@$TEXT~N~4051.181~3041.82~0.6~0~0~3~~4.5~Teensy 3.6~M 4052.61 3039.37L4052.61 3043.66 M 4051.18 3039.37L4054.04 3039.37 M 4055.39 3042.02L4057.85 3042.02 L4057.85 3041.62 L4057.64 3041.21 L4057.44 3041 L4057.03 3040.8 L4056.42 3040.8 L4056.01 3041 L4055.6 3041.41 L4055.39 3042.02 L4055.39 3042.43 L4055.6 3043.05 L4056.01 3043.46 L4056.42 3043.66 L4057.03 3043.66 L4057.44 3043.46 L4057.85 3043.05 M 4059.2 3042.02L4061.65 3042.02 L4061.65 3041.62 L4061.45 3041.21 L4061.24 3041 L4060.84 3040.8 L4060.22 3040.8 L4059.81 3041 L4059.4 3041.41 L4059.2 3042.02 L4059.2 3042.43 L4059.4 3043.05 L4059.81 3043.46 L4060.22 3043.66 L4060.84 3043.66 L4061.24 3043.46 L4061.65 3043.05 M 4063 3040.8L4063 3043.66 M 4063 3041.62L4063.62 3041 L4064.03 3040.8 L4064.64 3040.8 L4065.05 3041 L4065.25 3041.62 L4065.25 3043.66 M 4068.85 3041.41L4068.65 3041 L4068.04 3040.8 L4067.42 3040.8 L4066.81 3041 L4066.6 3041.41 L4066.81 3041.82 L4067.22 3042.02 L4068.24 3042.23 L4068.65 3042.43 L4068.85 3042.84 L4068.85 3043.05 L4068.65 3043.46 L4068.04 3043.66 L4067.42 3043.66 L4066.81 3043.46 L4066.6 3043.05 M 4070.41 3040.8L4071.64 3043.66 M 4072.86 3040.8L4071.64 3043.66 L4071.23 3044.48 L4070.82 3044.89 L4070.41 3045.09 L4070.2 3045.09 M 4077.77 3039.37L4080.02 3039.37 L4078.79 3041 L4079.41 3041 L4079.82 3041.21 L4080.02 3041.41 L4080.23 3042.02 L4080.23 3042.43 L4080.02 3043.05 L4079.61 3043.46 L4079 3043.66 L4078.39 3043.66 L4077.77 3043.46 L4077.57 3043.25 L4077.36 3042.84 M 4081.78 3042.64L4081.58 3042.84 L4081.78 3043.05 L4081.99 3042.84 L4081.78 3042.64 M 4085.79 3039.98L4085.59 3039.57 L4084.97 3039.37 L4084.56 3039.37 L4083.95 3039.57 L4083.54 3040.18 L4083.34 3041.21 L4083.34 3042.23 L4083.54 3043.05 L4083.95 3043.46 L4084.56 3043.66 L4084.77 3043.66 L4085.38 3043.46 L4085.79 3043.05 L4085.99 3042.43 L4085.99 3042.23 L4085.79 3041.62 L4085.38 3041.21 L4084.77 3041 L4084.56 3041 L4083.95 3041.21 L4083.54 3041.62 L4083.34 3042.23 ~~gge209~~0~#@$TRACK~1~3~~4034.37 3034.37 4034.37 3274.37 4104.37 3274.37 4104.37 3034.37 4084.37 3034.37 4084.37 3029.37 4054.37 3029.37 4054.37 3034.37 4034.37 3034.37~gge210~0#@$TRACK~1~3~~4049.37 3269.37 4089.37 3269.37 4089.37 3229.37 4059.37 3229.37 4049.37 3239.37 4049.37 3269.37~gge211~0#@$TRACK~1~3~~4044.37 3134.37 4044.37 3184.37 4094.37 3184.37 4094.37 3134.37 4044.37 3134.37~gge212~0#@$TRACK~1~3~~4059.527 3198.11 4079.685 3198.11 4079.685 3210.708 4059.527 3210.708 4059.527 3198.11~gge213~0#@$CIRCLE~4069.38~3204.38~5~1~3~gge214~0~~#@$PAD~ELLIPSE~4039.37~3039.37~6~6~11~GND~1~1.8~~0~gge215~0~~Y~0~0~0.4~4039.37,3039.37#@$PAD~ELLIPSE~4039.37~3049.37~6~6~11~TEENSY-3_2~2~1.8~~0~gge216~0~~Y~0~0~0.4~4039.37,3049.37#@$PAD~ELLIPSE~4039.37~3059.37~6~6~11~TEENSY-3_3~3~1.8~~0~gge217~0~~Y~0~0~0.4~4039.37,3059.37#@$PAD~ELLIPSE~4039.37~3069.37~6~6~11~TEENSY-3_4~4~1.8~~0~gge218~0~~Y~0~0~0.4~4039.37,3069.37#@$PAD~ELLIPSE~4039.37~3079.37~6~6~11~TEENSY-3_5~5~1.8~~0~gge219~0~~Y~0~0~0.4~4039.37,3079.37#@$PAD~ELLIPSE~4039.37~3089.37~6~6~11~TEENSY-3_6~6~1.8~~0~gge220~0~~Y~0~0~0.4~4039.37,3089.37#@$PAD~ELLIPSE~4039.37~3099.37~6~6~11~TEENSY-3_7~7~1.8~~0~gge221~0~~Y~0~0~0.4~4039.37,3099.37#@$PAD~ELLIPSE~4039.37~3109.37~6~6~11~TEENSY-3_8~8~1.8~~0~gge222~0~~Y~0~0~0.4~4039.37,3109.37#@$PAD~ELLIPSE~4039.37~3119.37~6~6~11~TEENSY-3_9~9~1.8~~0~gge223~0~~Y~0~0~0.4~4039.37,3119.37#@$PAD~ELLIPSE~4039.37~3129.37~6~6~11~TEENSY-3_10~10~1.8~~0~gge224~0~~Y~0~0~0.4~4039.37,3129.37#@$PAD~ELLIPSE~4039.37~3139.37~6~6~11~TEENSY-3_11~11~1.8~~0~gge225~0~~Y~0~0~0.4~4039.37,3139.37#@$PAD~ELLIPSE~4039.37~3149.37~6~6~11~TEENSY-3_12~12~1.8~~0~gge226~0~~Y~0~0~0.4~4039.37,3149.37#@$PAD~ELLIPSE~4039.37~3159.37~6~6~11~TEENSY-3Line truncated
|
||||||
|
"HOLE~4000~3000~4~gge358~1",
|
||||||
|
"HOLE~4140.866~3000~4~gge359~1",
|
||||||
|
"HOLE~4000~3310.866~4~gge360~1",
|
||||||
|
"HOLE~4140.866~3310.866~4~gge361~1",
|
||||||
|
"VIA~4113.46~3199.93~2.4016~TEENSY-3_29~0.6102~gge564~0",
|
||||||
|
"VIA~4105.61~3182.49~2.4016~TEENSY-3_28~0.6102~gge576~0",
|
||||||
|
"VIA~4084.37~3174.38~2.4016~TEENSY-3_36~0.6102~gge590~0",
|
||||||
|
"VIA~4125.984~3020.79~2.4016~GND~0.6102~gge603~0"
|
||||||
|
],
|
||||||
|
"layers": [
|
||||||
|
"1~TopLayer~#FF0000~true~true~true~",
|
||||||
|
"2~BottomLayer~#0000FF~true~false~true~",
|
||||||
|
"3~TopSilkLayer~#FFCC00~true~false~true~",
|
||||||
|
"4~BottomSilkLayer~#66CC33~true~false~true~",
|
||||||
|
"5~TopPasteMaskLayer~#808080~true~false~true~",
|
||||||
|
"6~BottomPasteMaskLayer~#800000~true~false~true~",
|
||||||
|
"7~TopSolderMaskLayer~#800080~true~false~true~0.3",
|
||||||
|
"8~BottomSolderMaskLayer~#AA00FF~true~false~true~0.3",
|
||||||
|
"9~Ratlines~#6464FF~true~false~true~",
|
||||||
|
"10~BoardOutline~#FF00FF~true~false~true~",
|
||||||
|
"11~Multi-Layer~#C0C0C0~true~false~true~",
|
||||||
|
"12~Document~#FFFFFF~true~false~true~",
|
||||||
|
"13~TopAssembly~#33CC99~false~false~false~",
|
||||||
|
"14~BottomAssembly~#5555FF~false~false~false~",
|
||||||
|
"15~Mechanical~#F022F0~false~false~false~",
|
||||||
|
"19~3DModel~#66CCFF~false~false~false~",
|
||||||
|
"21~Inner1~#800000~false~false~false~~",
|
||||||
|
"22~Inner2~#008000~false~false~false~~",
|
||||||
|
"23~Inner3~#00FF00~false~false~false~~",
|
||||||
|
"24~Inner4~#BC8E00~false~false~false~~",
|
||||||
|
"25~Inner5~#70DBFA~false~false~false~~",
|
||||||
|
"26~Inner6~#00CC66~false~false~false~~",
|
||||||
|
"27~Inner7~#9966FF~false~false~false~~",
|
||||||
|
"28~Inner8~#800080~false~false~false~~",
|
||||||
|
"29~Inner9~#008080~false~false~false~~",
|
||||||
|
"30~Inner10~#15935F~false~false~false~~",
|
||||||
|
"31~Inner11~#000080~false~false~false~~",
|
||||||
|
"32~Inner12~#00B400~false~false~false~~",
|
||||||
|
"33~Inner13~#2E4756~false~false~false~~",
|
||||||
|
"34~Inner14~#99842F~false~false~false~~",
|
||||||
|
"35~Inner15~#FFFFAA~false~false~false~~",
|
||||||
|
"36~Inner16~#99842F~false~false~false~~",
|
||||||
|
"37~Inner17~#2E4756~false~false~false~~",
|
||||||
|
"38~Inner18~#3535FF~false~false~false~~",
|
||||||
|
"39~Inner19~#8000BC~false~false~false~~",
|
||||||
|
"40~Inner20~#43AE5F~false~false~false~~",
|
||||||
|
"41~Inner21~#C3ECCE~false~false~false~~",
|
||||||
|
"42~Inner22~#728978~false~false~false~~",
|
||||||
|
"43~Inner23~#39503F~false~false~false~~",
|
||||||
|
"44~Inner24~#0C715D~false~false~false~~",
|
||||||
|
"45~Inner25~#5A8A80~false~false~false~~",
|
||||||
|
"46~Inner26~#2B937E~false~false~false~~",
|
||||||
|
"47~Inner27~#23999D~false~false~false~~",
|
||||||
|
"48~Inner28~#45B4E3~false~false~false~~",
|
||||||
|
"49~Inner29~#215DA1~false~false~false~~",
|
||||||
|
"50~Inner30~#4564D7~false~false~false~~",
|
||||||
|
"51~Inner31~#6969E9~false~false~false~~",
|
||||||
|
"52~Inner32~#9069E9~false~false~false~~",
|
||||||
|
"99~ComponentShapeLayer~#00CCCC~false~false~false~0.4",
|
||||||
|
"100~LeadShapeLayer~#CC9999~false~false~false~",
|
||||||
|
"101~ComponentMarkingLayer~#66FFCC~false~false~false~",
|
||||||
|
"Hole~Hole~#222222~~false~true~",
|
||||||
|
"DRCError~DRCError~#FAD609~~false~true~"
|
||||||
|
],
|
||||||
|
"objects": [
|
||||||
|
"All~true~false",
|
||||||
|
"Component~true~true",
|
||||||
|
"Prefix~true~true",
|
||||||
|
"Name~true~false",
|
||||||
|
"Track~true~true",
|
||||||
|
"Pad~true~true",
|
||||||
|
"Via~true~true",
|
||||||
|
"Hole~true~true",
|
||||||
|
"Copper_Area~true~true",
|
||||||
|
"Circle~true~true",
|
||||||
|
"Arc~true~true",
|
||||||
|
"Solid_Region~true~true",
|
||||||
|
"Text~true~true",
|
||||||
|
"Image~true~true",
|
||||||
|
"Rect~true~true",
|
||||||
|
"Dimension~true~true",
|
||||||
|
"Protractor~true~true"
|
||||||
|
],
|
||||||
|
"BBox": {
|
||||||
|
"x": 3960.6,
|
||||||
|
"y": 2960.6,
|
||||||
|
"width": 240.2,
|
||||||
|
"height": 442.2
|
||||||
|
},
|
||||||
|
"preference": {
|
||||||
|
"hideFootprints": "",
|
||||||
|
"hideNets": ""
|
||||||
|
},
|
||||||
|
"DRCRULE": {
|
||||||
|
"Default": {
|
||||||
|
"trackWidth": 0.5984,
|
||||||
|
"clearance": 0.5984,
|
||||||
|
"viaHoleDiameter": 2.4016,
|
||||||
|
"viaHoleD": 1.2008
|
||||||
|
},
|
||||||
|
"isRealtime": true,
|
||||||
|
"checkObjectToCopperarea": true,
|
||||||
|
"showDRCRangeLine": true
|
||||||
|
},
|
||||||
|
"routerRule": {
|
||||||
|
"unit": "mm",
|
||||||
|
"trackWidth": 0.6,
|
||||||
|
"trackClearance": 0.16,
|
||||||
|
"viaHoleD": 0.31,
|
||||||
|
"viaDiameter": 0.61,
|
||||||
|
"routerLayers": [
|
||||||
|
1,
|
||||||
|
2
|
||||||
|
],
|
||||||
|
"smdClearance": 0.16,
|
||||||
|
"specialNets": [],
|
||||||
|
"nets": [
|
||||||
|
"510_2",
|
||||||
|
"7805_2",
|
||||||
|
"GND",
|
||||||
|
"NRF24L01_8",
|
||||||
|
"TEENSY-3_10",
|
||||||
|
"TEENSY-3_11",
|
||||||
|
"TEENSY-3_12",
|
||||||
|
"TEENSY-3_13",
|
||||||
|
"TEENSY-3_14",
|
||||||
|
"TEENSY-3_15",
|
||||||
|
"TEENSY-3_16",
|
||||||
|
"TEENSY-3_17",
|
||||||
|
"TEENSY-3_18",
|
||||||
|
"TEENSY-3_19",
|
||||||
|
"TEENSY-3_2",
|
||||||
|
"TEENSY-3_20",
|
||||||
|
"TEENSY-3_21",
|
||||||
|
"TEENSY-3_22",
|
||||||
|
"TEENSY-3_23",
|
||||||
|
"TEENSY-3_24",
|
||||||
|
"TEENSY-3_25",
|
||||||
|
"TEENSY-3_26",
|
||||||
|
"TEENSY-3_27",
|
||||||
|
"TEENSY-3_28",
|
||||||
|
"TEENSY-3_29",
|
||||||
|
"TEENSY-3_3",
|
||||||
|
"TEENSY-3_30",
|
||||||
|
"TEENSY-3_31",
|
||||||
|
"TEENSY-3_32",
|
||||||
|
"TEENSY-3_33",
|
||||||
|
"TEENSY-3_35",
|
||||||
|
"TEENSY-3_36",
|
||||||
|
"TEENSY-3_37",
|
||||||
|
"TEENSY-3_38",
|
||||||
|
"TEENSY-3_39",
|
||||||
|
"TEENSY-3_4",
|
||||||
|
"TEENSY-3_40",
|
||||||
|
"TEENSY-3_41",
|
||||||
|
"TEENSY-3_42",
|
||||||
|
"TEENSY-3_43",
|
||||||
|
"TEENSY-3_44",
|
||||||
|
"TEENSY-3_45",
|
||||||
|
"TEENSY-3_46",
|
||||||
|
"TEENSY-3_47",
|
||||||
|
"TEENSY-3_48",
|
||||||
|
"TEENSY-3_49",
|
||||||
|
"TEENSY-3_5",
|
||||||
|
"TEENSY-3_50",
|
||||||
|
"TEENSY-3_51",
|
||||||
|
"TEENSY-3_52",
|
||||||
|
"TEENSY-3_53",
|
||||||
|
"TEENSY-3_54",
|
||||||
|
"TEENSY-3_55",
|
||||||
|
"TEENSY-3_56",
|
||||||
|
"TEENSY-3_57",
|
||||||
|
"TEENSY-3_58",
|
||||||
|
"TEENSY-3_59",
|
||||||
|
"TEENSY-3_6",
|
||||||
|
"TEENSY-3_60",
|
||||||
|
"TEENSY-3_61",
|
||||||
|
"TEENSY-3_62",
|
||||||
|
"TEENSY-3_63",
|
||||||
|
"TEENSY-3_64",
|
||||||
|
"TEENSY-3_65",
|
||||||
|
"TEENSY-3_66",
|
||||||
|
"TEENSY-3_67",
|
||||||
|
"TEENSY-3_68",
|
||||||
|
"TEENSY-3_69",
|
||||||
|
"TEENSY-3_7",
|
||||||
|
"TEENSY-3_70",
|
||||||
|
"TEENSY-3_71",
|
||||||
|
"TEENSY-3_72",
|
||||||
|
"TEENSY-3_73",
|
||||||
|
"TEENSY-3_74",
|
||||||
|
"TEENSY-3_75",
|
||||||
|
"TEENSY-3_76",
|
||||||
|
"TEENSY-3_77",
|
||||||
|
"TEENSY-3_78",
|
||||||
|
"TEENSY-3_79",
|
||||||
|
"TEENSY-3_8",
|
||||||
|
"TEENSY-3_80",
|
||||||
|
"TEENSY-3_81",
|
||||||
|
"TEENSY-3_82",
|
||||||
|
"TEENSY-3_83",
|
||||||
|
"TEENSY-3_84",
|
||||||
|
"TEENSY-3_85",
|
||||||
|
"TEENSY-3_86",
|
||||||
|
"TEENSY-3_87",
|
||||||
|
"TEENSY-3_88",
|
||||||
|
"TEENSY-3_9",
|
||||||
|
"U1_ADO",
|
||||||
|
"U1_INT",
|
||||||
|
"U1_XCL",
|
||||||
|
"U1_XDA",
|
||||||
|
"VCC"
|
||||||
|
],
|
||||||
|
"padsCount": 145,
|
||||||
|
"skipNets": [],
|
||||||
|
"realtime": true
|
||||||
|
},
|
||||||
|
"netColors": {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
# Main PCB (2026-11-13)
|
||||||
|
|
||||||
|
The PCB mounted inside the robot body, with the Teensy 3.6 peeking through
|
||||||
|
the hole in the top body. Teensy 3.6 carrier that distributes six servo
|
||||||
|
connectors (one per leg), an nRF24L01 radio, an MPU6050 IMU, a TO-252
|
||||||
|
regulator, a status LED and a 2-pin battery input.
|
||||||
|
|
||||||
|
## Files in this folder
|
||||||
|
|
||||||
|
| File | What it is |
|
||||||
|
|------|------------|
|
||||||
|
| `PCB_test_2026-11-13.json` | EasyEDA PCB source (editor v6.5.61). The authoritative board. |
|
||||||
|
| `OBJ_test.obj` + `.mtl` | EasyEDA 3D OBJ export. Just a slab shape with the four mounting holes; no components. Keep it because it round-trips with the EasyEDA source — but prefer `main-pcb.scad` for anything readable. |
|
||||||
|
| `main-pcb.scad` | Readable, parametric OpenSCAD model. Real board outline, 4 M3 mounting holes, and every major component as its own module on the correct side (see "Which side"). Component bodies have real-world dimensions; each module's local origin is the centre of its pad group so placements come straight from the pad bbox centres extracted from the EasyEDA JSON — no eyeballed positions. |
|
||||||
|
| `20190524_234512.jpg` | Photo of the **bottom** side: nRF24, IMU, 7805, ZENER, BATT JST and the six servo headers (JP1–JP6). |
|
||||||
|
| `20190524_234518.jpg` | Photo of the **top** side: Teensy 3.6 raised above the PCB on tall pin headers, USB powered, green POWER LED lit. |
|
||||||
|
| `top.png` | EasyEDA render of the **top** side (shows "Hexapod v1" title, spider silk, Teensy footprint, POWER + 510 Ω SMDs). |
|
||||||
|
| `bottom.png` | EasyEDA render of the **bottom** side (shows JP1–JP7 labels, NRF24L01, MPU, ZENER, 7805 footprints). This is the authoritative source for silkscreen names. |
|
||||||
|
|
||||||
|
## Which side each component is on
|
||||||
|
|
||||||
|
- **Top:** Teensy 3.6 (on 2×24 tall pin headers so it clears the IMU/radio underneath and pokes through the hole in the top body), POWER LED and its 511 Ω series resistor.
|
||||||
|
- **Bottom:** nRF24L01+ module (antenna hanging off the −Y board edge), GY-521 (MPU6050) IMU sitting directly under the Teensy, 7805 regulator, ZENER, 2-pin JST battery input, and the six servo headers JP1–JP6.
|
||||||
|
|
||||||
|
## Understanding the EasyEDA JSON
|
||||||
|
|
||||||
|
The JSON is EasyEDA's native PCB format: a `shape` array of tilde-separated
|
||||||
|
primitives. Here the board has **88** shape entries:
|
||||||
|
|
||||||
|
| Kind | Count | Field layout (after first `~`) |
|
||||||
|
|------|-------|--------------------------------|
|
||||||
|
| `TRACK` | 54 | width, layer, net, `x y x y …`, id, locked |
|
||||||
|
| `COPPERAREA` | 2 | id, layer, net, SVG path, … (one VCC pour, one GND pour) |
|
||||||
|
| `TEXT` | 9 | type, x, y, size, rotation, layer, …, string, path |
|
||||||
|
| `SVGNODE` | 1 | JSON of an SVG path (the 3D model placeholder) |
|
||||||
|
| `LIB` | 14 | x, y, `` package`NAME` ``, rotation, … (components) |
|
||||||
|
| `HOLE` | 4 | x, y, diameter (mm), id, locked |
|
||||||
|
| `VIA` | 4 | x, y, diameter, net, drill, id, locked |
|
||||||
|
|
||||||
|
**Layers** (`layers` key) follow EasyEDA's standard numbering: 1 TopLayer,
|
||||||
|
2 BottomLayer, 3/4 silk, 5/6 paste mask, 7/8 solder mask, 10 BoardOutline,
|
||||||
|
11 Multi-Layer, 13/14 assembly, 19 3DModel, Hole, DRCError.
|
||||||
|
|
||||||
|
### Units
|
||||||
|
|
||||||
|
Positions (and most sizes) are in **10-mil units = 0.254 mm**. The user
|
||||||
|
clearly laid out on a 1 mm grid: every component's x-offset from the
|
||||||
|
EasyEDA origin (4000, 3000) divides cleanly by 39.3700787 (10 mm per
|
||||||
|
10-mil unit). Hole and via **diameters** in this export are in millimetres
|
||||||
|
directly, which is standard EasyEDA practice.
|
||||||
|
|
||||||
|
### Coordinate frame
|
||||||
|
|
||||||
|
EasyEDA: +X right, +Y **down**, origin at `(4000, 3000)` (also the
|
||||||
|
top-left mounting hole). This OBJ export keeps the same X but flips Y to
|
||||||
|
negative.
|
||||||
|
|
||||||
|
`main-pcb.scad` uses +X right, +Y **up**, origin at the board's
|
||||||
|
**bottom-left corner**, so dimensions read the way you'd expect in CAD.
|
||||||
|
The conversion applied is:
|
||||||
|
|
||||||
|
```
|
||||||
|
x_mm = (x_eda - 3980.315) * 0.254
|
||||||
|
y_mm = (3330.7087 - y_eda) * 0.254
|
||||||
|
```
|
||||||
|
|
||||||
|
## Board summary
|
||||||
|
|
||||||
|
- Outline: 46.0 × 89.0 mm, black soldermask, 1.6 mm FR4 (the OBJ's 2.54 mm
|
||||||
|
"slab" is just the export; the physical board is standard).
|
||||||
|
- Four M3 clearance holes (⌀ 4 mm) at (5.00, 5.04), (40.78, 5.04),
|
||||||
|
(5.00, 84.00), (40.78, 84.00): hole grid 35.78 × 78.96 mm, centred at
|
||||||
|
(22.89, 44.52), slightly off the board centre (23, 44.5).
|
||||||
|
- Component placements (pad-group centres from the EasyEDA JSON — these
|
||||||
|
are the exact (x, y) the SCAD uses). All in mm from the board's
|
||||||
|
bottom-left corner.
|
||||||
|
|
||||||
|
| Component | Side | (x, y) mm | Notes |
|
||||||
|
|-----------|------|-----------|-------|
|
||||||
|
| Teensy 3.6 | top | (22.62, 44.79) | centre of 2×24 pin pattern; long axis along Y; USB at +Y, SD at −Y; raised 11 mm on tall headers |
|
||||||
|
| POWER LED (1206) | top | (33.00, 83.00) | |
|
||||||
|
| 510 Ω series resistor (2010) | top | (32.55, 78.72) | |
|
||||||
|
| "Hexapod v1" title silk | top | (6, 80.9) | top-silk text |
|
||||||
|
| nRF24L01+ | bottom | (28.00, 8.00) | header centre; module body + PCB antenna extend −Y and hang off the board edge |
|
||||||
|
| GY-521 (MPU6050) | bottom | (19.22, 44.73) | centre of 1×8 header; board extends +X; sits under the Teensy |
|
||||||
|
| 7805 regulator | bottom | (23.00, 79.00) | EasyEDA uses a `TO252` footprint but the physical board has a **through-hole 7805 in TO-220** bent flat into those pads |
|
||||||
|
| ZENER | bottom | (22.00, 67.00) | horizontal between its two pads |
|
||||||
|
| JP7 (2-pin JST, battery) | bottom | (15.00, 9.00) | |
|
||||||
|
| JP1 (5-pin JST-PH, servos) | bottom | ( 9.00, 69.00) | left column, top |
|
||||||
|
| JP2 | bottom | ( 9.00, 43.00) | left column, middle |
|
||||||
|
| JP3 | bottom | ( 9.00, 20.00) | left column, bottom |
|
||||||
|
| JP4 | bottom | (38.00, 69.00) | right column, top |
|
||||||
|
| JP5 | bottom | (38.00, 44.00) | right column, middle |
|
||||||
|
| JP6 | bottom | (38.00, 20.00) | right column, bottom |
|
||||||
|
|
||||||
|
Servo headers are 5-pin JST-PH footprints at **2.0 mm pitch** (total
|
||||||
|
span 8 mm), not 2.54 mm pin headers.
|
||||||
|
|
||||||
|
## Viewing
|
||||||
|
|
||||||
|
- OBJ: any 3D viewer (Fusion 360 will import it; `OBJ_test.mtl` sets a
|
||||||
|
dull-yellow material).
|
||||||
|
- SCAD: open `main-pcb.scad` in OpenSCAD; toggle `SHOW_COMPONENTS` and
|
||||||
|
`EXPLODE` to see parts lifted off the board.
|
||||||
Binary file not shown.
@@ -0,0 +1,316 @@
|
|||||||
|
// Main PCB of the 2026 hexapod robot — a Teensy 3.6 carrier board.
|
||||||
|
//
|
||||||
|
// Dimensions and placements are all derived from the EasyEDA export
|
||||||
|
// (PCB_test_2026-11-13.json), cross-checked against the EasyEDA renders
|
||||||
|
// (top.png, bottom.png) and photos of the populated board.
|
||||||
|
//
|
||||||
|
// Every component is placed at its actual pad reference point (not an
|
||||||
|
// eyeballed position), with its real-world body dimensions.
|
||||||
|
//
|
||||||
|
// Coordinate frame: X right, Y up, Z up, origin = board bottom-left.
|
||||||
|
// Board top surface at z = PCB_THICK, bottom surface at z = 0.
|
||||||
|
// EasyEDA uses Y-down with the base unit = 10 mil (0.254 mm). Conversion:
|
||||||
|
// x_mm = (x_eda - 3980.315) * 0.254
|
||||||
|
// y_mm = (3330.7087 - y_eda) * 0.254
|
||||||
|
|
||||||
|
/* [Board] */
|
||||||
|
BOARD_W = 46.0;
|
||||||
|
BOARD_H = 89.0;
|
||||||
|
PCB_THICK = 1.6;
|
||||||
|
CORNER_R = 1.0;
|
||||||
|
|
||||||
|
/* [Mounting holes] */
|
||||||
|
HOLE_DIA = 4.0; // M3 clearance
|
||||||
|
// Exact EasyEDA HOLE positions; the right/bottom insets are 5.22/5.04 mm,
|
||||||
|
// not 5, so the grid is 35.78 x 78.96 mm (the body's PCB bosses use it).
|
||||||
|
HOLES = [[5.00, 5.04], [40.78, 5.04], [5.00, 84.00], [40.78, 84.00]];
|
||||||
|
HOLE_GRID_CENTER = [22.89, 44.52];
|
||||||
|
|
||||||
|
/* [Rendering] */
|
||||||
|
SHOW_COMPONENTS = true;
|
||||||
|
SHOW_LABELS = true;
|
||||||
|
TEENSY_ALPHA = 0.4;
|
||||||
|
EXPLODE = 0;
|
||||||
|
|
||||||
|
/* [Hidden] */
|
||||||
|
$fa = 2; $fs = 0.3;
|
||||||
|
|
||||||
|
C_PCB = "#1a1a1a";
|
||||||
|
C_TEENSY = "#1e5a2a";
|
||||||
|
C_MODULE = "#1f4fa0";
|
||||||
|
C_HEADER = "#111";
|
||||||
|
C_METAL = "#b0b0b0";
|
||||||
|
C_PLASTIC = "#222";
|
||||||
|
C_LED_ON = "#55ff55";
|
||||||
|
C_LABEL = "white";
|
||||||
|
|
||||||
|
// ---------- board ----------------------------------------------------
|
||||||
|
|
||||||
|
module board_outline_2d() {
|
||||||
|
if (CORNER_R > 0)
|
||||||
|
hull() for (p = [[CORNER_R, CORNER_R],
|
||||||
|
[BOARD_W - CORNER_R, CORNER_R],
|
||||||
|
[CORNER_R, BOARD_H - CORNER_R],
|
||||||
|
[BOARD_W - CORNER_R, BOARD_H - CORNER_R]])
|
||||||
|
translate(p) circle(r = CORNER_R);
|
||||||
|
else
|
||||||
|
square([BOARD_W, BOARD_H]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module mounting_holes_2d() {
|
||||||
|
for (h = HOLES) translate(h) circle(d = HOLE_DIA);
|
||||||
|
}
|
||||||
|
|
||||||
|
module pcb() {
|
||||||
|
color(C_PCB)
|
||||||
|
linear_extrude(PCB_THICK)
|
||||||
|
difference() { board_outline_2d(); mounting_holes_2d(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- helpers --------------------------------------------------
|
||||||
|
|
||||||
|
module mount_top(cx, cy, rot = 0) {
|
||||||
|
translate([cx, cy, PCB_THICK + EXPLODE]) rotate([0, 0, rot]) children();
|
||||||
|
}
|
||||||
|
module mount_bottom(cx, cy, rot = 0) {
|
||||||
|
translate([cx, cy, -EXPLODE])
|
||||||
|
mirror([0, 0, 1])
|
||||||
|
rotate([0, 0, rot])
|
||||||
|
children();
|
||||||
|
}
|
||||||
|
|
||||||
|
module centered_cube(sx, sy, sz) {
|
||||||
|
translate([-sx/2, -sy/2, 0]) cube([sx, sy, sz]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module label(txt, size = 2.4, rot = 0) {
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
color(C_LABEL)
|
||||||
|
rotate([0, 0, rot])
|
||||||
|
linear_extrude(0.2)
|
||||||
|
text(txt, size = size, halign = "center",
|
||||||
|
valign = "center", font = "Liberation Sans");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic 1xN pin-header strip, pins along Y, strip centered on local origin.
|
||||||
|
// pitch defaults to 2.54 mm (standard); pass 2.0 for JST-PH.
|
||||||
|
module header_1xN(n, h = 8.5, pitch = 2.54) {
|
||||||
|
L = n * pitch;
|
||||||
|
color(C_HEADER) translate([-pitch/2, -L/2 + pitch/2 - pitch/2, 0])
|
||||||
|
cube([pitch, L, h]);
|
||||||
|
color(C_METAL)
|
||||||
|
for (i = [0:n-1])
|
||||||
|
translate([0, (i - (n-1)/2) * pitch, h])
|
||||||
|
cylinder(d = 0.65, h = 2.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic MxN pin-header, M rows along X (2.54 pitch) x N pins along Y.
|
||||||
|
module header_MxN(m, n, h = 8.5, pitch = 2.54) {
|
||||||
|
L = n * pitch; W = m * pitch;
|
||||||
|
color(C_HEADER)
|
||||||
|
translate([-W/2, -L/2, 0]) cube([W, L, h]);
|
||||||
|
color(C_METAL)
|
||||||
|
for (i = [0:m-1], j = [0:n-1])
|
||||||
|
translate([(i - (m-1)/2) * pitch, (j - (n-1)/2) * pitch, h])
|
||||||
|
cylinder(d = 0.65, h = 2.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- components -----------------------------------------------
|
||||||
|
//
|
||||||
|
// Every component module below is written so its LOCAL origin (0,0,0)
|
||||||
|
// matches a well-defined reference on the board — usually the geometric
|
||||||
|
// centre of its pad group (= the position the EasyEDA LIB extractor
|
||||||
|
// returned). All geometry is built upward from z = 0.
|
||||||
|
|
||||||
|
// Teensy 3.6: local origin = centre of the 2x24 pin pattern.
|
||||||
|
// Pin bbox: 15.24 mm (X, two rows at 0.6") x 58.42 mm (Y, 24 pins).
|
||||||
|
// Body is 17.8 x 61 x 1.6 mm, slightly wider than the pin pitch.
|
||||||
|
// Micro-USB jack at +Y end; microSD slot at -Y end.
|
||||||
|
module teensy_3_6() {
|
||||||
|
HDR_H = 11.0;
|
||||||
|
ROW_SPACING = 15.24; // 0.6 inch
|
||||||
|
PIN_SPAN = 24 * 2.54;
|
||||||
|
BODY_L = 61.0; BODY_W = 17.8; BODY_T = 1.6;
|
||||||
|
|
||||||
|
for (dx = [-ROW_SPACING/2, ROW_SPACING/2])
|
||||||
|
translate([dx, 0, 0]) header_1xN(24, HDR_H);
|
||||||
|
|
||||||
|
translate([0, 0, HDR_H]) {
|
||||||
|
color(C_TEENSY, TEENSY_ALPHA)
|
||||||
|
centered_cube(BODY_W, BODY_L, BODY_T);
|
||||||
|
// MK66FX1M0 chip, towards +Y end
|
||||||
|
color("#222")
|
||||||
|
translate([0, 10, BODY_T]) centered_cube(10, 10, 1.3);
|
||||||
|
// micro-USB jack, protrudes past +Y edge
|
||||||
|
color(C_METAL)
|
||||||
|
translate([0, BODY_L/2 - 1, BODY_T])
|
||||||
|
centered_cube(7.5, 5.5, 2.6);
|
||||||
|
// microSD slot at -Y end
|
||||||
|
color(C_METAL)
|
||||||
|
translate([0, -BODY_L/2 + 7, BODY_T])
|
||||||
|
centered_cube(12, 14, 1.5);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([0, -4, BODY_T + 1.5]) label("Teensy 3.6", 2.6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// nRF24L01+ with PCB antenna. Local origin = centre of the 2x4 header
|
||||||
|
// (pads span 7.62 x 2.54 mm). Module body is 15.5 x 29 x 1.2 mm; the
|
||||||
|
// header sits near one short edge, so the body extends -Y from origin
|
||||||
|
// and the PCB antenna end hangs off that side of the board.
|
||||||
|
module nrf24() {
|
||||||
|
HDR_H = 7.5;
|
||||||
|
BODY_L = 29.0; BODY_W = 15.5; BODY_T = 1.2;
|
||||||
|
HDR_FROM_EDGE = 3.2; // from body +Y edge to header centre
|
||||||
|
body_y = -(BODY_L/2 - HDR_FROM_EDGE);
|
||||||
|
|
||||||
|
header_MxN(2, 4, HDR_H);
|
||||||
|
translate([0, body_y, HDR_H]) {
|
||||||
|
color(C_MODULE) centered_cube(BODY_W, BODY_L, BODY_T);
|
||||||
|
// RF shield (can) over the chip area, nearer the header end
|
||||||
|
color(C_METAL)
|
||||||
|
translate([0, BODY_L/2 - 7.5, BODY_T])
|
||||||
|
centered_cube(BODY_W - 2, 10.0, 1.8);
|
||||||
|
// Cylindrical crystal next to the shield
|
||||||
|
color(C_METAL)
|
||||||
|
translate([-BODY_W/4, BODY_L/2 - 15, BODY_T])
|
||||||
|
cube([3.2, 8, 2.5]);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([0, BODY_L/2 - 20, BODY_T + 2.2]) label("nRF24", 2.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// GY-521 (MPU6050) breakout. Local origin = centre of the 1x8 header
|
||||||
|
// (pads span 0 x 17.78 mm, 2.54 pitch along Y). The board extends +X
|
||||||
|
// from the header; body is 15.6 x 21.2 x 1.6 mm.
|
||||||
|
module gy521() {
|
||||||
|
HDR_H = 8.0;
|
||||||
|
BODY_L = 21.2; BODY_W = 15.6; BODY_T = 1.6;
|
||||||
|
|
||||||
|
header_1xN(8, HDR_H);
|
||||||
|
translate([BODY_W/2, 0, HDR_H]) {
|
||||||
|
color(C_MODULE) centered_cube(BODY_W, BODY_L, BODY_T);
|
||||||
|
// MPU6050 QFN near the board centre
|
||||||
|
color("#222")
|
||||||
|
translate([0, 0, BODY_T]) centered_cube(4, 4, 1.1);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([0, BODY_L/2 - 3, BODY_T + 1.5]) label("MPU", 2.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 7805 in TO-220. Local origin = centre of the three TO-252 pads on the
|
||||||
|
// EasyEDA board (the physical build has a through-hole 7805 bent flat
|
||||||
|
// into those pads). Pads span ~4.57 x 7.29 mm.
|
||||||
|
module ic_7805() {
|
||||||
|
BODY_L = 10.0; BODY_W = 4.7; BODY_H = 4.5;
|
||||||
|
// body laid flat along +Y (matching the pad bbox orientation)
|
||||||
|
translate([0, 0, 0]) {
|
||||||
|
color(C_PLASTIC)
|
||||||
|
translate([-BODY_L/2, -BODY_W/2, 0]) cube([BODY_L, BODY_W, BODY_H]);
|
||||||
|
// metal tab
|
||||||
|
color(C_METAL)
|
||||||
|
translate([-BODY_L/2, -BODY_W/2, BODY_H - 1.2])
|
||||||
|
cube([BODY_L, BODY_W, 1.2]);
|
||||||
|
// 3 leads out of +Y side
|
||||||
|
color(C_METAL)
|
||||||
|
for (dx = [-2.54, 0, 2.54])
|
||||||
|
translate([dx - 0.3, BODY_W/2, 0])
|
||||||
|
cube([0.6, 3, 0.6]);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([0, 0, BODY_H + 0.5]) label("7805", 2.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Through-hole zener, lying between two pads along X (pad span 3.28 mm).
|
||||||
|
module zener() {
|
||||||
|
color("#444") rotate([0, 90, 0]) cylinder(d = 2.0, h = 3.0, center = true);
|
||||||
|
// cathode band
|
||||||
|
color("#eee") translate([-0.9, 0, 0])
|
||||||
|
rotate([0, 90, 0]) cylinder(d = 2.05, h = 0.3, center = true);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([0, 3.5, 0]) label("ZENER", 1.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2-pin JST-XH battery connector (silkscreen JP7). Pads 2 mm apart in X.
|
||||||
|
module jst_jp7() {
|
||||||
|
BODY_W = 7.6; BODY_D = 4.0; BODY_H = 7.0;
|
||||||
|
color(C_PLASTIC)
|
||||||
|
translate([-BODY_W/2, -BODY_D/2 + 1.0, 0])
|
||||||
|
cube([BODY_W, BODY_D, BODY_H]);
|
||||||
|
color(C_METAL)
|
||||||
|
translate([-3, -BODY_D/2 + 1.0 - 0.5, BODY_H - 1.5])
|
||||||
|
cube([6, 0.5, 1.0]);
|
||||||
|
if (SHOW_LABELS) translate([0, 0, BODY_H + 0.5]) label("JP7", 1.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5-pin JST-PH 2 mm servo header (JP1..JP6). Pads 2 mm pitch along Y,
|
||||||
|
// total span 8 mm. Local origin = pad-group centre.
|
||||||
|
module servo_jst5(label_txt) {
|
||||||
|
PITCH = 2.0;
|
||||||
|
header_1xN(5, 8.5, pitch = PITCH);
|
||||||
|
// JST-PH housing body (sits above the pins when soldered male-up)
|
||||||
|
color(C_PLASTIC)
|
||||||
|
translate([-1.8, -5.0, 0]) cube([3.6, 10.0, 7.0]);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([3.5, 0, 4]) label(label_txt, 1.8, 90);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1206 SMD LED and 2010 SMD resistor, both on the TOP layer.
|
||||||
|
module led_1206() {
|
||||||
|
color(C_LED_ON) translate([-1.6, -0.8, 0]) cube([3.2, 1.6, 0.9]);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([0, -2.5, 1.0]) label("PWR", 1.6);
|
||||||
|
}
|
||||||
|
module r_2010(txt = "510") {
|
||||||
|
color("#eee") translate([-2.5, -1.25, 0]) cube([5.0, 2.5, 0.6]);
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([0, 0, 0.7]) label(txt, 1.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
// "Hexapod v1" silkscreen text, at the position of the top-silk TEXT
|
||||||
|
// entry in the EasyEDA file.
|
||||||
|
module title_silk() {
|
||||||
|
if (SHOW_LABELS)
|
||||||
|
translate([6, 80.9, PCB_THICK + 0.02])
|
||||||
|
color("white")
|
||||||
|
linear_extrude(0.1)
|
||||||
|
text("Hexapod v1", size = 2.8, halign = "left",
|
||||||
|
valign = "center", font = "Liberation Sans");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- assembly -------------------------------------------------
|
||||||
|
//
|
||||||
|
// Placements use the pad-reference centres extracted from the EasyEDA
|
||||||
|
// file (see scratchpad/libs.py output).
|
||||||
|
|
||||||
|
module components() {
|
||||||
|
// --- TOP side ----
|
||||||
|
mount_top(22.62, 44.79) teensy_3_6();
|
||||||
|
mount_top(33.00, 83.00) led_1206();
|
||||||
|
mount_top(32.55, 78.72) r_2010("510");
|
||||||
|
title_silk();
|
||||||
|
|
||||||
|
// --- BOTTOM side ----
|
||||||
|
mount_bottom(28.00, 8.00) nrf24(); // header centre; body hangs off -Y edge
|
||||||
|
mount_bottom(19.22, 44.73) gy521(); // header centre; body extends +X
|
||||||
|
mount_bottom(23.00, 79.00) ic_7805();
|
||||||
|
mount_bottom(22.00, 67.00) zener();
|
||||||
|
mount_bottom(15.00, 9.00) jst_jp7();
|
||||||
|
|
||||||
|
// Servo headers, silkscreen numbering per bottom.png:
|
||||||
|
// left column (x=9) top-to-bottom = JP1, JP2, JP3
|
||||||
|
// right column (x=38) top-to-bottom = JP4, JP5, JP6
|
||||||
|
mount_bottom( 9.00, 69.00) servo_jst5("JP1");
|
||||||
|
mount_bottom( 9.00, 43.00) servo_jst5("JP2");
|
||||||
|
mount_bottom( 9.00, 20.00) servo_jst5("JP3");
|
||||||
|
mount_bottom(38.00, 69.00) servo_jst5("JP4");
|
||||||
|
mount_bottom(38.00, 44.00) servo_jst5("JP5");
|
||||||
|
mount_bottom(38.00, 20.00) servo_jst5("JP6");
|
||||||
|
}
|
||||||
|
|
||||||
|
module main_pcb() {
|
||||||
|
pcb();
|
||||||
|
if (SHOW_COMPONENTS) components();
|
||||||
|
}
|
||||||
|
|
||||||
|
main_pcb();
|
||||||
Binary file not shown.
@@ -0,0 +1,37 @@
|
|||||||
|
# Archive: earlier designs
|
||||||
|
|
||||||
|
Designs that are no longer the current ones, kept for reference. The
|
||||||
|
current remote is `remote_v2.scad` (see [../../README.md](../../README.md)).
|
||||||
|
|
||||||
|
## Original remote (`remote.scad`)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The remote used with the robot until 2026: a 208 x 175 x 45 mm box printed
|
||||||
|
from the Fusion 360 design `../fusion360/remote/remote v40.f3d`.
|
||||||
|
`remote.scad` rebuilds it from that file's solids (details, and the bugs
|
||||||
|
fixed in the rebuild, in [PLANNING.md](PLANNING.md), section "Remote").
|
||||||
|
|
||||||
|
What's inside (from the owner and the photos below):
|
||||||
|
|
||||||
|
- Two joysticks, JH-D300X-R1 (3-axis twist grip), on the lid. The model
|
||||||
|
uses the similar JH-D400X-R4 drawing.
|
||||||
|
- Nextion NX4832T035 3.5" display under a window in the lid.
|
||||||
|
- A Teensy 4.0 socketed on a cut perfboard with the nRF24L01 (100 uF cap)
|
||||||
|
and an AMS1117 regulator.
|
||||||
|
- An MPU6050 (GY-521) on the big standoff in the middle.
|
||||||
|
- An 18650 UPS/boost board on two standoffs, with its charge and on LEDs
|
||||||
|
visible through two small slots in the floor.
|
||||||
|
- A USB-C breakout glued into the holder at the side port.
|
||||||
|
- A slide switch mounted on top of the lid, and a lanyard loop on the bump.
|
||||||
|
|
||||||
|
Photos of the printed remote, opened: [original remote/](original%20remote/).
|
||||||
|
|
||||||
|
| | |
|
||||||
|
|---|---|
|
||||||
|
|  |  |
|
||||||
|
|  |  |
|
||||||
|
|
||||||
|
Why it was replaced: the new remote (`remote_v2.scad`) is smaller
|
||||||
|
(216 x 116 x 32 mm), prints in ASA without supports, hangs level from a neck
|
||||||
|
strap (a balance-point eyelet and a body brace), and stands on a table.
|
||||||
@@ -0,0 +1,245 @@
|
|||||||
|
# OpenSCAD body redesign: notes
|
||||||
|
|
||||||
|
`body.scad` rebuilds the body of `../fusion360/body-bottom/bottom v59.f3d`
|
||||||
|
(top + bottom plate, PCB, coxa servos; legs are placeholders).
|
||||||
|
|
||||||
|
## Source of truth
|
||||||
|
|
||||||
|
The `top` and `bottom` **solids** in `bottom v59.stp` (inside
|
||||||
|
`bottom v59.f3d_files.zip`). The `top.dxf` / `bottom.dxf` sketches in the
|
||||||
|
same zip are older and differ (front/back notch, side curve, one servo
|
||||||
|
pocket with an extra notch), so they are not used.
|
||||||
|
|
||||||
|
Coordinates: the plates are written in the original's top-view frame
|
||||||
|
(u, v) = (Fusion x, -Fusion z); `fusion_to_robot()` rotates that by -90°
|
||||||
|
into the robot frame of `robot/Config.h` (X = v forward, Y = -u left).
|
||||||
|
Fusion's up axis is Y; Fusion Y = 0 is the top face of the bottom plate,
|
||||||
|
which is also Z = 0 here.
|
||||||
|
|
||||||
|
`body.scad` slices were overlaid on the original solid edges at every
|
||||||
|
feature height (plate faces, standoff split, counterbore floor, nut wells,
|
||||||
|
PCB bosses, pivot bosses, battery bay): all match, apart from the fixes
|
||||||
|
below.
|
||||||
|
|
||||||
|
## What the original body is
|
||||||
|
|
||||||
|
- Two 3 mm plates, cavity 27 mm (Z 0..27, top plate Z 27..30).
|
||||||
|
- Outline: arm ends r 19.5 around each coxa axis, concave fillets r 15.5
|
||||||
|
at the mid arms, quadratic curves at the sides and a notch front/back.
|
||||||
|
Fully symmetric (the "asymmetry" seen earlier came from a stray line
|
||||||
|
near (128, 8) in `bottom.dxf` and construction points at x = 100).
|
||||||
|
- Coxa axes (u, v): corners (±50, ±100), mid (±65, 0) = robot
|
||||||
|
(±100, ±50) and (0, ±65), same as `Config.h`.
|
||||||
|
- Coxa servos (HS-485HB): ears rest on the top plate (Z 30), case hangs
|
||||||
|
in a 41 × 21 pocket down to Z 2. Shaft 10 mm from the outer case end.
|
||||||
|
Ear screw holes ⌀2.5, 48.25 × 10 mm. Corner servos turned 50°.
|
||||||
|
- Under each coxa axis a ⌀14 × 2 mm pivot boss on the bottom plate; the
|
||||||
|
coxa bracket (`hinge1` above / `hinge2` below, leg parts) wraps the
|
||||||
|
plate edge between the servo horn and this boss.
|
||||||
|
- 4 standoffs ⌀15 at (u, v) (±35, ±30), split at Z 13.5: M3 from the top
|
||||||
|
in a ⌀7 counterbore (floor Z 17.5), 8 mm grip, M3 nut in a hex well
|
||||||
|
from below (top of the well Z 9.5).
|
||||||
|
- PCB: long axis along the body, 4 bosses ⌀5 × 1 mm under the top plate
|
||||||
|
on the PCB hole grid (35.78 × 78.96), ⌀2.5 holes (self-tapping M3?),
|
||||||
|
⌀5 × 1 mm recess on top. PCB top face at Z 26.
|
||||||
|
- Teensy cut-out 23.78 × 66.96, centred.
|
||||||
|
- Slide switch at the front: slot 8 × 16 (v 57..73), ⌀2 screw holes 19 mm
|
||||||
|
apart, "ON"/"OFF" engraved 1 mm, readable from behind the robot.
|
||||||
|
- Battery bay on the bottom plate: rails 3 × 13.5 mm high at |u| 26.06..29.06
|
||||||
|
(52.1 mm between them), from v -74.21 (open, rear) to 31.79, end stop at
|
||||||
|
v 28.79..31.79.
|
||||||
|
|
||||||
|
## Bugs in the original, fixed here
|
||||||
|
|
||||||
|
- Left-front pivot boss at u = -50.894 instead of -50.
|
||||||
|
- Right-front corner has no coxa servo (only 5 of 6 placed).
|
||||||
|
- Only 2 of 6 legs (the mid legs), plus mirror-naming leftovers and the
|
||||||
|
empty `dontdeleteme` component (nothing to port).
|
||||||
|
- Hex nut wells rotated randomly; now one orientation.
|
||||||
|
|
||||||
|
## Leg dimensions (for robot/Config.h and the Unity sim)
|
||||||
|
|
||||||
|
Measured on the original solids (left mid leg, `bottom-leg v31`):
|
||||||
|
|
||||||
|
| Item | Value | Config.h today |
|
||||||
|
|------|-------|----------------|
|
||||||
|
| Coxa: coxa axis to femur axis, horizontal | 55.0 mm | `COXA_LEN_MM` 55 (matches) |
|
||||||
|
| Femur: femur axis to knee axis | 100.0 mm | `FEMUR_LEN_MM` 100 (matches) |
|
||||||
|
| Tibia: knee axis to foot ball centre | 150.0 mm | `TIBIA_LEN_MM` 150 (matches) |
|
||||||
|
| Foot ball radius | 5.0 mm + 0.5 mm TPU sock wall (same on the real robot) | not modelled |
|
||||||
|
| Femur/knee axes height | in the coxa's joint plane, 13.5 mm above the bottom plate's top face | coxa pivot at Z 0 (matches if Z 0 = that plane) |
|
||||||
|
| Leg mounts (coxa axes) | (±100, ±50), (0, ±65) | matches |
|
||||||
|
| Original pose | femur 0°, tibia -90° (foot straight under the knee) | |
|
||||||
|
|
||||||
|
So the link lengths need no change. What the firmware and Unity don't know
|
||||||
|
yet: the ground contact is the foot ball's surface (5 mm + sock from the
|
||||||
|
point the IK places), and the body's underside (coxa bracket lower arm) is
|
||||||
|
21.5 mm below the joint plane.
|
||||||
|
|
||||||
|
## Physical limits
|
||||||
|
|
||||||
|
Collision sweep of the model's real parts (2D, per joint, in 0.25° steps;
|
||||||
|
cross-checked with full CGAL intersections of body and legs). Joint
|
||||||
|
convention as `robot/Config.h`.
|
||||||
|
|
||||||
|
| Joint | Range | Stopped by |
|
||||||
|
|-------|-------|-----------|
|
||||||
|
| Coxa, mid legs 1/4 | -66.5° .. 66.5° | coxa bracket shell hits the plate waist |
|
||||||
|
| Coxa, legs 0 (front-right) / 3 (rear-left) | -95.75° .. 66.75° (sideways mount: -35.75 .. 126.75) | same |
|
||||||
|
| Coxa, legs 2 (rear-right) / 5 (front-left) | -66.75° .. 95.75° (sideways mount: -126.75 .. 35.75) | same |
|
||||||
|
| Femur | -101.25° .. 101.25° | femur link hits the coxa bracket |
|
||||||
|
| Tibia | -177° .. 12.75° | rod folds into the femur link / tibia shell hits it |
|
||||||
|
| Servo travel | coxa/femur ±90°, tibia -180..0° | from the `SERVOS` pulse ranges |
|
||||||
|
| Leg width at the joints | 33.7 mm to the horn side + 21.5 mm to the bearing side | neighbours touch at 55.2 mm |
|
||||||
|
|
||||||
|
Hexagon layout (owner's request): corner legs mounted 60° round from the mid
|
||||||
|
legs (mount angles ±30 / ±90 / ±150); this needs the four corner coxa
|
||||||
|
brackets turned 60° on their servo splines. In the firmware (`Config.h`):
|
||||||
|
per-leg `COXA_MIN_DEG`/`COXA_MAX_DEG`, all ±60 now (the sideways layout
|
||||||
|
needed -32..60 / -60..32 at the corners),
|
||||||
|
femur ±80 and tibia -150..-20 unchanged (inside the physical range), and
|
||||||
|
`LEG_CLEARANCE_MM` 56 (was 30). `sim_smoke` passes; turning on the spot
|
||||||
|
runs at ~77°/s with legs at least 97 mm apart (sideways layout: ~29°/s).
|
||||||
|
|
||||||
|
## Unity simulation
|
||||||
|
|
||||||
|
`export_unity.py` renders the parts into
|
||||||
|
`Hexapod_Simulation_Unity/Assets/HexapodSim/Resources/OpenScadModel/*.bytes`
|
||||||
|
(rerun it after changing the SCAD files). `OpenScadModel.cs` hides the old
|
||||||
|
scene's robot and builds a new rig with the same names at the exact
|
||||||
|
Config.h geometry; `HexapodSimulation.useOpenScadModel` switches it off.
|
||||||
|
`Editor/OpenScadModelSnapshot.cs` renders it in batch mode for checks.
|
||||||
|
|
||||||
|
## Remote (`remote.scad`)
|
||||||
|
|
||||||
|
Rebuilt from `../fusion360/remote/remote v40.f3d` the same way (slices
|
||||||
|
match the original). Bugs fixed: the lid was off by (0.406, 0.21, -0.365)
|
||||||
|
mm (sat in the ledge, posts overlapping the bosses); the display bezel's
|
||||||
|
mesh facets became a clean window; the stray Body12 (an ON-OFF bracket
|
||||||
|
line never cut in) is left out. The display is a Nextion NX4832T035
|
||||||
|
(3.5" Basic); its board's M3 holes are the lid's 94.2 x 48.5 post grid.
|
||||||
|
Reference parts in `remote.scad`: the joysticks are modelled as JH-D400X-R4 (owner's photos later showed JH-D300X-R1; 4-axis,
|
||||||
|
X/Y ±25°, twist ±45°, button; owner), mounted with the dust cover on the
|
||||||
|
lid's top face; their M2.5 square is 32.5 mm, so the lid's screw holes moved
|
||||||
|
from the original's 33 mm square to 32.5. The battery is an 18650 UPS/boost
|
||||||
|
board (89 x 22 mm, SMD-holder version, 22.4 mm tall; owner), on the bottom's
|
||||||
|
two d5 standoffs at (±27.9, -15) with the floor slots beside them for a
|
||||||
|
strap; its hole spacing (55.8 mm here) is not confirmed. No collisions.
|
||||||
|
Also from the owner: the bump on top of the middle post is a lanyard loop
|
||||||
|
(the original's tunnel through it is modelled); the square hole is the on/off
|
||||||
|
slide switch, mounted on top (same switch as the robot). Inside: an IMU on the
|
||||||
|
21 x 9 mm block (assumed GY-521), a USB-C breakout on the side-port block, and
|
||||||
|
a Teensy **4.0** (confirmed by the owner; `platformio.ini` now builds
|
||||||
|
the remote for it); it has no mounting holes and is placed on the
|
||||||
|
hole-less 8 x 24 mm block as a guess.
|
||||||
|
Open: what the 6 mm x 10 mm holes in the bottom bosses hold (magnets?), and
|
||||||
|
whether the upper two bosses are meant to be asymmetric (x -80.387 / +82.73).
|
||||||
|
|
||||||
|
## Remote v2 (`remote_v2.scad`), draft 4
|
||||||
|
|
||||||
|
A new remote for the same electronics; `remote.scad` stays as the record of
|
||||||
|
the printed one. How it's used (owner): the sticks are big twist grips that
|
||||||
|
take a whole hand each, so nothing holds the case. It hangs from a neck strap
|
||||||
|
or lies on a table. Earlier drafts: gamepad grips (dropped: nobody holds
|
||||||
|
them), strap tabs at the rear corners (it tipped forward), a hexapod emblem
|
||||||
|
inlay (owner preferred a honeycomb).
|
||||||
|
|
||||||
|
From the owner's photos and drawing: the sticks are JH-D300X-R1; the Teensy
|
||||||
|
sits socketed on a cut perfboard (56 x 80, measured) with the nRF24L01
|
||||||
|
(100 uF cap), an AMS1117, the ribbon connectors and now also the GY-521; the
|
||||||
|
switch's plate sits on top of the case, body through the slot, and the old
|
||||||
|
8 x 16 slot with d2 holes 19 mm apart fits it exactly; the UPS board's
|
||||||
|
charge/on LEDs show through two slots in the floor.
|
||||||
|
|
||||||
|
- Size 216 x 116 x 42 mm (top shell 10 mm taller than first printed, TOP_GROW: room behind the display) (old remote: 208 x 175 x 45). Sticks at u +-80,
|
||||||
|
display forward of them, strap eyelet behind the display, UPS board behind
|
||||||
|
that, switch at the rear centre. Main board under the display.
|
||||||
|
- JH-D300X-R1: dust cover d53.5 on the top face; the 40.4 mm control box
|
||||||
|
(25.5 tall) against the plate's underside, 4 x M2.5 x 14 through cover and
|
||||||
|
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. `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).
|
||||||
|
- Main board clamped at 4 points on its long sides, no holes in the board
|
||||||
|
(owner): posts beside the edges carry it, M3 x 8 button heads with d7
|
||||||
|
washers in heat-set inserts clamp the edge. 2 mm above the kickstand
|
||||||
|
recess for the wires underneath; Teensy micro-USB to the left, nRF24 to
|
||||||
|
the right. The cable plug clears the display board by ~0.2 mm and the left
|
||||||
|
stick's pot narrowly: plug and board sizes are estimates.
|
||||||
|
- UPS board on 2 standoffs behind the eyelet, Type-C end to the right (room
|
||||||
|
for the cut cable's plug); LEDs through 2 x 6 mm floor slots.
|
||||||
|
- Strap eyelet (separate part, 2 x M3 into heat-set inserts): on the top face
|
||||||
|
behind the display (slots +-5 mm to balance it), or on the front face (the
|
||||||
|
edge away from you, 2 more inserts at Z -19). Folded forward, the bail
|
||||||
|
hits a front-mounted eyelet: then park the bail back or down.
|
||||||
|
- Brace bail: U pivoting on the side faces (v -25, Z -22), M3 x 16 into
|
||||||
|
heat-set inserts; 0 = folded forward, -150 = brace against chest or belly,
|
||||||
|
-180 = straight back. Swings down under the case.
|
||||||
|
- Kickstand: 30 x 35 mm flap in a recess in the underside, hinged at the front
|
||||||
|
on an M3 x 40 into a nut trap; lifts the front a little on a table.
|
||||||
|
- Shells split at Z -12, both print without supports (top face down, bottom
|
||||||
|
on its flat underside), 45 deg chamfers, 1.2 mm locating lip, 4 x M3 x 12
|
||||||
|
from below into heat-set inserts. USB-C breakout glued into a pocket at
|
||||||
|
the front left, receptacle 0.6 mm inside the front face.
|
||||||
|
- Inlay (second colour, first 3 layers of the face-down top shell): ON/OFF
|
||||||
|
plus a honeycomb of whole cells (4.5 mm, 1.2 mm walls) right of a diagonal
|
||||||
|
through the middle, clear of display, sticks, eyelet and switch; lone
|
||||||
|
cells dropped. Colours (owner, ASA): black case, red honeycomb (PART
|
||||||
|
"inlay"), white ON/OFF (PART "text"); load "top", "inlay" and "text" as one
|
||||||
|
multi-part object. Each extra colour adds a swap on the first 3 layers only.
|
||||||
|
- Printability (the STLs sliced in 0.2 mm layers, every area not carried by
|
||||||
|
the layer below listed): the brace pivot bosses stand on pillars and the
|
||||||
|
lip's tie band steps out at 45 deg (both were floating overhangs in the
|
||||||
|
first export); what's left are bridges: the 30 mm kickstand-recess roof,
|
||||||
|
the hinge trough, hole and counterbore tops, the USB-C opening.
|
||||||
|
- Checked: no part collides with the shells or with each other, the shells
|
||||||
|
and the inlay don't overlap, kickstand clear at 0 and 70 deg, bail clear
|
||||||
|
from 0 to -180 deg (CGAL intersections).
|
||||||
|
- Open: component positions on the main board, Teensy cable plug size, LCD thickness, UPS
|
||||||
|
hole spacing; hand room untested; set `IMU_AXIS_FROM_CHIP` /
|
||||||
|
`IMU_AXIS_SIGN` in `remote/Config.h` for the IMU on the main board.
|
||||||
|
|
||||||
|
## Notes for future designs
|
||||||
|
|
||||||
|
- Robot power (still to choose): a battery or supply that gives a **stable
|
||||||
|
6 V** with enough current for all 18 servos (12 x HS-485HB + 6 stronger
|
||||||
|
ones of the same size). Servos draw well over 1 A each when stalled or
|
||||||
|
starting, and many move at once while walking, so plan for a 6 V regulator
|
||||||
|
/ UBEC of 15-20 A peak (e.g. a 2S LiPo through a high-current 6 V BEC), or
|
||||||
|
a pack that stays near 6 V under that load. Check the servos' datasheet
|
||||||
|
for the stall current. The battery must also fit the bay (see open
|
||||||
|
question 3) and leave room for the servo plugs.
|
||||||
|
|
||||||
|
- 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: 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
|
||||||
|
stop (X 28.8..31.8, top at Z 13.5). Kept as-is for now; give the plugs and
|
||||||
|
wires more room next time (e.g. a lower or shorter end stop, or a battery
|
||||||
|
that leaves space under the headers).
|
||||||
|
- The nRF24 under the switch is fine on the real robot.
|
||||||
|
|
||||||
|
## Open questions
|
||||||
|
|
||||||
|
1. Front = switch end (inferred from the ON/OFF text orientation)?
|
||||||
|
2. PCB direction: `PCB_USB_FRONT` (Teensy USB, 7805 and LED at the front,
|
||||||
|
nRF24 and battery JST at the rear) or reversed?
|
||||||
|
3. Battery size. The six servo headers hang above the bay (|Y| 14-15 mm)
|
||||||
|
and the JP1/JP4 or JP3/JP6 pair touches the end stop; servo plugs and
|
||||||
|
the battery need to share that space.
|
||||||
|
4. Leg geometry: in the original the femur servo sits further out than
|
||||||
|
`COXA_LEN_MM` = 55 suggests. Check when porting the legs.
|
||||||
@@ -0,0 +1,205 @@
|
|||||||
|
// 2026 hexapod body: top + bottom plate, rebuilt from the Fusion 360 model
|
||||||
|
// fusion360/body-bottom/bottom v59.f3d (the `top` and `bottom` solids in
|
||||||
|
// "bottom v59.stp", which are newer than the top.dxf/bottom.dxf sketches).
|
||||||
|
//
|
||||||
|
// Plate geometry is written in the original's top-view coordinates
|
||||||
|
// (u, v) = (Fusion x, -Fusion z), so every number can be checked against
|
||||||
|
// the Fusion file. fusion_to_robot() turns that into the robot frame of
|
||||||
|
// robot/Config.h (+X forward, +Y left, +Z up): X = v, Y = -u.
|
||||||
|
// Z = 0 is the top face of the bottom plate.
|
||||||
|
//
|
||||||
|
// Deviations from the original (its bugs):
|
||||||
|
// - Left-front pivot boss at u = -50 instead of -50.894.
|
||||||
|
// - All six coxa servos present (the original has none at right front).
|
||||||
|
// - Hex nut wells share one orientation (the original's are rotated randomly).
|
||||||
|
|
||||||
|
use <../main-pcb-2026-11-13/main-pcb.scad>
|
||||||
|
include <servo.scad>
|
||||||
|
|
||||||
|
/* [Plates] */
|
||||||
|
PLATE_T = 3.0; // original: 3 mm, both plates
|
||||||
|
CAVITY_H = 27.0; // inner gap; sized so the servo case ends 2 mm above the bottom plate
|
||||||
|
|
||||||
|
/* [Standoffs: split halfway, screw from the top into a captive nut] */
|
||||||
|
STANDOFF_D = 15.0;
|
||||||
|
SCREW_D = 3.1;
|
||||||
|
SCREW_GRIP = 4.0; // solid length of each half next to the split
|
||||||
|
COUNTERBORE_D = 7.0;
|
||||||
|
NUT_AF = 5.5; // M3 nut across flats
|
||||||
|
STANDOFFS_UV = [[35, 30], [-35, 30], [35, -30], [-35, -30]];
|
||||||
|
|
||||||
|
/* [Coxa servos] */
|
||||||
|
// Shaft axis per leg, in (u, v), with the direction the case extends from the shaft.
|
||||||
|
// Indices match robot/Config.h legs 0..5.
|
||||||
|
COXA_UV = [
|
||||||
|
[ 50, 100, 230], // 0 right front
|
||||||
|
[ 65, 0, 180], // 1 right mid
|
||||||
|
[ 50, -100, 130], // 2 right rear
|
||||||
|
[-50, -100, 50], // 3 left rear
|
||||||
|
[-65, 0, 0], // 4 left mid
|
||||||
|
[-50, 100, -50], // 5 left front (original boss at u = -50.894)
|
||||||
|
];
|
||||||
|
ARM_R = 19.5; // rounded arm end, centred on the coxa axis
|
||||||
|
PIVOT_BOSS_D = 14.0; // under the bottom plate, carries the coxa bracket
|
||||||
|
PIVOT_BOSS_H = 2.0;
|
||||||
|
|
||||||
|
/* [Teensy, PCB and switch] */
|
||||||
|
TEENSY_CUT = [23.78, 66.96]; // (u, v) size, centred
|
||||||
|
PCB_BOSSES_UV = [[17.89, 39.48], [-17.89, 39.48], [17.89, -39.48], [-17.89, -39.48]];
|
||||||
|
PCB_BOSS_D = 5.0;
|
||||||
|
PCB_BOSS_H = 1.0; // PCB top face ends up 1 mm under the top plate
|
||||||
|
PCB_SCREW_D = 2.5;
|
||||||
|
SWITCH_SLOT = [[-4, 57], [4, 73]];
|
||||||
|
SWITCH_HOLES = [[0, 55.5], [0, 74.5]];
|
||||||
|
SWITCH_HOLE_D = 2.0;
|
||||||
|
ENGRAVE_D = 1.0;
|
||||||
|
|
||||||
|
/* [Battery bay on the bottom plate] */
|
||||||
|
BAY_RAIL_U = [26.06, 29.06]; // inner/outer face of each rail, mirrored in u
|
||||||
|
BAY_V = [-74.21, 31.79]; // open end at -v (rear), closed end at +v
|
||||||
|
BAY_STOP = [[-16, 28.79], [16, 31.79]];
|
||||||
|
BAY_H = 13.5;
|
||||||
|
|
||||||
|
/* [Rendering] */
|
||||||
|
SHOW_TOP = true;
|
||||||
|
SHOW_BOTTOM = true;
|
||||||
|
SHOW_PCB = true;
|
||||||
|
SHOW_SERVOS = true;
|
||||||
|
EXPLODE = 0; // mm; lifts the top half
|
||||||
|
PCB_USB_FRONT = false; // owner: Teensy USB faces away from the switch (rear)
|
||||||
|
|
||||||
|
/* [Hidden] */
|
||||||
|
$fa = 2; $fs = 0.3;
|
||||||
|
STANDOFF_SPLIT = CAVITY_H / 2;
|
||||||
|
TOP_Z = CAVITY_H + PLATE_T;
|
||||||
|
|
||||||
|
module fusion_to_robot() rotate([0, 0, -90]) children();
|
||||||
|
|
||||||
|
// linear_extrude with a convexity, so the preview shows holes correctly.
|
||||||
|
module lx(h) linear_extrude(h, convexity = 10) children();
|
||||||
|
|
||||||
|
// ---------- outline -------------------------------------------------------
|
||||||
|
|
||||||
|
function bez2(p, t) = (1-t)*(1-t)*p[0] + 2*(1-t)*t*p[1] + t*t*p[2];
|
||||||
|
function rev(l) = [for (i = [len(l)-1:-1:0]) l[i]];
|
||||||
|
|
||||||
|
NOTCH = [[-34.12, 111.31], [0, 71.93], [34.12, 111.31]]; // front/back notch
|
||||||
|
WAIST = [[60.03, 83.28], [49.86, 74.48], [50.13, 64.77]]; // corner arm -> side
|
||||||
|
FILLET_C = [65, 35];
|
||||||
|
FILLET_R = 15.5;
|
||||||
|
N = 24;
|
||||||
|
|
||||||
|
// Right half, front to back; the arm circles fill in the chords at the arm ends.
|
||||||
|
Q1 = concat(
|
||||||
|
[for (i = [N/2:N]) bez2(NOTCH, i/N)],
|
||||||
|
[for (i = [0:N]) bez2(WAIST, i/N)],
|
||||||
|
[[49.5, 35]],
|
||||||
|
[for (a = [180:5:270]) FILLET_C + FILLET_R * [cos(a), sin(a)]],
|
||||||
|
[[65, 0]]);
|
||||||
|
RIGHT = concat(Q1, [for (p = rev(Q1)) [p[0], -p[1]]]);
|
||||||
|
OUTLINE = concat(RIGHT, [for (p = rev(RIGHT)) [-p[0], p[1]]]);
|
||||||
|
|
||||||
|
module outline_2d() {
|
||||||
|
polygon(OUTLINE);
|
||||||
|
for (c = COXA_UV) translate([c[0], c[1]]) circle(r = ARM_R);
|
||||||
|
}
|
||||||
|
|
||||||
|
module at_coxa(c) translate([c[0], c[1]]) rotate([0, 0, c[2]]) children();
|
||||||
|
|
||||||
|
// ---------- top plate -----------------------------------------------------
|
||||||
|
|
||||||
|
module top_plate_2d() {
|
||||||
|
difference() {
|
||||||
|
outline_2d();
|
||||||
|
for (c = COXA_UV) at_coxa(c) servo_pocket_2d();
|
||||||
|
square(TEENSY_CUT, center = true);
|
||||||
|
for (s = STANDOFFS_UV) translate(s) circle(d = SCREW_D);
|
||||||
|
for (b = PCB_BOSSES_UV) translate(b) circle(d = PCB_SCREW_D);
|
||||||
|
translate(SWITCH_SLOT[0]) square(SWITCH_SLOT[1] - SWITCH_SLOT[0]);
|
||||||
|
for (h = SWITCH_HOLES) translate(h) circle(d = SWITCH_HOLE_D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module switch_text() {
|
||||||
|
for (t = [["ON", 49.3], ["OFF", 80.6]])
|
||||||
|
translate([0, t[1]])
|
||||||
|
text(t[0], size = 5.8, halign = "center", valign = "center",
|
||||||
|
font = "Liberation Sans");
|
||||||
|
}
|
||||||
|
|
||||||
|
module top_half() render(convexity = 10) {
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
translate([0, 0, CAVITY_H]) lx(PLATE_T) top_plate_2d();
|
||||||
|
for (s = STANDOFFS_UV) translate([s[0], s[1], STANDOFF_SPLIT])
|
||||||
|
cylinder(d = STANDOFF_D, h = CAVITY_H - STANDOFF_SPLIT);
|
||||||
|
for (b = PCB_BOSSES_UV) translate([b[0], b[1], CAVITY_H - PCB_BOSS_H])
|
||||||
|
cylinder(d = PCB_BOSS_D, h = PCB_BOSS_H);
|
||||||
|
}
|
||||||
|
for (s = STANDOFFS_UV) translate([s[0], s[1], 0]) {
|
||||||
|
translate([0, 0, STANDOFF_SPLIT - 1]) cylinder(d = SCREW_D, h = SCREW_GRIP + 2);
|
||||||
|
translate([0, 0, STANDOFF_SPLIT + SCREW_GRIP]) cylinder(d = COUNTERBORE_D, h = TOP_Z);
|
||||||
|
}
|
||||||
|
for (b = PCB_BOSSES_UV) translate([b[0], b[1], 0]) {
|
||||||
|
translate([0, 0, CAVITY_H - PCB_BOSS_H - 1]) cylinder(d = PCB_SCREW_D, h = PLATE_T + 2);
|
||||||
|
translate([0, 0, TOP_Z - 1]) cylinder(d = PCB_BOSS_D, h = 2);
|
||||||
|
}
|
||||||
|
translate([0, 0, TOP_Z - ENGRAVE_D]) lx(ENGRAVE_D + 1) switch_text();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- bottom plate --------------------------------------------------
|
||||||
|
|
||||||
|
module bay_2d() {
|
||||||
|
for (m = [1, -1]) scale([m, 1])
|
||||||
|
translate([BAY_RAIL_U[0], BAY_V[0]])
|
||||||
|
square([BAY_RAIL_U[1] - BAY_RAIL_U[0], BAY_V[1] - BAY_V[0]]);
|
||||||
|
translate(BAY_STOP[0]) square(BAY_STOP[1] - BAY_STOP[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module bottom_half() render(convexity = 10) {
|
||||||
|
difference() {
|
||||||
|
union() {
|
||||||
|
translate([0, 0, -PLATE_T]) lx(PLATE_T) outline_2d();
|
||||||
|
for (s = STANDOFFS_UV) translate([s[0], s[1], 0])
|
||||||
|
cylinder(d = STANDOFF_D, h = STANDOFF_SPLIT);
|
||||||
|
lx(BAY_H) bay_2d();
|
||||||
|
for (c = COXA_UV) translate([c[0], c[1], -PLATE_T - PIVOT_BOSS_H])
|
||||||
|
cylinder(d = PIVOT_BOSS_D, h = PIVOT_BOSS_H);
|
||||||
|
}
|
||||||
|
for (s = STANDOFFS_UV) translate([s[0], s[1], 0]) {
|
||||||
|
translate([0, 0, STANDOFF_SPLIT - SCREW_GRIP - 1]) cylinder(d = SCREW_D, h = SCREW_GRIP + 2);
|
||||||
|
translate([0, 0, -PLATE_T - 1])
|
||||||
|
cylinder(d = NUT_AF / cos(30), h = STANDOFF_SPLIT - SCREW_GRIP + PLATE_T + 1, $fn = 6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- PCB -----------------------------------------------------------
|
||||||
|
// Long axis along the body (robot X), holes on the PCB bosses, top face
|
||||||
|
// 1 mm under the top plate, Teensy up through the cut-out.
|
||||||
|
|
||||||
|
PCB_T = 1.6;
|
||||||
|
PCB_HOLE_CENTER = [22.89, 44.52]; // HOLE_GRID_CENTER in main-pcb.scad
|
||||||
|
|
||||||
|
module pcb_in_body() {
|
||||||
|
translate([0, 0, CAVITY_H - PCB_BOSS_H - PCB_T])
|
||||||
|
rotate([0, 0, PCB_USB_FRONT ? -90 : 90])
|
||||||
|
translate([-PCB_HOLE_CENTER[0], -PCB_HOLE_CENTER[1], 0])
|
||||||
|
main_pcb();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- assembly ------------------------------------------------------
|
||||||
|
|
||||||
|
module body_servos_uv() for (c = COXA_UV) translate([0, 0, TOP_Z]) at_coxa(c) hs485hb();
|
||||||
|
|
||||||
|
module body_assembly() {
|
||||||
|
fusion_to_robot() {
|
||||||
|
if (SHOW_BOTTOM) color("#3a3a3a") bottom_half();
|
||||||
|
if (SHOW_TOP) translate([0, 0, EXPLODE]) color("#555555") top_half();
|
||||||
|
if (SHOW_SERVOS) translate([0, 0, EXPLODE]) body_servos_uv();
|
||||||
|
}
|
||||||
|
if (SHOW_PCB) translate([0, 0, EXPLODE]) pcb_in_body();
|
||||||
|
}
|
||||||
|
|
||||||
|
body_assembly();
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
"""Combine STL parts into one multi-part 3MF for OrcaSlicer / PrusaSlicer.
|
||||||
|
|
||||||
|
python export_3mf.py (from hardware/openscad, after the STL export)
|
||||||
|
|
||||||
|
Writes stl/remote_v2/remote_v2_top_inlays.3mf: the top shell with its
|
||||||
|
two inlays as ONE object with three parts, in the same frame, each part on
|
||||||
|
its own extruder/filament (1 = case, 2 = honeycomb, 3 = ON/OFF text). The
|
||||||
|
part list is in PARTS below. Uses the PrusaSlicer 3MF layout (one mesh, the
|
||||||
|
parts as triangle ranges in Metadata/Slic3r_PE_model.config), which
|
||||||
|
OrcaSlicer and PrusaSlicer both read.
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
import zipfile
|
||||||
|
|
||||||
|
HERE = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
OUT_DIR = os.path.join(HERE, "stl", "remote_v2")
|
||||||
|
|
||||||
|
# (file, part name, extruder)
|
||||||
|
PARTS = [
|
||||||
|
("remote_v2_top.stl", "top shell (black)", 1),
|
||||||
|
("remote_v2_inlay.stl", "honeycomb inlay (red)", 2),
|
||||||
|
("remote_v2_text.stl", "ON-OFF inlay (white)", 3),
|
||||||
|
]
|
||||||
|
OUT = "remote_v2_top_inlays.3mf" # remote_v2_top_multicolor.3mf is the owner's OrcaSlicer project
|
||||||
|
|
||||||
|
|
||||||
|
def read_stl(path):
|
||||||
|
"""Triangles of an ASCII or binary STL as lists of 3 vertex tuples."""
|
||||||
|
data = open(path, "rb").read()
|
||||||
|
tris = []
|
||||||
|
if data[:5] == b"solid" and b"facet" in data[:400]:
|
||||||
|
verts = []
|
||||||
|
for line in data.decode("ascii", "replace").splitlines():
|
||||||
|
t = line.split()
|
||||||
|
if t and t[0] == "vertex":
|
||||||
|
verts.append(tuple(float(x) for x in t[1:4]))
|
||||||
|
if len(verts) == 3:
|
||||||
|
tris.append(verts)
|
||||||
|
verts = []
|
||||||
|
else:
|
||||||
|
import struct
|
||||||
|
n = struct.unpack_from("<I", data, 80)[0]
|
||||||
|
for i in range(n):
|
||||||
|
f = struct.unpack_from("<12f", data, 84 + 50 * i)
|
||||||
|
tris.append([tuple(f[3:6]), tuple(f[6:9]), tuple(f[9:12])])
|
||||||
|
return tris
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
vertices, index, triangles, ranges = [], {}, [], []
|
||||||
|
for fname, name, extruder in PARTS:
|
||||||
|
first = len(triangles)
|
||||||
|
for tri in read_stl(os.path.join(OUT_DIR, fname)):
|
||||||
|
ids = []
|
||||||
|
for v in tri:
|
||||||
|
key = (round(v[0], 5), round(v[1], 5), round(v[2], 5), len(ranges)) # no sharing between parts
|
||||||
|
if key not in index:
|
||||||
|
index[key] = len(vertices)
|
||||||
|
vertices.append(v)
|
||||||
|
ids.append(index[key])
|
||||||
|
if len(set(ids)) == 3:
|
||||||
|
triangles.append(ids)
|
||||||
|
ranges.append((first, len(triangles) - 1, name, extruder))
|
||||||
|
|
||||||
|
model = ['<?xml version="1.0" encoding="UTF-8"?>',
|
||||||
|
'<model unit="millimeter" xml:lang="en-US" '
|
||||||
|
'xmlns="http://schemas.microsoft.com/3dmanufacturing/core/2015/02" '
|
||||||
|
'xmlns:slic3rpe="http://schemas.slic3r.org/3mf/2017/06">',
|
||||||
|
' <metadata name="slic3rpe:Version3mf">1</metadata>',
|
||||||
|
' <metadata name="Title">remote_v2 top shell with inlays</metadata>',
|
||||||
|
' <resources>',
|
||||||
|
' <object id="1" type="model">',
|
||||||
|
' <mesh>',
|
||||||
|
' <vertices>']
|
||||||
|
model += [' <vertex x="%.5f" y="%.5f" z="%.5f"/>' % v for v in vertices]
|
||||||
|
model += [' </vertices>', ' <triangles>']
|
||||||
|
model += [' <triangle v1="%d" v2="%d" v3="%d"/>' % tuple(t) for t in triangles]
|
||||||
|
model += [' </triangles>', ' </mesh>', ' </object>', ' </resources>',
|
||||||
|
' <build>', ' <item objectid="1"/>', ' </build>', '</model>']
|
||||||
|
|
||||||
|
config = ['<?xml version="1.0" encoding="UTF-8"?>', '<config>',
|
||||||
|
' <object id="1" instances_count="1">',
|
||||||
|
' <metadata type="object" key="name" value="remote_v2_top_multicolor"/>']
|
||||||
|
for first, last, name, extruder in ranges:
|
||||||
|
config += [' <volume firstid="%d" lastid="%d">' % (first, last),
|
||||||
|
' <metadata type="volume" key="name" value="%s"/>' % name,
|
||||||
|
' <metadata type="volume" key="volume_type" value="ModelPart"/>',
|
||||||
|
' <metadata type="volume" key="extruder" value="%d"/>' % extruder,
|
||||||
|
' </volume>']
|
||||||
|
config += [' </object>', '</config>']
|
||||||
|
|
||||||
|
content_types = ('<?xml version="1.0" encoding="UTF-8"?>\n'
|
||||||
|
'<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">\n'
|
||||||
|
' <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>\n'
|
||||||
|
' <Default Extension="model" ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"/>\n'
|
||||||
|
' <Default Extension="config" ContentType="text/xml"/>\n'
|
||||||
|
'</Types>\n')
|
||||||
|
rels = ('<?xml version="1.0" encoding="UTF-8"?>\n'
|
||||||
|
'<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">\n'
|
||||||
|
' <Relationship Target="/3D/3dmodel.model" Id="rel0" '
|
||||||
|
'Type="http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel"/>\n'
|
||||||
|
'</Relationships>\n')
|
||||||
|
|
||||||
|
path = os.path.join(OUT_DIR, OUT)
|
||||||
|
with zipfile.ZipFile(path, "w", zipfile.ZIP_DEFLATED) as z:
|
||||||
|
z.writestr("[Content_Types].xml", content_types)
|
||||||
|
z.writestr("_rels/.rels", rels)
|
||||||
|
z.writestr("3D/3dmodel.model", "\n".join(model) + "\n")
|
||||||
|
z.writestr("Metadata/Slic3r_PE_model.config", "\n".join(config) + "\n")
|
||||||
|
print("%s: %d vertices, %d triangles, parts %s" % (OUT, len(vertices), len(triangles),
|
||||||
|
", ".join("%s %d-%d" % (r[2], r[0], r[1]) for r in ranges)))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,109 @@
|
|||||||
|
"""Export the OpenSCAD robot as meshes for the Unity simulation.
|
||||||
|
|
||||||
|
python export_unity.py (from hardware/openscad, needs OpenSCAD)
|
||||||
|
|
||||||
|
Writes Hexapod_Simulation_Unity/Assets/HexapodSim/Resources/OpenScadModel/*.bytes,
|
||||||
|
loaded by Assets/HexapodSim/OpenScadModel.cs. Every file is one rig segment
|
||||||
|
in the robot frame (mm, +X forward, +Y left, +Z up), relative to the
|
||||||
|
segment's pivot, in the rest pose that matches the rig's zero rotations
|
||||||
|
(coxa 0, femur 0, tibia -90):
|
||||||
|
body Z = 0 on the joint plane (13.5 mm above the bottom plate)
|
||||||
|
leg_<side>_* left = as leg 4 (mount +90), right = its mirror (mount -90)
|
||||||
|
|
||||||
|
File format (little endian): b"HXM1", int32 groups, then per group
|
||||||
|
float32 r, g, b, a, int32 triangles, triangles * 9 float32 (x, y, z).
|
||||||
|
Triangles wind counter-clockwise seen from outside (right-handed).
|
||||||
|
"""
|
||||||
|
import os, re, struct, subprocess, sys, tempfile
|
||||||
|
|
||||||
|
HERE = os.path.dirname(os.path.abspath(__file__)).replace("\\", "/")
|
||||||
|
OUT = os.path.normpath(os.path.join(HERE, "..", "..", "Hexapod_Simulation_Unity", "Assets",
|
||||||
|
"HexapodSim", "Resources", "OpenScadModel"))
|
||||||
|
OPENSCAD = os.environ.get("OPENSCAD", r"C:/Program Files/OpenSCAD/openscad.exe")
|
||||||
|
HEADER = f"use <{HERE}/body.scad>\nuse <{HERE}/leg.scad>\n"
|
||||||
|
JOINT_PLANE_Z = 13.5
|
||||||
|
|
||||||
|
|
||||||
|
def hexcol(h, a=1.0):
|
||||||
|
h = h.lstrip("#")
|
||||||
|
return [int(h[i:i + 2], 16) / 255 for i in (0, 2, 4)] + [a]
|
||||||
|
|
||||||
|
|
||||||
|
# segment -> list of (colour, OpenSCAD geometry in the segment's frame)
|
||||||
|
BODY = [
|
||||||
|
("#3a3a3a", f"translate([0, 0, -{JOINT_PLANE_Z}]) fusion_to_robot() bottom_half();"),
|
||||||
|
("#555555", f"translate([0, 0, -{JOINT_PLANE_Z}]) fusion_to_robot() top_half();"),
|
||||||
|
("#2a2a2a", f"translate([0, 0, -{JOINT_PLANE_Z}]) fusion_to_robot() body_servos_uv();"),
|
||||||
|
("#2b6b3a", f"translate([0, 0, -{JOINT_PLANE_Z}]) pcb_in_body();"),
|
||||||
|
]
|
||||||
|
LEFT = "rotate([0, 0, 90]) " # leg frame -> robot frame for the left legs (mount +90)
|
||||||
|
LEG = {
|
||||||
|
"coxa": [
|
||||||
|
("#d9822b", LEFT + "{ coxa_bracket_upper(); coxa_bracket_lower(); }"),
|
||||||
|
("#bdbdbd", LEFT + "translate([55, 0, 0]) along_y(28.7) horn_adapter();"),
|
||||||
|
("#5a3a1e", LEFT + "coxa_cables();"),
|
||||||
|
],
|
||||||
|
"femur": [
|
||||||
|
("#4a7fbf", LEFT + "{ link_channel(); link_lid(); }"),
|
||||||
|
("#2a2a2a", LEFT + "link_servos();"),
|
||||||
|
("#5a3a1e", LEFT + "femur_cables();"),
|
||||||
|
],
|
||||||
|
"tibia": [
|
||||||
|
("#5fa35f", LEFT + "{ tibia_bearing_half(); tibia_horn_half(); }"),
|
||||||
|
("#bdbdbd", LEFT + "along_y(28.7) horn_adapter();"),
|
||||||
|
("#1c1c1c", LEFT + "foot_sock();"),
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def render(geometry, tmp):
|
||||||
|
scad = os.path.join(tmp, "part.scad"); stl = os.path.join(tmp, "part.stl")
|
||||||
|
with open(scad, "w") as f:
|
||||||
|
f.write(HEADER + geometry + "\n")
|
||||||
|
r = subprocess.run([OPENSCAD, "-o", stl, scad], capture_output=True, text=True)
|
||||||
|
if r.returncode != 0 or not os.path.exists(stl):
|
||||||
|
sys.exit(f"OpenSCAD failed on: {geometry}\n{r.stderr}")
|
||||||
|
tris = []
|
||||||
|
num = r"([-+0-9.eE]+)"
|
||||||
|
for m in re.finditer(r"outer loop\s+vertex\s+%s\s+%s\s+%s\s+vertex\s+%s\s+%s\s+%s\s+vertex\s+%s\s+%s\s+%s" % ((num,) * 9),
|
||||||
|
open(stl).read()):
|
||||||
|
tris.append([float(v) for v in m.groups()])
|
||||||
|
os.remove(stl)
|
||||||
|
return tris
|
||||||
|
|
||||||
|
|
||||||
|
def mirror_y(tris):
|
||||||
|
# (x, y, z) -> (x, -y, z) and swap two vertices to keep outward winding
|
||||||
|
out = []
|
||||||
|
for t in tris:
|
||||||
|
a, b, c = t[0:3], t[3:6], t[6:9]
|
||||||
|
a, b, c = [a[0], -a[1], a[2]], [b[0], -b[1], b[2]], [c[0], -c[1], c[2]]
|
||||||
|
out.append(a + c + b)
|
||||||
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def write(name, groups):
|
||||||
|
path = os.path.join(OUT, name + ".bytes")
|
||||||
|
with open(path, "wb") as f:
|
||||||
|
f.write(b"HXM1" + struct.pack("<i", len(groups)))
|
||||||
|
for col, tris in groups:
|
||||||
|
f.write(struct.pack("<4f", *col) + struct.pack("<i", len(tris)))
|
||||||
|
for t in tris:
|
||||||
|
f.write(struct.pack("<9f", *t))
|
||||||
|
print(f" {name}: {sum(len(t) for _, t in groups)} triangles")
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
os.makedirs(OUT, exist_ok=True)
|
||||||
|
with tempfile.TemporaryDirectory() as tmp:
|
||||||
|
print("body")
|
||||||
|
write("body", [(hexcol(c), render(g, tmp)) for c, g in BODY])
|
||||||
|
for seg, parts in LEG.items():
|
||||||
|
print("leg", seg)
|
||||||
|
groups = [(hexcol(c), render(g, tmp)) for c, g in parts]
|
||||||
|
write(f"leg_left_{seg}", groups)
|
||||||
|
write(f"leg_right_{seg}", [(c, mirror_y(t)) for c, t in groups])
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
@@ -0,0 +1,383 @@
|
|||||||
|
// 2026 hexapod leg, rebuilt from the Fusion 360 model
|
||||||
|
// fusion360/body-bottom/bottom v59.f3d (bottom-leg v31 + hinge1/hinge2).
|
||||||
|
//
|
||||||
|
// Leg frame (left leg): origin on the coxa axis at the joint plane
|
||||||
|
// (13.5 mm above the bottom plate's top face), +x outward along the leg,
|
||||||
|
// +y along the femur/knee axes towards the horn side (the robot's rear),
|
||||||
|
// +z up. Right legs are the mirror image (see robot.scad).
|
||||||
|
// leg(pose) poses it with the firmware's joint convention (robot/Config.h):
|
||||||
|
// coxa + = CCW seen from above, femur + = up, tibia relative to the femur,
|
||||||
|
// + = up. The original is modelled at [0, 0, -90].
|
||||||
|
//
|
||||||
|
// Every joint uses the same layout: servo ears 16.5 mm from the joint
|
||||||
|
// plane; a 5 mm horn plate at 28.7..33.7 on one side holding a printed
|
||||||
|
// horn adapter; a 3 mm bearing plate at -21.5..-18.5 on the other side,
|
||||||
|
// whose ring takes a 14 mm boss on the opposite part; plates shaped as a
|
||||||
|
// lens (r 25.5 around the axis, cut by r 19.963 offset 9.463 towards the
|
||||||
|
// part's body); and a wrap shell up to r 25.5 for clearance.
|
||||||
|
//
|
||||||
|
// Deviations from the original (its bugs):
|
||||||
|
// - Tibia halves split exactly at y = 0 (one half was 0.1 mm off, holes up
|
||||||
|
// to 0.03 mm apart, different blade spline nets).
|
||||||
|
// - Lid locating lips all 0.8 mm (the original's were 0.5..0.9 mm).
|
||||||
|
// - The foot sock sits on the foot (the original's was 10/13.5 mm off).
|
||||||
|
|
||||||
|
include <servo.scad>
|
||||||
|
|
||||||
|
/* [Links (match robot/Config.h)] */
|
||||||
|
COXA_LEN = 55;
|
||||||
|
FEMUR_LEN = 100;
|
||||||
|
TIBIA_LEN = 150; // knee axis to foot ball centre
|
||||||
|
|
||||||
|
/* [Shared joint design] */
|
||||||
|
SHELL_R = 25.5;
|
||||||
|
BRACKET_SHELL_IN = 23.5;
|
||||||
|
TIBIA_SHELL_IN = 24.0;
|
||||||
|
LENS_R = 19.963;
|
||||||
|
LENS_OFFSET = 9.463;
|
||||||
|
HORN_PLATE = [28.7, 33.7];
|
||||||
|
BEARING_PLATE = [-21.5, -18.5];
|
||||||
|
RING = [7.2, 10.5, 1.5]; // pocket radius, outer radius, height
|
||||||
|
BOSS_D = 14;
|
||||||
|
BOSS_H = 2;
|
||||||
|
SERVO_EAR_PLANE = 16.5;
|
||||||
|
HORN_SQUARE = 30;
|
||||||
|
JOIN = 1; // shells reach this far into their plates, so parts fuse
|
||||||
|
HORN_HUB_D = 9.2;
|
||||||
|
HORN_CROSS_DEPTH = 2;
|
||||||
|
|
||||||
|
/* [Fasteners] */
|
||||||
|
M3_D = 3.1;
|
||||||
|
M3_HEAD_D = 5.7;
|
||||||
|
M3_NUT_AF = 5.7;
|
||||||
|
|
||||||
|
/* [Coxa bracket] */
|
||||||
|
BLOCK_Z = [-12, 12.5];
|
||||||
|
BLOCK_Y = 15;
|
||||||
|
BRACKET_BOLTS = [[26.4, 10.92], [26.4, -10.92]]; // (x, y), vertical
|
||||||
|
CABLE_D = 6;
|
||||||
|
|
||||||
|
/* [Femur link] */
|
||||||
|
LINK_X = [-19, 119];
|
||||||
|
LINK_Z = 13; // half height
|
||||||
|
LINK_R = 3;
|
||||||
|
LINK_WALL = 2;
|
||||||
|
LINK_TOP = [13.5, 16.5]; // top wall, carries both servos
|
||||||
|
LINK_LID = [-16.5, -13.5];
|
||||||
|
LIP = [0.8, 3, 0.5]; // thickness, height, clearance to the wall
|
||||||
|
CABLE_SLOT = [-12.5, 3]; // slot for x < -12.5, |y| < 3
|
||||||
|
|
||||||
|
/* [Tibia] */
|
||||||
|
LOBE_X = 25.5;
|
||||||
|
LOBE_R = 14.985;
|
||||||
|
LOBE_Y = 12;
|
||||||
|
TIBIA_BOLTS = [[26.43, 10.585], [26.43, -10.585]]; // (x, z), along y
|
||||||
|
ROD_R = 5;
|
||||||
|
ROD_PATH = [[28.5, -0], [47.41, -36.13], [0, -TIBIA_LEN]]; // (x, z), quadratic Bezier
|
||||||
|
|
||||||
|
/* [Foot sock (TPU)] */
|
||||||
|
SOCK_T = 0.5; // wall, same as the real printed socks
|
||||||
|
SOCK_LEN = 12.2; // along the rod from the foot ball centre
|
||||||
|
|
||||||
|
/* [Rendering] */
|
||||||
|
SHOW_SERVOS = true;
|
||||||
|
SHOW_ADAPTERS = true;
|
||||||
|
SHOW_SOCK = true;
|
||||||
|
SHOW_CABLES = true;
|
||||||
|
|
||||||
|
/* [Hidden] */
|
||||||
|
$fa = 2; $fs = 0.3;
|
||||||
|
C_BRACKET = "#d9822b";
|
||||||
|
C_LINK = "#4a7fbf";
|
||||||
|
C_TIBIA = "#5fa35f";
|
||||||
|
C_ADAPTER = "#bdbdbd";
|
||||||
|
C_SOCK = "#1c1c1c";
|
||||||
|
BIG = 200;
|
||||||
|
|
||||||
|
// ---------- helpers -------------------------------------------------------
|
||||||
|
|
||||||
|
function rot2(p, a) = [p[0]*cos(a) - p[1]*sin(a), p[0]*sin(a) + p[1]*cos(a)];
|
||||||
|
function bez(p, t) = (1-t)*(1-t)*p[0] + 2*(1-t)*t*p[1] + t*t*p[2];
|
||||||
|
|
||||||
|
// Shell around the local Z axis between r_in and SHELL_R, ±45° about angle a.
|
||||||
|
module shell(r_in, z0, z1, a = 0)
|
||||||
|
translate([0, 0, z0]) rotate([0, 0, a - 45])
|
||||||
|
lx(z1 - z0) intersection() {
|
||||||
|
difference() { circle(r = SHELL_R); circle(r = r_in); }
|
||||||
|
polygon([[0, 0], [2 * SHELL_R, 0], [2 * SHELL_R, 2 * SHELL_R], [0, 2 * SHELL_R]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// linear_extrude with a convexity, so the preview shows holes and shells.
|
||||||
|
module lx(h) linear_extrude(h, convexity = 10) children();
|
||||||
|
|
||||||
|
// Plate outline around an axis at the origin, biased by `off` along x.
|
||||||
|
module lens_2d(off) intersection() {
|
||||||
|
circle(r = SHELL_R);
|
||||||
|
translate([off, 0]) circle(r = LENS_R);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turns a part built along local Z into one along +y (for horizontal axes).
|
||||||
|
module along_y(y0) translate([0, y0, 0]) rotate([-90, 0, 0]) children();
|
||||||
|
|
||||||
|
module ring(z0) translate([0, 0, z0]) difference() {
|
||||||
|
cylinder(r = RING[1], h = RING[2]);
|
||||||
|
translate([0, 0, -1]) cylinder(r = RING[0], h = RING[2] + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
module hex_well(af, h) cylinder(d = af / cos(30), h = h, $fn = 6);
|
||||||
|
|
||||||
|
// The servo cross horn, arms on the diagonals (same in every horn pocket).
|
||||||
|
CROSS_ARM = concat([[6.106, 0], [10.926, 6.853]],
|
||||||
|
[for (a = [-34.56 : 10 : 125.44]) [8.874, 8.874] + 2.88 * [cos(a), sin(a)]],
|
||||||
|
[[6.853, 10.926]]);
|
||||||
|
module cross_2d() polygon([for (k = [0:3]) for (p = CROSS_ARM) rot2(p, 90 * k)]);
|
||||||
|
|
||||||
|
// Hub hole through, cross pocket in the top HORN_CROSS_DEPTH of a 5 mm plate.
|
||||||
|
module horn_cut(h = 5) {
|
||||||
|
translate([0, 0, -1]) cylinder(d = HORN_HUB_D, h = h + 2);
|
||||||
|
translate([0, 0, h - HORN_CROSS_DEPTH]) lx(HORN_CROSS_DEPTH + 1) cross_2d();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Printed horn adapter ("servo horn v6"): sits in a horn plate's square window.
|
||||||
|
module horn_adapter() color(C_ADAPTER) render(convexity = 10) difference() {
|
||||||
|
translate([-HORN_SQUARE/2, -HORN_SQUARE/2, 0]) cube([HORN_SQUARE, HORN_SQUARE, 5]);
|
||||||
|
horn_cut();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- coxa bracket --------------------------------------------------
|
||||||
|
// Two printed halves split at the joint plane, bolted with 2 x M3.
|
||||||
|
|
||||||
|
// Fills the gap between the two shells; reaches 1 mm into both shell walls so
|
||||||
|
// each bracket half prints as one solid (in the original they are separate bodies).
|
||||||
|
module bracket_block(z0, z1) difference() {
|
||||||
|
translate([18, -BLOCK_Y, z0]) cube([20, 2 * BLOCK_Y, z1 - z0]);
|
||||||
|
cylinder(r = SHELL_R - 1, h = BIG, center = true);
|
||||||
|
translate([COXA_LEN, 0, 0]) rotate([90, 0, 0]) cylinder(r = SHELL_R - 1, h = BIG, center = true);
|
||||||
|
}
|
||||||
|
|
||||||
|
module bracket_common_cuts() {
|
||||||
|
translate([20, 0, 0]) rotate([0, 90, 0]) cylinder(d = CABLE_D, h = 15);
|
||||||
|
for (b = BRACKET_BOLTS) translate([b[0], b[1], -5]) cylinder(d = M3_D, h = 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
module coxa_bracket_upper() color(C_BRACKET) render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
shell(BRACKET_SHELL_IN, 0, HORN_PLATE[0] + JOIN);
|
||||||
|
translate([0, 0, HORN_PLATE[0]]) difference() {
|
||||||
|
lx(HORN_PLATE[1] - HORN_PLATE[0]) intersection() {
|
||||||
|
circle(r = SHELL_R);
|
||||||
|
union() {
|
||||||
|
square(HORN_SQUARE, center = true);
|
||||||
|
translate([LENS_OFFSET, 0]) circle(r = LENS_R);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
horn_cut();
|
||||||
|
}
|
||||||
|
bracket_block(0, BLOCK_Z[1]);
|
||||||
|
translate([COXA_LEN, 0, 0]) {
|
||||||
|
along_y(0) shell(BRACKET_SHELL_IN, 0, HORN_PLATE[0] + JOIN, 180);
|
||||||
|
along_y(HORN_PLATE[0]) lx(HORN_PLATE[1] - HORN_PLATE[0]) difference() {
|
||||||
|
lens_2d(-LENS_OFFSET);
|
||||||
|
square(HORN_SQUARE, center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bracket_common_cuts();
|
||||||
|
for (b = BRACKET_BOLTS) translate([b[0], b[1], 4]) cylinder(d = M3_HEAD_D, h = 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
module coxa_bracket_lower() color(C_BRACKET) render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
shell(BRACKET_SHELL_IN, BEARING_PLATE[1] - JOIN, 0);
|
||||||
|
translate([0, 0, BEARING_PLATE[0]])
|
||||||
|
lx(BEARING_PLATE[1] - BEARING_PLATE[0]) lens_2d(LENS_OFFSET);
|
||||||
|
ring(BEARING_PLATE[1]);
|
||||||
|
bracket_block(BLOCK_Z[0], 0);
|
||||||
|
translate([COXA_LEN, 0, 0]) {
|
||||||
|
along_y(BEARING_PLATE[1] - JOIN) shell(BRACKET_SHELL_IN, 0, -BEARING_PLATE[1] + JOIN, 180);
|
||||||
|
along_y(BEARING_PLATE[0]) lx(BEARING_PLATE[1] - BEARING_PLATE[0])
|
||||||
|
lens_2d(-LENS_OFFSET);
|
||||||
|
along_y(BEARING_PLATE[1]) ring(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bracket_common_cuts();
|
||||||
|
for (b = BRACKET_BOLTS) translate([b[0], b[1], BLOCK_Z[0] - 1]) hex_well(M3_NUT_AF, 9);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- femur link ----------------------------------------------------
|
||||||
|
// Femur frame: origin on the femur axis, knee at x = FEMUR_LEN.
|
||||||
|
|
||||||
|
module link_profile_2d(inset = 0, r = LINK_R)
|
||||||
|
translate([LINK_X[0] + inset, -LINK_Z + inset])
|
||||||
|
offset(r = r) offset(delta = -r)
|
||||||
|
square([LINK_X[1] - LINK_X[0] - 2*inset, 2*(LINK_Z - inset)]);
|
||||||
|
|
||||||
|
SERVO_SHAFTS = [[0, 0], [FEMUR_LEN, 180]]; // (x, direction the case extends)
|
||||||
|
|
||||||
|
module link_channel() color(C_LINK) render(convexity = 10) difference() {
|
||||||
|
along_y(LINK_LID[1]) lx(LINK_TOP[1] - LINK_LID[1]) link_profile_2d();
|
||||||
|
along_y(LINK_LID[1] - 1) lx(LINK_TOP[0] - LINK_LID[1] + 1)
|
||||||
|
link_profile_2d(LINK_WALL, 1);
|
||||||
|
for (s = SERVO_SHAFTS) along_y(LINK_TOP[0] - 1) translate([s[0], 0]) rotate([0, 0, s[1]])
|
||||||
|
lx(LINK_TOP[1] - LINK_TOP[0] + 2) servo_pocket_2d();
|
||||||
|
translate([LINK_X[0] - 1, -CABLE_SLOT[1], -BIG/2])
|
||||||
|
cube([CABLE_SLOT[0] - LINK_X[0] + 1, 2 * CABLE_SLOT[1], BIG]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module link_lid() color(C_LINK) render(convexity = 10) {
|
||||||
|
along_y(LINK_LID[0]) lx(LINK_LID[1] - LINK_LID[0]) link_profile_2d();
|
||||||
|
for (x = [0, FEMUR_LEN]) translate([x, 0, 0])
|
||||||
|
along_y(LINK_LID[0] - BOSS_H) cylinder(d = BOSS_D, h = BOSS_H);
|
||||||
|
in = LINK_WALL + LIP[2];
|
||||||
|
along_y(LINK_LID[1]) lx(LIP[1]) {
|
||||||
|
for (m = [1, -1]) scale([1, m])
|
||||||
|
translate([-10, LINK_Z - in - LIP[0]]) square([120, LIP[0]]);
|
||||||
|
translate([LINK_X[0] + in, -8]) square([LIP[0], 16]);
|
||||||
|
translate([LINK_X[1] - in - LIP[0], -8]) square([LIP[0], 16]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module link_servos() if (SHOW_SERVOS)
|
||||||
|
for (s = SERVO_SHAFTS) translate([s[0], SERVO_EAR_PLANE, 0])
|
||||||
|
rotate([-90, 0, 0]) rotate([0, 0, s[1]]) hs485hb();
|
||||||
|
|
||||||
|
// ---------- tibia ---------------------------------------------------------
|
||||||
|
// Knee frame: origin on the knee axis, axes as the femur frame in the
|
||||||
|
// original pose (tibia at -90 degrees, rod hanging down).
|
||||||
|
|
||||||
|
ROD_N = 30;
|
||||||
|
module rod() for (i = [0:ROD_N-1]) hull() {
|
||||||
|
a = bez(ROD_PATH, i / ROD_N); b = bez(ROD_PATH, (i + 1) / ROD_N);
|
||||||
|
translate([a[0], 0, a[1]]) sphere(r = ROD_R, $fn = 36);
|
||||||
|
translate([b[0], 0, b[1]]) sphere(r = ROD_R, $fn = 36);
|
||||||
|
}
|
||||||
|
|
||||||
|
module half_space(side) translate([-BIG, side > 0 ? 0 : -BIG, -BIG]) cube([2*BIG, BIG, 2*BIG]);
|
||||||
|
|
||||||
|
// Bolt lobe behind the knee, only outside the shell (r > SHELL_R), so it
|
||||||
|
// clears the femur link's end at any knee angle.
|
||||||
|
module tibia_lobe(y0, y1) along_y(y0) lx(y1 - y0) difference() {
|
||||||
|
translate([LOBE_X, 0]) circle(r = LOBE_R);
|
||||||
|
circle(r = SHELL_R - JOIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
// One half of the rod, trimmed to stay outside the shell's inner radius.
|
||||||
|
module rod_half(side) difference() {
|
||||||
|
intersection() { rod(); half_space(side); }
|
||||||
|
along_y(-BIG/2) cylinder(r = TIBIA_SHELL_IN, h = BIG);
|
||||||
|
}
|
||||||
|
|
||||||
|
module tibia_bolts(y0, h, d) for (b = TIBIA_BOLTS) translate([b[0], 0, b[1]]) along_y(y0) cylinder(d = d, h = h);
|
||||||
|
|
||||||
|
// Bearing side (original "leg left 1"); M3 heads in its 8 mm counterbores.
|
||||||
|
module tibia_bearing_half() color(C_TIBIA) render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
along_y(BEARING_PLATE[0]) lx(BEARING_PLATE[1] - BEARING_PLATE[0]) lens_2d(LENS_OFFSET);
|
||||||
|
along_y(BEARING_PLATE[1]) ring(0);
|
||||||
|
along_y(BEARING_PLATE[1] - JOIN) shell(TIBIA_SHELL_IN, 0, -BEARING_PLATE[1] + JOIN);
|
||||||
|
tibia_lobe(-LOBE_Y, 0);
|
||||||
|
rod_half(-1);
|
||||||
|
}
|
||||||
|
tibia_bolts(-4, 5, M3_D);
|
||||||
|
tibia_bolts(-LOBE_Y - 1, LOBE_Y - 4 + 1, M3_HEAD_D);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Horn side (original "leg left 2"); M3 nuts in its hex wells.
|
||||||
|
module tibia_horn_half() color(C_TIBIA) render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
along_y(HORN_PLATE[0]) lx(HORN_PLATE[1] - HORN_PLATE[0]) difference() {
|
||||||
|
lens_2d(LENS_OFFSET);
|
||||||
|
square(HORN_SQUARE, center = true);
|
||||||
|
}
|
||||||
|
along_y(0) shell(TIBIA_SHELL_IN, 0, HORN_PLATE[0] + JOIN);
|
||||||
|
tibia_lobe(0, LOBE_Y);
|
||||||
|
rod_half(1);
|
||||||
|
}
|
||||||
|
tibia_bolts(-1, 5, M3_D);
|
||||||
|
for (b = TIBIA_BOLTS) translate([b[0], 0, b[1]]) along_y(4) hex_well(M3_NUT_AF, LOBE_Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TPU sock over the foot ball and the end of the rod.
|
||||||
|
FOOT = [ROD_PATH[2][0], 0, ROD_PATH[2][1]];
|
||||||
|
SOCK_DIR = [ROD_PATH[1][0] - ROD_PATH[2][0], 0, ROD_PATH[1][1] - ROD_PATH[2][1]]
|
||||||
|
/ norm([ROD_PATH[1][0] - ROD_PATH[2][0], ROD_PATH[1][1] - ROD_PATH[2][1]]);
|
||||||
|
module foot_sock() color(C_SOCK) render(convexity = 10) difference() {
|
||||||
|
intersection() {
|
||||||
|
hull() {
|
||||||
|
translate(FOOT) sphere(r = ROD_R + SOCK_T);
|
||||||
|
translate(FOOT + SOCK_LEN * SOCK_DIR) sphere(r = ROD_R + SOCK_T);
|
||||||
|
}
|
||||||
|
// flat open end, perpendicular to the rod
|
||||||
|
translate(FOOT) rotate([0, atan2(SOCK_DIR[0], SOCK_DIR[2]), 0])
|
||||||
|
translate([-BIG/2, -BIG/2, -BIG]) cube([BIG, BIG, BIG + SOCK_LEN]);
|
||||||
|
}
|
||||||
|
rod();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- servo cables (reference only) ---------------------------------
|
||||||
|
// Route of the original: along the lid under the servo cases, up through
|
||||||
|
// the link's end slot, through the bracket's cable channel, into the body
|
||||||
|
// cavity at the arm end (the channel sits at the cavity's mid-height).
|
||||||
|
// The lead leaves the case at the end opposite the shaft, low down.
|
||||||
|
|
||||||
|
CABLE_W = 2.4;
|
||||||
|
C_CABLE = "#5a3a1e";
|
||||||
|
|
||||||
|
module cable(pts) color(C_CABLE)
|
||||||
|
for (i = [0:len(pts)-2]) hull() {
|
||||||
|
translate(pts[i]) sphere(d = CABLE_W, $fn = 12);
|
||||||
|
translate(pts[i+1]) sphere(d = CABLE_W, $fn = 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Femur frame part of a lead: case exit -> along the lid -> out of the end slot.
|
||||||
|
function link_lead(exit_x, toward, z) = [
|
||||||
|
[exit_x, -9, z], [exit_x + toward * 2, -12.3, z], [-12, -12.3, z],
|
||||||
|
[-15.5, -8, z * 0.5], [-17, 0, 0], [LINK_X[0] - 4, 0, 0]];
|
||||||
|
// Leg frame part, original pose: bracket channel -> into the body cavity.
|
||||||
|
LEAD_BODY = [[COXA_LEN - 25.5 - 1, 0, 0], [16, 0, 0], [12, 12, 0], [-35, 12, 0]];
|
||||||
|
|
||||||
|
// Coxa-frame part: bridge from the link's end slot to the bracket channel,
|
||||||
|
// then on into the body.
|
||||||
|
module coxa_cables() {
|
||||||
|
cable(LEAD_BODY);
|
||||||
|
cable([[COXA_LEN + LINK_X[0] - 4, 0, 0], [COXA_LEN - 25.5 - 1, 0, 0]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Femur-frame part: both leads inside the femur link.
|
||||||
|
module femur_cables() {
|
||||||
|
cable(link_lead(30, 1, -3)); // femur servo
|
||||||
|
cable(link_lead(FEMUR_LEN - 30, -1, 3)); // knee servo
|
||||||
|
}
|
||||||
|
|
||||||
|
module leg_cables(pose) rotate([0, 0, pose[0]]) {
|
||||||
|
coxa_cables();
|
||||||
|
translate([COXA_LEN, 0, 0]) rotate([0, -pose[1], 0]) femur_cables();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- posed leg -----------------------------------------------------
|
||||||
|
|
||||||
|
module leg(pose = [0, 0, -90]) {
|
||||||
|
if (SHOW_CABLES) leg_cables(pose);
|
||||||
|
leg_parts(pose);
|
||||||
|
}
|
||||||
|
|
||||||
|
module leg_parts(pose) rotate([0, 0, pose[0]]) {
|
||||||
|
coxa_bracket_upper();
|
||||||
|
coxa_bracket_lower();
|
||||||
|
translate([COXA_LEN, 0, 0]) {
|
||||||
|
if (SHOW_ADAPTERS) along_y(HORN_PLATE[0]) horn_adapter();
|
||||||
|
rotate([0, -pose[1], 0]) {
|
||||||
|
link_channel();
|
||||||
|
link_lid();
|
||||||
|
link_servos();
|
||||||
|
translate([FEMUR_LEN, 0, 0]) rotate([0, -(pose[2] + 90), 0]) {
|
||||||
|
tibia_bearing_half();
|
||||||
|
tibia_horn_half();
|
||||||
|
if (SHOW_ADAPTERS) along_y(HORN_PLATE[0]) horn_adapter();
|
||||||
|
if (SHOW_SOCK) foot_sock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
leg();
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,246 @@
|
|||||||
|
// Handheld remote: bottom shell + lid, rebuilt from the Fusion 360 model
|
||||||
|
// fusion360/remote/remote v40.f3d (the `bottom` and `top` solids in
|
||||||
|
// "remote v40.stp"; remote v4 is an early flat stick plate).
|
||||||
|
//
|
||||||
|
// Written in the original's top-view coordinates (u, v) = (Fusion x,
|
||||||
|
// -Fusion z), so every number can be checked against the Fusion file.
|
||||||
|
// Z = 0 on the rim of the bottom shell (the lid's top face sits flush).
|
||||||
|
// Text on the lid reads upright with +v up.
|
||||||
|
//
|
||||||
|
// Deviations from the original (its bugs):
|
||||||
|
// - Lid moved by (-0.406, -0.21, +0.365) mm: it was off-centre and sat
|
||||||
|
// 0.365 mm into the bottom's ledge, its posts overlapping the bosses.
|
||||||
|
// - The display bezel's stepped facets (an imported mesh) are a clean
|
||||||
|
// rectangular window plus its 0.45 mm lip; small clip notches omitted.
|
||||||
|
// - Body12 (an "ON-OFF" bracket line that was never cut into the lid) left out.
|
||||||
|
|
||||||
|
/* [Shell] */
|
||||||
|
CORNERS = [[-66.5, -58.883], [66.5, -58.883], [66.5, 41.117], [-66.5, 41.117]];
|
||||||
|
R_OUT = 37.5; // outside of the bottom shell
|
||||||
|
R_WALL = 32.5; // inside of the walls (5 mm)
|
||||||
|
R_LEDGE = 35.5; // rebate the lid drops into
|
||||||
|
R_LID = 35.0; // lid outline (0.5 mm clearance in the rebate)
|
||||||
|
FLOOR_Z = [-45, -42];
|
||||||
|
LEDGE_Z = -5;
|
||||||
|
LID_Z = [-5, 0];
|
||||||
|
|
||||||
|
/* [Fixing] */
|
||||||
|
BOSSES = [[-30, 40], [30, 40], [-80.387, -72.711], [82.73, -73]];
|
||||||
|
BOSS_D = 10;
|
||||||
|
BOSS_TOP = -35;
|
||||||
|
BOSS_HOLE_D = 6; // through the floor, 10 mm deep (magnets?)
|
||||||
|
POST_HOLE_D = 3; // blind, from the lid post's end
|
||||||
|
|
||||||
|
/* [Sticks, switch, display] */
|
||||||
|
STICKS = [[-66.5, 41.117], [66.5, 41.117]];
|
||||||
|
STICK_HOLE_D = 40;
|
||||||
|
STICK_SCREW = 16.25; // 4 x d2 (M2.5 self-tapping) on the joystick's 32.5 mm square (original: 33)
|
||||||
|
SWITCH_SLOT = [[-4, 33.975], [4, 49.975]]; // on/off slide switch, mounted on top (same as the robot's)
|
||||||
|
SWITCH_HOLES = [[0, 32.475], [0, 51.475]];
|
||||||
|
PILL = [[0, 5], [0, 15]]; // centres of the round ends
|
||||||
|
WINDOW = [[-37.94, -66.964], [37.96, -16.064]];
|
||||||
|
WINDOW_LIP = [0.45, -1.05, -0.45]; // inset, z range
|
||||||
|
DISPLAY_POCKET = [[-49.0, -73.0], [52.258, -10.0]];
|
||||||
|
DISPLAY_POCKET_Z = -2; // pocket from the lid's underside up to here
|
||||||
|
DISPLAY_POSTS = [[-44.939, -65.772], [49.261, -65.772], [-44.939, -17.272], [49.261, -17.272]];
|
||||||
|
TEXT = [["ON", [0.7, 26.29]], ["OFF", [0.15, 57.61]]];
|
||||||
|
ENGRAVE_D = 1;
|
||||||
|
|
||||||
|
/* [Rendering] */
|
||||||
|
SHOW_BOTTOM = true;
|
||||||
|
SHOW_LID = true;
|
||||||
|
SHOW_DISPLAY = true;
|
||||||
|
SHOW_STICKS = true;
|
||||||
|
SHOW_BATTERY = true;
|
||||||
|
EXPLODE = 0;
|
||||||
|
|
||||||
|
/* [Hidden] */
|
||||||
|
$fa = 2; $fs = 0.3;
|
||||||
|
BIG = 300;
|
||||||
|
|
||||||
|
module lx(h) linear_extrude(h, convexity = 10) children();
|
||||||
|
|
||||||
|
module rounded_2d(r) hull() for (c = CORNERS) translate(c) circle(r = r);
|
||||||
|
|
||||||
|
module stadium_2d(a, b, r) hull() { translate(a) circle(r = r); translate(b) circle(r = r); }
|
||||||
|
|
||||||
|
// ---------- bottom shell --------------------------------------------------
|
||||||
|
|
||||||
|
module remote_bottom() render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
difference() {
|
||||||
|
translate([0, 0, FLOOR_Z[0]]) lx(-FLOOR_Z[0]) rounded_2d(R_OUT);
|
||||||
|
translate([0, 0, FLOOR_Z[1]]) lx(BIG) rounded_2d(R_WALL);
|
||||||
|
translate([0, 0, LEDGE_Z]) lx(BIG) rounded_2d(R_LEDGE);
|
||||||
|
}
|
||||||
|
for (b = BOSSES) translate([b[0], b[1], FLOOR_Z[1] - 1]) cylinder(d = BOSS_D, h = BOSS_TOP - FLOOR_Z[1] + 1);
|
||||||
|
// blocks rising from the floor
|
||||||
|
translate([-10.5, 29, FLOOR_Z[1] - 1]) cube([21, 9, -17 - FLOOR_Z[1] + 1]);
|
||||||
|
translate([-4, 44, FLOOR_Z[1] - 1]) cube([8, 24, -17 - FLOOR_Z[1] + 1]);
|
||||||
|
for (m = [-1, 1]) translate([m * 27.9, -15, FLOOR_Z[1] - 1]) cylinder(d = 5, h = 4);
|
||||||
|
translate([88, -10, FLOOR_Z[1] - 1]) cube([12, 14, -28 - FLOOR_Z[1] + 1]); // port board block
|
||||||
|
// post up through the lid's slot, with a rounded lanyard loop on top
|
||||||
|
translate([0, 0, FLOOR_Z[1] - 1]) lx(-FLOOR_Z[1] + 1) stadium_2d(PILL[0], PILL[1], 4.75);
|
||||||
|
difference() {
|
||||||
|
intersection() {
|
||||||
|
hull() for (p = PILL) translate([p[0], p[1], 2.75]) sphere(r = 4.75);
|
||||||
|
translate([-10, 0, 0]) cube([20, 30, 10]);
|
||||||
|
}
|
||||||
|
hull() for (p = PILL) translate([-10, p[1], 2.75]) rotate([0, 90, 0]) cylinder(r = 2.75, h = 20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (b = BOSSES) translate([b[0], b[1], FLOOR_Z[0] - 1]) cylinder(d = BOSS_HOLE_D, h = BOSS_TOP - FLOOR_Z[0] + 2);
|
||||||
|
for (m = [-1, 1]) translate([m * 6.562, 35, FLOOR_Z[1]]) cylinder(d = 3, h = 30);
|
||||||
|
for (m = [-1, 1]) translate([m * 27.9, -15, FLOOR_Z[1]]) cylinder(d = 3, h = 10);
|
||||||
|
for (m = [-1, 1]) translate([0, 0, FLOOR_Z[0] - 1])
|
||||||
|
lx(5) stadium_2d([m * 23.9, -17], [m * 23.9, -13], 1);
|
||||||
|
translate([98, -10, -35]) cube([10, 14, 15]); // side port opening
|
||||||
|
for (v = [-7.5, 1.5]) translate([91, v, -37]) cylinder(d = 3, h = 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- lid -----------------------------------------------------------
|
||||||
|
|
||||||
|
module lid_plate_2d() difference() {
|
||||||
|
rounded_2d(R_LID);
|
||||||
|
for (s = STICKS) translate(s) {
|
||||||
|
circle(d = STICK_HOLE_D);
|
||||||
|
for (du = [-1, 1], dv = [-1, 1]) translate([du, dv] * STICK_SCREW) circle(d = 2);
|
||||||
|
}
|
||||||
|
stadium_2d(PILL[0], PILL[1], 5);
|
||||||
|
translate(SWITCH_SLOT[0]) square(SWITCH_SLOT[1] - SWITCH_SLOT[0]);
|
||||||
|
for (h = SWITCH_HOLES) translate(h) circle(d = 2);
|
||||||
|
translate(WINDOW[0]) offset(r = 0.5) offset(delta = -0.5) square(WINDOW[1] - WINDOW[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
module remote_lid() render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
translate([0, 0, LID_Z[0]]) lx(LID_Z[1] - LID_Z[0]) lid_plate_2d();
|
||||||
|
for (b = BOSSES) translate([b[0], b[1], BOSS_TOP]) cylinder(d = BOSS_D, h = LID_Z[0] - BOSS_TOP + 1);
|
||||||
|
// window lip, left over from the original's display bezel
|
||||||
|
translate([0, 0, WINDOW_LIP[1]]) lx(WINDOW_LIP[2] - WINDOW_LIP[1]) difference() {
|
||||||
|
translate(WINDOW[0]) square(WINDOW[1] - WINDOW[0]);
|
||||||
|
translate(WINDOW[0] + [1, 1] * WINDOW_LIP[0]) square(WINDOW[1] - WINDOW[0] - [2, 2] * WINDOW_LIP[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
translate([0, 0, LID_Z[0] - 1]) lx(DISPLAY_POCKET_Z - LID_Z[0] + 1) difference() {
|
||||||
|
translate(DISPLAY_POCKET[0]) square(DISPLAY_POCKET[1] - DISPLAY_POCKET[0]);
|
||||||
|
for (p = DISPLAY_POSTS) translate(p) circle(d = 6);
|
||||||
|
}
|
||||||
|
for (p = DISPLAY_POSTS) translate([p[0], p[1], LID_Z[0] - 1]) cylinder(d = 2.5, h = 4);
|
||||||
|
for (b = BOSSES) translate([b[0], b[1], BOSS_TOP - 1]) cylinder(d = POST_HOLE_D, h = LID_Z[0] - BOSS_TOP + 1);
|
||||||
|
for (t = TEXT) translate([t[1][0], t[1][1], LID_Z[1] - ENGRAVE_D]) lx(ENGRAVE_D + 1)
|
||||||
|
text(t[0], size = 5.8, halign = "center", valign = "center", font = "Liberation Sans");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- reference parts -----------------------------------------------
|
||||||
|
|
||||||
|
// Nextion NX4832T035 (3.5" Basic): 100.5 x 54.94 mm board, M3 holes 3.15 /
|
||||||
|
// 3.22 mm from its edges = the lid's 94.2 x 48.5 post grid; LCD module
|
||||||
|
// approximate, its visible area (73.44 x 48.96) under the window.
|
||||||
|
module nextion_3_5() {
|
||||||
|
centre = (DISPLAY_POSTS[0] + DISPLAY_POSTS[3]) / 2;
|
||||||
|
translate([centre[0], centre[1], DISPLAY_POCKET_Z - 4.5 - 1.6]) {
|
||||||
|
color("#1e5a2a") difference() {
|
||||||
|
translate([-100.5/2, -54.94/2, 0]) cube([100.5, 54.94, 1.6]);
|
||||||
|
for (p = DISPLAY_POSTS) translate([p[0] - centre[0], p[1] - centre[1], -1]) cylinder(d = 3.2, h = 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
win = (WINDOW[0] + WINDOW[1]) / 2;
|
||||||
|
color("#202020") translate([win[0] - 84/2, win[1] - 54/2, DISPLAY_POCKET_Z - 4.5]) cube([84, 54, 4.5]);
|
||||||
|
color("#3050a0") translate([win[0] - 73.44/2, win[1] - 48.96/2, DISPLAY_POCKET_Z - 0.2]) cube([73.44, 48.96, 0.2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Joystick, modelled from the JH-D400X-R4 drawing (4-axis, X/Y +-25 deg,
|
||||||
|
// twist +-45 deg, button). The remote's sticks turned out to be JH-D300X-R1
|
||||||
|
// (label on the box, owner's photo): similar, dimensions not checked yet. Mounted with its dust cover on the lid's top
|
||||||
|
// face; the body hangs through the d40 opening. Local frame: stick axis on
|
||||||
|
// Z, Z = 0 on the dust cover's underside. Pots on +X and +Y.
|
||||||
|
JOY_COVER_D = 53.5;
|
||||||
|
JOY_COVER_T = 3; // not dimensioned; drawing proportions
|
||||||
|
JOY_BOX = 40.4; // control box, square
|
||||||
|
JOY_BOX_H = 25.5;
|
||||||
|
JOY_BELOW = 42; // box bottom to dust cover top
|
||||||
|
JOY_ABOVE = 52.5; // dust cover top to button top
|
||||||
|
JOY_POT_D = 16.5;
|
||||||
|
JOY_POT_L = (49.6 - 40.4);
|
||||||
|
|
||||||
|
module jh_d400x() {
|
||||||
|
top = JOY_COVER_T;
|
||||||
|
color("#202020") {
|
||||||
|
difference() {
|
||||||
|
cylinder(d = JOY_COVER_D, h = JOY_COVER_T);
|
||||||
|
for (du = [-1, 1], dv = [-1, 1]) translate([du * 16.25, dv * 16.25, -1]) cylinder(d = 2.7, h = 5);
|
||||||
|
}
|
||||||
|
translate([0, 0, top]) cylinder(d1 = 39.5, d2 = 30, h = 3); // dust ring / boot
|
||||||
|
translate([0, 0, top - JOY_BELOW]) translate([-JOY_BOX/2, -JOY_BOX/2, 0]) cube([JOY_BOX, JOY_BOX, JOY_BOX_H]);
|
||||||
|
translate([0, 0, top - JOY_BELOW + JOY_BOX_H]) cylinder(d = 34, h = JOY_BELOW - JOY_BOX_H - JOY_COVER_T + 0.01);
|
||||||
|
for (a = [0, 90]) rotate([0, 0, a])
|
||||||
|
translate([JOY_BOX/2, 0, top - JOY_BELOW + JOY_BOX_H/2]) rotate([0, 90, 0]) cylinder(d = JOY_POT_D, h = JOY_POT_L);
|
||||||
|
// handle: neck, knurled body, top with the button
|
||||||
|
translate([0, 0, top + 6]) cylinder(d = 6, h = 12);
|
||||||
|
translate([0, 0, top + 16]) cylinder(d = 22, h = 8);
|
||||||
|
translate([0, 0, top + 24]) cylinder(d = 35, h = 22);
|
||||||
|
translate([0, 0, top + 46]) cylinder(d1 = 35, d2 = 26, h = 5);
|
||||||
|
}
|
||||||
|
color("#c0c0c0") translate([0, 0, top + 51]) cylinder(d = 8, h = JOY_ABOVE - 51);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 18650 UPS / boost board (5/9/12 V, Type-C charging), "SMD battery box"
|
||||||
|
// version: 89 x 22 mm board, holder on top, 22.4 mm overall, d3 holes.
|
||||||
|
// Placed on the bottom's two d5 standoffs at (+-27.9, -15); the board's real
|
||||||
|
// hole spacing isn't confirmed. The floor slots beside them take a strap.
|
||||||
|
UPS_CENTRE = [0, -15];
|
||||||
|
UPS_Z = -39; // standoff tops
|
||||||
|
module ups_18650() translate([UPS_CENTRE[0], UPS_CENTRE[1], UPS_Z]) {
|
||||||
|
color("#202020") difference() {
|
||||||
|
translate([-89/2, -22/2, 0]) cube([89, 22, 1.6]);
|
||||||
|
for (m = [-1, 1]) translate([m * 27.9, 0, -1]) cylinder(d = 3, h = 4);
|
||||||
|
}
|
||||||
|
color("#151515") translate([-77/2, -21/2, 1.6]) difference() {
|
||||||
|
cube([77, 21, 22.4 - 1.6]);
|
||||||
|
translate([3, 1.5, 3]) cube([71, 18, 30]);
|
||||||
|
}
|
||||||
|
color("#4060c0") translate([-65/2, 0, 1.6 + 3 + 18.5/2]) rotate([0, 90, 0]) cylinder(d = 18.5, h = 65);
|
||||||
|
color("#b0b0b0") translate([89/2 - 7, -4.5, 1.6]) cube([7.5, 9, 3.2]); // Type-C
|
||||||
|
}
|
||||||
|
|
||||||
|
// Small USB-C breakout (owner: glued in the holder at the side port), on the
|
||||||
|
// port block (u 88..99, v -10..4, top Z -28) with the receptacle facing the
|
||||||
|
// opening (v -10..4, Z -35..-20). Board size approximate.
|
||||||
|
module usb_c_breakout() translate([88, -10, -28]) {
|
||||||
|
color("#1a3a8a") cube([11, 14, 1.6]);
|
||||||
|
color("#c0c0c0") translate([11 - 7.3, 7 - 8.9/2, 1.6]) cube([7.5, 8.9, 3.2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// IMU (owner: on the big standoff in the middle), assumed a GY-521 / MPU6050
|
||||||
|
// like the robot's: 21.2 x 15.6 mm board on the 21 x 9 mm block (top Z -17),
|
||||||
|
// its hole end over the block's two d3 holes at v 35, board towards the centre.
|
||||||
|
module imu_gy521() translate([0, 35 + 3.5 - 15.6, -17]) {
|
||||||
|
color("#1f4fa0") translate([-21.2/2, 0, 0]) cube([21.2, 15.6, 1.6]);
|
||||||
|
color("#222") translate([-2, 7, 1.6]) cube([4, 4, 1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Teensy 4.0 (owner; no mounting holes), assumed on the hole-less 8 x 24 mm
|
||||||
|
// block (u -4..4, v 44..68, top Z -17). Across the block by default; lengthwise
|
||||||
|
// it would end 0.1 mm from the shell wall.
|
||||||
|
TEENSY_LENGTHWISE = false;
|
||||||
|
module teensy_4_0() translate([0, 56, -17]) rotate([0, 0, TEENSY_LENGTHWISE ? 90 : 0]) {
|
||||||
|
color("#1e5a2a") translate([-35.6/2, -17.8/2, 0]) cube([35.6, 17.8, 1.6]);
|
||||||
|
color("#222") translate([-3, -5, 1.6]) cube([10, 10, 1.2]); // i.MX RT1062
|
||||||
|
color("#c0c0c0") translate([-35.6/2 - 1, -7.5/2, 1.6]) cube([5.7, 7.5, 2.9]); // micro-USB
|
||||||
|
}
|
||||||
|
|
||||||
|
module remote_assembly() {
|
||||||
|
if (SHOW_BOTTOM) color("#3a3a3a") remote_bottom();
|
||||||
|
if (SHOW_LID) translate([0, 0, EXPLODE]) color("#5a5a5a") remote_lid();
|
||||||
|
if (SHOW_DISPLAY) translate([0, 0, EXPLODE]) nextion_3_5();
|
||||||
|
if (SHOW_BATTERY) ups_18650();
|
||||||
|
if (SHOW_BATTERY) usb_c_breakout();
|
||||||
|
if (SHOW_BATTERY) imu_gy521();
|
||||||
|
if (SHOW_BATTERY) teensy_4_0();
|
||||||
|
// pots towards the nearest side wall and the near edge, where there's room
|
||||||
|
if (SHOW_STICKS) for (s = STICKS) translate([s[0], s[1], LID_Z[1] + EXPLODE])
|
||||||
|
mirror([s[0] < 0 ? 1 : 0, 0, 0]) jh_d400x();
|
||||||
|
}
|
||||||
|
|
||||||
|
remote_assembly();
|
||||||
@@ -0,0 +1,588 @@
|
|||||||
|
// Remote v2: a flat console for the same electronics as the original remote
|
||||||
|
// (remote.scad, kept as the record of the printed one). Draft 3, not printed.
|
||||||
|
//
|
||||||
|
// Use (owner): both hands wrap the big twist-grip sticks, so nothing holds
|
||||||
|
// the case. It hangs from a neck strap on one eyelet on the top face, near
|
||||||
|
// the balance point and behind the display (slide it in its slots to balance),
|
||||||
|
// with a fold-out bail that braces against the body; or it lies on a table on
|
||||||
|
// its kickstand. The sticks sit far apart and nothing rises above the top face
|
||||||
|
// near them.
|
||||||
|
//
|
||||||
|
// Two shells split horizontally, printed in ASA: the top shell face down,
|
||||||
|
// the bottom shell on its flat underside, both without supports. The
|
||||||
|
// kickstand, strap eyelet and brace bail are separate parts. The shells are joined by M3 screws from below
|
||||||
|
// into heat-set inserts in the top shell.
|
||||||
|
//
|
||||||
|
// Frame: u to the right, v away from the user (the far edge is the front),
|
||||||
|
// Z up, Z = 0 on the top face.
|
||||||
|
//
|
||||||
|
// Electronics (all reused): 2 x JH-D300X-R1 joystick, Nextion NX4832T035
|
||||||
|
// (3.5"), 18650 UPS/boost board (89 x 22), Teensy 4.0, GY-521 (MPU6050),
|
||||||
|
// 12 x 15 mm 4-pin USB-C breakout (V, D-, D+, G), slide switch (the robot's).
|
||||||
|
// Wiring (owner): the breakout's V/G go to the UPS board's charge input and
|
||||||
|
// D-/D+ to the Teensy, through two halves of a cut USB cable whose plugs go
|
||||||
|
// into the UPS board and the Teensy; the UPS output feeds the Teensy.
|
||||||
|
|
||||||
|
|
||||||
|
/* [Shell] */
|
||||||
|
T = 2.4; // walls and floor (6 perimeters of 0.4)
|
||||||
|
PLATE = 3.0; // top plate
|
||||||
|
TOP_GROW = 10; // extra height of the top shell only (room behind the display); the bottom shell is unchanged
|
||||||
|
Z_BOT = -32 - TOP_GROW; // flat underside (32 mm thick before TOP_GROW: the D300X sticks reach 28.5 down)
|
||||||
|
Z_SPLIT = -12 - TOP_GROW; // top shell / bottom shell
|
||||||
|
CHAMFER = 4; // 45 deg bottom edge (printable without support)
|
||||||
|
TOP_CHAMFER = 1.5; // 45 deg top edge (the top shell prints face down)
|
||||||
|
LIP_H = 2.5; // locating lip on the bottom shell, into the top shell
|
||||||
|
LIP_W = 1.2;
|
||||||
|
FIT = 0.2; // clearance per side between printed parts
|
||||||
|
|
||||||
|
/* [Outline] */
|
||||||
|
STICKS = [[-80, 0], [80, 0]];
|
||||||
|
STICK_SQ = [28, 40]; // half size (u, v) of the rounded box around each stick
|
||||||
|
STICK_SQ_R = 10;
|
||||||
|
FRONT_BAND = [[-60, 0], [60, 52]]; // u, v box: display, USB-C, Teensy
|
||||||
|
FRONT_V = FRONT_BAND[1][1];
|
||||||
|
SIDE_U = STICKS[1][0] + STICK_SQ[0]; // the flat side faces
|
||||||
|
REAR_BAND = [[-80, -64], [80, 0]]; // UPS board behind the strap eyelet, switch behind that
|
||||||
|
CORNER_R = 10;
|
||||||
|
|
||||||
|
/* [Fasteners] */
|
||||||
|
// M3 x 12 from below; heat-set insert M3 (4.0 mm hole, 5.7 mm long) in the top shell
|
||||||
|
SCREWS = [[-58, 32], [58, 32], [-70, -52], [70, -52]];
|
||||||
|
BOSS_D = 9;
|
||||||
|
INSERT_D = 4.0;
|
||||||
|
INSERT_L = 6;
|
||||||
|
SCREW_D = 3.4;
|
||||||
|
HEAD_D = 6.5;
|
||||||
|
HEAD_Z = Z_SPLIT - 7; // counterbore floor: 7 mm of tower + 5 mm into the insert
|
||||||
|
|
||||||
|
/* [Joysticks] */
|
||||||
|
STICK_HOLE_D = 40;
|
||||||
|
STICK_SCREW = 16.25; // 4 x M2.5 x 14 on a 32.5 mm square, through cover and plate into the control box
|
||||||
|
STICK_SCREW_D = 2.8;
|
||||||
|
|
||||||
|
/* [Display: Nextion NX4832T035] */
|
||||||
|
NX_BOARD = [100.6, 55]; // measured by the owner
|
||||||
|
NX_HOLES = [94.2, 48.5]; // M3 grid, centred on the board
|
||||||
|
NX_CENTRE = [0, 20]; // board centre (forward of the sticks, so the strap misses it)
|
||||||
|
NX_FLIP = true; // display mounted turned 180 deg (its J1 connector on the right, clear of
|
||||||
|
// the Teensy's USB plug): set display direction 180 in the Nextion Editor
|
||||||
|
NX_WIN_OFF = [NX_FLIP ? 2.15 : -2.15, 0]; // window (visible area) centre from the board centre
|
||||||
|
NX_WINDOW = [75.9, 50.9]; // opening in the plate
|
||||||
|
NX_LCD = [85.7, 55]; // LCD module outline (owner: 7.45 mm of board beside it on both sides, centred on the board)
|
||||||
|
NX_LCD_CABLE = 1.3; // its flex cable sticks out this much on one short side (87 mm overall)
|
||||||
|
NX_LCD_T = 3.86; // LCD thickness (owner)
|
||||||
|
NX_BACK = 11.21 - NX_LCD_T - 1.6; // board underside to back of the J1 connector (owner: 11.21 from the glass)
|
||||||
|
NX_BEZEL = 1.0; // plate left above the glass (was 1.5: the display sat on the Teensy)
|
||||||
|
NX_POST_D = 5.5; // clears the LCD module (with its cable) by 0.2 mm
|
||||||
|
NX_SCREW_D = 2.5; // M3 tap drill: tap the posts for M3 x 5 machine screws through the board
|
||||||
|
NX_SKIN = 1.2; // plastic left between the tapped hole and the top face
|
||||||
|
|
||||||
|
/* [Switch: slide switch, mounted on top] */
|
||||||
|
SWITCH_POS = [0, -56];
|
||||||
|
SWITCH_SLOT = [16, 8]; // 8 x 16 slot and d2 holes 19 apart: fit the switch exactly (owner, old remote)
|
||||||
|
SWITCH_PITCH = 19;
|
||||||
|
SWITCH_HOLE_D = 2.0;
|
||||||
|
ENGRAVE_D = 0.6; // ON/OFF inlay: the first 3 layers (0.2) of the face-down top shell
|
||||||
|
|
||||||
|
/* [USB-C breakout] */
|
||||||
|
USBC_BOARD = [12, 15, 1.6];
|
||||||
|
USBC_RCPT = [8.94, 7.35, 3.26]; // receptacle, flush with the board's front edge
|
||||||
|
USBC_POS = [-45, 0]; // board centre u (v follows from the front wall)
|
||||||
|
USBC_Z = Z_BOT + 10; // board underside
|
||||||
|
|
||||||
|
/* [Other boards] */
|
||||||
|
UPS_CENTRE = [0, -41];
|
||||||
|
UPS_LEDS = [[-23.9, 0], [23.9, 0]]; // charge / on LEDs, seen through 2 x 6 mm floor slots (as on the old remote)
|
||||||
|
UPS_HOLES = 27.9; // +- u, not confirmed (same as the old remote)
|
||||||
|
UPS_Z = Z_BOT + T + 2; // board underside (2 mm standoffs); its top ends 2 mm under the plate
|
||||||
|
|
||||||
|
/* [Main board: perfboard with the Teensy 4.0 (socketed), nRF24L01, AMS1117] */
|
||||||
|
// Cut perfboard, 56 x 80 mm (owner). Component positions are estimates from the
|
||||||
|
// owner's photos. Board frame: x across (0..56), y
|
||||||
|
// along (0..80), Teensy micro-USB at y 0, nRF24 overhanging at y 80.
|
||||||
|
PERF = [56, 80, 1.6]; // measured by the owner: 56 x 80
|
||||||
|
// Held by 4 clamps on its long sides, no holes in the board (owner): a post
|
||||||
|
// beside the edge carries the board's edge on its inner half, and an M3 x 8
|
||||||
|
// button head with a washer (d7) in a heat-set insert in the post clamps it.
|
||||||
|
PERF_CLAMPS = [[0, 4], [0, 68], [PERF[0], 4], [PERF[0], 68]]; // board frame: on the long edges x = 0 / PERF[0], at these y
|
||||||
|
PERF_CLAMP_OUT = 1.5; // post centre outside the board edge (washer overlaps the board ~2 mm)
|
||||||
|
PERF_POS = [-36, 37]; // where the board's (0, 0) corner goes; x runs to -v, y to +u
|
||||||
|
PERF_Z = Z_BOT + 7.5; // board underside: 2 mm over the kickstand recess roof for wires (the Teensy USB plug then clears the display board)
|
||||||
|
PERF_IMU = [23, 38]; // GY-521 on the main board (owner), on 8.5 mm headers: its corner, board frame
|
||||||
|
|
||||||
|
/* [Kickstand] */
|
||||||
|
KS_W = 30; // flap width (u)
|
||||||
|
KS_V = [8, 43.75]; // free end, hinge axis (the trough clears the main board)
|
||||||
|
KS_T = 3;
|
||||||
|
KS_BARREL_D = 6.5;
|
||||||
|
KS_PIN_D = 3.3; // M3 x 40 screw, from inside on the left, into a nut trap on the right
|
||||||
|
KS_WALL = 3; // side walls (nut trap)
|
||||||
|
KS_WALL_V = 2; // front/back walls
|
||||||
|
|
||||||
|
/* [Strap eyelet] */
|
||||||
|
// A loop on the top face for the neck strap's snap hook, near the balance
|
||||||
|
// point (estimated centre of mass v -3, Z -18: with the eyelet at v -24 the
|
||||||
|
// remote hangs level when the strap leaves at ~34 deg from vertical).
|
||||||
|
// Two M3 x 8 button heads into heat-set inserts; the slots give
|
||||||
|
// +-HOOK_TRAVEL to balance it.
|
||||||
|
HOOK_POS = [0, -24];
|
||||||
|
HOOK_TRAVEL = 5;
|
||||||
|
HOOK_INSERTS = 7; // +- u
|
||||||
|
HOOK_BASE = [24, 18, 4]; // u, v, Z
|
||||||
|
// Alternative place: the front face (the edge away from you), 2 inserts in
|
||||||
|
// the front wall of the bottom shell; the loop then points forward.
|
||||||
|
HOOK_FRONT_Z = Z_SPLIT - 7;
|
||||||
|
HOOK_MOUNT = "top"; // [top, front] (assembly view only)
|
||||||
|
HOOK_HOLE_D = 8; // for the snap hook
|
||||||
|
HOOK_H = 16; // top of the loop above the top face
|
||||||
|
|
||||||
|
/* [Brace bail] */
|
||||||
|
// A U-shaped bail pivoting on the side faces, outside the case and below the
|
||||||
|
// hands. Folded forward it wraps the front edge; swung back and down its
|
||||||
|
// crossbar rests against your chest or belly. M3 x 16 button-head screws
|
||||||
|
// with a washer into heat-set inserts in the side walls; friction holds it.
|
||||||
|
BAIL_PIVOT = [-25, Z_BOT + 10]; // v, Z on the side faces (u +-SIDE_U)
|
||||||
|
BAIL_L = 82; // pivot to crossbar centre line
|
||||||
|
BAIL_BOW = 10; // crossbar bows outwards by this much in the middle
|
||||||
|
BAIL_T = 5; // arm thickness (u)
|
||||||
|
BAIL_H = 12; // arm and crossbar height
|
||||||
|
BAIL_GAP = 0.5; // arm to side face (a washer fills it)
|
||||||
|
BAIL_ANGLE = 0; // 0 = folded forward, swings down: -90 hanging, -180 straight back, ~-150 brace
|
||||||
|
|
||||||
|
/* [Rendering] */
|
||||||
|
PART = "assembly"; // [assembly, top, inlay, text, bottom, kickstand, eyelet, bail]
|
||||||
|
SHOW_TOP = true;
|
||||||
|
SHOW_BOTTOM = true;
|
||||||
|
SHOW_PARTS = true;
|
||||||
|
SHOW_STICKS = true;
|
||||||
|
KS_OPEN = 0; // kickstand angle, deg
|
||||||
|
EXPLODE = 0;
|
||||||
|
|
||||||
|
/* [Hidden] */
|
||||||
|
$fa = 4; $fs = 0.5;
|
||||||
|
BIG = 400;
|
||||||
|
JOIN = 1;
|
||||||
|
|
||||||
|
module lx(h) linear_extrude(h, convexity = 10) children();
|
||||||
|
module rbox(b, r) translate(b[0] + [r, r]) offset(r = r) square(b[1] - b[0] - [2 * r, 2 * r]);
|
||||||
|
module rsq(c, h, r) translate(c) offset(r = r) square(2 * (h - [r, r]), center = true);
|
||||||
|
|
||||||
|
// ---------- outline and solid ----------------------------------------------
|
||||||
|
|
||||||
|
module outline_2d() hull() {
|
||||||
|
rbox(FRONT_BAND, CORNER_R);
|
||||||
|
rbox(REAR_BAND, CORNER_R);
|
||||||
|
for (s = STICKS) rsq(s, STICK_SQ, STICK_SQ_R);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The outline swept with a 45 deg chamfer at the bottom (and optionally at
|
||||||
|
// the top): a thin slab of the outline, inset by the chamfer, Minkowski'd
|
||||||
|
// with a turned profile. `inset` gives the inner surface of the walls.
|
||||||
|
module swept(inset, z0, z1, top_chamfer) {
|
||||||
|
c = CHAMFER;
|
||||||
|
h = z1 - z0;
|
||||||
|
tc = top_chamfer;
|
||||||
|
minkowski() {
|
||||||
|
translate([0, 0, z0]) linear_extrude(0.01) offset(delta = -(c + inset)) outline_2d();
|
||||||
|
rotate_extrude($fn = 32) polygon([[0, 0], [c, c], [c, h - tc], [c - tc, h], [0, h]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module outer_solid() swept(0, Z_BOT, 0, TOP_CHAMFER);
|
||||||
|
module inner_solid() swept(T, Z_BOT + T, BIG / 4, 0);
|
||||||
|
|
||||||
|
// ---------- top shell -------------------------------------------------------
|
||||||
|
|
||||||
|
module nx_holes() for (du = [-1, 1], dv = [-1, 1]) translate(NX_CENTRE + [du * NX_HOLES[0], dv * NX_HOLES[1]] / 2) children();
|
||||||
|
module stick_screws() for (s = STICKS, du = [-1, 1], dv = [-1, 1]) translate(s + [du, dv] * STICK_SCREW) children();
|
||||||
|
NX_WIN = NX_CENTRE + NX_WIN_OFF;
|
||||||
|
NX_BOARD_TOP = -NX_BEZEL - NX_LCD_T; // board's top face
|
||||||
|
|
||||||
|
module top_shell() render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
intersection() {
|
||||||
|
outer_solid();
|
||||||
|
difference() {
|
||||||
|
translate([-BIG / 2, -BIG / 2, Z_SPLIT]) cube([BIG, BIG, -Z_SPLIT]);
|
||||||
|
difference() { inner_solid(); translate([-BIG / 2, -BIG / 2, -PLATE]) cube(BIG); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// eyelet inserts
|
||||||
|
for (m = [-1, 1]) translate([HOOK_POS[0] + m * HOOK_INSERTS, HOOK_POS[1], -PLATE - 7 + JOIN]) cylinder(d = 8, h = 7);
|
||||||
|
// screw bosses
|
||||||
|
for (s = SCREWS) translate([s[0], s[1], Z_SPLIT]) cylinder(d = BOSS_D, h = -Z_SPLIT - PLATE + JOIN);
|
||||||
|
// display posts
|
||||||
|
nx_holes() translate([0, 0, NX_BOARD_TOP]) cylinder(d = NX_POST_D, h = -NX_BOARD_TOP - PLATE + JOIN);
|
||||||
|
// joystick nut bosses
|
||||||
|
}
|
||||||
|
// display: window (chamfered to the top) and LCD pocket
|
||||||
|
translate(concat(NX_WIN, -NX_BEZEL - 0.01)) hull() {
|
||||||
|
translate([0, 0, 0.005]) cube(concat(NX_WINDOW, 0.01), center = true);
|
||||||
|
translate([0, 0, NX_BEZEL + 0.01]) cube(concat(NX_WINDOW + [2, 2] * NX_BEZEL, 0.02), center = true);
|
||||||
|
}
|
||||||
|
// LCD pocket: cable allowance on both short sides, so it fits either way round
|
||||||
|
translate(concat(NX_CENTRE - (NX_LCD + [2 * NX_LCD_CABLE + 0.4, 1]) / 2, -PLATE - 1)) cube(concat(NX_LCD + [2 * NX_LCD_CABLE + 0.4, 1], PLATE + 1 - NX_BEZEL));
|
||||||
|
nx_holes() translate([0, 0, NX_BOARD_TOP - 1]) cylinder(d = NX_SCREW_D, h = 1 - NX_BOARD_TOP - NX_SKIN);
|
||||||
|
// joysticks
|
||||||
|
for (s = STICKS) translate([s[0], s[1], -BIG / 2]) cylinder(d = STICK_HOLE_D, h = BIG);
|
||||||
|
stick_screws() translate([0, 0, -BIG / 2]) cylinder(d = STICK_SCREW_D, h = BIG);
|
||||||
|
// switch
|
||||||
|
translate(SWITCH_POS) {
|
||||||
|
translate([-SWITCH_SLOT[0] / 2, -SWITCH_SLOT[1] / 2, -BIG / 2]) cube([SWITCH_SLOT[0], SWITCH_SLOT[1], BIG]);
|
||||||
|
for (m = [-1, 1]) translate([m * SWITCH_PITCH / 2, 0, -BIG / 2]) cylinder(d = SWITCH_HOLE_D, h = BIG);
|
||||||
|
}
|
||||||
|
// inserts
|
||||||
|
for (s = SCREWS) translate([s[0], s[1], Z_SPLIT - 1]) cylinder(d = INSERT_D, h = 1 + INSERT_L);
|
||||||
|
translate([0, 0, -ENGRAVE_D]) lx(1 + ENGRAVE_D) top_inlay_2d(); // ON/OFF and honeycomb inlays
|
||||||
|
for (m = [-1, 1]) translate([HOOK_POS[0] + m * HOOK_INSERTS, HOOK_POS[1], -PLATE - 7]) {
|
||||||
|
cylinder(d = INSERT_D, h = 7 + PLATE - 1);
|
||||||
|
cylinder(d = SCREW_D, h = BIG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ON/OFF text, cut into the top face and printed as a second-colour inlay
|
||||||
|
// (PART = "inlay", exported in the same frame as PART = "top").
|
||||||
|
module switch_text_2d() for (t = [["ON", -1], ["OFF", 1]]) translate([t[1] * 19, 0])
|
||||||
|
text(t[0], size = 5, halign = "center", valign = "center", font = "Liberation Sans:style=Bold");
|
||||||
|
// Honeycomb on the right of a diagonal through the middle of the top face.
|
||||||
|
// Only whole cells are drawn (every wall full width): a cell is kept when its
|
||||||
|
// outer edge lies right of the diagonal, inside the top face (EDGE_KEEP from
|
||||||
|
// the outline) and clear of the display window, the stick covers, the strap
|
||||||
|
// eyelet (with its travel) and the switch with its ON/OFF text.
|
||||||
|
HEX_R = 4.5; // cell circumradius (wall centre lines)
|
||||||
|
HEX_LINE = 1.2; // wall width (3 extrusion widths)
|
||||||
|
DIAG_POINT = [0, -14]; // the diagonal passes through here...
|
||||||
|
DIAG_ANGLE = 20; // ...leaning this far from the v axis (top end to the right)
|
||||||
|
EDGE_KEEP = 3; // from the outline (clear of the top chamfer)
|
||||||
|
HEX_GAP = 1.5; // around the keep-outs
|
||||||
|
|
||||||
|
HEX_OUT = (HEX_R + HEX_LINE / 2 / cos(30)); // outer circumradius of a cell
|
||||||
|
// The outline is the hull of rounded boxes with one corner radius, so it is
|
||||||
|
// this convex polygon grown by CORNER_R (corners listed counter-clockwise).
|
||||||
|
function _ol_pts() = let(r = CORNER_R, f = FRONT_BAND, b = REAR_BAND,
|
||||||
|
su = STICKS[1][0] + STICK_SQ[0] - r, sv = STICK_SQ[1] - r)
|
||||||
|
[[f[0][0] + r, f[1][1] - r], [-su, sv], [-su, -sv], [b[0][0] + r, b[0][1] + r],
|
||||||
|
[b[1][0] - r, b[0][1] + r], [su, -sv], [su, sv], [f[1][0] - r, f[1][1] - r]];
|
||||||
|
function _cross(a, b, q) = (b[0] - a[0]) * (q[1] - a[1]) - (b[1] - a[1]) * (q[0] - a[0]);
|
||||||
|
function _seg_dist(a, b, q) = let(d = b - a, t = max(0, min(1, ((q - a) * d) / (d * d)))) norm(q - (a + t * d));
|
||||||
|
function _poly_dist(P, q) = let(n = len(P),
|
||||||
|
inside = min([for (i = [0 : n - 1]) _cross(P[i], P[(i + 1) % n], q)]) >= 0)
|
||||||
|
inside ? 0 : min([for (i = [0 : n - 1]) _seg_dist(P[i], P[(i + 1) % n], q)]);
|
||||||
|
function _in_face(q) = _poly_dist(_ol_pts(), q) <= CORNER_R - EDGE_KEEP;
|
||||||
|
function _right(q) = ((q - DIAG_POINT) * [cos(DIAG_ANGLE), -sin(DIAG_ANGLE)]) >= 0;
|
||||||
|
function _rect_dist(c, size, q) = let(d = [max(abs(q[0] - c[0]) - size[0] / 2, 0), max(abs(q[1] - c[1]) - size[1] / 2, 0)]) norm(d);
|
||||||
|
function _clear(q) = let(rr = HEX_OUT + HEX_GAP)
|
||||||
|
_rect_dist(NX_WIN, NX_WINDOW + [2, 2] * NX_BEZEL, q) >= rr &&
|
||||||
|
min([for (st = STICKS) norm(q - st)]) >= 53.5 / 2 + rr &&
|
||||||
|
_rect_dist(HOOK_POS, [HOOK_BASE[0], HOOK_BASE[1] + 2 * HOOK_TRAVEL], q) >= rr &&
|
||||||
|
_rect_dist(SWITCH_POS, [2 * 19 + 16, 7], q) >= rr;
|
||||||
|
function _cell_ok(c) = _clear(c) && min([for (k = [0 : 5]) let(q = c + HEX_OUT * [cos(60 * k), sin(60 * k)])
|
||||||
|
(_right(q) && _in_face(q)) ? 1 : 0]) == 1;
|
||||||
|
HEX_CELLS = [for (i = [-30 : 30], j = [-20 : 20])
|
||||||
|
let(c = [i * 1.5 * HEX_R, (j + (i % 2 == 0 ? 0 : 0.5)) * sqrt(3) * HEX_R]) if (_cell_ok(c)) c];
|
||||||
|
// drop stray cells (fewer than 2 neighbours)
|
||||||
|
HEX_KEEP = [for (c = HEX_CELLS) if (len([for (o = HEX_CELLS) if (o != c && norm(o - c) < 2 * HEX_R) 1]) >= 2) c];
|
||||||
|
module hex_pattern_2d() for (c = HEX_KEEP) translate(c) difference() {
|
||||||
|
circle(r = HEX_OUT, $fn = 6);
|
||||||
|
circle(r = HEX_R - HEX_LINE / 2 / cos(30), $fn = 6);
|
||||||
|
}
|
||||||
|
module top_inlay_2d() { translate(SWITCH_POS) switch_text_2d(); hex_pattern_2d(); }
|
||||||
|
// Two inlays, so each can have its own colour (owner: black case, red
|
||||||
|
// honeycomb, white ON/OFF). Each extra colour adds a swap on the first 3 layers.
|
||||||
|
module hex_inlay() translate([0, 0, -ENGRAVE_D]) lx(ENGRAVE_D) hex_pattern_2d();
|
||||||
|
module text_inlay() translate([0, 0, -ENGRAVE_D]) lx(ENGRAVE_D) translate(SWITCH_POS) switch_text_2d();
|
||||||
|
|
||||||
|
// ---------- bottom shell ----------------------------------------------------
|
||||||
|
|
||||||
|
USBC_V = FRONT_V - 0.6; // receptacle front, 0.6 inside the front face
|
||||||
|
|
||||||
|
module bottom_shell() render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
difference() {
|
||||||
|
intersection() {
|
||||||
|
outer_solid();
|
||||||
|
translate([-BIG / 2, -BIG / 2, Z_BOT - 1]) cube([BIG, BIG, Z_SPLIT - Z_BOT + 1]);
|
||||||
|
}
|
||||||
|
inner_solid();
|
||||||
|
}
|
||||||
|
// locating lip
|
||||||
|
translate([0, 0, Z_SPLIT - 3]) lx(3 + LIP_H) difference() {
|
||||||
|
offset(delta = -(T + FIT)) outline_2d();
|
||||||
|
offset(delta = -(T + FIT + LIP_W)) outline_2d();
|
||||||
|
for (s = SCREWS) translate(s) circle(d = BOSS_D + 2 * FIT);
|
||||||
|
}
|
||||||
|
// ties the lip to the wall; its underside steps out at 45 deg (no flat overhang)
|
||||||
|
for (i = [0 : 4]) translate([0, 0, Z_SPLIT - 3 - i * 0.35]) lx(3 + 0.01) difference() {
|
||||||
|
offset(delta = -(T - JOIN)) outline_2d();
|
||||||
|
offset(delta = -(T + FIT + LIP_W - i * 0.35)) outline_2d();
|
||||||
|
for (s = SCREWS) translate(s) circle(d = BOSS_D + 2 * FIT);
|
||||||
|
}
|
||||||
|
intersection() {
|
||||||
|
inner_solid();
|
||||||
|
union() {
|
||||||
|
// screw towers
|
||||||
|
for (s = SCREWS) translate([s[0], s[1], Z_BOT]) cylinder(d = BOSS_D, h = Z_SPLIT - Z_BOT);
|
||||||
|
// bail pivot bosses in the side walls, on pillars down to the floor (printable)
|
||||||
|
for (m = [-1, 1]) hull() for (z = [BAIL_PIVOT[1], Z_BOT + 5])
|
||||||
|
translate([m * SIDE_U, BAIL_PIVOT[0], z]) rotate([0, -m * 90, 0]) cylinder(d = 10, h = 14);
|
||||||
|
// UPS standoffs
|
||||||
|
for (m = [-1, 1]) translate([UPS_CENTRE[0] + m * UPS_HOLES, UPS_CENTRE[1], Z_BOT]) cylinder(d = 6, h = UPS_Z - Z_BOT);
|
||||||
|
// kickstand recess and hinge trough walls
|
||||||
|
kickstand_housing();
|
||||||
|
// USB-C cradle
|
||||||
|
usbc_cradle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// main board standoffs
|
||||||
|
intersection() {
|
||||||
|
inner_solid();
|
||||||
|
perf_clamp_place() translate([0, 0, Z_BOT - PERF_Z]) cylinder(d = 8, h = PERF_Z - Z_BOT);
|
||||||
|
}
|
||||||
|
// front eyelet inserts: bosses behind the front wall
|
||||||
|
intersection() {
|
||||||
|
inner_solid();
|
||||||
|
for (m = [-1, 1]) translate([m * HOOK_INSERTS, FRONT_V - T - 6 + JOIN, HOOK_FRONT_Z]) rotate([-90, 0, 0]) cylinder(d = 8, h = 6 + JOIN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// screw holes: counterbore from below, clearance up to the split
|
||||||
|
for (s = SCREWS) translate([s[0], s[1], 0]) {
|
||||||
|
translate([0, 0, Z_BOT - 1]) cylinder(d = HEAD_D, h = HEAD_Z - Z_BOT + 1);
|
||||||
|
cylinder(d = SCREW_D, h = BIG, center = true);
|
||||||
|
}
|
||||||
|
for (m = [-1, 1]) translate([UPS_CENTRE[0] + m * UPS_HOLES, UPS_CENTRE[1], Z_BOT + 1.2]) cylinder(d = 2.5, h = 20);
|
||||||
|
for (l = UPS_LEDS) translate(concat(UPS_CENTRE + l, Z_BOT - 1)) lx(T + 2) hull() for (d = [-2, 2]) translate([0, d]) circle(d = 2);
|
||||||
|
perf_clamp_place() translate([0, 0, -6]) cylinder(d = INSERT_D, h = 7);
|
||||||
|
for (m = [-1, 1]) translate([m * HOOK_INSERTS, FRONT_V - INSERT_L - 1, HOOK_FRONT_Z]) rotate([-90, 0, 0]) cylinder(d = INSERT_D, h = INSERT_L + 2);
|
||||||
|
kickstand_cut();
|
||||||
|
usbc_cut();
|
||||||
|
for (m = [-1, 1]) translate([m * SIDE_U, BAIL_PIVOT[0], BAIL_PIVOT[1]]) rotate([0, -m * 90, 0]) translate([0, 0, -1]) cylinder(d = INSERT_D, h = 1 + 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Kickstand: a flap in a recess in the underside, hinged at the front on a
|
||||||
|
// pin through a barrel. Friction on the pin holds the angle.
|
||||||
|
KS_RECESS = KS_T + 0.5;
|
||||||
|
KS_ROOF = Z_BOT + KS_RECESS + 2; // top of the recess roof
|
||||||
|
KS_AXIS_Z = Z_BOT + KS_BARREL_D / 2; // barrel tangent to the underside (sits on the bed when printed)
|
||||||
|
module kickstand_housing() {
|
||||||
|
translate([-KS_W / 2 - FIT - KS_WALL, KS_V[0] - FIT - KS_WALL_V, Z_BOT])
|
||||||
|
cube([KS_W + 2 * (FIT + KS_WALL), KS_V[1] - KS_V[0] + KS_BARREL_D / 2 + 2 * FIT + 2 * KS_WALL_V, KS_RECESS + 2]);
|
||||||
|
translate([-KS_W / 2 - FIT - KS_WALL, KS_V[1] - KS_BARREL_D / 2 - FIT - KS_WALL_V, Z_BOT])
|
||||||
|
cube([KS_W + 2 * (FIT + KS_WALL), KS_BARREL_D + 2 * (FIT + KS_WALL_V), KS_BARREL_D + 0.6 + FIT + 2]);
|
||||||
|
}
|
||||||
|
module kickstand_cut() {
|
||||||
|
translate([-KS_W / 2 - FIT, KS_V[0] - FIT, Z_BOT - 1]) cube([KS_W + 2 * FIT, KS_V[1] - KS_V[0] + 2 * FIT, 1 + KS_RECESS]);
|
||||||
|
translate([-KS_W / 2 - FIT, KS_V[1] - KS_BARREL_D / 2 - FIT, Z_BOT - 1]) cube([KS_W + 2 * FIT, KS_BARREL_D + 2 * FIT, 1 + KS_BARREL_D + 0.6 + FIT]);
|
||||||
|
translate([0, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) cylinder(d = KS_PIN_D, h = KS_W + 2 * KS_WALL + 10, center = true);
|
||||||
|
translate([KS_W / 2 + FIT + KS_WALL - 2.5, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) rotate([0, 0, 30]) cylinder(d = 5.5 / cos(30) + 0.3, h = 5, $fn = 6);
|
||||||
|
}
|
||||||
|
module kickstand() render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
hull() {
|
||||||
|
translate([-KS_W / 2, KS_V[0], Z_BOT]) cube([KS_W, 1, KS_T]);
|
||||||
|
translate([-KS_W / 2, KS_V[1] - 1, Z_BOT]) cube([KS_W, 1, KS_T]);
|
||||||
|
}
|
||||||
|
translate([0, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) cylinder(d = KS_BARREL_D, h = KS_W, center = true);
|
||||||
|
// finger notch lip at the free end is cut below
|
||||||
|
}
|
||||||
|
translate([0, KS_V[1], KS_AXIS_Z]) rotate([0, 90, 0]) cylinder(d = KS_PIN_D, h = KS_W + 2, center = true);
|
||||||
|
translate([0, KS_V[0] - 2, Z_BOT - 1]) scale([1, 0.6, 1]) cylinder(r = 9, h = KS_T + 2); // finger notch
|
||||||
|
}
|
||||||
|
|
||||||
|
module perf_place() translate(concat(PERF_POS, PERF_Z)) rotate([0, 0, -90]) children();
|
||||||
|
// at each clamp post's axis, Z = 0 on the board's underside
|
||||||
|
module perf_clamp_place() perf_place() for (c = PERF_CLAMPS)
|
||||||
|
translate([c[0] + (c[0] > PERF[0] / 2 ? 1 : -1) * PERF_CLAMP_OUT, c[1], 0]) children();
|
||||||
|
module perf_clamp_screws() perf_clamp_place() translate([0, 0, PERF[2]]) color("#b0b0b0") {
|
||||||
|
cylinder(d = 7, h = 0.5); // washer
|
||||||
|
translate([0, 0, 0.5]) cylinder(d = 5.7, h = 1.65); // M3 button head
|
||||||
|
}
|
||||||
|
|
||||||
|
// USB-C breakout on a block, the receptacle in a slot through the front wall.
|
||||||
|
module usbc_cradle() translate([USBC_POS[0] - USBC_BOARD[0] / 2 - 2, USBC_V - USBC_BOARD[1] - 2, Z_BOT])
|
||||||
|
cube([USBC_BOARD[0] + 4, USBC_BOARD[1] + 2 + 3, USBC_Z - Z_BOT]);
|
||||||
|
module usbc_cut() {
|
||||||
|
inner_v = FRONT_V - T;
|
||||||
|
// board pocket (glue it in), open towards the inside; through the wall only the board's own slot
|
||||||
|
translate([USBC_POS[0] - USBC_BOARD[0] / 2 - FIT, USBC_V - USBC_BOARD[1] - FIT, USBC_Z]) cube([USBC_BOARD[0] + 2 * FIT, inner_v - (USBC_V - USBC_BOARD[1] - FIT), 20]);
|
||||||
|
translate([USBC_POS[0] - USBC_BOARD[0] / 2 - FIT, USBC_V - 5, USBC_Z]) cube([USBC_BOARD[0] + 2 * FIT, 5 + FIT, USBC_BOARD[2] + 2 * FIT]);
|
||||||
|
// receptacle opening, chamfered on the outside for the plug
|
||||||
|
translate([USBC_POS[0], USBC_V - 3, USBC_Z + USBC_BOARD[2] + USBC_RCPT[2] / 2]) rotate([-90, 0, 0]) {
|
||||||
|
linear_extrude(10) offset(r = 1.4) square([USBC_RCPT[0] + 0.6 - 2.8, USBC_RCPT[2] + 0.6 - 2.8], center = true);
|
||||||
|
translate([0, 0, 3 + 0.6 - 0.01]) linear_extrude(1.01, scale = [1.3, 1.6]) offset(r = 1.4) square([USBC_RCPT[0] + 0.6 - 2.8, USBC_RCPT[2] + 0.6 - 2.8], center = true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Strap eyelet: printed base down (the d8 loop hole is a short bridge).
|
||||||
|
module eyelet() render(convexity = 10) difference() {
|
||||||
|
b = HOOK_BASE;
|
||||||
|
union() {
|
||||||
|
translate([-b[0] / 2, -b[1] / 2, 0]) cube(b);
|
||||||
|
hull() {
|
||||||
|
translate([-4, -b[1] / 2 + 2, 0]) cube([8, b[1] - 4, b[2]]);
|
||||||
|
translate([-4, 0, HOOK_H - b[1] / 2 + 2]) rotate([0, 90, 0]) cylinder(r = b[1] / 2 - 2, h = 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
translate([-10, 0, HOOK_H - b[1] / 2 + 2]) rotate([0, 90, 0]) cylinder(d = HOOK_HOLE_D, h = 20);
|
||||||
|
for (m = [-1, 1]) translate([m * HOOK_INSERTS, 0, -1]) hull() for (d = [-1, 1]) translate([0, d * HOOK_TRAVEL, 0]) cylinder(d = SCREW_D, h = 10);
|
||||||
|
// screw heads (M3 button head, 5.7 mm) in slotted counterbores beside the loop
|
||||||
|
for (m = [-1, 1]) translate([m * HOOK_INSERTS, 0, 2]) hull() for (d = [-1, 1]) translate([0, d * HOOK_TRAVEL, 0]) cylinder(d = 6.2, h = 10);
|
||||||
|
}
|
||||||
|
module eyelet_placed(shift = 0) translate([HOOK_POS[0], HOOK_POS[1] + shift, 0]) eyelet();
|
||||||
|
module eyelet_front_placed() translate([HOOK_POS[0], FRONT_V, HOOK_FRONT_Z]) rotate([-90, 0, 0]) eyelet();
|
||||||
|
|
||||||
|
// Brace bail, in its pivot frame: arms along +y (folded forward), pivots on x.
|
||||||
|
BAIL_X = SIDE_U + BAIL_GAP;
|
||||||
|
module bail() render(convexity = 10) difference() {
|
||||||
|
union() {
|
||||||
|
for (m = [-1, 1]) hull() for (y = [0, BAIL_L]) translate([m > 0 ? BAIL_X : -BAIL_X - BAIL_T, y, 0]) rotate([0, 90, 0]) cylinder(d = BAIL_H, h = BAIL_T);
|
||||||
|
// crossbar, bowed outwards
|
||||||
|
n = 16;
|
||||||
|
w = BAIL_X + BAIL_T / 2;
|
||||||
|
translate([0, 0, -BAIL_H / 2]) lx(BAIL_H) for (i = [0 : n - 1]) hull() for (k = [i, i + 1]) {
|
||||||
|
x = -w + k * 2 * w / n;
|
||||||
|
translate([x, BAIL_L + BAIL_BOW * (1 - pow(x / w, 2))]) circle(d = 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rotate([0, 90, 0]) cylinder(d = SCREW_D, h = 2 * BIG, center = true);
|
||||||
|
}
|
||||||
|
module bail_placed() translate([0, BAIL_PIVOT[0], BAIL_PIVOT[1]]) rotate([BAIL_ANGLE, 0, 0]) bail();
|
||||||
|
|
||||||
|
// ---------- reference parts (local frames, then placed) ---------------------
|
||||||
|
|
||||||
|
module nextion() {
|
||||||
|
translate(concat(NX_CENTRE, NX_BOARD_TOP - 1.6)) color("#1e5a2a") difference() {
|
||||||
|
translate(concat(-NX_BOARD / 2, 0)) cube(concat(NX_BOARD, 1.6));
|
||||||
|
for (du = [-1, 1], dv = [-1, 1]) translate([du * NX_HOLES[0], dv * NX_HOLES[1], 0] / 2 + [0, 0, -1]) cylinder(d = 3.2, h = 4);
|
||||||
|
}
|
||||||
|
translate(concat(NX_CENTRE - NX_LCD / 2, NX_BOARD_TOP)) color("#202020") cube(concat(NX_LCD, NX_LCD_T));
|
||||||
|
translate(concat(NX_WIN - [73.44, 48.96] / 2, -NX_BEZEL - 0.2)) color("#3050a0") cube([73.44, 48.96, 0.2]);
|
||||||
|
translate(concat(NX_CENTRE + [(NX_FLIP ? 1 : -1) * (NX_BOARD[0] / 2 - 7), -5], NX_BOARD_TOP - 1.6 - NX_BACK)) color("#eee") cube([6, 10, NX_BACK]); // J1 4-pin connector (approx.)
|
||||||
|
}
|
||||||
|
|
||||||
|
module ups_18650() translate(concat(UPS_CENTRE, UPS_Z)) {
|
||||||
|
color("#202020") difference() {
|
||||||
|
translate([-89 / 2, -22 / 2, 0]) cube([89, 22, 1.6]);
|
||||||
|
for (m = [-1, 1]) translate([m * UPS_HOLES, 0, -1]) cylinder(d = 3, h = 4);
|
||||||
|
}
|
||||||
|
color("#151515") translate([-77 / 2, -21 / 2, 1.6]) difference() {
|
||||||
|
cube([77, 21, 22.4 - 1.6]);
|
||||||
|
translate([3, 1.5, 3]) cube([71, 18, 30]);
|
||||||
|
}
|
||||||
|
color("#4060c0") translate([-65 / 2, 0, 1.6 + 3 + 18.5 / 2]) rotate([0, 90, 0]) cylinder(d = 18.5, h = 65);
|
||||||
|
color("#b0b0b0") translate([89 / 2 - 7, -4.5, 1.6]) cube([7.5, 9, 3.2]); // Type-C (charge input)
|
||||||
|
color("#808080") translate([89 / 2 + 0.5, -6, 0]) cube([18, 12, 7]); // cut-cable plug (approx.)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Main board as in the owner's photos (layout approximate).
|
||||||
|
module main_board() { perf_clamp_screws(); main_board_only(); }
|
||||||
|
module main_board_only() perf_place() {
|
||||||
|
color("#2a8a4a") difference() {
|
||||||
|
cube(PERF);
|
||||||
|
}
|
||||||
|
// Teensy 4.0 in female headers (8.5 mm), micro-USB at the board edge
|
||||||
|
translate([12.1, 1, PERF[2]]) {
|
||||||
|
color("#111") for (x = [0, 17.8 - 2.5]) translate([x, 0, 0]) cube([2.5, 35.6, 8.5]);
|
||||||
|
translate([0, 0, 8.5]) {
|
||||||
|
color("#1e5a2a") cube([17.8, 35.6, 1.6]);
|
||||||
|
color("#222") translate([4, 12, 1.6]) cube([10, 10, 1.2]);
|
||||||
|
color("#c0c0c0") translate([(17.8 - 7.5) / 2, -1, 1.6]) cube([7.5, 5.7, 2.9]);
|
||||||
|
color("#808080") translate([(17.8 - 10) / 2, -1 - 18, 1.6 - 2]) cube([10, 18, 7]); // cable plug (approx.)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// nRF24L01 lying over the far edge, on its 2 x 4 header
|
||||||
|
translate([15, 63, PERF[2]]) {
|
||||||
|
color("#111") translate([2, 0, 0]) cube([10, 5, 2.5]);
|
||||||
|
color("#151515") translate([0, 0, 2.5]) cube([15.3, 29, 1.2]);
|
||||||
|
}
|
||||||
|
color("#222") translate([2, 74, PERF[2]]) cube([11, 6.3, 6.3]); // 100 uF cap, lying
|
||||||
|
color("#222") translate([5, 58, PERF[2]]) cube([7, 6.5, 1.8]); // AMS1117
|
||||||
|
// ribbon and display/IMU connectors at the edge, plugs on top (approx.)
|
||||||
|
color("#333") translate([PERF[0] - 8, 8, PERF[2]]) cube([5, 21, 12]);
|
||||||
|
color("#333") translate([PERF[0] - 8, 44, PERF[2]]) cube([5, 11, 12]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// GY-521 on the main board, on headers (board frame: 15.6 across, 21.2 along)
|
||||||
|
module imu_gy521() perf_place() translate(concat(PERF_IMU, PERF[2])) {
|
||||||
|
color("#111") translate([0, 1, 0]) cube([2.5, 19, 8.5]);
|
||||||
|
translate([0, 0, 8.5]) {
|
||||||
|
color("#1f4fa0") cube([15.6, 21.2, 1.6]);
|
||||||
|
color("#222") translate([6, 8.6, 1.6]) cube([4, 4, 1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module usbc_breakout() translate([USBC_POS[0], USBC_V, USBC_Z]) {
|
||||||
|
color("#1a7a3a") translate([-USBC_BOARD[0] / 2, -USBC_BOARD[1], 0]) cube(USBC_BOARD);
|
||||||
|
color("#c0c0c0") translate([-USBC_RCPT[0] / 2, -USBC_RCPT[1], USBC_BOARD[2]]) cube(USBC_RCPT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Slide switch as on the old remote: mounting plate on the top face, screwed
|
||||||
|
// down with 2 screws, body hanging through the slot. Sizes approximate.
|
||||||
|
module slide_switch() translate(SWITCH_POS) color("#303030") {
|
||||||
|
translate([-12.5, -3.5, 0]) cube([25, 7, 0.8]); // mounting plate
|
||||||
|
translate([-7.5, -3.5, -10]) cube([15, 7, 10]); // body, through the slot
|
||||||
|
translate([-1.5, -1.5, 0.8]) cube([3, 3, 4]); // knob
|
||||||
|
}
|
||||||
|
|
||||||
|
// JH-D300X-R1 3-axis joystick (owner's drawing): handle d35 with the twist
|
||||||
|
// pot inside, dust cover d53.5 on top of the plate, 40.4 mm control box
|
||||||
|
// (25.5 tall) under it, clamping the plate with 4 x M2.5 x 14. X/Y pots
|
||||||
|
// d16.5 sticking 9.2 out of the box on -x and -y. Local Z = 0 on the cover's
|
||||||
|
// underside (the top face); the box hangs from the plate's underside.
|
||||||
|
JOY_BOX = 40.4; JOY_BOX_H = 25.5; JOY_POT_D = 16.5; JOY_POT_L = 49.6 - 40.4;
|
||||||
|
JOY_COVER_T = 3.8; JOY_POT_Z = 15.3; // pot axis above the box bottom (from the drawing)
|
||||||
|
module jh_d300x() {
|
||||||
|
zb = -PLATE - JOY_BOX_H; // box bottom
|
||||||
|
color("#202020") {
|
||||||
|
difference() {
|
||||||
|
cylinder(d1 = 53.5, d2 = 50, h = JOY_COVER_T);
|
||||||
|
for (du = [-1, 1], dv = [-1, 1]) translate([du * STICK_SCREW, dv * STICK_SCREW, -1]) cylinder(d = 2.7, h = 6);
|
||||||
|
}
|
||||||
|
translate([0, 0, JOY_COVER_T]) cylinder(d = 39.5, h = 1); // dust ring
|
||||||
|
translate([-JOY_BOX / 2, -JOY_BOX / 2, zb]) cube([JOY_BOX, JOY_BOX, JOY_BOX_H]);
|
||||||
|
translate([0, 0, zb + JOY_POT_Z]) {
|
||||||
|
rotate([0, -90, 0]) translate([0, 0, JOY_BOX / 2]) cylinder(d = JOY_POT_D, h = JOY_POT_L); // Y pot, -x
|
||||||
|
rotate([90, 0, 0]) translate([0, 0, JOY_BOX / 2]) cylinder(d = JOY_POT_D, h = JOY_POT_L); // X pot, -y
|
||||||
|
}
|
||||||
|
t = JOY_COVER_T;
|
||||||
|
translate([0, 0, t]) cylinder(d = 6, h = 11.5); // shaft
|
||||||
|
translate([0, 0, t + 11]) cylinder(d1 = 12, d2 = 18, h = 8); // neck
|
||||||
|
translate([0, 0, t + 19]) cylinder(d = 32, h = 7);
|
||||||
|
translate([0, 0, t + 26]) cylinder(d = 35, h = 19); // knurled grip
|
||||||
|
translate([0, 0, t + 45]) cylinder(d1 = 35, d2 = 30, h = 8); // top: 53 above the cover
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// pots towards the middle and towards the user
|
||||||
|
module sticks() for (s = STICKS) translate(concat(s, 0)) if (s[0] > 0) jh_d300x(); else mirror([1, 0, 0]) jh_d300x();
|
||||||
|
|
||||||
|
module electronics() {
|
||||||
|
nextion();
|
||||||
|
ups_18650();
|
||||||
|
main_board();
|
||||||
|
imu_gy521();
|
||||||
|
usbc_breakout();
|
||||||
|
slide_switch();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------- assembly and print layout --------------------------------------
|
||||||
|
|
||||||
|
module kickstand_placed() translate([0, KS_V[1], KS_AXIS_Z]) rotate([KS_OPEN, 0, 0]) translate([0, -KS_V[1], -KS_AXIS_Z]) kickstand();
|
||||||
|
|
||||||
|
module remote_v2() {
|
||||||
|
if (SHOW_BOTTOM) { color("#1c1c1c") bottom_shell(); color("#1c1c1c") kickstand_placed(); color("#1c1c1c") bail_placed(); }
|
||||||
|
if (HOOK_MOUNT == "front") color("#1c1c1c") eyelet_front_placed();
|
||||||
|
else if (SHOW_TOP) translate([0, 0, EXPLODE]) color("#1c1c1c") eyelet_placed();
|
||||||
|
if (SHOW_TOP) translate([0, 0, EXPLODE]) { color("#262626") top_shell(); color("#c8102e") hex_inlay(); color("#f2f2f2") text_inlay(); }
|
||||||
|
if (SHOW_PARTS) { translate([0, 0, EXPLODE]) { nextion(); slide_switch(); }
|
||||||
|
ups_18650(); main_board(); imu_gy521(); usbc_breakout(); }
|
||||||
|
if (SHOW_STICKS) translate([0, 0, EXPLODE]) sticks();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PART == "assembly") remote_v2();
|
||||||
|
else if (PART == "top") rotate([180, 0, 0]) top_shell(); // face down on the bed
|
||||||
|
else if (PART == "inlay") rotate([180, 0, 0]) hex_inlay(); // load with "top" (and "text") as one multi-part object
|
||||||
|
else if (PART == "text") rotate([180, 0, 0]) text_inlay();
|
||||||
|
else if (PART == "bottom") translate([0, 0, -Z_BOT]) bottom_shell();
|
||||||
|
else if (PART == "kickstand") translate([0, 0, -Z_BOT]) kickstand();
|
||||||
|
else if (PART == "eyelet") eyelet(); // base on the bed, the loop hole bridges
|
||||||
|
else if (PART == "bail") translate([0, 0, BAIL_H / 2]) bail();
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,36 @@
|
|||||||
|
// The whole 2026 hexapod: body (body.scad) plus six legs (leg.scad),
|
||||||
|
// placed and posed like robot/Config.h. Robot frame: +X forward (switch
|
||||||
|
// end), +Y left, +Z up, Z = 0 on the bottom plate's top face.
|
||||||
|
|
||||||
|
use <body.scad>
|
||||||
|
use <leg.scad>
|
||||||
|
|
||||||
|
/* [Pose] */
|
||||||
|
// "original" = the Fusion model's pose; "stand" = firmware stance
|
||||||
|
// (Kinematics::neutralStance(): feet 130 mm out, 150 mm down).
|
||||||
|
POSE_NAME = "stand"; // [original, stand]
|
||||||
|
// Optional per-leg override, [coxa, femur, tibia] in degrees, legs 0..5.
|
||||||
|
POSE_OVERRIDE = [];
|
||||||
|
|
||||||
|
// Leg mounts from robot/Config.h: x, y, mount angle (0..2 right, 3..5 left).
|
||||||
|
// Hexagon layout: corner legs 60 deg round from the mid legs.
|
||||||
|
LEG_MOUNT = [[100, -50, -30], [0, -65, -90], [-100, -50, -150],
|
||||||
|
[-100, 50, 150], [0, 65, 90], [100, 50, 30]];
|
||||||
|
JOINT_PLANE_Z = 13.5; // femur/knee axes, halfway up the body cavity
|
||||||
|
|
||||||
|
POSES = [["original", [0, 0, -90]], ["stand", [0, -1.2, -98.3]]];
|
||||||
|
function base_pose() = [for (p = POSES) if (p[0] == POSE_NAME) p[1]][0];
|
||||||
|
function leg_pose(i) = len(POSE_OVERRIDE) == 6 ? POSE_OVERRIDE[i] : base_pose();
|
||||||
|
|
||||||
|
module robot() {
|
||||||
|
body_assembly();
|
||||||
|
for (i = [0:5]) {
|
||||||
|
m = LEG_MOUNT[i];
|
||||||
|
p = leg_pose(i);
|
||||||
|
translate([m[0], m[1], JOINT_PLANE_Z])
|
||||||
|
if (m[2] > 0) rotate([0, 0, m[2]]) leg(p);
|
||||||
|
else mirror([0, 1, 0]) rotate([0, 0, -m[2]]) leg([-p[0], p[1], p[2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
robot();
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// Hitec HS-485HB, from the servo's Fusion model (servo-hitec-hs-485hb).
|
||||||
|
// Local frame: shaft on the Z axis, case extending +X, Z = 0 at the ear
|
||||||
|
// underside. Include (not use) this file to get the constants.
|
||||||
|
|
||||||
|
SERVO_CASE = [[-10, -10, -28], [30, 10, 9.75]];
|
||||||
|
SERVO_EARS = [[-16, -10, 0], [36, 10, 3]];
|
||||||
|
SERVO_EAR_HOLES = [[-13.9, 5], [-13.9, -5], [34.35, 5], [34.35, -5]];
|
||||||
|
SERVO_EAR_SCREW_D = 2.5; // pilot hole for the ear screws in printed parts
|
||||||
|
POCKET_CLEAR = 0.5;
|
||||||
|
|
||||||
|
module servo_pocket_2d() {
|
||||||
|
translate([SERVO_CASE[0][0] - POCKET_CLEAR, SERVO_CASE[0][1] - POCKET_CLEAR])
|
||||||
|
square([SERVO_CASE[1][0] - SERVO_CASE[0][0] + 2*POCKET_CLEAR,
|
||||||
|
SERVO_CASE[1][1] - SERVO_CASE[0][1] + 2*POCKET_CLEAR]);
|
||||||
|
for (h = SERVO_EAR_HOLES) translate(h) circle(d = SERVO_EAR_SCREW_D);
|
||||||
|
}
|
||||||
|
|
||||||
|
module hs485hb() {
|
||||||
|
color("#303030") {
|
||||||
|
translate(SERVO_CASE[0]) cube(SERVO_CASE[1] - SERVO_CASE[0]);
|
||||||
|
difference() {
|
||||||
|
translate(SERVO_EARS[0]) cube(SERVO_EARS[1] - SERVO_EARS[0]);
|
||||||
|
for (h = SERVO_EAR_HOLES) translate([h[0], h[1], -1]) cylinder(d = 4.42, h = 5);
|
||||||
|
}
|
||||||
|
translate([0, 0, 9.75]) cylinder(d = 14, h = 2.25);
|
||||||
|
}
|
||||||
|
color("#e0e0e0") translate([0, 0, 12]) cylinder(d = 5, h = 3.25);
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
|||||||
; Hexapod: two firmware images in one project.
|
; Hexapod: two firmware images in one project.
|
||||||
; pio run -e robot build robot/ (Teensy 3.6)
|
; pio run -e robot build robot/ (Teensy 3.6)
|
||||||
; pio run -e remote build remote/ (Teensy 4.1)
|
; pio run -e remote build remote/ (Teensy 4.0)
|
||||||
; pio run -e robot -t upload flash (Teensy Loader / teensy_cli)
|
; pio run -e robot -t upload flash (Teensy Loader / teensy_cli)
|
||||||
; pio device monitor -e robot serial monitor at 115200
|
; pio device monitor -e robot serial monitor at 115200
|
||||||
;
|
;
|
||||||
@@ -25,5 +25,5 @@ board = teensy36
|
|||||||
custom_src_dir = robot
|
custom_src_dir = robot
|
||||||
|
|
||||||
[env:remote]
|
[env:remote]
|
||||||
board = teensy41
|
board = teensy40
|
||||||
custom_src_dir = remote
|
custom_src_dir = remote
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
#include "Battery.h"
|
||||||
|
#include "Config.h"
|
||||||
|
|
||||||
|
void Battery::update(float dt) {
|
||||||
|
if (BATTERY_SENSE_PIN == 255) return; // not fitted: stays 0
|
||||||
|
// Sticks set the ADC to ADC_BITS for every analogRead().
|
||||||
|
float v = analogRead(BATTERY_SENSE_PIN) * (BATTERY_ADC_REF_V / ((1 << ADC_BITS) - 1)) * BATTERY_DIVIDER;
|
||||||
|
if (!primed_) { volts_ = v; primed_ = true; return; }
|
||||||
|
float a = constrain(dt / 2.0f, 0.0f, 1.0f); // ~2 s time constant
|
||||||
|
volts_ += (v - volts_) * a;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <Arduino.h>
|
||||||
|
|
||||||
|
// Handset battery voltage through a resistor divider (Config.h BATTERY_*), smoothed.
|
||||||
|
class Battery {
|
||||||
|
public:
|
||||||
|
void update(float dt);
|
||||||
|
uint16_t millivolts() const { return (uint16_t)(volts_ * 1000.0f + 0.5f); } // 0 = not fitted
|
||||||
|
|
||||||
|
private:
|
||||||
|
float volts_ = 0;
|
||||||
|
bool primed_ = false;
|
||||||
|
};
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
// =====================================================================
|
// =====================================================================
|
||||||
// Remote handset config (Teensy 4.1). Everything here is a placeholder
|
// Remote handset config (Teensy 4.0). Everything here is a placeholder
|
||||||
// until checked against your real wiring and parts - see the BENCH notes.
|
// until checked against your real wiring and parts - see the BENCH notes.
|
||||||
// Radio address/channel/rate/PA/payload size are NOT here: they live in
|
// Radio address/channel/rate/PA/payload size are NOT here: they live in
|
||||||
// shared/HexapodProtocol so they can't drift from the robot.
|
// shared/HexapodProtocol so they can't drift from the robot.
|
||||||
@@ -31,16 +31,18 @@ constexpr uint32_t LINK_LOST_MS = 300;
|
|||||||
// Logical axis order used everywhere in the remote code.
|
// Logical axis order used everywhere in the remote code.
|
||||||
enum StickAxis : uint8_t { L_X = 0, L_Y, L_TWIST, R_X, R_Y, R_TWIST, NUM_AXES };
|
enum StickAxis : uint8_t { L_X = 0, L_Y, L_TWIST, R_X, R_Y, R_TWIST, NUM_AXES };
|
||||||
|
|
||||||
// A0-A5 in a row, as wired for the old remote (2019-teensy-nrf24/remote/Joysticks.h).
|
// The old remote had A0-A5 in a row (2019-teensy-nrf24/remote/Joysticks.h).
|
||||||
// A4/A5 are also Wire's SDA/SCL - that's why the MPU6050 is on Wire2 below.
|
// The two wires on A4/A5 (pins 18/19) move to A7/A8 (pins 21/22), because
|
||||||
// BENCH: which physical axis is on which pin wasn't recoverable from the old
|
// 18/19 are Wire's SDA/SCL for the MPU6050 (owner's choice 2026-11-17: edge
|
||||||
// code; reorder these so each lands on the right logical axis ('p' dump).
|
// headers only, no pads underneath). A6 (20) stays free for the battery.
|
||||||
constexpr uint8_t STICK_PINS[NUM_AXES] = { A0, A1, A2, A3, A4, A5 };
|
// Checked on the real remote (2026-11-17): the left stick is on A3/A7/A8, the
|
||||||
|
// right stick on A0/A1/A2.
|
||||||
|
constexpr uint8_t STICK_PINS[NUM_AXES] = { A3, A7, A8, A0, A1, A2 };
|
||||||
|
|
||||||
// Each logical axis must end up: X + = pushed RIGHT, Y + = pushed FORWARD
|
// Each logical axis must end up: X + = pushed RIGHT, Y + = pushed FORWARD
|
||||||
// (away from you), TWIST + = rotated COUNTERCLOCKWISE seen from above.
|
// (away from you), TWIST + = rotated COUNTERCLOCKWISE seen from above.
|
||||||
// BENCH: flip any axis that reads the wrong way on the serial 'p' status dump.
|
// Checked on the real remote (2026-11-17): every axis but the right twist reads inverted.
|
||||||
constexpr bool STICK_INVERT[NUM_AXES] = { false, false, false, false, false, false };
|
constexpr bool STICK_INVERT[NUM_AXES] = { true, true, true, true, true, false };
|
||||||
|
|
||||||
constexpr int ADC_BITS = 12; // 0..4095
|
constexpr int ADC_BITS = 12; // 0..4095
|
||||||
constexpr int ADC_AVERAGING = 8; // hardware averaging per analogRead()
|
constexpr int ADC_AVERAGING = 8; // hardware averaging per analogRead()
|
||||||
@@ -69,15 +71,14 @@ constexpr float STICK_EXPO[NUM_AXES] = { 0.25f, 0.25f, 0.30f, 0.20f, 0.20f,
|
|||||||
// One-pole low-pass on raw ADC counts (1 = no filtering). Pots are noisy.
|
// One-pole low-pass on raw ADC counts (1 = no filtering). Pots are noisy.
|
||||||
constexpr float STICK_FILTER_ALPHA = 0.5f;
|
constexpr float STICK_FILTER_ALPHA = 0.5f;
|
||||||
|
|
||||||
// ---- Remote IMU: MPU6050 on the second I2C bus (Wire2: SDA2 = 25, SCL2 = 24) ----
|
// ---- Remote IMU: MPU6050 on Wire (SDA = 18, SCL = 19) ----
|
||||||
// Not Wire (18/19): those pins are stick axes A4/A5.
|
// Edge-header pins; the stick axes that used to be there moved to A7/A8.
|
||||||
#define IMU_WIRE Wire2
|
#define IMU_WIRE Wire
|
||||||
constexpr uint8_t IMU_ADDR = 0x68; // 0x69 if AD0 is pulled high
|
constexpr uint8_t IMU_ADDR = 0x68; // 0x69 if AD0 is pulled high
|
||||||
// Mounting remap: which chip axis (0=X,1=Y,2=Z) and sign gives each handset
|
// Mounting remap: which chip axis (0=X,1=Y,2=Z) and sign gives each handset
|
||||||
// axis. Handset frame: +X = away from you, +Y = your left, +Z = up.
|
// axis. Handset frame: +X = away from you, +Y = your left, +Z = up.
|
||||||
// BENCH: with the defaults the chip is assumed flat, component side up, its
|
// Checked on the real remote (2026-11-17): the defaults are right - tipping
|
||||||
// X arrow pointing away from you. Verify with the serial 'p' dump: tipping
|
// the far edge down reads +pitch, dipping the right side reads +roll.
|
||||||
// the far edge down must read +pitch, dipping the right side must read +roll.
|
|
||||||
constexpr uint8_t IMU_AXIS_FROM_CHIP[3] = { 0, 1, 2 };
|
constexpr uint8_t IMU_AXIS_FROM_CHIP[3] = { 0, 1, 2 };
|
||||||
constexpr int8_t IMU_AXIS_SIGN[3] = { +1, +1, +1 };
|
constexpr int8_t IMU_AXIS_SIGN[3] = { +1, +1, +1 };
|
||||||
constexpr float IMU_ALPHA = 0.98f; // complementary filter, same as the robot
|
constexpr float IMU_ALPHA = 0.98f; // complementary filter, same as the robot
|
||||||
@@ -107,24 +108,37 @@ constexpr uint32_t WALK_LINGER_MS = 250;
|
|||||||
// (post-deadzone, -1000..1000 scale), so the robot never arms mid-command.
|
// (post-deadzone, -1000..1000 scale), so the robot never arms mid-command.
|
||||||
constexpr int16_t ARM_CENTER_TOLERANCE = 50;
|
constexpr int16_t ARM_CENTER_TOLERANCE = 50;
|
||||||
|
|
||||||
// ---- Nextion touchscreen on Serial1 (RX1 = pin 0, TX1 = pin 1), as in the old remote ----
|
// ---- Nextion touchscreen on Serial2 (RX2 = pin 7, TX2 = pin 8) ----
|
||||||
#define NEXTION_SERIAL Serial1
|
// Found on the real remote (2026-11-17): the display answers on Serial2 at 115200. The old
|
||||||
// BENCH: the old sketch used the ITEAD library, whose nexInit() talks at 9600
|
// sketch's Serial1.begin() was a red herring; its ITEAD Nextion library used Serial2.
|
||||||
// unless it was modified. This firmware expects 115200: add `bauds=115200`
|
#define NEXTION_SERIAL Serial2
|
||||||
// to the HMI's Program.s (see remote/NEXTION.md) or set 9600 here.
|
// The HMI (remote/remote.HMI) sets this with `bauds=115200` in Program.s.
|
||||||
constexpr uint32_t NEXTION_BAUD = 115200;
|
constexpr uint32_t NEXTION_BAUD = 115200;
|
||||||
// Controls live on this page (remote/NEXTION.md). Its components must have
|
#define NEXTION_UPLOAD_PAGE "upload"
|
||||||
// vscope = global, so the firmware can update them whichever page is showing.
|
// The firmware only writes the page that is showing (each page reports itself
|
||||||
#define NEXTION_CONTROL_PAGE "control"
|
// with a 'P' frame), and only what changed since the last write.
|
||||||
// The old HMI's link-status texts (pages 1 and 3, both named t1), also
|
constexpr uint32_t NEXTION_RENDER_MS = 50; // repaint rate of the showing page
|
||||||
// vscope = global. BENCH: use your real page names (Nextion's default
|
constexpr uint32_t NEXTION_SERVOS_RENDER_MS = 100; // SERVOS page: 36 values, so a bit slower
|
||||||
// names are page0..page5; only page 4 "uploadscreen" is known).
|
|
||||||
constexpr const char* NEXTION_STATUS_TEXTS[] = { "page1.t1", "page3.t1" };
|
|
||||||
// The old HMI's "upload" button: page 1, component id 5 (b2), sends the
|
|
||||||
// standard touch event. It puts the remote into Nextion upload passthrough.
|
|
||||||
constexpr uint8_t NEXTION_UPLOAD_BUTTON_PAGE = 1;
|
|
||||||
constexpr uint8_t NEXTION_UPLOAD_BUTTON_ID = 5;
|
|
||||||
#define NEXTION_UPLOAD_PAGE "uploadscreen"
|
|
||||||
constexpr uint32_t NEXTION_FULL_REFRESH_MS = 2000; // re-push everything periodically (self-heals after a display reset)
|
constexpr uint32_t NEXTION_FULL_REFRESH_MS = 2000; // re-push everything periodically (self-heals after a display reset)
|
||||||
constexpr uint32_t NEXTION_LINK_REFRESH_MS = 250; // link-quality text update rate
|
// A render is skipped while less than this is free in the TX buffer, so the
|
||||||
|
// TX loop never blocks on the display.
|
||||||
|
constexpr int NEXTION_TX_MIN_FREE = 400;
|
||||||
constexpr uint32_t STATUS_MESSAGE_MS = 2500; // how long transient status messages stay up
|
constexpr uint32_t STATUS_MESSAGE_MS = 2500; // how long transient status messages stay up
|
||||||
|
constexpr uint32_t UPLOAD_CONFIRM_MS = 3000; // UPDATE DISPLAY: second tap within this
|
||||||
|
|
||||||
|
// ---- Robot telemetry (ack payloads) ----
|
||||||
|
constexpr uint32_t TELEMETRY_STALE_MS = 500; // older than this -> the display shows "no data"
|
||||||
|
|
||||||
|
// ---- Servo centre calibration (CAL page) ----
|
||||||
|
constexpr int16_t SERVO_TRIM_STEP_SMALL_US = 1;
|
||||||
|
constexpr int16_t SERVO_TRIM_STEP_BIG_US = 10;
|
||||||
|
// SAVE / REVERT go out for this long (the robot acts once; repeats are harmless).
|
||||||
|
constexpr uint32_t SERVO_CAL_OP_MS = 300;
|
||||||
|
|
||||||
|
// ---- Battery voltage (STATUS page) ----
|
||||||
|
// BENCH: not built yet. Planned: the 18650's + through a 100k/100k divider
|
||||||
|
// into A6 (pin 20) with 100 nF to GND (see README.md "Planned"). Then set
|
||||||
|
// the pin to A6. 255 = not fitted: the display shows "--".
|
||||||
|
constexpr uint8_t BATTERY_SENSE_PIN = 255;
|
||||||
|
constexpr float BATTERY_DIVIDER = 2.0f; // battery V / pin V
|
||||||
|
constexpr float BATTERY_ADC_REF_V = 3.3f;
|
||||||
Loaded 100 of 139 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user