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

Mesh collision not working properly #31

Closed
cherylwang20 opened this issue May 29, 2024 · 5 comments
Closed

Mesh collision not working properly #31

cherylwang20 opened this issue May 29, 2024 · 5 comments

Comments

@cherylwang20
Copy link

Hi,

Thanks for the great package! I am a student and I was trying to use obj2mjcf to convert a beaker.obj model into sub-meshes to use as a hollow object in mujoco.

I managed it separate it into 28 convex hulls, however, when I load the mesh into the env I have with a table and robotic arm, it penetrates the table and has its COM on the side.

I have attached the initial setup:
screenshot

and after free falling from a height:
screenshot

As a reference, the box and the mug model from MuJoCo are behaving fine.

Please see here for the xml code:
https://github.com/cherylwang20/mj_envs/blob/3e73f238eea48cffed0423d7fcd604b467838b4a/robohive/envs/arms/ur10e/scene_gripper.xml

Any help is greatly appreciated! Thank you.

@kevinzakka
Copy link
Owner

Can you share a ZIP file containing the original mesh, the decomposition and the scene.xml with all the assets? I can take a closer look :)

@cherylwang20
Copy link
Author

Can you share a ZIP file containing the original mesh, the decomposition, and the scene.xml with all the assets? I can take a closer look :)

Hi Kevin,

Thanks for the quick reply. Here is the zip file.
beaker_file.zip

If you drag the scene_gripper.xml into mujoco, it should reproduce what I have. The beaker.mtl and beaker.obj are the original mesh files. the decomposition is in the folder 'beaker'.

Thank you again and let me now if you need anything else.

@kevinzakka
Copy link
Owner

Taking a look, thanks @cherylwang20!

@kevinzakka
Copy link
Owner

kevinzakka commented May 30, 2024

Hi @cherylwang20, the XMLs you sent were super disorganized so I stripped everything down to just the beaker and the table and tweaked the physics to get better behavior.

I found that 15 convex hulls are sufficient to approximate the beaker well. Here's the obj2mjcf command I ran:

obj2mjcf --obj-dir . --obj-filter beaker --save-mjcf --compile-model --decompose --overwrite --coacd-args.max-convex-hull 15

In terms of changes I made to the XML:

  1. Switched to elliptic cones.
  2. Changed collision condim to 6.
  3. Stiffen contacts by reducing solref[0] (note it should not go below 2 x your timestep).
  4. Toggled multiccd to get more stable contacts between the table surface and the beaker.

Cheers!

beaker_scene.zip

@cherylwang20
Copy link
Author

@kevinzakka Thanks for helping me look into this problem. And apologies for the inconvenience in XML file organization.

Thank you again for the prompt support and the development of this package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants