google-deepmind / mujoco

Multi-Joint dynamics with Contact. A general purpose physics simulator.
https://mujoco.org
Apache License 2.0
8.17k stars 816 forks source link

The slide property is not rendered in Unity. #2165

Open mg638 opened 2 weeks ago

mg638 commented 2 weeks ago

Intro

hello. I am working on the mujoco project with Unity. This time, I used a slide in the model, but it came out normally in the simulator, but it was not created properly in Unity, so I would like to inquire.

My setup

3.2.0 Unity 2022.3.4f1

What's happening? What did you expect?

376986195-04cf5639-1202-440d-ab07-65627dcee209 376986183-7f3a8b7a-ecf4-4524-ae31-aed45b1264f4

As shown in the image, the slider is rendered normally in the simulator, but is not rendered in Unity.

Steps for reproduction

The model was imported using import mujoco scene using the Unity plugin.

Minimal model for reproduction

I couldn't reveal all the information about the model, so I only wrote some of it.

        <body name="slider2" pos="-0.14 0.15 0.035"  euler="0 0 -90">
            <inertial pos="0 0 0" euler="0 0 0" mass="0.5" diaginertia="0.001 0.001 0.001"/>
            <geom name="slider2_geom" type="box" pos="0 0 0" size="0.02 0.02 0.015" rgba="0. 0. 0.5 1"/>
            <joint name="slide2" type="slide" pos="0 0 0" range="-0.15 0.15" limited="true" axis="1 0 0" damping="0.1"/>

            <body name="slider2_dump" pos="0 0 0"  euler="18 0 9">
                    <site name="slider2_origin" pos="0 0 0" size=".001"/>
            <!-- <composite type="cable" curve="s 0 0" count="11 1 1" size="1.05 0.25 0.25" offset="0 0 0" initial="ball" prefix="cable2_">
                <plugin plugin="mujoco.elasticity.cable">
                    <config key="twist" value="1e7"/>
                    <config key="bend" value="4e6"/>
                    <config key="vmax" value="5e-3"/>
                </plugin>
                <joint kind="main" damping=".015"/>
                <geom type="capsule" size=".005" rgba=".8 .2 .1 1" condim="1"/>
            </composite> -->
            </body>
        </body>

        <body name="slider3" pos="-0.14 0.15 -0.075"  euler="0 0 -90">
            <inertial pos="0 0 0" euler="0 0 0" mass="0.5" diaginertia="0.001 0.001 0.001"/>
            <geom name="slider3_geom" type="box" pos="0 0 0" size="0.02 0.02 0.015" rgba="0. 0.3 0. 1"/>
            <joint name="slide3" type="slide" pos="0 0 0" range="-0.15 0.15" limited="true" axis="1 0 0" damping="0.1"/>

            <body name="slider3_dump" pos="0 0 0"  euler="0 0 12">
                    <site name="slider3_origin" pos="0 0 0" size=".001"/>
            <!-- <composite type="cable" curve="s 0 0" count="6 1 1" size="0.51 0.15 0.25" offset="0 0 0" initial="ball" prefix="cable3_">
                <plugin plugin="mujoco.elasticity.cable">
                    <config key="twist" value="1e7"/>
                    <config key="bend" value="4e6"/>
                    <config key="vmax" value="1e-2"/>
                </plugin>
                <joint kind="main" damping=".015"/>
                <geom type="capsule" size=".005" rgba=".8 .2 .1 1" condim="1"/>
            </composite> -->
            </body>
        </body>

        <body name="slider4" pos="-0.14 0.15 -0.035"  euler="0 0 -90">
            <inertial pos="0 0 0" euler="0 0 0" mass="0.5" diaginertia="0.001 0.001 0.001"/>
            <geom name="slider4_geom" type="box" pos="0 0 0" size="0.02 0.02 0.015" rgba="0. 0. 0.5 1"/>
            <joint name="slide4" type="slide" pos="0 0 0" range="-0.15 0.15" limited="true" axis="1 0 0" damping="0.1"/>

            <body name="slider4_dump" pos="0 0 0"  euler="-18 0 9">
                    <site name="slider4_origin" pos="0 0 0" size=".001"/>
            <!-- <composite type="cable" curve="s 0 0" count="11 1 1" size="1.05 0.25 0.25" offset="0 0 0" initial="ball" prefix="cable4_">
                <plugin plugin="mujoco.elasticity.cable">
                    <config key="twist" value="1e7"/>
                    <config key="bend" value="4e6"/>
                    <config key="vmax" value="2e-3"/>
                </plugin>
                <joint kind="main" damping=".015"/>
                <geom type="capsule" size=".005" rgba=".8 .2 .1 1" condim="1"/>
            </composite> -->
            </body>
        </body>
...

Code required for reproduction

import mujoco
import mediapy as media
model = mujoco.MjModel.from_xml_string(xml)
data = mujoco.MjData(model)

with mujoco.Renderer(model) as renderer:
  mujoco.mj_forward(model, data)
  renderer.update_scene(data)

  media.show_image(renderer.render())

Confirmations

Balint-H commented 1 day ago

Hello, apologies for the delayed response. This is because the Unity package currently does not support the loading of MuJoCo plugins such as elasticity. We have a WIP solution the development of which has been paused for a while, but I'm returning to it. My estimated time to finish it is the end of November.