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

Can't apply convex decomposition to a hollow cylinder (STL file) in Python? #53

Open
kurtenkera opened this issue Aug 2, 2024 · 4 comments

Comments

@kurtenkera
Copy link

Hi,

I am trying to use the example script python/package/bin/coacd on an STL file of a hollow cylinder (attached:
hollowcyl.zip).

image

I want to decompose this cylinder into a union of convex objects so I can accurately simulate collision detection in MuJoCo. The picture above shows the hollow cylinder in a MuJoCo simulation. The video below shows that a small sphere is unable to fall through the hollow cylinder as its convex hull doesn't allow this.

Screencast.from.02-08-24.11.50.29.webm

When I execute the code:

cd python
python package/bin/coacd -i hollowcyl.stl -o hollowcyl_coacd.stl

I still get the same issues, whereas I was expecting this to produce an STL file that allows the sphere to fall through the cylinder? I have read the code in python/package/bin/coacd line-by-line and I don't know why I am encountering this issue. Can anyone help?

Thanks in advance!

@SarahWeiii
Copy link
Owner

Hi here are the .obj and .stl files that coacd generated, by visualization I feel the results are reasonble, can you show the coacd result you generate to compare? I also attached the files.

Screenshot 2024-08-01 at 23 15 33 Screenshot 2024-08-01 at 23 15 45

out.zip

@CumulusAlpha
Copy link

Hello, CoACD!
I have tried your out.zip in my mujoco, however, it doesn't work as well. You can see as below:
2025-01-12 14-07-20 的屏幕截图

And after I hold the "H" button(which can show the real convex mesh, i think), the hole is filled up again like below:
2025-01-12 14-13-50 的屏幕截图

I am wondering how can I solve this problem, thanks for your kind helping!

@CumulusAlpha
Copy link

CumulusAlpha commented Jan 12, 2025

And here is my mujoco code, sorry for that i forget to post it before:
`

<geom name="floor" size="0 0 0.05" type="plane" material="groundplane"/>
    
<body name="sphere1" pos="1 1 10">
  <joint type="free" name="sphere_joint" damping="0.001"/>
  <geom name="sphere1" type="sphere" size="0.1" rgba="1 1 1 1" mass="0.2"/>
</body>

<body name="cylinder1">
  <joint type="free" name="cylinder_joint" damping="0.001"/>
  <geom name="cylinder1" type="mesh" mass="1"  rgba="1 1 1 1" mesh="cylinder1"/>
</body>

`

image

@CumulusAlpha
Copy link

CumulusAlpha commented Jan 14, 2025

Oh, i think i figure out the problem When you import the part, do not just import a single Stl file that coacd generates! Instead, let coacd generate several parts and include them in just one body.

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

3 participants