mjcf loading consistency with unity plugin and python interface #2396
-
IntroHi! I am an ai researcher, recently migrating my application with mujoco to unity plugin. My setupmujoco version: My questionI am trying to use With this workflow, can I assume both unity and python mujoco are loading Confirmations
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello, The intention is for the data arrays to be ordered the same way. One thing that is guaranteed to change at the moment is the names of the mujoco components - they get a string appended for their names in the underlying mjData (not visible in Unity). So index-based environments are expected to behave similarly, but named access based environments are expected to fail. Once you imported your MJCF in Unity, check out There are also certain conditions in Unity that may alter the order of components which would also break index based referencing, if no additional care is taken. Can you explain more about your goals and the types of scenes/environments you are investigating? |
Beta Was this translation helpful? Give feedback.
As far as setting qpos, it is very much possible. Naturally it introduces a discontinuity in your physics, and there will be missing dynamics (unless you do inverse dynamics as well) for the frames you do the "teleportation". It is appropriate and common however for a custom reset function like this to just set the kinematics.
Using reset_context lets you skip calling mj_forward manually, which would be needed to ensure all you global positions and contacts will be correct immediately.
(The context calls forward after exiting it: https://github.com/google-deepmind/dm_control/blob/a4b9b312c4ae82dded5d2a331d0b5904bf33b869/dm_control/mujoco/engine.py#L307)
As long as the values of the new qp…