Unverified Commit 63bd4285 authored by robotsfan's avatar robotsfan Committed by GitHub

Removes duplicated `TerminationsCfg` code in G1 and H1 RoughEnvCfg (#1484)

# Description

`TerminationsCfg` is the same as `LocomotionVelocityRoughEnvCfg`, there
is no need to configure it again, just modify the corresponding name
`self.terminations.base_contact.params["sensor_cfg"].body_names`

## Type of change

- Bug fix (non-breaking change which fixes an issue)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
Co-authored-by: 's avatarKelly Guo <kellyg@nvidia.com>
parent 6f4663a3
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
from omni.isaac.lab.managers import RewardTermCfg as RewTerm from omni.isaac.lab.managers import RewardTermCfg as RewTerm
from omni.isaac.lab.managers import SceneEntityCfg from omni.isaac.lab.managers import SceneEntityCfg
from omni.isaac.lab.managers import TerminationTermCfg as DoneTerm
from omni.isaac.lab.utils import configclass from omni.isaac.lab.utils import configclass
import omni.isaac.lab_tasks.manager_based.locomotion.velocity.mdp as mdp import omni.isaac.lab_tasks.manager_based.locomotion.velocity.mdp as mdp
...@@ -104,21 +103,9 @@ class G1Rewards(RewardsCfg): ...@@ -104,21 +103,9 @@ class G1Rewards(RewardsCfg):
) )
@configclass
class TerminationsCfg:
"""Termination terms for the MDP."""
time_out = DoneTerm(func=mdp.time_out, time_out=True)
base_contact = DoneTerm(
func=mdp.illegal_contact,
params={"sensor_cfg": SceneEntityCfg("contact_forces", body_names="torso_link"), "threshold": 1.0},
)
@configclass @configclass
class G1RoughEnvCfg(LocomotionVelocityRoughEnvCfg): class G1RoughEnvCfg(LocomotionVelocityRoughEnvCfg):
rewards: G1Rewards = G1Rewards() rewards: G1Rewards = G1Rewards()
terminations: TerminationsCfg = TerminationsCfg()
def __post_init__(self): def __post_init__(self):
# post init of parent # post init of parent
...@@ -163,6 +150,9 @@ class G1RoughEnvCfg(LocomotionVelocityRoughEnvCfg): ...@@ -163,6 +150,9 @@ class G1RoughEnvCfg(LocomotionVelocityRoughEnvCfg):
self.commands.base_velocity.ranges.lin_vel_y = (-0.0, 0.0) self.commands.base_velocity.ranges.lin_vel_y = (-0.0, 0.0)
self.commands.base_velocity.ranges.ang_vel_z = (-1.0, 1.0) self.commands.base_velocity.ranges.ang_vel_z = (-1.0, 1.0)
# terminations
self.terminations.base_contact.params["sensor_cfg"].body_names = "torso_link"
@configclass @configclass
class G1RoughEnvCfg_PLAY(G1RoughEnvCfg): class G1RoughEnvCfg_PLAY(G1RoughEnvCfg):
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
from omni.isaac.lab.managers import RewardTermCfg as RewTerm from omni.isaac.lab.managers import RewardTermCfg as RewTerm
from omni.isaac.lab.managers import SceneEntityCfg from omni.isaac.lab.managers import SceneEntityCfg
from omni.isaac.lab.managers import TerminationTermCfg as DoneTerm
from omni.isaac.lab.utils import configclass from omni.isaac.lab.utils import configclass
import omni.isaac.lab_tasks.manager_based.locomotion.velocity.mdp as mdp import omni.isaac.lab_tasks.manager_based.locomotion.velocity.mdp as mdp
...@@ -71,21 +70,9 @@ class H1Rewards(RewardsCfg): ...@@ -71,21 +70,9 @@ class H1Rewards(RewardsCfg):
) )
@configclass
class TerminationsCfg:
"""Termination terms for the MDP."""
time_out = DoneTerm(func=mdp.time_out, time_out=True)
base_contact = DoneTerm(
func=mdp.illegal_contact,
params={"sensor_cfg": SceneEntityCfg("contact_forces", body_names=".*torso_link"), "threshold": 1.0},
)
@configclass @configclass
class H1RoughEnvCfg(LocomotionVelocityRoughEnvCfg): class H1RoughEnvCfg(LocomotionVelocityRoughEnvCfg):
rewards: H1Rewards = H1Rewards() rewards: H1Rewards = H1Rewards()
terminations: TerminationsCfg = TerminationsCfg()
def __post_init__(self): def __post_init__(self):
# post init of parent # post init of parent
...@@ -127,6 +114,9 @@ class H1RoughEnvCfg(LocomotionVelocityRoughEnvCfg): ...@@ -127,6 +114,9 @@ class H1RoughEnvCfg(LocomotionVelocityRoughEnvCfg):
self.commands.base_velocity.ranges.lin_vel_y = (0.0, 0.0) self.commands.base_velocity.ranges.lin_vel_y = (0.0, 0.0)
self.commands.base_velocity.ranges.ang_vel_z = (-1.0, 1.0) self.commands.base_velocity.ranges.ang_vel_z = (-1.0, 1.0)
# terminations
self.terminations.base_contact.params["sensor_cfg"].body_names = ".*torso_link"
@configclass @configclass
class H1RoughEnvCfg_PLAY(H1RoughEnvCfg): class H1RoughEnvCfg_PLAY(H1RoughEnvCfg):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment