Microduck RL MJCF Robot Models: Complete Guide to All 8 XML Configurations
Microduck RL defines eight distinct MJCF robot models—including walking, ground-contact, roller-skate, and backlash variants—each declared in src/mjlab_microduck/robot/microduck_constants.py and loaded via dedicated helper functions.
The Microduck RL framework from pollen-robotics/microduck_rl uses MuJoCo MJCF XML files to describe every physical robot configuration used across its reinforcement learning environments. This article breaks down each model's purpose, file location, and how to load it in your code.
The Central constants.py File
All MJCF robot models are declared in src/mjlab_microduck/robot/microduck_constants.py. According to the Microduck RL source code, this file contains:
- Path constants for each XML file (e.g.,
MICRODUCK_WALK_XML,MICRODUCK_GROUNDCONTACT_XML) - Helper functions that return compiled
mujoco.MjSpecobjects - Version-specific variants for tasks requiring different collision fidelity or mechanical realism
Lines 16-36 define the complete mapping between model names and their filesystem locations.
Base Walking Models
Walk Robot (robot_walk.xml)
The baseline bipedal robot used for standard walking and velocity-tracking tasks.
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_WALK_XML (lines 16-17) |
| XML path | src/mjlab_microduck/robot/microduck/robot_walk.xml |
| Load function | get_walk_spec() |
from mjlab_microduck.robot.microduck_constants import get_walk_spec
# Load the standard walking robot spec
walk_spec = get_walk_spec()
Ground-Contact Robot (robot_groundcontact.xml)
A curated collision subset for precise foot-ground interaction. Includes collision geoms for soles, legs, trunk, head, jaw, battery, and hips.
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_GROUNDCONTACT_XML (lines 18-20) |
| XML path | src/mjlab_microduck/robot/microduck/robot_groundcontact.xml |
| Load functions | get_standup_spec(), get_ground_pick_spec() |
Used in standup and ground manipulation tasks where contact fidelity matters.
Advanced Collision Models
All-Collisions Robot (robot_allcollisions.xml)
Full collision coverage with 70 geoms and 37 meshes. Every robot part carries collision geometry.
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_ALLCOLLISIONS_XML (lines 22-25) |
| XML path | src/mjlab_microduck/robot/microduck/robot_allcollisions.xml |
| Load function | get_allcollisions_spec() |
Currently unused in active environments but exported for future tasks requiring maximum physical accuracy.
Roller-Skate Variants
Ground-Contact Robot with Rollers (robot_groundcontact_rollers.xml)
Extends the walk model with passive wheel hinges (passive_*wheel) for roller-skate locomotion tasks.
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_GROUNDCONTACT_ROLLERS_XML (lines 28-30) |
| XML path | src/mjlab_microduck/robot/microduck/robot_groundcontact_rollers.xml |
| Load function | get_walk_rollers_spec() |
Backlash Models for Real-World Fidelity
Microduck RL includes backlash variants that add passive hinges with ±1° of play to every servo joint, matching real-world encoder behavior.
Backlash Ground-Contact Robot (robot_groundcontact_backlash.xml)
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_GROUNDCONTACT_BACKLASH_XML (lines 30-34) |
| Load function | get_backlash_spec() |
Backlash Walk Robot (robot_walk_backlash.xml)
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_WALK_BACKLASH_XML (lines 33-35) |
| Load function | get_walk_backlash_spec() |
Backlash Rollers Robot (robot_groundcontact_rollers_backlash.xml)
Combines roller-skate mechanics with backlash simulation—the most complex configuration.
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_GROUNDCONTACT_ROLLERS_BACKLASH_XML (lines 35-36) |
| Load function | get_rollers_backlash_spec() |
from mjlab_microduck.robot.microduck_constants import (
get_rollers_backlash_spec,
MICRODUCK_GROUNDCONTACT_ROLLERS_BACKLASH_XML,
)
# Most complex model: rollers + backlash
spec = get_rollers_backlash_spec()
print("XML source:", MICRODUCK_GROUNDCONTACT_ROLLERS_BACKLASH_XML)
Auxiliary Object Models
Ball Object (ball.xml)
A 70 mm, 15 g ball used exclusively in the BallKick task.
| Attribute | Value |
|---|---|
| Path constant | MICRODUCK_BALL_XML (lines 26-28) |
| XML path | src/mjlab_microduck/robot/microduck/ball.xml |
| Load function | get_ball_spec() |
from mjlab_microduck.robot.microduck_constants import get_ball_spec
ball_spec = get_ball_spec() # For ball-kicking environments
Loading and Inspecting MJCF Models
Inspect Any XML File Path
from mjlab_microduck.robot.microduck_constants import MICRODUCK_WALK_XML
print("Walk model XML:", MICRODUCK_WALK_XML)
# Output: src/mjlab_microduck/robot/microduck/robot_walk.xml
Complete Model Selection Pattern
Environment configuration files in src/mjlab_microduck/tasks/ (e.g., microduck_velocity_env_cfg.py, microduck_roller_crouch_env_cfg.py) import these specs to instantiate the appropriate robot model for each training task.
Related Source Files
| File Path | Purpose |
|---|---|
src/mjlab_microduck/robot/microduck_constants.py |
Central MJCF path definitions and loader functions |
src/mjlab_microduck/tasks/*_env_cfg.py |
Environment configs that select robot models |
src/mjlab_microduck/robot/microduck/*.xml |
Actual MJCF XML files |
src/mjlab_microduck/actuator/* |
BAM and backlash encoder configurations |
Summary
- Eight MJCF robot models are defined in
microduck_constants.py(lines 16-36) - Three complexity tiers: base walking, ground-contact (curated collisions), and all-collisions (full geometry)
- Three mechanical variants: standard, roller-skate (passive wheels), and backlash (±1° joint play)
- One auxiliary object: 70 mm ball for kicking tasks
- Consistent API: each model has a path constant (
MICRODUCK_*_XML) and loader function (get_*_spec())
Frequently Asked Questions
How do I choose between walk and ground-contact models?
robot_walk.xml is lighter and faster for basic locomotion tasks. robot_groundcontact.xml adds precise sole and leg collisions when foot-ground interaction accuracy matters—as in the standup and ground-pick environments.
What does the backlash model simulate?
Real servo encoders have mechanical play. The backlash models add passive hinges with ±1° of free movement to every joint, making simulation trajectories match physical robot behavior more closely. Use these when validating policies on hardware.
Can I use the all-collisions model in training?
The all-collisions robot (robot_allcollisions.xml with 70 geoms) is currently unused in active environments. It exists for future tasks where full-body collision detection outweighs the computational cost.
Where are these models actually instantiated?
Environment configuration files in src/mjlab_microduck/tasks/ import specs from microduck_constants.py. For example, roller-skate tasks call get_walk_rollers_spec() or get_rollers_backlash_spec() depending on whether real-world fidelity is required.
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 →