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

Query ExtraContactData in gz-sim 2 gz-physics interface #2050

Conversation

antbre
Copy link
Contributor

@antbre antbre commented Jul 26, 2023

🦟 Bug fix

Fixes #2037

Summary

Previously the data contained by the ContactSensorPlugin did not include ExtraContactData. Now the message is also populated with this data.
Now the EntityContactMap contains a deque of pairs of ContactPoint and ExtraContactData. That way the messages can be populated with Normals, Forces, and Depth. The force on body 2 is equal and opposite to the force on body 1.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸🔸

@antbre antbre requested a review from azeey as a code owner July 26, 2023 10:02
@github-actions github-actions bot added the 🌱 garden Ignition Garden label Jul 26, 2023
Copy link
Contributor

@azeey azeey 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 the contribution! I mostly have minor things to address. I'd also ask if you could add a test in test/integration/physics_system.cc.

src/systems/physics/Physics.cc Outdated Show resolved Hide resolved
src/systems/physics/Physics.cc Outdated Show resolved Hide resolved
src/systems/physics/Physics.cc Outdated Show resolved Hide resolved
@azeey
Copy link
Contributor

azeey commented Jul 26, 2023

Could also signoff your commits (See the DCO section in https://gazebosim.org/docs/garden/contributing#process)

@antbre antbre requested a review from mjcarroll as a code owner July 31, 2023 13:20
@antbre
Copy link
Contributor Author

antbre commented Jul 31, 2023

Thanks for the contribution! I mostly have minor things to address. I'd also ask if you could add a test in test/integration/physics_system.cc.

Regarding the test: Since I'm effectively testing message transport e.g. whether messages are filled and published correctly, should it still be added to test/integration/physics_system.cc or rather somewhere else? Is there also already an example that is testing transport using a subscriber that I can orient myself on?

@azeey
Copy link
Contributor

azeey commented Jul 31, 2023

Thanks for the contribution! I mostly have minor things to address. I'd also ask if you could add a test in test/integration/physics_system.cc.

Regarding the test: Since I'm effectively testing message transport e.g. whether messages are filled and published correctly, should it still be added to test/integration/physics_system.cc or rather somewhere else? Is there also already an example that is testing transport using a subscriber that I can orient myself on?

Good point. test/integration/contact_system.cc might be more appropriate. It also already contains tests that use transport, so it should be a good reference.

@azeey azeey added the beta Targeting beta release of upcoming collection label Jul 31, 2023
@antbre antbre force-pushed the add_extraContactData_to_gz_sim_physics_interface branch 2 times, most recently from cb59b81 to 7607b33 Compare August 1, 2023 17:13
antbre added 5 commits August 1, 2023 19:14
Now the EntityContactMap contains a deque of pairs of ContactPoint
and ExtraContactData. That way the messages can be populated with
Normals, Forces, and Depth. The force on body 2 is equal and
opposite to the force on body 1.

Fixes Issue gazebosim#2037

Signed-off-by: Anton Bredenbeck <[email protected]>
- snake_case -> camelCase
- check whether contactExtraData is not nullptr before accessing

Signed-off-by: Anton Bredenbeck <[email protected]>
@antbre antbre force-pushed the add_extraContactData_to_gz_sim_physics_interface branch from 7607b33 to 9c157be Compare August 1, 2023 17:15
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

LGTM! Just one more style issue.

Also, I think the test ActorFixture.ActorTrajectoryNoMesh is flaky. /cc @iche033.

src/systems/physics/Physics.cc Outdated Show resolved Hide resolved
antbre and others added 2 commits August 1, 2023 23:14
@codecov
Copy link

codecov bot commented Aug 3, 2023

Codecov Report

Merging #2050 (3f4b8db) into gz-sim7 (50a99e6) will increase coverage by 0.00%.
Report is 19 commits behind head on gz-sim7.
The diff coverage is 100.00%.

❗ Current head 3f4b8db differs from pull request most recent head ad6b339. Consider uploading reports for the commit ad6b339 to get more accurate results

@@           Coverage Diff            @@
##           gz-sim7    #2050   +/-   ##
========================================
  Coverage    65.00%   65.01%           
========================================
  Files          354      354           
  Lines        28667    28688   +21     
========================================
+ Hits         18636    18651   +15     
- Misses       10031    10037    +6     
Files Changed Coverage Δ
include/gz/sim/ServerConfig.hh 100.00% <ø> (ø)
include/gz/sim/rendering/MarkerManager.hh 100.00% <ø> (ø)
src/LevelManager.cc 89.39% <ø> (ø)
src/systems/physics/Physics.cc 67.78% <100.00%> (+0.45%) ⬆️

... and 1 file with indirect coverage changes

@azeey
Copy link
Contributor

azeey commented Aug 3, 2023

All the CI failures seem unrelated. Merging!

@azeey azeey merged commit 0aadc81 into gazebosim:gz-sim7 Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Targeting beta release of upcoming collection 🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

ContactSensor does not contain information about Contact Depth, Normal and Wrench
2 participants