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

CompoundMesh does not work with FCL #1053

Open
rjoomen opened this issue Oct 21, 2024 · 9 comments · May be fixed by #1080
Open

CompoundMesh does not work with FCL #1053

rjoomen opened this issue Oct 21, 2024 · 9 comments · May be fixed by #1080
Assignees

Comments

@rjoomen
Copy link
Contributor

rjoomen commented Oct 21, 2024

CompoundMesh does not work with the FCL collision checker. I suppose it is because for Bullet, one CompoundMesh is added as one compound object, whereas for FCL, one CompoundMesh is added a multiple objects.

I've taken a look, it seems FCL does not support compound objects, apart from BHVModel, which only supports meshes or pointclouds as submodels.

And for reference, neither does HPP-FCL: #340, #448.

@Levi-Armstrong
Copy link
Contributor

Are you saying there is a bug? The concept of CompoundMesh has always existed just handled differently now. Previously every sub mesh was converted directly to a Geometry object but now all sub meshes are stored in the new CompoundMesh. Then the collision checker handle this new type and processes all of the sub meshes. The only difference now is the CompoundMesh is captured at the highest level.

@Levi-Armstrong
Copy link
Contributor

Here is the code which process the CompoundMesh.

@rjoomen
Copy link
Contributor Author

rjoomen commented Oct 21, 2024

I checked the code indeed. There is a bug, I tested adding some meshes separately (within a link) or as a CompoundMesh, and for Bullet this works for both, but for FCL the CompoundMesh version crashes. And with my HPP-FCL version (mostly similar to the FCL version) it is the same. I did not check in detail what went wrong, but CompoundMesh is the cause.

@Levi-Armstrong
Copy link
Contributor

I thought this was covered by a unit test but I will look into it.

@Levi-Armstrong
Copy link
Contributor

There is a unit test which does confirm this is working but may not be testing everything. Do you have a backtrace or could you add a unit test which triggers the failure?

@rjoomen
Copy link
Contributor Author

rjoomen commented Oct 27, 2024

I'll take a look tomorrow. I'm not really using FCL, so I just found this by accident.

@Levi-Armstrong
Copy link
Contributor

@rjoomen Did you get a chance to look into this?

@rjoomen
Copy link
Contributor Author

rjoomen commented Dec 11, 2024

I just did. It was quite hard to find, but the problem is this:

In the COW constructor, a number of shapes and shape_poses is added. Before, each one shape was added as one COW, and thus had a matching shape_pose (and shapes_.size() == shape_poses_.size() == collision_objects_.size()). With a CompoundMesh, one shape is added as multiple COWs, and shape_poses_.size() != collision_objects_.size(). So when for example setCollisionObjectsTransform is executed for a CompoundMesh COW, it runs through, say, 5 objects, but only 1 object gets a valid shape_pose_.

I have submitted a PR to fix this, but please take a good look if this is the best solution.

@rjoomen
Copy link
Contributor Author

rjoomen commented Dec 11, 2024

The tests didn't pick this up as no setCollisionObjectsTransform is performed on a CompoundMesh.

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