Skip to content

Conversation

fan-ziqi
Copy link
Contributor

Description

Corrected calculation of target height adjustment based on sensor data.

Fixes #1546 and #1698

Thanks to @ClemensSchwarke and @shendredm for the modification suggestions. To use this base_height_l2 reward function, users need to make the following changes:

  1. Customize a new sensor
class MySceneCfg(InteractiveSceneCfg):
    height_scanner_base = RayCasterCfg(
        prim_path="{ENV_REGEX_NS}/Robot/base",
        offset=RayCasterCfg.OffsetCfg(pos=(0.0, 0.0, 20.0)),
        attach_yaw_only=True,
        pattern_cfg=patterns.GridPatternCfg(resolution=0.05, size=(0.1, 0.1)),
        debug_vis=False,
        mesh_prim_paths=["/World/ground"],
    )
  1. Pass this new sensor to the reward function
class RewardsCfg:
    base_height_l2 = RewTerm(
        func=mdp.base_height_l2,
        weight=0.0,
        params={
            "asset_cfg": SceneEntityCfg("robot", body_names=""),
            "sensor_cfg": SceneEntityCfg("height_scanner_base"),
            "target_height": 0.0,
        },
    )

This will create a 10 by 10 cm patch consisting of 9 rays and should provide a good estimate of the ground height at the robot's position.

Type of change

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

Checklist

  • I have run the pre-commit checks with ./isaaclab.sh --format
  • I have made corresponding changes to the documentation
  • 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
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@kellyguo11 kellyguo11 changed the title hotfix: corrected calculation of target height adjustment based on sensor data Corrects calculation of target height adjustment based on sensor data Jan 22, 2025
@kellyguo11 kellyguo11 merged commit 21173c3 into isaac-sim:main Jan 22, 2025
5 checks passed
jtigue-bdai pushed a commit that referenced this pull request Apr 14, 2025
…#1710)

# Description

Corrected calculation of target height adjustment based on sensor data.

Fixes #1546 and #1698

Thanks to @ClemensSchwarke and @shendredm for the modification
suggestions. To use this `base_height_l2` reward function, users need to
make the following changes:

1. Customize a new sensor

```python
class MySceneCfg(InteractiveSceneCfg):
    height_scanner_base = RayCasterCfg(
        prim_path="{ENV_REGEX_NS}/Robot/base",
        offset=RayCasterCfg.OffsetCfg(pos=(0.0, 0.0, 20.0)),
        attach_yaw_only=True,
        pattern_cfg=patterns.GridPatternCfg(resolution=0.05, size=(0.1, 0.1)),
        debug_vis=False,
        mesh_prim_paths=["/World/ground"],
    )
```

2. Pass this new sensor to the reward function

```python
class RewardsCfg:
    base_height_l2 = RewTerm(
        func=mdp.base_height_l2,
        weight=0.0,
        params={
            "asset_cfg": SceneEntityCfg("robot", body_names=""),
            "sensor_cfg": SceneEntityCfg("height_scanner_base"),
            "target_height": 0.0,
        },
    )
```

This will create a 10 by 10 cm patch consisting of 9 rays and should
provide a good estimate of the ground height at the robot's position.

## 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
SevenFo pushed a commit to SevenFo/IsaacLab that referenced this pull request May 19, 2025
…isaac-sim#1710)

# Description

Corrected calculation of target height adjustment based on sensor data.

Fixes isaac-sim#1546 and isaac-sim#1698

Thanks to @ClemensSchwarke and @shendredm for the modification
suggestions. To use this `base_height_l2` reward function, users need to
make the following changes:

1. Customize a new sensor

```python
class MySceneCfg(InteractiveSceneCfg):
    height_scanner_base = RayCasterCfg(
        prim_path="{ENV_REGEX_NS}/Robot/base",
        offset=RayCasterCfg.OffsetCfg(pos=(0.0, 0.0, 20.0)),
        attach_yaw_only=True,
        pattern_cfg=patterns.GridPatternCfg(resolution=0.05, size=(0.1, 0.1)),
        debug_vis=False,
        mesh_prim_paths=["/World/ground"],
    )
```

2. Pass this new sensor to the reward function

```python
class RewardsCfg:
    base_height_l2 = RewTerm(
        func=mdp.base_height_l2,
        weight=0.0,
        params={
            "asset_cfg": SceneEntityCfg("robot", body_names=""),
            "sensor_cfg": SceneEntityCfg("height_scanner_base"),
            "target_height": 0.0,
        },
    )
```

This will create a 10 by 10 cm patch consisting of 9 rays and should
provide a good estimate of the ground height at the robot's position.

## 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Question] Base_heght_l2 dynamic target height issue

2 participants