
microduck_rl
Sim-to-real RL environments for a 25 cm bipedal robot
Replaces Nvidia Isaac Sim, Aws Robomaker, Unity Robotics

Who it's for
microduck_rl provides a documented, reproducible sim2real pipeline for a real hardware target. The actuator modeling depth (voltage control law, gear backlash, domain randomization) makes it a concrete reference for studying what physical fidelity is necessary and sufficient for successful policy transfer on servo-driven bipeds.
If your research target is a different hardware platform or a larger robot with different actuator characteristics, the environment stack does not generalize without significant rework to the MJCF models and actuator config.
The task registry is extensible: each task family is a separate environment config file. Owners who want to teach the robot a new motion can follow the existing task structure, implement reward functions in `mdp.py`, and train with the same pipeline used for the built-in 13 tasks.
If you do not own or plan to own Microduck hardware, there is no general-purpose benefit to this repository over other RL locomotion environments.
The ONNX export path with a baked normalizer and a shared observation contract demonstrates a concrete approach to deploying learned policies on a resource-constrained robot runtime. Engineers evaluating whether PPO-trained policies can run reliably on embedded hardware will find the export and inference scripts directly applicable.
Skip if your target platform uses a different deployment format (TensorRT, TFLite) or requires a format-agnostic inference pipeline; ONNX is the only supported export path here.
The problem
Building bipedal robot locomotion policies requires a simulation environment that faithfully replicates the physics of real servo joints. Off-the-shelf simulators treat actuators as ideal, which means policies that train well in simulation often fail on hardware when they encounter real friction, gear backlash, and voltage sag under load. For small, low-cost bipedal robots like Microduck, the sim2real gap is especially pronounced. At this scale, tiny servos driving an 800 g frame are the primary source of discrepancy between simulation and physical behavior. Most existing robot RL tooling is built around larger platforms and uses simplified actuator models. Researchers who want sim2real transfer on a platform like Microduck have had to build the actuator modeling and domain randomization stack themselves.
How it works
Covers walking, fall recovery, sit-to-stand, ball kicking, forward rolling (roulade), and roller-skating gaits on flat and rough terrain. Each task has a flat variant and most have a rough-terrain twin; roller tasks add three additional skate-specific environments. The task registry is live and queryable with `uv run list-envs`.
Uses the BAM M6 model for the Dynamixel XL330, covering voltage control law, back-EMF, and Coulomb/Stribeck friction. Per-environment domain randomization varies battery voltage, voltage sag under load, command delay, and friction magnitude. A backlash variant adds ±1° of gear play to all 14 servo joints.
The export script bakes the observation normalizer into the ONNX graph, so deployed policies always see correctly scaled inputs without any runtime preprocessing step. The shared 61-dimensional observation contract lets any trained policy hot-swap onto the robot without firmware changes.
Policies train at 50 Hz using PPO through the mjlab framework on MuJoCo Warp. A usable walking gait takes roughly one to two hours at 4,096 parallel environments on a CUDA GPU. Checkpoint resume is one flag away on any train command.
Teams without a local CUDA GPU can route any train command to Hugging Face Jobs by adding the `--hf-jobs` flag. This removes the GPU hardware requirement from the training step and lets the repository run on CPU-only machines for everything except policy training itself.
Walk, fall-recovery, roulade, and sit-stand policies share a 61-dimensional actor observation layout. Environments that do not use a command slot zero-pad it rather than dropping it, keeping the ONNX export and robot runtime unchanged across the full policy library.
Features
- 13 locomotion task environments
- High-fidelity sim2real actuator modeling
- ONNX export with baked observation normalizer
- PPO training on MuJoCo Warp
- Hugging Face Jobs offload for GPU-free setups
- Hot-swappable runtime policies
How to install
Install via git clone; training requires a CUDA GPU and the uv package manager.
git clone https://github.com/pollen-robotics/microduck_rl
cd microduck_rl
uv run train Mjlab-Velocity-Flat-MicroDuck --env.scene.num-envs 4096Recommended for this setup
Strengths
- Complete sim2real recipe, not just a task list: Most RL environment repos provide task definitions and leave the physics gap to the user. microduck_rl ships the full recipe: BAM actuator modeling, backlash simulation, per-environment domain randomization, and the reward-design lessons from the project documented in AGENTS.md. The gap between training result and hardware deployment is reproducible and explained.
- Apache 2.0 license with no usage cost: Apache 2.0 allows commercial use, modification, and redistribution without royalties. Unlike NVIDIA Isaac Sim (proprietary, seat-based licensing) or AWS RoboMaker (pay-per-use cloud compute), the training environment itself carries no licensing fee.
- Auditable reward design: AGENTS.md documents the reward-design rules distilled from the project, readable by both human engineers and AI coding agents working in the repository. Each task family is a separate environment config file with `ENABLE_*` booleans for domain randomization toggles, so reward functions are visible and modifiable rather than hidden in framework internals.
Trade-offs
- Requires a CUDA GPU for training: Training runs through MuJoCo Warp, which requires a CUDA-capable GPU. On ARM-based machines (DGX Spark, Jetson), the first dependency sync pulls around 2 GB of CUDA wheels and can time out; the README documents the `UV_HTTP_TIMEOUT=600` workaround. Hugging Face Jobs offloads this requirement but adds account setup overhead.
- Purpose-built for Microduck hardware only: The robot models, actuator configs, and task definitions target the Microduck 14-servo bipedal platform specifically. Adapting these environments to a different robot requires replacing the MJCF models, actuator config, and all joint-layout references throughout the codebase. This is not a general-purpose bipedal locomotion framework.
- 3D model files carry a non-commercial license: The code is Apache 2.0, but the 3D model files (MJCF exports from Onshape) are Creative Commons BY-SA-NC, which prohibits commercial use. Teams planning to build commercial hardware from the Microduck physical design need to review the CC license separately from the code license.
Tech stack
FAQ
No. Training and policy visualization run entirely in simulation using MuJoCo. You need a CUDA GPU and the mjlab framework for training, but not the physical robot. Hardware is only required if you want to deploy and test the exported ONNX policy on the real Microduck.
Isaac Sim is a general-purpose robot simulator with broad hardware support, PhysX-based physics, and proprietary licensing. microduck_rl is narrower: it targets Microduck specifically, uses MuJoCo Warp, and is Apache 2.0 licensed at no cost. Isaac Sim is the better choice for teams simulating multiple robot types or integrating with NVIDIA's broader robotics stack. microduck_rl is the better choice when Microduck is your hardware target and you want the exact actuator model and reward design that produced the published sim2real results.
Yes. Add `--hf-jobs` to any train command to submit the run to Hugging Face Jobs instead of running locally. See `scripts/hf/README.md` for configuration. CPU-only config-invariant and reward-function regression tests are also available via pytest and do not require a GPU.
microduck_rl addresses the sim2real gap through three mechanisms: BAM actuator modeling (voltage control law, back-EMF, and friction for the Dynamixel XL330), per-environment domain randomization on battery voltage, command delay, and friction magnitude, and explicit backlash simulation adding ±1° of gear play to all 14 servo joints. The observation normalizer is baked into the exported ONNX graph so policies see consistent inputs on real hardware.
The code and training environments are Apache 2.0 licensed, which allows commercial use, modification, and redistribution without royalties. The 3D model files (MJCF exports) carry a separate Creative Commons BY-SA-NC license, which prohibits commercial use of those assets. If your use case involves the physical robot design rather than just the training code, review both licenses before proceeding.