• robotsfan's avatar
    Corrects calculation of target height adjustment based on sensor data (#1710) · 21173c3e
    robotsfan authored
    # 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
    21173c3e
Name
Last commit
Last update
.aws Loading commit data...
.github Loading commit data...
.vscode Loading commit data...
docker Loading commit data...
docs Loading commit data...
source Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.flake8 Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.pre-commit-config.yaml Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS.md Loading commit data...
LICENSE Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...
isaaclab.bat Loading commit data...
isaaclab.sh Loading commit data...
pyproject.toml Loading commit data...