blodow / realtime_urdf_filter

ROS package that can filter geometry defined in URDF models from Kinect depth images. Can also preprocess data for the OpenNI tracker, to remove backgrounds, robots etc.
Other
89 stars 46 forks source link

Assertion `face.mNumIndices == 3' failed. #36

Closed kidpaul94 closed 2 years ago

kidpaul94 commented 2 years ago

Hello,

I appreciate for the great work here! I'm trying to use this package to do the urdf filtering with my mobile robot and ROS Noetic. So, I just modified the realtime_urdf_filter.launch and filter_parameters.yaml. However, I'm currently facing this error message from here:

https://github.com/blodow/realtime_urdf_filter/blob/4051fe6a8ba5b269e229aa7da3796067e638ab5e/src/renderable.cpp#L408

Would you mind giving me some ideas about any reason possibly causing this assertion fail?

Thank you.

blodow commented 2 years ago

Hi kidpaul94,

I’m glad people are using it!!

That assert encodes the assumptions of the following 3 lines of code: that every mesh face contains 3 vertices, i.e. that every mesh face is a triangle. The assert is triggered in your case because the mesh you’re loading most likely contains geometry that is not just triangular in nature.

I see two possible courses of action here: 1) The code in initMesh is improved to deal with other numbers of face vertices than 3. This might be tricky, because not only the loading but also the rendering part assumes triangles. 2) You load the mesh into a mesh editor like Meshlab, somehow modify it so it only contains triangles, and save that mesh to a file that you then use in realtime_urdf_filter. That’s probably way simpler.

I’m sorry I can’t be of more help, but hope this is enough of a pointer to get things working for you.

Cheers!

kidpaul94 commented 2 years ago

Thank you for the quick reply! I'll try on those.

Yitian-Xian commented 2 years ago

Hi @kidpaul94, I am encountered with similar problems when I am working on the Franka Emika Panda robot and using their provided models. Do you fix this issue? If so, could you please tell me how to do that? Thanks!!

Hi @blodow, could you please provide any guidance on the second suggestion? Do I need to modify the stl or the dae file? Thank you!!

Yitian-Xian commented 2 years ago

Hi @blodow, @kidpaul94, I have found a link https://github.com/AndrejOrsula/panda_ign_moveit2/tree/master/panda_description. If you check this link, we can see that the stl file does have some polygons, which may cause the problem. Could you please tell me how to fix? Thx!

blodow commented 2 years ago

So i see two ways:

if you could improve the code where the assert fails so it is able to deal with more than three vertices per mesh face, that would be perfect. It would also be helpful to future users of the urdf filter.

Short of that, you would have to load the mesh in some external program and convert all quads/n-gons to triangles. Meshlab and blender are both great tools to know.

Here is a inspirational link that mentions solutions for both cases:

https://gamedev.stackexchange.com/a/45685

I hope this helps. And again, a PR with a fix would be much appreciated 😅

Yitian-Xian commented 2 years ago

Hi @blodow, thank you for your answer. Since I am not familiar with computer graphics, I would prefer the second way. Could you please tell me whether I should fix the stl or dae file?

blodow commented 2 years ago

that depends which model is actually loaded, which depends on what your launch files and config files define. i’m afraid you will have to just trace that..

On Sat 19. Mar 2022 at 10:46 Yitian-Xian @.***> wrote:

Hi @blodow https://github.com/blodow, thank you for your answer. Since I am not familiar with computer graphics, I would prefer the second way. Could you please tell me whether I should fix the stl or dae file?

— Reply to this email directly, view it on GitHub https://github.com/blodow/realtime_urdf_filter/issues/36#issuecomment-1072978535, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADW24X57PCUIAPHIBNGBF3VAWO55ANCNFSM5FY3NZAQ . You are receiving this because you were mentioned.Message ID: @.***>