[FEATURE] Add relative quaternion getter#2765
Open
Travor278 wants to merge 1 commit intoGenesis-Embodied-AI:mainfrom
Open
[FEATURE] Add relative quaternion getter#2765Travor278 wants to merge 1 commit intoGenesis-Embodied-AI:mainfrom
Travor278 wants to merge 1 commit intoGenesis-Embodied-AI:mainfrom
Conversation
Author
|
@codex review |
6 tasks
|
Codex Review: Didn't find any major issues. Swish! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Adds a keyword-only
relativeparameter toKinematicEntity.get_quat(). Whenrelative=True, the method returns the base link orientation relative to the entity's initial quaternion. The default remainsrelative=False, so existing calls toget_quat()andget_quat(envs_idx)keep returning the same absolute quaternion as before.The relative getter mirrors the existing
set_quat(..., relative=True)behavior by using the same initial base-link quaternion reference as the setter, including per-environment initial quaternions for heterogeneous variants. The returned quaternion satisfiesabs_quat == transform_quat_by_quat(init_quat, delta).Related Issue
Resolves #2730
Motivation and Context
set_quat()already supports applying quaternions relative to the initial orientation, which is useful for domain randomization and RL observation pipelines. Without the matching getter, users have to manually track the initial quaternion and repeat the inverse-composition math in their own scripts.This change makes the API more symmetric, reduces boilerplate quaternion math for users, and keeps the absolute-orientation getter as the backwards-compatible default.
How Has This Been / Can This Be Tested?
The root-pose coverage now checks both the new relative path and the old absolute path:
get_quat(relative=True)returns the expected relative quaternion after both relative and absoluteset_quat()calls.get_quat(relative=False)matchesget_quat(), preserving the previous default behavior.Additional regression coverage verifies that:
envs_idxsubsetting keeps the relative getter aligned with the selected environments;batch_links_info=True;qpos0entries.Validated locally with Python 3.12.13:
Results:
tests/test_rigid_physics.py::test_merge_entities: 4 passedChecklist:
Submitting Code Changessection of CONTRIBUTING document.