Skip to content

Changes Quaternion convention from WXYZ to XYZW#4437

Merged
kellyguo11 merged 39 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/quat
Jan 30, 2026
Merged

Changes Quaternion convention from WXYZ to XYZW#4437
kellyguo11 merged 39 commits into
isaac-sim:developfrom
AntoineRichard:antoiner/quat

Conversation

@AntoineRichard

@AntoineRichard AntoineRichard commented Jan 22, 2026

Copy link
Copy Markdown
Collaborator

Description

Changes the quaternion convention in IsaacLab to match that of:

  • ROS
  • PhysX
  • Newton
  • Scipy
  • Low level USD

Fixes https://github.com/isaac-sim/IsaacLab-Internal/issues/744

This PR brings massive changes throughout the code base. Almost all users should expect their code to be impacted by these changes. We provide a tool that should help users navigate these changes.

./scripts/tools/find_quaternions.py provides users with an automated script to search throughout the code base some quaternions that do not differ between the current code and a given commit. This can be used to track if your code has changed the order of its hard-coded quaternions.

For instance running the following will show all the quaternions that might need to be updated inside your extension. The dry-run flag will make it so that the script does not attempt to modify the quaternions.

./scripts/tools/find_quaternions.py --path PATH_TO_YOUR_EXTENSION --all-quats --fix --context 4 --dry-run

If you want to modify the quaternions the script comes with an interactive mode where it prompts you with changes to be made, to do so remove the --dry-run flag:

./scripts/tools/find_quaternions.py --path PATH_TO_YOUR_EXTENSION --all-quats --fix --context 4

The --context flag provides more or less context before and after the line where a quaternion was found.

Here is a sample of the interactive mode:

Searching 968 Python, 11 JSON, and 6 RST files...
Comparing against: main
Found 178 files changed from main

Found 69 potential quaternions to review:

====================================================================================================

────────────────────────────────────────────────────────────────────────────────
📍 source/isaaclab_assets/isaaclab_assets/robots/anymal.py:173 [AMBIGUOUS]
────────────────────────────────────────────────────────────────────────────────
     169 | # Configuration - Sensors.
     170 | ##
     171 | 
     172 | ANYMAL_LIDAR_CFG = VELODYNE_VLP_16_RAYCASTER_CFG.replace(
>>>  173 |     offset=RayCasterCfg.OffsetCfg(pos=(-0.310, 0.000, 0.159), rot=(0.0, 0.0, 0.0, 1.0))
     174 | )
     175 | """Configuration for the Velodyne VLP-16 sensor mounted on the ANYmal robot's base."""
────────────────────────────────────────────────────────────────────────────────
  Change: [0.0, 0.0, 0.0, 1.0] → [0.0, 0.0, 1.0, 0.0]
  Result: offset=RayCasterCfg.OffsetCfg(pos=(-0.310, 0.000, 0.159), rot=(0.0, 0.0, 1.0, 0.0))
Apply this fix? [Y/n/a/q]: Y
  ✅ Fixed!

