main
History Download
Drew Owens Scrub internal hostnames, quota ledger, local paths, and private links for public release 09af481

Microgoose Onboard Runtime (goosectl)

goosectl is the 50 Hz (20.0 ms) Linux multi-daemon control stack running on the Microgoose Radxa Zero 3W (RK3566). It splits hardware bus I/O and neural policy execution into two Unix-domain-socket daemons modeled after robotctl:

  1. goosectl.spine_daemon (200 Hz, /tmp/microgoose-spine.sock): Communicates with the STM32G431CBT6 Spine MCU over J4 (1 Mbps or 2 Mbps COBS/CRC-16 USART2 link, or runs the built-in --sim damped XL330-M288-T physics plant), publishing RobotState (15 joint positions/velocities/loads mapped across J1 Left Leg DXL IDs 1..5, J2 Right Leg DXL IDs 6..10, and J3 Neck/Head DXL IDs 11..14 plus Beak DXL ID 15, torso and head IMU attitude/gyro/projected_gravity, J5 8x8 VL53L5CX ground distances, PA0 VBAT, and INA226 0.30 mOhm 5V_BUS current/watts) and dispatching 15-DoF joint targets.
  2. goosectl.policy_daemon (50 Hz, /tmp/microgoose-policy.sock): Assembles the 61-dimensional float32 observation vector from design/mechanical-interface.json, evaluates the 61 -> 14 ONNX walking policy via onnxruntime (reading action_scale_rad and action_clip from ONNX metadata when present), drives the independent 15th-DoF expressive beak state machine, and enforces attitude and electrical safety limits.

Safety Architecture

  • Stand-only startup ramp: On daemon startup (and whenever goosectl stand runs), the controller executes a 1.5 s 5th-order minimum-jerk trajectory from the measured posture to defaultRad. Neural walking is blocked until the stand ramp completes and a validated 61 -> 14 ONNX model is loaded.
  • Zero-drop ONNX hot-load: goosectl policy load <path.onnx> validates input/output shapes (61 -> 14) and runs a warmup pass before swapping the active InferenceSession under lock without dropping XL330 servo torque.
  • Independent 15th-DoF beak (J3, dxlId = 15): goosectl honk drives honk, chatter, open, and close trajectories within [0, 38] deg (defaultRad = 0.05 rad) without perturbing the 14 locomotion joints (indices 0..13).
  • Safety supervisor and auto-rollback: Trips immediately when |roll| > 0.75 rad, |pitch| > 0.75 rad, VBAT < 6.10 V, or 5V_BUS current exceeds 4.20 A continuously for more than 100 ms. Attitude trips execute a 120 ms damped crouch rollback before latching torque-safe ESTOP; electrical trips cut servo torque immediately.

CLI Reference

Every command prints OK: or ERROR: with an actionable Hint: line (stripping ANSI codes automatically when piped), or structured JSON when --json is passed.

# Start 200 Hz spine_daemon and 50 Hz policy_daemon against the simulated plant
./runtime/bin/goosectl daemon start --sim

# Start against the physical STM32G431CB Spine UART (J4) on Radxa Zero 3W
./runtime/bin/goosectl daemon start --port /dev/ttyS3 --baud 1000000

# Check daemon health and inspect live telemetry
./runtime/bin/goosectl health
./runtime/bin/goosectl status
./runtime/bin/goosectl stand

# Hot-load a 61 -> 14 ONNX policy and start walking at 0.15 m/s
./runtime/bin/goosectl policy load rl/checkpoints/policy.onnx
./runtime/bin/goosectl policy reset
./runtime/bin/goosectl walk --vx 0.15 --vy 0 --wz 0

# Trigger the 15th-DoF beak while walking and capture 10 live 50 Hz ticks
./runtime/bin/goosectl honk --style honk
./runtime/bin/goosectl monitor --ticks 10 --json

# Latch emergency stop and shut down daemons
./runtime/bin/goosectl estop
./runtime/bin/goosectl daemon stop

Automated HIL Verification

Run the end-to-end hardware-in-the-loop test suite (PTY UART COBS/CRC-16 loopback, J1/J2/J3 DXL ID verification, stand ramp, ONNX hot-load, walk, honk, injected 50-degree tilt auto-rollback, > 4.2 A overcurrent trip, < 6.1 V undervoltage trip, and estop), which writes runtime/tests/hil_verification_report.json:

python3 runtime/tests/test_goosectl_stack.py