|
27 | 27 | from isaaclab.utils.noise import UniformNoiseCfg as Unoise |
28 | 28 |
|
29 | 29 | import isaaclab_tasks.manager_based.locomotion.velocity.mdp as mdp |
30 | | -from isaaclab_tasks.utils import PresetCfg |
| 30 | +from isaaclab_tasks.utils import PresetCfg, preset |
31 | 31 |
|
32 | 32 | ## |
33 | 33 | # Pre-defined configs |
@@ -161,6 +161,50 @@ def __post_init__(self): |
161 | 161 | class EventsCfg: |
162 | 162 | """Configuration for events.""" |
163 | 163 |
|
| 164 | + # startup |
| 165 | + physics_material = EventTerm( |
| 166 | + func=mdp.randomize_rigid_body_material, |
| 167 | + mode="startup", |
| 168 | + params={ |
| 169 | + "asset_cfg": SceneEntityCfg("robot", body_names=".*"), |
| 170 | + "static_friction_range": (0.8, 0.8), |
| 171 | + "dynamic_friction_range": (0.6, 0.6), |
| 172 | + "restitution_range": (0.0, 0.0), |
| 173 | + "num_buckets": 64, |
| 174 | + }, |
| 175 | + ) |
| 176 | + |
| 177 | + add_base_mass = EventTerm( |
| 178 | + func=mdp.randomize_rigid_body_mass, |
| 179 | + mode="startup", |
| 180 | + params={ |
| 181 | + "asset_cfg": SceneEntityCfg("robot", body_names="base"), |
| 182 | + "mass_distribution_params": (-5.0, 5.0), |
| 183 | + "operation": "add", |
| 184 | + }, |
| 185 | + ) |
| 186 | + |
| 187 | + base_com = preset( |
| 188 | + default=EventTerm( |
| 189 | + func=mdp.randomize_rigid_body_com, |
| 190 | + mode="startup", |
| 191 | + params={ |
| 192 | + "asset_cfg": SceneEntityCfg("robot", body_names="base"), |
| 193 | + "com_range": {"x": (-0.05, 0.05), "y": (-0.05, 0.05), "z": (-0.01, 0.01)}, |
| 194 | + }, |
| 195 | + ), |
| 196 | + newton=None, |
| 197 | + ) |
| 198 | + |
| 199 | + collider_offsets = EventTerm( |
| 200 | + func=mdp.randomize_rigid_body_collider_offsets, |
| 201 | + mode="startup", |
| 202 | + params={ |
| 203 | + "asset_cfg": SceneEntityCfg("robot", body_names=".*"), |
| 204 | + "contact_offset_distribution_params": (0.01, 0.01), |
| 205 | + }, |
| 206 | + ) |
| 207 | + |
164 | 208 | # reset |
165 | 209 | base_external_force_torque = EventTerm( |
166 | 210 | func=mdp.apply_external_force_torque, |
@@ -206,41 +250,6 @@ class EventsCfg: |
206 | 250 | ) |
207 | 251 |
|
208 | 252 |
|
209 | | -@configclass |
210 | | -class StartupEventsCfg: |
211 | | - # startup |
212 | | - physics_material = EventTerm( |
213 | | - func=mdp.randomize_rigid_body_material, |
214 | | - mode="startup", |
215 | | - params={ |
216 | | - "asset_cfg": SceneEntityCfg("robot", body_names=".*"), |
217 | | - "static_friction_range": (0.8, 0.8), |
218 | | - "dynamic_friction_range": (0.6, 0.6), |
219 | | - "restitution_range": (0.0, 0.0), |
220 | | - "num_buckets": 64, |
221 | | - }, |
222 | | - ) |
223 | | - |
224 | | - add_base_mass = EventTerm( |
225 | | - func=mdp.randomize_rigid_body_mass, |
226 | | - mode="startup", |
227 | | - params={ |
228 | | - "asset_cfg": SceneEntityCfg("robot", body_names="base"), |
229 | | - "mass_distribution_params": (-5.0, 5.0), |
230 | | - "operation": "add", |
231 | | - }, |
232 | | - ) |
233 | | - |
234 | | - base_com = EventTerm( |
235 | | - func=mdp.randomize_rigid_body_com, |
236 | | - mode="startup", |
237 | | - params={ |
238 | | - "asset_cfg": SceneEntityCfg("robot", body_names="base"), |
239 | | - "com_range": {"x": (-0.05, 0.05), "y": (-0.05, 0.05), "z": (-0.01, 0.01)}, |
240 | | - }, |
241 | | - ) |
242 | | - |
243 | | - |
244 | 253 | @configclass |
245 | 254 | class RewardsCfg: |
246 | 255 | """Reward terms for the MDP.""" |
@@ -286,6 +295,10 @@ class TerminationsCfg: |
286 | 295 | func=mdp.illegal_contact, |
287 | 296 | params={"sensor_cfg": SceneEntityCfg("contact_forces", body_names="base"), "threshold": 1.0}, |
288 | 297 | ) |
| 298 | + body_lin_vel = DoneTerm( |
| 299 | + func=mdp.body_lin_vel_out_of_limit, |
| 300 | + params={"max_velocity": 20.0, "asset_cfg": SceneEntityCfg("robot", body_names=".*")}, |
| 301 | + ) |
289 | 302 |
|
290 | 303 |
|
291 | 304 | @configclass |
@@ -313,7 +326,7 @@ class LocomotionVelocityRoughEnvCfg(ManagerBasedRLEnvCfg): |
313 | 326 | # MDP settings |
314 | 327 | rewards: RewardsCfg = RewardsCfg() |
315 | 328 | terminations: TerminationsCfg = TerminationsCfg() |
316 | | - events: EventsCfg = MISSING |
| 329 | + events: EventsCfg = EventsCfg() |
317 | 330 | curriculum: CurriculumCfg = CurriculumCfg() |
318 | 331 |
|
319 | 332 | def __post_init__(self): |
|
0 commit comments