Microduck RL Locomotion Tasks: Complete Task Catalog for Bipedal Robot Training
Microduck RL provides 18+ distinct locomotion tasks spanning velocity control, recovery behaviors, manipulation, and acrobatic skills, each available in flat or rough terrain variants plus optional backlash simulation.
The pollen-robotics/microduck_rl repository implements a comprehensive task library for training a bipedal robot using reinforcement learning. All tasks are centrally registered in src/mjlab_microduck/tasks/__init__.py through MJLab's register_mjlab_task helper, which binds environment configurations, RL hyperparameters, and execution runners into trainable units.
Core Locomotion Task Families
Microduck RL organizes its locomotion tasks into functional families based on robot behavior and terrain complexity. Each family supports both flat and rough terrain variants unless noted otherwise.
Standard Velocity Control
The foundational walking tasks train the robot to track linear and angular velocity commands.
- Mjlab-Velocity-Flat-MicroDuck — Baseline velocity tracking on flat ground
- Mjlab-Velocity-Rough-MicroDuck — Velocity tracking with randomized terrain height
Both use make_microduck_velocity_env_cfg() with rough=True toggling terrain complexity. The RL configuration class is MicroduckRlCfg.
VelStand: Walk, Recovery, and Pose Control
The VelStand task family combines velocity tracking with fall recovery and explicit pose control, making it robust for real-world deployment.
- Mjlab-VelStand-Flat-MicroDuck
- Mjlab-VelStand-Rough-MicroDuck
Configuration via make_microduck_velstand_env_cfg() and MicroduckVelStandRlCfg. This is the recommended starting point for general locomotion policies.
Stand-Up Recovery
Trains the robot to recover from an inverted (back-lying) starting position.
- Mjlab-StandUp-Flat-MicroDuck
- Mjlab-StandUp-Rough-MicroDuck
Uses make_microduck_standup_env_cfg() and MicroduckStandUpRlCfg. Critical for fault-tolerant deployment.
Sit/Stand Transitions
Explicit commanded transitions between sitting and standing postures.
- Mjlab-SitStand-Flat-MicroDuck
- Mjlab-SitStand-Rough-MicroDuck
Configuration via make_microduck_sitstand_env_cfg() and MicroduckSitStandRlCfg. Useful for power-saving behaviors and human-robot interaction.
Manipulation and Interaction Tasks
Ground-Pick: Crouch-to-Grasp Behaviors
Trains a multi-phase behavior: crouch → mouth contact → stand with object.
- Mjlab-GroundPick-Flat-MicroDuck
- Mjlab-GroundPick-Rough-MicroDuck
Uses make_microduck_ground_pick_env_cfg() and MicroduckGroundPickRlCfg. The task specification includes contact detection between the robot's mouth and target objects.
Ball Kick
A flat-terrain-only task for kicking a 70 mm ball toward a target direction.
- Mjlab-BallKick-Flat-MicroDuck
Configuration via make_microduck_ball_kick_env_cfg() and MicroduckBallKickRlCfg. Adds spherical object dynamics to the simulation.
Roller-Equipped Variants
Microduck RL includes a distinct hardware variant with passive roller wheels on the feet, enabling skating gaits.
Roller Velocity Control
- Mjlab-Velocity-Flat-MicroDuck-Rollers — Standard velocity on roller hardware
Uses make_microduck_velocity_rollers_env_cfg() and MicroduckRollersRlCfg.
Roller-Swizzle: Symmetric Foot-Grounded Gait
- Mjlab-Velocity-Swizzle-MicroDuck — Symmetric velocity control with both feet grounded
Uses make_microduck_velocity_swizzle_env_cfg() and MicroduckSwizzleRlCfg. Unique among roller tasks for its bilateral constraint.
Specialized Roller Behaviors
| Task ID | Description | Config Function | RL Config |
|---|---|---|---|
Mjlab-RollerCrouch-Flat-MicroDuck |
Stable crouched posture on rollers | make_microduck_roller_crouch_env_cfg() |
MicroduckRollerCrouchRlCfg |
Mjlab-RollerSlope-Flat-MicroDuck |
Navigation on inclined terrain | make_microduck_roller_slope_env_cfg() |
MicroduckRollerSlopeRlCfg |
Mjlab-RollerStandUp-Flat-MicroDuck |
Recovery to stand on roller feet | make_microduck_roller_standup_env_cfg() |
MicroduckRollerStandUpRlCfg |
Acrobatic and Specialized Locomotion Tasks
Spin: On-Spot Rotation
- Mjlab-Spin-Flat-MicroDuck — High-speed in-place rotation
Uses make_microduck_spin_env_cfg() and MicroduckSpinRlCfg. Optimizes for maximum yaw rate while maintaining balance.
Roulade: Forward Roll
- Mjlab-Roulade-Flat-MicroDuck — Complete forward roll over the head
Uses make_microduck_roulade_env_cfg() and MicroduckRouladeRlCfg. The most dynamic task in the library, requiring precise timing of limb retraction and extension.
Backlash Variants for Sim-to-Real Transfer
Every base task has a backlash-augmented counterpart that injects ±1° gear-play and encoder backlash. These variants use an identical task_id pattern with -Backlash- inserted:
Mjlab-Velocity-Flat-Backlash-MicroDuck
Mjlab-StandUp-Rough-Backlash-MicroDuck
Mjlab-VelStand-Flat-Backlash-MicroDuck
The registration loop in src/mjlab_microduck/tasks/__init__.py (lines 54-71) automatically generates these variants using the helper in backlash.py. Training with backlash improves robustness to real hardware imperfections.
Quick-Start Code Examples
List All Available Tasks
from mjlab.tasks.registry import list_tasks
for task in list_tasks():
if "MicroDuck" in task.task_id:
print(task.task_id)
Train a Specific Locomotion Task
uv run train Mjlab-VelStand-Flat-MicroDuck \
--env.scene.num-envs 4096 \
--agent.max_iterations 5000
Train with Backlash Simulation
uv run train Mjlab-VelStand-Flat-Backlash-MicroDuck \
--env.scene.num-envs 4096
Deploy a Trained Policy
uv run play Mjlab-VelStand-Flat-MicroDuck \
--wandb-run-path myuser/microduck/rl-run-123
Task Architecture and Extensibility
Understanding the source structure helps extend the locomotion task library:
- Registration —
register_mjlab_task()in__init__.pybindstask_idto factory functions and config classes - Environment Config — Each
make_*_env_cfg()returns anEnvCfgdataclass specifying robot model, terrain, observations, and commands - RL Config —
*RlCfgclasses inherit from MJLab's base and define reward weights, curricula, and algorithm settings - Runner —
MicroduckOnPolicyRunnerhandles training loop execution with symmetry-configuration cleanup
To add a new locomotion task, create:
- A new
*_env_cfg.pymodule with yourmake_*_env_cfg()factory - A matching
*RlCfgclass - One
register_mjlab_task()call in__init__.py
The backlash variant generates automatically if desired.
Key Source Files
| File | Purpose |
|---|---|
src/mjlab_microduck/tasks/__init__.py |
Central registry and backlash variant generation |
src/mjlab_microduck/tasks/microduck_velocity_env_cfg.py |
Standard velocity task environment |
src/mjlab_microduck/tasks/microduck_velstand_env_cfg.py |
VelStand combined task |
src/mjlab_microduck/tasks/microduck_standup_env_cfg.py |
Inverted recovery task |
src/mjlab_microduck/tasks/microduck_ground_pick_env_cfg.py |
Manipulation task |
src/mjlab_microduck/tasks/microduck_roller_slope_env_cfg.py |
Roller slope navigation |
src/mjlab_microduck/tasks/backlash.py |
Backlash injection helper |
src/mjlab_microduck/tasks/mdp.py |
Shared rewards, observations, and events |
Summary
- 18 base locomotion tasks across velocity, recovery, manipulation, roller, and acrobatic categories
- Flat and rough terrain variants for most tasks to train generalization
- Automatic backlash variants (±1° gear-play) for sim-to-real robustness
- Modular registration system in
src/mjlab_microduck/tasks/__init__.pyenabling rapid task prototyping - Recommended starting point:
Mjlab-VelStand-Flat-MicroDuckfor balanced locomotion,Mjlab-Velocity-Flat-Backlash-MicroDuckfor hardware-ready policies
Frequently Asked Questions
What is the difference between Velocity and VelStand tasks?
Velocity tasks train pure command tracking with recovery as an emergent property. VelStand tasks explicitly reward pose maintenance and include curriculum elements for fall recovery, producing more robust policies for real-world deployment. VelStand uses MicroduckVelStandRlCfg with distinct reward shaping compared to the base MicroduckRlCfg.
How do I train a policy for rough terrain?
Append -Rough- to the base task_id or pass rough=True to the config factory function. For example: uv run train Mjlab-Velocity-Rough-MicroDuck. The rough terrain variant adds randomized height fields with configurable frequency and amplitude parameters in the environment configuration.
When should I use backlash variants?
Use backlash variants when preparing policies for physical hardware deployment. The ±1° joint backlash and encoder noise model in backlash.py forces the policy to tolerate imprecise state estimation and mechanical play. Training without backlash first, then fine-tuning with backlash, often produces the best results.
Can I create custom locomotion tasks?
Yes. The modular architecture requires: (1) a new *_env_cfg.py file with your make_*_env_cfg() factory returning an EnvCfg, (2) a *RlCfg class extending MJLab's base RL configuration, and (3) a register_mjlab_task() call in __init__.py. The existing microduck_spin_env_cfg.py provides a concise template for acrobatic tasks.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →