Skip to content

Inconsistency between contact frame and its visualization #2335

Open
@jjyyxx

Description

@jjyyxx

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

// 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions