Fix wrench composer to correctly update composed wrenches#4604
Fix wrench composer to correctly update composed wrenches#4604LoreMoretti wants to merge 9 commits intoisaac-sim:mainfrom
Conversation
Greptile OverviewGreptile SummaryThis PR refactors the wrench composer to use "mixed" frame representation instead of pure link-frame representation. In the new approach, forces and torques are stored with global frame orientation but referenced to the link origin, which simplifies composition of forces from multiple sources. Key changes:
Critical issues found:
Impact: Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Asset
participant WrenchComposer
participant Kernel
participant PhysXView
User->>Asset: Apply external forces/torques
Asset->>WrenchComposer: add_forces_and_torques(forces, torques, is_global)
WrenchComposer->>WrenchComposer: Fetch link_positions and link_quaternions
WrenchComposer->>Kernel: Launch add_forces_and_torques_at_position
Kernel->>Kernel: cast_force_to_mixed_frame(force, quat, is_global)
Note over Kernel: If is_global=True: keep in global frame<br/>If is_global=False: rotate to global via quat_rotate
Kernel->>Kernel: cast_position_to_mixed_frame(pos, link_pos, quat, is_global)
Note over Kernel: If is_global=True: offset = pos - link_pos<br/>If is_global=False: rotate pos via quat_rotate
Kernel->>Kernel: Compute torque = cross(position_offset, force)
Kernel->>Kernel: Add to composed_forces_m and composed_torques_m
WrenchComposer-->>Asset: Returns (forces in mixed frame)
Asset->>PhysXView: apply_forces_and_torques_at_position(force_data, torque_data, is_global=True)
Note over PhysXView: Forces/torques are in global orientation<br/>at link origin (mixed representation)
|
Additional Comments (6)
|
1809909 to
c8d833c
Compare
8bd46a0 to
55ffb03
Compare
|
Hi Lorenzo, looking into this PR I'm not sure it's working as expected. Can local forces track rotations in the case where I apply a permanent local force and rotate the body? I might be better to compose local and global forces separately and compose them into a local force just before applying them. It's a bit tedious but I feel like it would be more robust. See: gbionics#1 |
|
Hi Antoine, I see your point, you're right. |
Description
It addresses #4580.
The main change is that the force and torques of the
wrench_composerare now stored in a representation which is called mixed (as used in some references, like https://traversaro.github.io/traversaro-phd-thesis/traversaro-phd-thesis.pdf), which means orientation as the world frame and origin as the link frame.Everything else is changed accordingly.
Type of change
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there