Repository navigation
Fix FORGE wrench transforms and PhysX joint-wrench frames - #7967
Conversation
change_FT_frame applied the rotation of the target pose in the source frame instead of its transpose, and shifted the torque with the wrong lever-arm sign. Express the source pose in the target frame and apply the wrench transform from Modern Robotics eq. 3.95. The FORGE force observation is unchanged: the environment passes identity rotations and only consumes the force components. Fixes isaac-sim#3513 Signed-off-by: Lynn <[email protected]>
There was a problem hiding this comment.
Isaac Lab Review Bot
The wrench transform correction and regression coverage are coherent, but the updated frame-convention documentation retains an incorrect quaternion ordering that should be fixed before merge.
- Design and architecture: The implementation remains localized to the FORGE helper and preserves its signature and tuple ordering. Computing the source pose in the target frame with
subtract_frame_transformsmatches the wrench transformation exercised by the point-force reference test. - API: The updated docstring labels frame quaternions as
quat_xyzw, whilesubtract_frame_transforms,quat_apply, and the test inputs use Isaac Lab's scalar-first(w, x, y, z)convention. Change both frame tuple descriptions toquat_wxyzto avoid misleading callers. - Implementation: The revised force and torque calculations consistently use the source pose expressed in the target frame, and the tests cover both translated identity-axis frames and independently rotated frames. The remaining issue is confined to the documented input contract.
Minor fixes needed. Posted 1 actionable finding inline.
Automated review; human maintainers own approval decisions.
| target_frame: Tuple of (quat_xyzw, pos) for target frame. | ||
| source_F: Force in source frame [N]. Shape is (N, 3). | ||
| source_T: Torque in source frame, about the source frame's origin [N·m]. Shape is (N, 3). | ||
| source_frame: Tuple of (quat_xyzw, pos) for source frame, both expressed in a common frame. |
There was a problem hiding this comment.
🔵 Suggestion · Api — Docstring states wrong quaternion ordering
The rewritten Args block documents the frame tuples as (quat_xyzw, pos), but these quaternions are passed to subtract_frame_transforms and quat_apply, which use Isaac Lab's scalar-first (w, x, y, z) ordering; the new test correspondingly feeds quat_from_matrix output. Since these lines are being rewritten specifically to state the frame conventions, document them as (quat_wxyz, pos) so callers do not silently pass the wrong layout.
There was a problem hiding this comment.
I believe (quat_xyzw, pos) is correct on develop. The math utilities use scalar-last ordering: quat_apply documents "The quaternion in (x, y, z, w)" (isaaclab/utils/math.py:640), subtract_frame_transforms/combine_frame_transforms document q01 as "(x, y, z, w)", quat_from_matrix returns "(x, y, z, w)", and the only caller (forge_env.py:109) builds the identity as [0, 0, 0, 1]. The regression test passes these through with random rotations and matches the point-force reference, which would not hold with the wrong ordering. So I have left the docstring as is.
|
|
run-ci |
|
run-ci |
|
Thank you @ooctipus for picking up the PhysX joint-wrench frame fix in this PR, for the shared physics-based frame test, and for getting it merged so quickly. I really appreciate it! One follow-up: the OVPhysX joint-wrench sensor ( |
# Description Follow-up to #7967, which fixed this for PhysX. The OVPhysX joint-wrench sensor had the same extra frame transform. OVPhysX reports `LINK_INCOMING_JOINT_FORCE` in the **child-side joint frame at the joint anchor**, the same convention as PhysX. `isaaclab_ov/sensors/joint_wrench/kernels.py` treated that reading as "body1's frame at body1's origin" and shifted/rotated it again by the child joint pose (`localPos1`/`localRot1`). Readings were therefore wrong whenever that pose was not identity. This PR mirrors the PhysX correction in #7967 and makes the physical contract explicit across all three backends: - The OVPhysX split kernel passes force and torque through; unused USD joint-frame buffers are removed. - The shared `test_joint_wrench_frame` lives in `source/isaaclab/test/sensors/joint_wrench_contract.py`. Newton, PhysX, and OVPhysX import it directly into their existing sensor suites and provide their existing `sim` fixtures, following the FrameView contract-test pattern. - The runtime test utility, forwarding test functions, and circular OVPhysX frame-transform test are removed. The same physical scene and analytic force/torque expectations remain shared. - A small structural test checks that every joint-wrench backend imports the shared tests, rejects backend dependencies in the contract, and prevents restoration of the old utility. - OVPhysX uses the existing `device_split` CI marker so CPU and CUDA cases run in separate processes instead of silently skipping one device. ## Measurement (OVPhysX 0.6.3, before this PR) The setup is a 0.5 kg tool welded to an arm. The tool's COM is 0.15 m past the wrist anchor. I authored the child and parent frames of the weld as below and compared the tool's reading with the analytic wrench. | Child joint frame | Sensor force | Sensor torque | Analytic (joint frame, at anchor) | Raw OVPhysX | |---|---|---|---|---| | identity | (0, 0, 4.905) | (0, -0.736, 0) | (0, 0, 4.905) / (0, -0.736, 0) | = analytic | | 90° about z | (0, 0, 4.905) | (0, **+0.736**, 0) | (0, 0, 4.905) / (-0.736, 0, 0) | = analytic | | anchor offset (lever 0.25 m) | (0, 0, 4.905) | (0, **-1.717**, 0) | (0, 0, 4.905) / (0, -1.226, 0) | = analytic | | 90° about z + offset | (0, 0, 4.905) | (**-0.491**, **1.226**, 0) | (0, 0, 4.905) / (-1.226, 0, 0) | = analytic | | 90° about x | (0, 0, **-4.905**) | (0, **0.736**, 0) | (0, 4.905, 0) / (0, 0, 0.736) | = analytic | In every case the raw OVPhysX tensor already matches the analytic wrench, and only the extra transform makes the sensor output wrong. With a 90° rotation about x, the reported force even points the wrong way. ## Type of change - Bug fix (non-breaking change which fixes an issue) - Readings change only for joints whose child frame is not identity. - The documented `incoming_joint_frame` convention is unchanged. ## Tests Local validation with OVPhysX 0.6.3, running backends in separate processes (CUDA on an RTX 5090): - Newton joint-wrench suite: 14 passed. - PhysX joint-wrench suite: 16 passed. - OVPhysX CPU pass (`-k 'cpu or not cuda'`): 12 passed, including the device-independent pre-init test. - OVPhysX CUDA pass (`-k cuda`): 11 passed. - Shared-contract structural gate: 1 passed. Removing the OVPhysX contract import makes it fail. - Restoring the original OVPhysX sensor and kernel makes the shared physical test fail on both CPU and CUDA with a maximum force-component error of 19.62 N. - File-by-file architecture audit and `uv run --no-sync isaaclab -f` passed. The physical scenario count is unchanged; the existing per-backend frame tests now collect the same test function. Full PR CI remains pending. ## Checklist - [x] I have read and understood the contribution guidelines - [x] I have run the `pre-commit` checks with `./isaaclab.sh --format` - [x] I have made corresponding changes to the documentation (kernel docstring) - [x] I have added tests that prove my fix is effective or that my feature works - [x] I have added a changelog fragment for every touched package - [x] I have added my name to the `CONTRIBUTORS.md` or my name already exists there cc @ooctipus --------- Signed-off-by: Lynn <[email protected]> Co-authored-by: Octi Zhang <[email protected]>
…7996) ## Description Backports #7967 (`37cfd637f6521dd36865f25918c303f120980acd`) to `release/3.0.0`, following the merged backport batch #7993. Corrects the rotation and torque lever-arm sign in FORGE's wrench transform. Removes the duplicate PhysX joint-frame conversion because the native wrench already uses the child-side joint frame and anchor. Includes the shared physical regression fixture, backend tests, documentation, and changelog fragments. The source change applies without conflicts. All added and removed lines match #7967; existing release-specific context in the Newton tests, sensor documentation, and development guidelines is preserved. ## Validation - Newton joint-wrench sensor suite and FORGE tests: **12 passed**. - PhysX joint-wrench sensor suite: **16 passed**, including the shared analytic frame check, recorded/eager updates, and resets. - File-by-file backport audit, `uv run --no-sync isaaclab -f`, and `git diff --check` passed. - Full Docker/GPU CI requested for this backport. Co-authored-by: Lynn <[email protected]>
Description
Fixes #3513 and the PhysX joint-wrench frame discrepancy discussed in #7978.
forge_utils.change_FT_frameused the inverse rotation and the wrong lever-arm sign when expressing a wrench in another frame. It now computes the source pose in the target frame and applies:f_t = R_ts f_stau_t = R_ts tau_s + p_ts × f_tThe existing independent point-force test covers translated frames with identity and arbitrary rotations. FORGE's current force-only observation remains unchanged because its call uses identity rotations.
The PhysX sensor had a separate error:
get_link_incoming_joint_force()already returns forces and torques in the child-side joint frame, about its anchor. The sensor appliedlocalPos1andlocalRot1again. It now exposes the native components directly, removing the redundant USD traversal, frame buffers, and GPU transformations. This follows the PhysX tensor API contract.Replaced the circular PhysX frame test with one shared integration fixture used by both Newton and PhysX. It uses the same timestep, geometry, loads, expected values, and tolerances: a passive vertical hinge supports a 2 kg body through an offset child frame rotated 90 degrees relative to the body. The articulation is also rotated about world Z. Both backends must report
F=(0, 0, 19.62) Nandtau=(-1.962, 4.905, 0) N·m, calculated from gravity and the known lever arm. The test checks that the body stays at rest. No raw wrench or production conversion is used to calculate the reference.The fixture reuses the existing simple articulation asset with temporary USD overrides; no asset is added to the repository. The existing backend test files invoke the shared check. Removed the old circular reference helper.
Validation
uv run --no-sync isaaclab -fpassed.Type of change
Checklist
CONTRIBUTORS.mdFollow-up
FORGE names its raw incoming-joint wrench
force_sensor_world, although the API reports the child joint frame. Moving FORGE's observation to an explicitly selected frame is separate work because it can change policy inputs. This PR preserves its current force observation.