-
Notifications
You must be signed in to change notification settings - Fork 276
Velocity task improvements #833
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
Open
kevinzakka
wants to merge
10
commits into
main
Choose a base branch
from
velocity-mdp-tweaks
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
70a305d
Use biased joint positions in velocity actor observations
kevinzakka d50d8cc
Reset peak_heights on env reset in feet_swing_height
kevinzakka b21360a
Enable joint velocity and acceleration penalties for Go1
kevinzakka d866a1a
Enable angular velocity and momentum penalties for Go1
kevinzakka 4c2e76e
Add thigh collision penalty for Go1
kevinzakka fe093a8
Tweak njmax/nconmax
kevinzakka ecef220
Fix TerrainHeightSensor reporting max_distance during ground contact
kevinzakka 7198312
Add G1 flat run config with velocity curriculum
kevinzakka 7f1315f
Bump njmax for go1 rough.
kevinzakka ab4286f
Widen base angular velocity range and update G1 run curriculum
kevinzakka 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,6 @@ | |
| TerrainHeightSensorCfg, | ||
| ) | ||
| from mjlab.tasks.velocity import mdp | ||
| from mjlab.tasks.velocity.mdp import UniformVelocityCommandCfg | ||
| from mjlab.tasks.velocity.velocity_env_cfg import make_velocity_env_cfg | ||
|
|
||
| TerrainType = Literal["rough", "obstacles"] | ||
|
|
@@ -35,10 +34,11 @@ def unitree_go1_rough_env_cfg( | |
| """Create Unitree Go1 rough terrain velocity configuration.""" | ||
| cfg = make_velocity_env_cfg() | ||
|
|
||
| cfg.sim.mujoco.ccd_iterations = 500 | ||
| cfg.sim.njmax = 120 | ||
| cfg.sim.nconmax = 20 | ||
|
|
||
| cfg.sim.mujoco.impratio = 10 | ||
| cfg.sim.mujoco.cone = "elliptic" | ||
| cfg.sim.contact_sensor_maxmatch = 500 | ||
|
|
||
| cfg.scene.entities = {"robot": get_go1_robot_cfg()} | ||
|
|
||
|
|
@@ -203,9 +203,11 @@ def unitree_go1_rough_env_cfg( | |
| for reward_name in ["foot_clearance", "foot_slip"]: | ||
| cfg.rewards[reward_name].params["asset_cfg"].site_names = site_names | ||
|
|
||
| cfg.rewards["body_ang_vel"].weight = 0.0 | ||
| cfg.rewards["angular_momentum"].weight = 0.0 | ||
| cfg.rewards["body_ang_vel"].weight = -1e-4 | ||
| cfg.rewards["angular_momentum"].weight = -1e-4 | ||
| cfg.rewards["air_time"].weight = 0.0 | ||
| cfg.rewards["joint_vel_l2"] = RewardTermCfg(func=mdp.joint_vel_l2, weight=-1e-5) | ||
| cfg.rewards["joint_acc_l2"] = RewardTermCfg(func=mdp.joint_acc_l2, weight=-1e-7) | ||
|
|
||
| # Per-body-group collision penalties. | ||
| cfg.rewards["self_collisions"] = RewardTermCfg( | ||
|
|
@@ -218,6 +220,11 @@ def unitree_go1_rough_env_cfg( | |
| weight=-0.1, | ||
| params={"sensor_name": shank_ground_cfg.name}, | ||
| ) | ||
| cfg.rewards["thigh_collision"] = RewardTermCfg( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WDYT about an alive reward? I was thinking it could be helpful especially for rough terrain |
||
| func=mdp.self_collision_cost, | ||
| weight=-0.5, | ||
| params={"sensor_name": thigh_ground_cfg.name}, | ||
| ) | ||
| cfg.rewards["trunk_head_collision"] = RewardTermCfg( | ||
| func=mdp.self_collision_cost, | ||
| weight=-0.1, | ||
|
|
@@ -262,10 +269,7 @@ def unitree_go1_flat_env_cfg(play: bool = False) -> ManagerBasedRlEnvCfg: | |
| """Create Unitree Go1 flat terrain velocity configuration.""" | ||
| cfg = unitree_go1_rough_env_cfg(play=play) | ||
|
|
||
| cfg.sim.njmax = 300 | ||
| cfg.sim.mujoco.ccd_iterations = 50 | ||
| cfg.sim.contact_sensor_maxmatch = 64 | ||
| cfg.sim.nconmax = None | ||
| cfg.sim.njmax = 50 | ||
|
|
||
| # Switch to flat terrain. | ||
| assert cfg.scene.terrain is not None | ||
|
|
@@ -288,7 +292,12 @@ def unitree_go1_flat_env_cfg(play: bool = False) -> ManagerBasedRlEnvCfg: | |
| cfg.rewards["upright"].params.pop("terrain_sensor_names", None) | ||
|
|
||
| # Remove granular collision rewards (not useful on flat ground). | ||
| for key in ("self_collisions", "shank_collision", "trunk_head_collision"): | ||
| for key in ( | ||
| "self_collisions", | ||
| "shank_collision", | ||
| "thigh_collision", | ||
| "trunk_head_collision", | ||
| ): | ||
| cfg.rewards.pop(key, None) | ||
|
|
||
| # On flat terrain fell_over is sufficient; thigh contact implies fallen. | ||
|
|
@@ -302,10 +311,4 @@ def unitree_go1_flat_env_cfg(play: bool = False) -> ManagerBasedRlEnvCfg: | |
| # Disable terrain curriculum (not present in play mode since rough clears all). | ||
| cfg.curriculum.pop("terrain_levels", None) | ||
|
|
||
| if play: | ||
| twist_cmd = cfg.commands["twist"] | ||
| assert isinstance(twist_cmd, UniformVelocityCommandCfg) | ||
| twist_cmd.ranges.lin_vel_x = (-1.5, 2.0) | ||
| twist_cmd.ranges.ang_vel_z = (-0.7, 0.7) | ||
|
|
||
| return cfg | ||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, such a low njmax/nconmax work?