openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.83k stars 810 forks source link

Fix for skinned cloth segfault #668

Closed cheng-chi closed 2 months ago

cheng-chi commented 2 years ago

This PR addresses issue #373 and #443 I have applied the changes from hermanjakobsen's fix to the current master. It seems to work for me.

Screen Shot 2022-01-02 at 23 40 13
Rancho-zhao commented 2 years ago

Hi! What versions of mujoco and mujoco-py do you use? I use mujoco2.1.0 and mujoco-py2.1.2.14, but it didn't work according to your change suggestions.😂

cheng-chi commented 2 years ago

@Rancho-zhao I'm using exactly the same versions and it has been working fine for me. Could you describe what exactly is the problem for you?

Rancho-zhao commented 2 years ago

First, I use docker which is built with the official Dockfile . When I added the following content to my XML file,

    <body name="B3_5" pos="0 0 1">
        <freejoint/> 
        <composite type="cloth" count="9 9 1" spacing="0.05" flatinertia="0.01"> 
            <joint kind="main" damping="0.001"/> 
            <skin material="matcarpet" texcoord="true" inflate="0.005" subgrid="2"/> 
            <geom type="capsule" size="0.015 0.01" rgba=".8 .2 .1 1"/> 
         </composite> 
    </body>

I saw the error Segmentation fault. Then I changed the file mjrendercontext.pyx and mjsim.pyx according to your suggestions, but it didn't work. After I found this https://github.com/jangirrishabh/mujoco-py, it has been working fine. I compared its code and found that its changes are very similar to yours. So it's a little weird that yours didn't work and its worked.