-
Notifications
You must be signed in to change notification settings - Fork 30
feat: add Microduck robot and integrate it into humanoid walk task #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # @package _global_ | ||
| # Task microduck-walk-flat: motrix.fastsac shared training recipe. | ||
| defaults: | ||
| - /algo_base@algo: motrix.fastsac | ||
| - _self_ | ||
| task: | ||
| env: microduck-walk-flat | ||
| rllib: motrix | ||
| algo: fastsac | ||
| num_envs: 2048 | ||
| play_num_envs: 16 | ||
| seed: 1 | ||
| checkpoint: | ||
| interval: 1000 | ||
| algo: | ||
| agent: | ||
| alpha_init: 0.01 | ||
| target_entropy_ratio: -0.1 | ||
| num_updates: 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # @package _global_ | ||
| # Task microduck-walk-rough: motrix.fastsac shared training recipe. | ||
| defaults: | ||
| - /algo_base@algo: motrix.fastsac | ||
| - _self_ | ||
| task: | ||
| env: microduck-walk-rough | ||
| rllib: motrix | ||
| algo: fastsac | ||
| num_envs: 2048 | ||
| play_num_envs: 16 | ||
| seed: 1 | ||
| checkpoint: | ||
| interval: 1000 | ||
| algo: | ||
| agent: | ||
| alpha_init: 0.01 | ||
| target_entropy_ratio: -0.1 | ||
| num_updates: 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
motrix_envs/src/motrix_envs/locomotion/humanoid/microduck.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,123 @@ | ||
| # Copyright Motphys Technology Co., Ltd. 2025, 2026 | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Pollen Robotics Microduck humanoid velocity-tracking presets and registration.""" | ||
|
|
||
| from dataclasses import replace | ||
|
|
||
| from motrix_env_core import registry | ||
| from motrix_env_core.base import SimCfg | ||
| from motrix_env_core.config.scene import HFieldTerrainCfg, SystemCameraCfg | ||
| from motrix_envs.config.scene import StandardSceneObjsCfg | ||
| from motrix_envs.locomotion.humanoid import cfg as humanoid_cfg | ||
| from motrix_envs.locomotion.humanoid.walk_np import HumanoidVelocityTrackingEnv | ||
| from motrix_envs.robot import Microduck | ||
|
|
||
|
|
||
| def _make_microduck_robot() -> Microduck: | ||
| return Microduck() | ||
|
|
||
|
|
||
| # Pinned Microduck termination collision inventory, owned by the Microduck walk task. | ||
| _MICRODUCK_TERMINATION_GEOMS = ("trunk_collision",) | ||
|
|
||
|
|
||
| @registry.envcfg("microduck-walk-flat") | ||
| def make_microduck_walk_flat_cfg() -> humanoid_cfg.HumanoidVelocityTrackingEnvCfg: | ||
| """Track walking commands with Microduck on flat ground. | ||
|
|
||
| zh_CN: 控制 Microduck 小型双足机器人在平地上跟踪行走指令。 | ||
| """ | ||
|
|
||
| return humanoid_cfg.HumanoidVelocityTrackingEnvCfg( | ||
| scene=humanoid_cfg.HumanoidWalkSceneCfg( | ||
| # Microduck is a ~25 cm robot; frame the lead env much closer than | ||
| # the full-size humanoid default camera (grid center at z=0.75). | ||
| system_camera=SystemCameraCfg( | ||
| lookat=(0.0, 0.0, 0.12), | ||
| distance=0.35, | ||
| elevation=-20.0, | ||
| azimuth=180.0, | ||
| ), | ||
| objs=StandardSceneObjsCfg(robot=_make_microduck_robot()), | ||
| ), | ||
| control_config=humanoid_cfg.ControlCfg(action_scale=0.5), | ||
| commands=humanoid_cfg.CommandsCfg( | ||
| vel_limit=[ | ||
| [-1.0, -1.0, -1.0], | ||
| [1.0, 1.0, 1.0], | ||
| ], | ||
| ), | ||
| gait=humanoid_cfg.GaitCfg( | ||
| period=0.5, | ||
| swing_height=0.04, | ||
|
wlgys8 marked this conversation as resolved.
|
||
| feet_phase_sigma=0.002, | ||
| ), | ||
| reward_config=humanoid_cfg.RewardCfg( | ||
| scales=humanoid_cfg.RewardScales( | ||
| tracking_lin_vel=10.0, | ||
| tracking_ang_vel=3.0, | ||
| penalty_action_rate=-0.5, | ||
| feet_phase=8.0, | ||
| ), | ||
| tracking_sigma=0.15, | ||
| close_feet_threshold=0.05, | ||
| pose_weights={ | ||
| "left_hip_yaw": 5.0, | ||
| "left_hip_roll": 1.0, | ||
| "left_hip_pitch": 0.01, | ||
| "left_knee": 0.01, | ||
| "left_ankle": 5.0, | ||
| "neck_pitch": 50.0, | ||
| "head_pitch": 50.0, | ||
| "head_yaw": 50.0, | ||
| "head_roll": 50.0, | ||
| "right_hip_yaw": 5.0, | ||
| "right_hip_roll": 1.0, | ||
| "right_hip_pitch": 0.01, | ||
| "right_knee": 0.01, | ||
| "right_ankle": 5.0, | ||
| }, | ||
| ), | ||
| asset=humanoid_cfg.AssetCfg( | ||
| foot_height_site_names=("left_foot", "right_foot"), | ||
| ground_geom_name="floor", | ||
| terminate_contact_geom_names=_MICRODUCK_TERMINATION_GEOMS, | ||
| ), | ||
| sim=SimCfg(dt=0.005, solver_iterations=6, solver_tolerance=1e-4), | ||
| spawn_xy_range=0.0, | ||
| ) | ||
|
|
||
|
|
||
| @registry.envcfg("microduck-walk-rough") | ||
| def make_microduck_walk_rough_cfg() -> humanoid_cfg.HumanoidVelocityTrackingEnvCfg: | ||
| """Track walking commands with Microduck over uneven terrain. | ||
|
|
||
| zh_CN: 控制 Microduck 小型双足机器人在起伏地形上跟踪行走指令。 | ||
| """ | ||
|
|
||
| return replace( | ||
| make_microduck_walk_flat_cfg(), | ||
| scene=humanoid_cfg.HumanoidWalkSceneCfg( | ||
| assets=humanoid_cfg.TerrainSceneAssetsCfg(), | ||
| system_camera=SystemCameraCfg( | ||
| lookat=(0.0, 0.0, 0.12), | ||
| distance=0.35, | ||
| elevation=-20.0, | ||
| azimuth=180.0, | ||
| ), | ||
| objs=StandardSceneObjsCfg( | ||
| floor=HFieldTerrainCfg( | ||
| hfield="terrain", | ||
| material="mat_ground", | ||
| ), | ||
| robot=_make_microduck_robot(), | ||
| ), | ||
| ), | ||
| spawn_xy_range=4.0, | ||
| render_spacing=0.0, | ||
| ) | ||
|
|
||
|
|
||
| registry.env("microduck-walk-flat")(HumanoidVelocityTrackingEnv) | ||
| registry.env("microduck-walk-rough")(HumanoidVelocityTrackingEnv) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
motrix_envs/src/motrix_envs/robot/assets/microduck/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # Microduck robot model | ||
|
|
||
| Ported from https://github.com/pollen-robotics/microduck_rl | ||
| (`src/mjlab_microduck/robot/microduck/robot_walk.xml`, renamed to | ||
| `microduck.xml`). Relative to upstream, a named termination capsule | ||
| `trunk_collision` was added on `trunk_base` for the humanoid walk task's | ||
| fall-termination contact query; everything else is unmodified. | ||
|
|
||
| - Upstream code and MJCF: Apache License 2.0 | ||
| - 3D mesh files (`assets/*.stl`): Creative Commons BY-SA-NC | ||
| (non-commercial), per the upstream README | ||
|
|
||
| The Microduck is a ~800 g, ~25 cm bipedal robot by Pollen Robotics with 14 | ||
| actuated joints (5 per leg, 4 neck/head). |
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/ankle_left.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/ankle_right.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/banana_pcb_locker.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/bearing_roll.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/bottom_head_shell.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
...x_envs/src/motrix_envs/robot/assets/microduck/assets/elec_rpi_robot_hat_pcb.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/face_part.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/foot_left.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/foot_right.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/hip_l.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/jaw.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/jaw_soft.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/left_shell.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/leg.stl
Git LFS file not shown
3 changes: 3 additions & 0 deletions
3
motrix_envs/src/motrix_envs/robot/assets/microduck/assets/lens.stl
Git LFS file not shown
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.