Unverified Commit 478e914f authored by Octi Zhang's avatar Octi Zhang Committed by GitHub

Fixes orientation resampling logic in reset_root_state_uniform event (#486)

The event reset_root_state_uniform had two different logics for setting position and orientation:
```
positions = root_states[:, 0:3] + env.scene.env_origins[env_ids] + rand_samples[:, 0:3]
orientations = math_utils.quat_from_euler_xyz(rand_samples[:, 3], rand_samples[:, 4], rand_samples[:, 5])
```
where the position is set by adding the random samples to the default root states, but the orientation was set as an absolute value.

Both orientation and position are now relative offsets.

## 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 run all the tests with `./isaaclab.sh --test` and they pass
- [x] 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
parent a8fb6b04
...@@ -51,6 +51,7 @@ Guidelines for modifications: ...@@ -51,6 +51,7 @@ Guidelines for modifications:
* Rosario Scalise * Rosario Scalise
* Shafeef Omar * Shafeef Omar
* Vladimir Fokow * Vladimir Fokow
* Zhengyu Zhang
## Acknowledgements ## Acknowledgements
......
[package] [package]
# Note: Semantic Versioning is used: https://semver.org/ # Note: Semantic Versioning is used: https://semver.org/
version = "0.17.12" version = "0.17.13"
# Description # Description
title = "Isaac Lab framework for Robot Learning" title = "Isaac Lab framework for Robot Learning"
......
Changelog Changelog
--------- ---------
0.17.13 (2024-06-13)
~~~~~~~~~~~~~~~~~~~~
Fixed
^^^^^
* Fixed the orientation reset logic in :func:`omni.isaac.lab.envs.mdp.events.reset_root_state_uniform` to make it relative to the default orientation.
Earlier, the position was sampled relative to the default and the orientation not.
0.17.12 (2024-06-13) 0.17.12 (2024-06-13)
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
......
...@@ -230,7 +230,7 @@ class Articulation(RigidObject): ...@@ -230,7 +230,7 @@ class Articulation(RigidObject):
) -> tuple[list[int], list[str]]: ) -> tuple[list[int], list[str]]:
"""Find fixed tendons in the articulation based on the name keys. """Find fixed tendons in the articulation based on the name keys.
Please see the :func:`omni.isaac.orbit.utils.string.resolve_matching_names` function for more information Please see the :func:`omni.isaac.lab.utils.string.resolve_matching_names` function for more information
on the name matching. on the name matching.
Args: Args:
......
...@@ -611,8 +611,8 @@ def reset_root_state_uniform( ...@@ -611,8 +611,8 @@ def reset_root_state_uniform(
rand_samples = math_utils.sample_uniform(ranges[:, 0], ranges[:, 1], (len(env_ids), 6), device=asset.device) rand_samples = math_utils.sample_uniform(ranges[:, 0], ranges[:, 1], (len(env_ids), 6), device=asset.device)
positions = root_states[:, 0:3] + env.scene.env_origins[env_ids] + rand_samples[:, 0:3] positions = root_states[:, 0:3] + env.scene.env_origins[env_ids] + rand_samples[:, 0:3]
orientations = math_utils.quat_from_euler_xyz(rand_samples[:, 3], rand_samples[:, 4], rand_samples[:, 5]) orientations_delta = math_utils.quat_from_euler_xyz(rand_samples[:, 3], rand_samples[:, 4], rand_samples[:, 5])
orientations = math_utils.quat_mul(root_states[:, 3:7], orientations_delta)
# velocities # velocities
range_list = [velocity_range.get(key, (0.0, 0.0)) for key in ["x", "y", "z", "roll", "pitch", "yaw"]] range_list = [velocity_range.get(key, (0.0, 0.0)) for key in ["x", "y", "z", "roll", "pitch", "yaw"]]
ranges = torch.tensor(range_list, device=asset.device) ranges = torch.tensor(range_list, device=asset.device)
......
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