-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Supports Anymal-D Rough terrain training in newton #5225
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
| from isaaclab.utils.noise import UniformNoiseCfg as Unoise | ||
|
|
||
| import isaaclab_tasks.manager_based.locomotion.velocity.mdp as mdp | ||
| from isaaclab_tasks.utils import PresetCfg | ||
| from isaaclab_tasks.utils import PresetCfg, preset | ||
|
|
||
| ## | ||
| # Pre-defined configs | ||
|
|
@@ -161,6 +161,50 @@ def __post_init__(self): | |
| class EventsCfg: | ||
| """Configuration for events.""" | ||
|
|
||
| # startup | ||
| physics_material = EventTerm( | ||
| func=mdp.randomize_rigid_body_material, | ||
| mode="startup", | ||
| params={ | ||
| "asset_cfg": SceneEntityCfg("robot", body_names=".*"), | ||
| "static_friction_range": (0.8, 0.8), | ||
| "dynamic_friction_range": (0.6, 0.6), | ||
| "restitution_range": (0.0, 0.0), | ||
| "num_buckets": 64, | ||
| }, | ||
| ) | ||
|
|
||
| add_base_mass = EventTerm( | ||
| func=mdp.randomize_rigid_body_mass, | ||
| mode="startup", | ||
| params={ | ||
| "asset_cfg": SceneEntityCfg("robot", body_names="base"), | ||
| "mass_distribution_params": (-5.0, 5.0), | ||
| "operation": "add", | ||
| }, | ||
| ) | ||
|
|
||
| base_com = preset( | ||
| default=EventTerm( | ||
| func=mdp.randomize_rigid_body_com, | ||
| mode="startup", | ||
| params={ | ||
| "asset_cfg": SceneEntityCfg("robot", body_names="base"), | ||
| "com_range": {"x": (-0.05, 0.05), "y": (-0.05, 0.05), "z": (-0.01, 0.01)}, | ||
| }, | ||
| ), | ||
| newton=None, | ||
| ) | ||
|
|
||
| collider_offsets = EventTerm( | ||
| func=mdp.randomize_rigid_body_collider_offsets, | ||
| mode="startup", | ||
| params={ | ||
| "asset_cfg": SceneEntityCfg("robot", body_names=".*"), | ||
| "contact_offset_distribution_params": (0.01, 0.01), | ||
| }, | ||
| ) | ||
|
Comment on lines
+199
to
+206
Contributor
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.
collider_offsets = preset(
default=EventTerm(
func=mdp.randomize_rigid_body_collider_offsets,
mode="startup",
params={
"asset_cfg": SceneEntityCfg("robot", body_names=".*"),
"contact_offset_distribution_params": (0.01, 0.01),
},
),
newton=None,
) |
||
|
|
||
| # reset | ||
| base_external_force_torque = EventTerm( | ||
| func=mdp.apply_external_force_torque, | ||
|
|
@@ -206,41 +250,6 @@ class EventsCfg: | |
| ) | ||
|
|
||
|
|
||
| @configclass | ||
| class StartupEventsCfg: | ||
| # startup | ||
| physics_material = EventTerm( | ||
| func=mdp.randomize_rigid_body_material, | ||
| mode="startup", | ||
| params={ | ||
| "asset_cfg": SceneEntityCfg("robot", body_names=".*"), | ||
| "static_friction_range": (0.8, 0.8), | ||
| "dynamic_friction_range": (0.6, 0.6), | ||
| "restitution_range": (0.0, 0.0), | ||
| "num_buckets": 64, | ||
| }, | ||
| ) | ||
|
|
||
| add_base_mass = EventTerm( | ||
| func=mdp.randomize_rigid_body_mass, | ||
| mode="startup", | ||
| params={ | ||
| "asset_cfg": SceneEntityCfg("robot", body_names="base"), | ||
| "mass_distribution_params": (-5.0, 5.0), | ||
| "operation": "add", | ||
| }, | ||
| ) | ||
|
|
||
| base_com = EventTerm( | ||
| func=mdp.randomize_rigid_body_com, | ||
| mode="startup", | ||
| params={ | ||
| "asset_cfg": SceneEntityCfg("robot", body_names="base"), | ||
| "com_range": {"x": (-0.05, 0.05), "y": (-0.05, 0.05), "z": (-0.01, 0.01)}, | ||
| }, | ||
| ) | ||
|
|
||
|
|
||
| @configclass | ||
| class RewardsCfg: | ||
| """Reward terms for the MDP.""" | ||
|
|
@@ -286,6 +295,10 @@ class TerminationsCfg: | |
| func=mdp.illegal_contact, | ||
| params={"sensor_cfg": SceneEntityCfg("contact_forces", body_names="base"), "threshold": 1.0}, | ||
| ) | ||
| body_lin_vel = DoneTerm( | ||
| func=mdp.body_lin_vel_out_of_limit, | ||
| params={"max_velocity": 20.0, "asset_cfg": SceneEntityCfg("robot", body_names=".*")}, | ||
| ) | ||
|
|
||
|
|
||
| @configclass | ||
|
|
@@ -313,7 +326,7 @@ class LocomotionVelocityRoughEnvCfg(ManagerBasedRLEnvCfg): | |
| # MDP settings | ||
| rewards: RewardsCfg = RewardsCfg() | ||
| terminations: TerminationsCfg = TerminationsCfg() | ||
| events: EventsCfg = MISSING | ||
| events: EventsCfg = EventsCfg() | ||
| curriculum: CurriculumCfg = CurriculumCfg() | ||
|
|
||
| def __post_init__(self): | ||
|
|
||
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.
The nested
for i / for jPython loops buildfacesas a growing list, costing O(nx × ny) loop iterations at the Python level. For a typicalborder_width=5 mwithhorizontal_scale=0.1 m, each strip has ~50 × N cells. While this is a one-time startup cost, a vectorised numpy approach avoids it entirely and makes the intent clearer: