-
Shaoshu Su authored
## Description Previously, `euler_xyz_from_quat` returned Euler angles in the [0, 2π) range, which is uncommon in robotics applications. As a result, several users implemented their own workarounds to adjust the angle range to (−π, π]. Examples include: - **Isaac-RL-Two-wheel-Legged-Bot**: Custom unwrapping implemented in [`rewards.py#L17`](https://github.com/jaykorea/Isaac-RL-Two-wheel-Legged-Bot/blob/057f81ed3aa4aff91551fce5c54256e47cece29a/lab/flamingo/tasks/constraint_based/locomotion/velocity/mdp/rewards.py#L17). - **lorenzo-bianchi/IsaacLab**: Manual angle shifting in [`quadcopter_env_v1.py#L219`](https://github.com/lorenzo-bianchi/IsaacLab/blob/247f66db3691046ecdfecb311268eccc729048ec/source/extensions/omni.isaac.lab_tasks/omni/isaac/lab_tasks/direct/quadcopter/quadcopter_env_v1.py#L219). - **kscalelabs/klab**: Custom angle normalization in [`imu.py#L17`](https://github.com/kscalelabs/klab/blob/edf749f5177ba296a076d13380cd0fb1e5846e3f/exts/zbot2/zbot2/tasks/locomotion/velocity/mdp/imu.py#L17). To address this issue, we have updated the default angle range from [0, 2π) to (−π, π] by removing the `% (2 * torch.pi)` operation at the return statement, since the [atan2 function](https://en.wikipedia.org/wiki/Atan2) naturally outputs angles within the (−π, π] range. We also introduced a new parameter, `wrap_to_2pi: bool = False`. Setting this parameter to `True` will maintain the previous behavior: - **Default (`wrap_to_2pi=False`)**: Angles returned in the range (−π, π]. - **Optional (`wrap_to_2pi=True`)**: Angles wrapped in the original [0, 2π) range. Additionally, multiple test samples have been added to evaluate and ensure performance and accuracy across different scenarios. ### What’s Changed - **Default behavior** updated to (−π, π] (non-breaking). - **New argument** `wrap_to_2pi` for optional wrapping. - **Unit tests** added for both wrapped and unwrapped outputs. --- Fixes https://github.com/isaac-sim/IsaacLab/issues/2364 ## Type of Change - **Enhancement** (non-breaking addition of functionality) --- ## Checklist - [x] Ran `./isaaclab.sh --format` and all pre-commit checks pass - [x] Updated docstrings to describe `wrap_to_2pi` parameter - [x] Added tests covering both wrapped and unwrapped outputs - [x] No new warnings introduced - [ ] Updated changelog and bumped version in `config/extension.toml` - [x] Confirmed my name is listed in `CONTRIBUTORS.md` --------- Co-authored-by:
Kelly Guo <kellyg@nvidia.com>