From e2ecc151208a51e473abb0ee43acc15c47e6a883 Mon Sep 17 00:00:00 2001 From: Hany Hamed Date: Mon, 10 Nov 2025 14:28:09 +0100 Subject: [PATCH 1/3] Fix root_height_below_minimum for rough terrain similar to rewards.base_height_l2 --- source/isaaclab/isaaclab/envs/mdp/terminations.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/source/isaaclab/isaaclab/envs/mdp/terminations.py b/source/isaaclab/isaaclab/envs/mdp/terminations.py index a13ce9bb4a2..81998e5016a 100644 --- a/source/isaaclab/isaaclab/envs/mdp/terminations.py +++ b/source/isaaclab/isaaclab/envs/mdp/terminations.py @@ -16,7 +16,7 @@ from isaaclab.assets import Articulation, RigidObject from isaaclab.managers import SceneEntityCfg -from isaaclab.sensors import ContactSensor +from isaaclab.sensors import ContactSensor, RayCaster if TYPE_CHECKING: from isaaclab.envs import ManagerBasedRLEnv @@ -65,11 +65,16 @@ def root_height_below_minimum( """Terminate when the asset's root height is below the minimum height. Note: - This is currently only supported for flat terrains, i.e. the minimum height is in the world frame. + For rough terrain, sensor readings can adjust the asset height to account for the terrain. """ # extract the used quantities (to enable type-hinting) asset: RigidObject = env.scene[asset_cfg.name] - return asset.data.root_pos_w[:, 2] < minimum_height + asset_height = asset.data.root_pos_w[:, 2] + if sensor_cfg is not None: + sensor: RayCaster = env.scene[sensor_cfg.name] + # Adjust the asset height using the sensor data + asset_height = asset_height - torch.mean(sensor.data.ray_hits_w[..., 2], dim=1) + return asset_height < minimum_height """ From ed2e799c90331cb4d58b46a40a83350a8fc52307 Mon Sep 17 00:00:00 2001 From: hany606 Date: Mon, 10 Nov 2025 14:42:33 +0100 Subject: [PATCH 2/3] hotfix --- source/isaaclab/isaaclab/envs/mdp/terminations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/isaaclab/isaaclab/envs/mdp/terminations.py b/source/isaaclab/isaaclab/envs/mdp/terminations.py index 81998e5016a..6780799fb40 100644 --- a/source/isaaclab/isaaclab/envs/mdp/terminations.py +++ b/source/isaaclab/isaaclab/envs/mdp/terminations.py @@ -60,7 +60,10 @@ def bad_orientation( def root_height_below_minimum( - env: ManagerBasedRLEnv, minimum_height: float, asset_cfg: SceneEntityCfg = SceneEntityCfg("robot") + env: ManagerBasedRLEnv, + minimum_height: float, + asset_cfg: SceneEntityCfg = SceneEntityCfg("robot"), + sensor_cfg: SceneEntityCfg | None = None, ) -> torch.Tensor: """Terminate when the asset's root height is below the minimum height. From f57073e2bf7132d80755dab92e26e82b872d3559 Mon Sep 17 00:00:00 2001 From: hany606 Date: Mon, 10 Nov 2025 14:46:20 +0100 Subject: [PATCH 3/3] Added my name to the CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 8491f2647a4..73c036af247 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -67,6 +67,7 @@ Guidelines for modifications: * Felix Yu * Gary Lvov * Giulio Romualdi +* Hany Hamed * Haoran Zhou * Harsh Patel * HoJin Jeon