locksleyfox-walker / README.md
locksleyu's picture
Upload 2 files
f9ef669 verified
|
Raw History Blame Contribute Delete
5.17 kB
metadata
license: cc-by-nc-4.0
tags:
  - robotics
  - reinforcement-learning
  - quadruped
  - legged-robots
  - mujoco
  - brax
  - sim-to-real

LocksleyFox walker (s22rl3)

A walking policy for LocksleyFox, a 3D-printed robot dog with 8 RobStride RS00 motors (hip and knee on each leg). It was trained in simulation with Brax PPO on MuJoCo MJX and runs on the real robot on a Teensy 4.1 microcontroller, with no onboard computer.

This repo includes the policy weights, the robot's MuJoCo model, a small inference script (numpy + safetensors, no deep-learning framework), a closed-loop walking demo and the int8 export used on the Teensy.

LocksleyFox, the real robot

Build log: https://dreamingofrobots.com/locksleyfox How the training runs on a Mac: https://dreamingofrobots.com/robot-training-on-mac

Files

File What it is
policy.safetensors Observation normalizer (obs_mean, obs_std) and the 4 dense layers, float32
inference.py The policy in plain numpy (weights loaded with safetensors), plus the action-to-joint-target mapping. python inference.py checks it against test_vectors.npz
test_vectors.npz 64 observations and the actions the original Brax policy gives for them
locksleyfox.xml MuJoCo model of the robot as used in training (nominal parameters, 7.8 kg, collision hulls of the printed parts)
walk_demo.py The policy walking the model in plain MuJoCo (python walk_demo.py 1.0 --view)
walker_weights_int8.h The int8 C header that ran on the robot (per-neuron scales)
model.png The MuJoCo model in its stand pose

Network

  • Multilayer perceptron 46 → 512 → 256 → 128 → 24, swish activations on the hidden layers.
  • Inputs are normalized with (obs - obs_mean) / obs_std.
  • Outputs 0-11 are the action mean, and the deployed action is tanh(mean). Outputs 12-23 are the exploration noise scale used only in training.
  • The policy runs at 50 Hz (every 20 ms). The simulation step is 1 ms.

Observation (46 values)

Index Value
0-2 Trunk angular velocity in the trunk frame, rad/s, times 0.25
3-5 Gravity direction in the trunk frame (unit vector)
6-17 Joint angles minus the stand pose, rad (abad, hip, knee for FL, FR, RL, RR). Abad entries are always 0
18-29 Joint velocities, rad/s, times 0.05. Abad entries are always 0
30-41 Previous action
42 Forward speed command, m/s (trained 0 to 3)
43-44 sin and cos of 2π·phase, where the phase advances (2.5 + 0.7·|cmd|) cycles per second
45 Turn rate command, rad/s (trained up to ±1.5, less at higher speeds)

Action (12 values)

Joint position targets are stand + scale * clip(action, -1, 1), with:

  • stand pose (abad, hip, knee) = (0, 0.6435, -1.287) rad
  • scale = (0.25, 0.4, 0.25) rad per unit action

A PD loop tracks the targets: on the robot kp is 49.4 N·m/rad and kd is 1.24 N·m·s/rad, with RS00 torque limits. The robot has no abad motors. Those joints are locked in the model, and their actions are ignored.

Training

  • Brax PPO on MuJoCo MJX, through a MuJoCo Playground-style environment. It was fine-tuned in stages from earlier LocksleyFox walkers. This last stage was 30M steps on a laptop CPU, about 2 hours.
  • Randomized during training:
    • pushes
    • IMU tilt bias and noise
    • actuation delay
    • floor contact parameters
    • slightly springy legs and 3 mm floor bumps
    • speed and turn commands
  • Actuation goes through a model of the RS00 motor fitted to bench measurements: current lag, back-EMF and friction. That model is part of the training code and is not included here. walk_demo.py uses a plain PD loop with a 14 N·m limit instead.

Results

Setup Command Speed
Training simulation (evaluation suite, no falls in 30 runs) 0.5 / 1.0 m/s 0.51 / 1.07 m/s
Training simulation, springy legs 2.0 / 2.5 / 3.0 m/s 2.20 / 2.52 / 2.61 m/s
walk_demo.py (plain PD, 6 s from standstill) 0.5 / 1.0 / 2.0 m/s 0.54 / 1.10 / 1.89 m/s
Real robot, garage floor (2026-11-29) 3.0 m/s peak 2.26 m/s, about 2.1 m/s average

Real-robot speeds come from the robot's IMU speed estimate, scaled to the tape-measured distance of each run.

Running on a microcontroller

walker_weights_int8.h stores each layer as int8 with one scale per output neuron (about 184 KB). It is the file that ran on the robot (firmware build "fox_panel 121"). In simulation, the int8 version walked the same as float32 for a walker of this size. On a Teensy 4.1 at 600 MHz, with the weights in RAM, one policy step takes about 2.7 ms.

Limitations

  • The policy is trained for this robot's geometry, masses and motors. On another robot it will need retraining.
  • The robot has no foot contact sensors or abad sensing. The policy walks from IMU, joint encoders and its own clock.
  • The legs in this model are the 1x shanks (152 mm from knee axis to sole). Longer legs need a different walker.

License

CC BY-NC 4.0: free to use, share and adapt with credit, but not for commercial purposes. For commercial use, ask in this repo's Community tab.