mujoco
mujoco copied to clipboard
What could be the cause of mjWARN_BADQACC?
Hi, I am having a weird behavior in the mujoco simulator. The scenario is described below:
- Two objects(box) are combined through a weld constraint. The smaller one is inside another.
- The smaller one can be controlled by slide actuators.
Ideally, they should move together, slowly because of a small action, which does happen in most of the other scenarios. However, for this rare one, all of a sudden, they move so abruptly.
These are xyz locations of the smaller box in 5 consecutive physics.steps.
[-0.54017543 -0.06785287 0.04978686] -> (activate constaint and keep it for later steps) -> step() ->
[-0.54133 -0.0676916 0.04982307] -> (movement between this and last step is indeed small), step() ->
[0.85014079 0.50555359 1.88797865] <------ magic happens from here !!
[-16.61497857 -17.21111811 1.36517479]
[1049.15584802 1045.70554427 5.04508734]
Actually, I have set joint range limit and the working space is surrounded by walls and a ceiling(the space is rather small, about 2x2x2). So ideally they should at least stay inside this space.
Probably this is related to setting constraints. I found a previous post that says weird behavior might happen when objects are very small. But it didn't change anything when I change from one 0.05, one 0.01 box to one 0.05, one 0.03 box.
We can't reproduce without a model.
I suspect the two objects are contacting each other and the huge contact forces are causing divergence?
Activate contact force visualisation ('F' in simulate) to diagnose.
Just in case, but have you disabled collisions between the two objects?
Thanks @Balint-H,
Yes, that's what I meant.
Yes, having contacts is expected. I think the main reason is that during the constraint activation, quaternion for relpose is [1, 0, 0, 0] and this correction step would lead to bad acc in some rare cases (e.g. there are so many rotations to make an object quaternion to [1, 0, 0, 0]). Fortunately, I later solved my issue by setting relpose by changing eq_data in the runtime.
I also make a model that can reproduce the error. Thanks! minimul_case.txt