-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Intro
Hi!
I am a graduate student at HKU, I use MuJoCo for my research on robotic manipulation.
My setup
MuJoCo 3.2.6, Python and C, Linux
What's happening? What did you expect?
Mujoco is using the X axis as the contact normal direction in mjContact.frame
, as explicitly stated in the documentation:
Thus, given that MuJoCo uses row-major format, the contact normal axis (which is the X axis of the contact frame by our convention) is in position mjContact.frame[0-2], the Y axis is in [3-5] and the Z axis is in [6-8]. The reason for this arrangement is because ...
However, when visualizing with mjFRAME_CONTACT
, the normal direction becomes the Z axis in blue, as explicitly switched in
mujoco/src/engine/engine_vis_visualize.c
Lines 134 to 137 in 4d82ab5
// mat = contact rotation matrix (normal along z) | |
mju_copy(tmp, con->frame+3, 6); | |
mju_copy(tmp+6, con->frame, 3); | |
mju_transpose(mat, tmp, 3, 3); |
Both conventions are perfectly fine for me, but the inconsistency may create confusion during debugging, especially when dealing with anisotropic friction in the way recommended by documentation:
For a predefined contact pair we know the two geom types in advance, and the corresponding collision function always generates contact frames oriented in the same way – which we do not describe here but it can be seen in the visualizer.
Steps for reproduction
Minimal model for reproduction
No response
Code required for reproduction
No response
Confirmations
- I searched the latest documentation thoroughly before posting.
- I searched previous Issues and Discussions, I am certain this has not been raised before.