────────────────────────────────────────────────────────────────────────────────
📍 source/isaaclab_mimic/test/test_curobo_planner_franka.py:42 [AMBIGUOUS]
────────────────────────────────────────────────────────────────────────────────
      38 | 
      39 | # Predefined EE goals for the test
      40 | # Each entry is a tuple of: (goal specification, goal ID)
      41 | predefined_ee_goals_and_ids = [
>>>   42 |     ({"pos": [0.70, -0.25, 0.25], "quat": [0.0, 0.707, 0.0, 0.707]}, "Behind wall, left"),
      43 |     ({"pos": [0.70, 0.25, 0.25], "quat": [0.0, 0.707, 0.0, 0.707]}, "Behind wall, right"),
      44 |     ({"pos": [0.65, 0.0, 0.45], "quat": [1.0, 0.0, 0.0, 0.0]}, "Behind wall, center, high"),
      45 |     ({"pos": [0.80, -0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far left"),
      46 |     ({"pos": [0.80, 0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far right"),
────────────────────────────────────────────────────────────────────────────────
  Change: [0.0, 0.707, 0.0, 0.707] → [0.707, 0.0, 0.707, 0.0]
  Result: ({"pos": [0.70, -0.25, 0.25], "quat": [0.707, 0.0, 0.707, 0.0]}, "Behind wall, left"),
Apply this fix? [Y/n/a/q]: Y
  ✅ Fixed!

────────────────────────────────────────────────────────────────────────────────
📍 source/isaaclab_mimic/test/test_curobo_planner_franka.py:43 [AMBIGUOUS]
────────────────────────────────────────────────────────────────────────────────
      39 | # Predefined EE goals for the test
      40 | # Each entry is a tuple of: (goal specification, goal ID)
      41 | predefined_ee_goals_and_ids = [
      42 |     ({"pos": [0.70, -0.25, 0.25], "quat": [0.707, 0.0, 0.707, 0.0]}, "Behind wall, left"),
>>>   43 |     ({"pos": [0.70, 0.25, 0.25], "quat": [0.0, 0.707, 0.0, 0.707]}, "Behind wall, right"),
      44 |     ({"pos": [0.65, 0.0, 0.45], "quat": [1.0, 0.0, 0.0, 0.0]}, "Behind wall, center, high"),
      45 |     ({"pos": [0.80, -0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far left"),
      46 |     ({"pos": [0.80, 0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far right"),
      47 | ]
────────────────────────────────────────────────────────────────────────────────
  Change: [0.0, 0.707, 0.0, 0.707] → [0.707, 0.0, 0.707, 0.0]
  Result: ({"pos": [0.70, 0.25, 0.25], "quat": [0.707, 0.0, 0.707, 0.0]}, "Behind wall, right"),
Apply this fix? [Y/n/a/q]: Y
  ✅ Fixed!

Type of change

  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Checklist

  • I have read and understood the contribution guidelines
  • 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

@github-actions github-actions Bot added documentation Improvements or additions to documentation asset New asset feature or request isaac-mimic Related to Isaac Mimic team labels Jan 22, 2026
@AntoineRichard AntoineRichard marked this pull request as ready for review January 23, 2026 13:49
@greptile-apps

greptile-apps Bot commented Jan 23, 2026

Copy link
Copy Markdown
Contributor

Skipped: This PR changes more files than the configured file change limit: (142 files found, 100 file limit)

Comment thread scripts/environments/state_machine/lift_cube_sm.py Outdated
Comment thread source/isaaclab/isaaclab/assets/deformable_object/deformable_object_data.py Outdated
@kellyguo11

Copy link
Copy Markdown
Contributor

@njawale42 @peterd-NV @michaellin6 fyi - we'll likely need to update the curobo, mimic, and IK tests with these changes.

@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

@ooctipus could you check the fabric stuff? I think I may have used the wrong ordering, but it still passes the tests somehow?

@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

@kellyguo11 Looks like the regular test suites are passing. Do you know if we could run the whole set of tests on this PR?

@Mayankm96 Mayankm96 changed the title Quaternion convention change from WXYZ to XYZW Changes Quaternion convention from WXYZ to XYZW Jan 26, 2026
@ooctipus

ooctipus commented Jan 26, 2026

Copy link
Copy Markdown
Collaborator

I think fabric looks right!

@kellyguo11

Copy link
Copy Markdown
Contributor

latest CI run seems to have a lot more test failures in the camera classes and test_views_xform_prim and some other places. are these from recent updates to develop? also linter check is failing.

@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

I just merged develop and fixed a couple things. It looks like almost everything is passing now?

@michaellin6

Copy link
Copy Markdown
Contributor

I took a quick look at the Pink IK related tests and env scripts, and the quat conventions have been updated correctly. If test_pink_ik.py is passing then it should be good on that side.

@kellyguo11

Copy link
Copy Markdown
Contributor

Thanks @michaellin6! looks like all the other failing ones are in the mimic extension now, we can probably disable those until mimic migrates to 3.0.

not sure why the factory environment test is timing out though. does that one run fine locally?

@kellyguo11

Copy link
Copy Markdown
Contributor

@AntoineRichard submitted a fix to your branch for the factory environments - AntoineRichard#6. let's merge this in once that's there

Fixes quaternion issues with factory environments
@AntoineRichard

Copy link
Copy Markdown
Collaborator Author

@AntoineRichard submitted a fix to your branch for the factory environments - AntoineRichard#6. let's merge this in once that's there

Thanks @kellyguo11 . It looks like they use the isaacsim math utils. Should we ask someone to change to our internal helpers?

@AntoineRichard

AntoineRichard commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator Author

Looks like the tests are getting datasets generate in WXYZ formats :/. I can make a utility to help convert the old datasets, but eventually we'll have to regenerate them. @kellyguo11

AntoineRichard and others added 2 commits January 30, 2026 16:23
@kellyguo11 kellyguo11 merged commit 9659a5c into isaac-sim:develop Jan 30, 2026
5 of 9 checks passed
daniela-hase pushed a commit to daniela-hase/IsaacLab that referenced this pull request Mar 30, 2026
# Description

Changes the quaternion convention in IsaacLab to match that of:
- ROS
- PhysX
- Newton
- Scipy
- Low level USD

Fixes isaac-sim/IsaacLab-Internal#744 

This PR brings massive changes throughout the code base. Almost all
users should expect their code to be impacted by these changes. We
provide a tool that should help users navigate these changes.

`./scripts/tools/find_quaternions.py` provides users with an automated
script to search throughout the code base some quaternions that do not
differ between the current code and a given commit. This can be used to
track if your code has changed the order of its hard-coded quaternions.

For instance running the following will show all the quaternions that
might need to be updated inside your extension. The dry-run flag will
make it so that the script does not attempt to modify the quaternions.
```
./scripts/tools/find_quaternions.py --path PATH_TO_YOUR_EXTENSION --all-quats --fix --context 4 --dry-run
```
If you want to modify the quaternions the script comes with an
interactive mode where it prompts you with changes to be made, to do so
remove the `--dry-run` flag:
```
./scripts/tools/find_quaternions.py --path PATH_TO_YOUR_EXTENSION --all-quats --fix --context 4
```
The `--context` flag provides more or less context before and after the
line where a quaternion was found.


Here is a sample of the interactive mode:
```shell
Searching 968 Python, 11 JSON, and 6 RST files...
Comparing against: main
Found 178 files changed from main

Found 69 potential quaternions to review:

====================================================================================================

────────────────────────────────────────────────────────────────────────────────
📍 source/isaaclab_assets/isaaclab_assets/robots/anymal.py:173 [AMBIGUOUS]
────────────────────────────────────────────────────────────────────────────────
     169 | # Configuration - Sensors.
     170 | ##
     171 | 
     172 | ANYMAL_LIDAR_CFG = VELODYNE_VLP_16_RAYCASTER_CFG.replace(
>>>  173 |     offset=RayCasterCfg.OffsetCfg(pos=(-0.310, 0.000, 0.159), rot=(0.0, 0.0, 0.0, 1.0))
     174 | )
     175 | """Configuration for the Velodyne VLP-16 sensor mounted on the ANYmal robot's base."""
────────────────────────────────────────────────────────────────────────────────
  Change: [0.0, 0.0, 0.0, 1.0] → [0.0, 0.0, 1.0, 0.0]
  Result: offset=RayCasterCfg.OffsetCfg(pos=(-0.310, 0.000, 0.159), rot=(0.0, 0.0, 1.0, 0.0))
Apply this fix? [Y/n/a/q]: Y
  ✅ Fixed!

────────────────────────────────────────────────────────────────────────────────
📍 source/isaaclab_mimic/test/test_curobo_planner_franka.py:42 [AMBIGUOUS]
────────────────────────────────────────────────────────────────────────────────
      38 | 
      39 | # Predefined EE goals for the test
      40 | # Each entry is a tuple of: (goal specification, goal ID)
      41 | predefined_ee_goals_and_ids = [
>>>   42 |     ({"pos": [0.70, -0.25, 0.25], "quat": [0.0, 0.707, 0.0, 0.707]}, "Behind wall, left"),
      43 |     ({"pos": [0.70, 0.25, 0.25], "quat": [0.0, 0.707, 0.0, 0.707]}, "Behind wall, right"),
      44 |     ({"pos": [0.65, 0.0, 0.45], "quat": [1.0, 0.0, 0.0, 0.0]}, "Behind wall, center, high"),
      45 |     ({"pos": [0.80, -0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far left"),
      46 |     ({"pos": [0.80, 0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far right"),
────────────────────────────────────────────────────────────────────────────────
  Change: [0.0, 0.707, 0.0, 0.707] → [0.707, 0.0, 0.707, 0.0]
  Result: ({"pos": [0.70, -0.25, 0.25], "quat": [0.707, 0.0, 0.707, 0.0]}, "Behind wall, left"),
Apply this fix? [Y/n/a/q]: Y
  ✅ Fixed!

────────────────────────────────────────────────────────────────────────────────
📍 source/isaaclab_mimic/test/test_curobo_planner_franka.py:43 [AMBIGUOUS]
────────────────────────────────────────────────────────────────────────────────
      39 | # Predefined EE goals for the test
      40 | # Each entry is a tuple of: (goal specification, goal ID)
      41 | predefined_ee_goals_and_ids = [
      42 |     ({"pos": [0.70, -0.25, 0.25], "quat": [0.707, 0.0, 0.707, 0.0]}, "Behind wall, left"),
>>>   43 |     ({"pos": [0.70, 0.25, 0.25], "quat": [0.0, 0.707, 0.0, 0.707]}, "Behind wall, right"),
      44 |     ({"pos": [0.65, 0.0, 0.45], "quat": [1.0, 0.0, 0.0, 0.0]}, "Behind wall, center, high"),
      45 |     ({"pos": [0.80, -0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far left"),
      46 |     ({"pos": [0.80, 0.15, 0.35], "quat": [0.0, 0.5, 0.0, 0.866]}, "Behind wall, far right"),
      47 | ]
────────────────────────────────────────────────────────────────────────────────
  Change: [0.0, 0.707, 0.0, 0.707] → [0.707, 0.0, 0.707, 0.0]
  Result: ({"pos": [0.70, 0.25, 0.25], "quat": [0.707, 0.0, 0.707, 0.0]}, "Behind wall, right"),
Apply this fix? [Y/n/a/q]: Y
  ✅ Fixed!
```


## Type of change

- Breaking change (existing functionality will not work without user
modification)
- Documentation update


## Checklist

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [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

---------

Signed-off-by: Kelly Guo <kellyg@nvidia.com>
Co-authored-by: Kelly Guo <kellyg@nvidia.com>
kellyguo11 added a commit that referenced this pull request May 27, 2026
…#5754)

# Description


`scripts/imitation_learning/locomanipulation_sdg/gr00t/convert_dataset.py`
still passed `scalar_first=True` to `Rotation.from_quat` / `as_quat`,
but
since #4437 (Jan 2026) Isaac Lab returns body poses in XYZW. The script
therefore mis-interpreted recorded poses as WXYZ, corrupting every
relative-pose computation (hands, object, fixture, goal) in the GR00T
training data and causing trained policies to produce twisted-arm
rollouts.

<!-- As a practice, it is recommended to open an issue to have
discussions on the proposed pull request.
This makes it easier for the community to keep track of what is being
developed or added, and if a given feature
is demanded by more than one party. -->

## Type of change

<!-- As you go through the list, delete the ones that are not
applicable. -->

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

## Screenshots

Please attach before and after screenshots of the change if applicable.

<!--
Example:

| Before | After |
| ------ | ----- |
| _gif/png before_ | _gif/png after_ |

To upload images to a PR -- simply drag and drop an image while in edit
mode and it should upload the image directly. You can then paste that
source into the above before/after sections.
-->

## Checklist

- [ ] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [ ] I have run the [`pre-commit` checks](https://pre-commit.com/) 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

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

Co-authored-by: Kelly Guo <kellyg@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

asset New asset feature or request documentation Improvements or additions to documentation infrastructure isaac-mimic Related to Isaac Mimic team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants