Add flag to disable collision detection#484
Conversation
# Conflicts: # mujoco_warp/_src/forward.py
|
is it not possible to just edit the disablebit for collisions? DisableBit.CONTACT? |
|
DisableBit.CONTACT still zeros ncon_out and therefore discards the contacts injected from Newton, see function below. I could move the flag check up but it might have side effects. Inputs from mujoco experts are welcome. |
|
I see your point. What does your pipeline look like, you will generate contacts before the call to mjwarp.step()? How are you getting the correct geom positions in this case? FK does run as part of the step as well. would it make sense to give you a callback or something along these lines? |
|
A callback does not really help since the contacts get already passed into newton's step function. I simply convert them to mujoco. So far it works quite good but I need to test more examples. The following code shows the step function in solver_mujoco.py from newton. The signature of step is fixed, so I don't know if a callback to run contact detection again (=inefficient) makes sense. |
|
Does not make any sense to run contact gen twice indeed. So you are relying on the newton FK to get shape positions? I still don't really get how that would give you updated geom positions. Plus there is a lot of duplication that could be removed if you are relying on an external forward kinematics step anyway. Back to the main topic, I guess in this setup your proposal makes sense. Is there a world where we would generate contacts for part of the geom in MjWarp, and other geoms have externally generated contacts? Maybe it would make sense to design the API around this. |
|
The MuJoCo Way™ for public API functions to take only Model and Data, and control flow is dictated by Model properties. So I think you have two options here:
I think either of those we could work with. Long term, if you think you'll be customizing how you use mjwarp a lot, I think 1) is the better bet. |
|
@erikfrey I added a new flag to the options in the model. I tried option 1 but it involves too much code I would need to copy over to newton. |
Add flag to optionally disable collision detection. This allows to inject contacts from other sources, e. g. newton.