Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion on Collision between Sphere and Box #1895

Open
abhihjoshi opened this issue Aug 12, 2024 · 6 comments
Open

Confusion on Collision between Sphere and Box #1895

abhihjoshi opened this issue Aug 12, 2024 · 6 comments
Assignees
Labels
bug Something isn't working question Request for help or information

Comments

@abhihjoshi
Copy link
Contributor

Hello, I'm currently running this model and would like some help understanding its behavior. The sphere geom seems to go through the box geom rather than colliding with it and rolling. The behavior is not what I would expect. Would someone mind explaining the reasoning why the sphere appears to go through the box geom? Also, does anyone have any suggestions on how I can achieve the expected behavior?

Here is a model which explains my question:

<mujoco>

    <asset>
        <texture name="grid" type="2d" builtin="checker" width="512" height="512" rgb1=".1 .2 .3" rgb2=".2 .3 .4"/>
        <material name="grid" texture="grid" texrepeat="8 8" texuniform="true" reflectance=".2"/>
    </asset>
    
    <worldbody>
        <light name="top" pos="0 0 2" diffuse="1 1 1"/>
        <geom name="floor" material="grid" pos="0 0 0" type="plane" size="1 1 .01"/>
        
        <body name="ramp" euler="0 0 0" pos=".3 0 .05">
            <geom type="box" size=".1 .1 .01" euler="0 30 0"/>
        </body>

        <body>
            <freejoint />
            <geom type="sphere" size="0.01 0.01 0.01" pos=".3 0 0.3" rgba="0 0 1 .5"/>
        </body>

    </worldbody>
</mujoco>
Screen.Recording.2024-08-12.at.1.59.44.PM.mov
@abhihjoshi abhihjoshi added the question Request for help or information label Aug 12, 2024
@kevinzakka
Copy link
Collaborator

What MuJoCo version?

@kevinzakka kevinzakka added the bug Something isn't working label Aug 13, 2024
@kevinzakka
Copy link
Collaborator

kevinzakka commented Aug 13, 2024

@yuvaltassa Noticing this on 3.2.0:

  • Lowering the timestep does not fix the problem.
  • Making things stiffer (<geom solref=".004 1"/>) with a slightly bigger sphere eliminates the problem.
  • Changing the sphere to a box is stable.
  • Changing the ramp to a plane does not fix the issue.
  • When I slow down the simulation, I notice the following:
buggy_box_sphere.mp4

So most likely a collider issue.

@kevinzakka
Copy link
Collaborator

Looks like this has always been an issue (loaded as far back as 2.3.7).

@abhihjoshi
Copy link
Contributor Author

What MuJoCo version?

I am currently working off of version 3.2.0

@abhihjoshi
Copy link
Contributor Author

abhihjoshi commented Aug 13, 2024

It also seems to especially be a problem with smaller objects (i.e. within the range 0.001). Here is another example with a box-box collision:

<mujoco>
    <size memory="100M"/>

    <asset>
        <texture name="grid" type="2d" builtin="checker" width="512" height="512" rgb1=".1 .2 .3" rgb2=".2 .3 .4"/>
        <material name="grid" texture="grid" texrepeat="8 8" texuniform="true" reflectance=".2"/>
    </asset>

    <default>
        <default class="collision">
            <geom solimp="0.98 0.99 0.0001" solref=".004 1"/>
        </default>
    </default>
    
    <worldbody>
        <light name="top" pos="0 0 2" diffuse="1 1 1"/>
        <geom class="collision" name="floor" material="grid" pos="0 0 0" type="plane" size="1 1 .01"/>

        <body pos="0 0 .005" euler="0 30 0">
            <geom type="box" size="0.01 0.01 0.001" />
        </body>

        <body>
            <freejoint />
            <geom class="collision" type="box" size="0.001 0.001 0.001" pos="-0.01 0 0.022" euler="0 30 0" rgba="0 0 1 .5"/>
        </body>

    </worldbody>
</mujoco>
Screen.Recording.2024-08-12.at.6.37.59.PM.mov

@yuvaltassa
Copy link
Collaborator

We are working on a full overhaul of the collision pipeline (ETA, 1-2 months), we will add these models as test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Request for help or information
Projects
None yet
Development

No branches or pull requests

4 participants