Improve the implementation of euler_xyz_from_quat #2365
+62
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:rewards.py#L17
.quadcopter_env_v1.py#L219
.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 naturally outputs angles within the (−π, π] range.We also introduced a new parameter,
wrap_to_2pi: bool = False
. Setting this parameter toTrue
will maintain the previous behavior:wrap_to_2pi=False
): Angles returned in the range (−π, π].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
wrap_to_2pi
for optional wrapping.Fixes #2364
Type of Change
Checklist
./isaaclab.sh --format
and all pre-commit checks passwrap_to_2pi
parameterconfig/extension.toml
CONTRIBUTORS.md