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

Use collision bitmask flag for meshes #160

Merged
merged 7 commits into from
Jun 16, 2020
Merged

Conversation

luca-della-vedova
Copy link
Member

Preliminary support for collision bitmask was introduce in ign-physics with this PR.

That introduces filling the bitmask and introducing the filtering in the ConstructSdfCollision function. The issue is that the function is called in an else statement only if the object is not a mesh.
This means that before this PR meshes didn't implement the collide_bitmask flag, now they do. This effectively makes the change in the ConstructSdfCollision obsolete and it can be removed.

While this is just a few lines and it fixes the problem, it introduces an additional feature to the MinimumFeatureList which is probably not desirable. Also, I guess there should be a discussion about whether more features from the ConstructSdfCollision functions should be ported to make them work with meshes as well, from what I can see in the code there is a whole chunk of SDF parameters related to friction that will be applied to primitives but not to meshes, which doesn't sound correct.

Open to ideas on whether this fix is acceptable (and whether we should find a way to port the above) or if I should look at alternative fixes.

@luca-della-vedova luca-della-vedova requested a review from azeey as a code owner May 29, 2020 07:38
@github-actions github-actions bot added the 🔮 dome Ignition Dome label May 29, 2020
@codecov
Copy link

codecov bot commented May 29, 2020

Codecov Report

Merging #160 into master will increase coverage by 0.09%.
The diff coverage is 60.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #160      +/-   ##
==========================================
+ Coverage   65.68%   65.77%   +0.09%     
==========================================
  Files         128      128              
  Lines        6297     6305       +8     
==========================================
+ Hits         4136     4147      +11     
+ Misses       2161     2158       -3     
Impacted Files Coverage Δ
src/systems/physics/Physics.cc 33.84% <55.55%> (+0.27%) ⬆️
src/systems/physics/Physics.hh 100.00% <100.00%> (+9.09%) ⬆️
src/SimulationRunner.cc 87.54% <0.00%> (+1.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1e6f026...9f5ef0f. Read the comment docs.

@chapulina chapulina requested a review from iche033 June 1, 2020 18:50
@luca-della-vedova luca-della-vedova force-pushed the collision_bitmask_mesh branch 3 times, most recently from 4add457 to 5772da8 Compare June 4, 2020 10:21
Copy link
Contributor

@iche033 iche033 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, just one minor codecheck error. Can you update changelog?

src/systems/physics/Physics.cc Outdated Show resolved Hide resolved
@iche033 iche033 self-requested a review June 4, 2020 21:17
@iche033
Copy link
Contributor

iche033 commented Jun 4, 2020

the homebrew build failure looks be unrelated. I think we may need to release a new ign-gui bottle for it to pass

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for removing it from the minimum feature list, but I think this still breaks backwards compatibility.

TPE for example will lose collision support because it doesn't have the bitmask feature. Do you mind creating a new feature list just for this? I know it's more work, but this feature feels niche enough to be an option in itself.

Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
@luca-della-vedova
Copy link
Member Author

luca-della-vedova commented Jun 12, 2020

Thanks for removing it from the minimum feature list, but I think this still breaks backwards compatibility.

TPE for example will lose collision support because it doesn't have the bitmask feature. Do you mind creating a new feature list just for this? I know it's more work, but this feature feels niche enough to be an option in itself.

Done here, I used a different strategy compared to the parts above for printing the error (not printing any). The reason is that even if the user doesn't specify a collide_bitmask in SDF there will still be a value assigned to it (default of 0xFF), so the warning for the missing feature would be always printed.

There will still be warnings printed in the entityCast function though if the bitmask filter is not implemented, but I'm not sure how to handle them.
We would need a way to know if the user defined a bitmask, I can think of three ways:

  • Returning a std::optional in the sdf CollideBitmask function, possibly the proper way, although would break API.
  • Comparing with the default of 0xFF (would probably work but a bit hacky).
  • Adding a "CollideBitmaskDefined" function to sdformat that returns a boolean whether a collide_bitmask tag was found or not while parsing the sdf file.

Ideas?

@chapulina
Copy link
Contributor

There will still be warnings printed in the entityCast function though if the bitmask filter is not implemented, but I'm not sure how to handle them.

That's a good point. We could just make that function silent and let the caller responsible for printing messages.

We would need a way to know if the user defined a bitmask

I'd be ok punting on this for now, maybe ticketing an issue.

Signed-off-by: Luca Della Vedova <luca@openrobotics.org>
@luca-della-vedova
Copy link
Member Author

That's a good point. We could just make that function silent and let the caller responsible for printing messages.

Something like this?

@chapulina
Copy link
Contributor

Something like this?

Yup, thanks, that looks good to me!

Signed-off-by: Louise Poubel <louise@openrobotics.org>
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for iterating! I bumped the required physics version in ff69acb.

@iche033
Copy link
Contributor

iche033 commented Jun 16, 2020

the latest changes look good to me, thanks!

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

Successfully merging this pull request may close these issues.

3 participants