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

Functions to enable velocity and acceleration checks on Link #935

Merged
merged 6 commits into from
Jul 30, 2021

Conversation

chapulina
Copy link
Contributor

🎉 New feature

Summary

This is broken off #926 for easier review.

The Link class provides convenient functions to retrieve velocities and accelerations without needing to touch the ECM directly. But in order to use those functions, users need to create the necessary components. This defeats the purpose of having an API that hides away the ECM's complexity.

This PR adds the Enable(Velocity|Acceleration)Checks functions, which provide a way for users of the Link API to create those components without necessarily knowing that they're doing so.

Test it

I used the new functions in some existing plugins to demonstrate how it comes in handy for plugin developers, see below. The tests and documentation should also be helpful to understand the intended usage.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • 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

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

@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Jul 27, 2021
@codecov
Copy link

codecov bot commented Jul 27, 2021

Codecov Report

Merging #935 (17f4473) into ign-gazebo3 (847b1ae) will decrease coverage by 0.04%.
The diff coverage is 100.00%.

❗ Current head 17f4473 differs from pull request most recent head 1c444a6. Consider uploading reports for the commit 1c444a6 to get more accurate results
Impacted file tree graph

@@               Coverage Diff               @@
##           ign-gazebo3     #935      +/-   ##
===============================================
- Coverage        77.83%   77.79%   -0.05%     
===============================================
  Files              219      220       +1     
  Lines            12593    12562      -31     
===============================================
- Hits              9802     9772      -30     
+ Misses            2791     2790       -1     
Impacted Files Coverage Δ
include/ignition/gazebo/Link.hh 100.00% <ø> (ø)
include/ignition/gazebo/Util.hh 100.00% <100.00%> (ø)
src/Link.cc 93.54% <100.00%> (+1.51%) ⬆️
...ems/kinetic_energy_monitor/KineticEnergyMonitor.cc 82.69% <100.00%> (-2.16%) ⬇️
src/systems/lift_drag/LiftDrag.cc 69.93% <100.00%> (-1.68%) ⬇️
src/systems/wind_effects/WindEffects.cc 79.32% <100.00%> (-0.23%) ⬇️
src/Server.cc 82.80% <0.00%> (-1.54%) ⬇️
src/Util.cc 92.96% <0.00%> (-0.08%) ⬇️
src/SimulationRunner.cc 94.42% <0.00%> (-0.07%) ⬇️
src/SimulationRunner.hh 100.00% <0.00%> (ø)
... and 3 more

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 847b1ae...1c444a6. Read the comment docs.

@chapulina chapulina mentioned this pull request Jul 29, 2021
12 tasks
Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

These new APIs are awesome! They'll make it so much easier for systems authors (and result in lot cleaner systems). One small suggestion is lets make the helper function void enableComponent(EntityComponentManager &_ecm, Entity _entity, bool _enable) in link.cc public. There are many places where this pattern is used and it'd be incredibly helpful to reduce the complexity of systems code.

src/Link.cc Outdated Show resolved Hide resolved
src/systems/kinetic_energy_monitor/KineticEnergyMonitor.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@mjcarroll mjcarroll left a comment

Choose a reason for hiding this comment

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

I agree with @arjo129 that moving this enableComponent function into the public API would make a lot of sense. It's a pattern that we do a good bit throughout the codebase.

src/Link.cc Outdated Show resolved Hide resolved
Copy link
Contributor

@arjo129 arjo129 left a comment

Choose a reason for hiding this comment

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

LGTM. I've got a small suggestion to make that might improve quality of life but feel free to reject it if you think its inappropriate.

include/ignition/gazebo/Util.hh Outdated Show resolved Hide resolved
@chapulina chapulina enabled auto-merge (squash) July 30, 2021 01:16
@chapulina chapulina disabled auto-merge July 30, 2021 01:23
Signed-off-by: Louise Poubel <[email protected]>
@chapulina chapulina enabled auto-merge (squash) July 30, 2021 01:25
@chapulina chapulina merged commit 638e97c into ign-gazebo3 Jul 30, 2021
@chapulina chapulina deleted the chapulina/3/enable_link branch July 30, 2021 02:15
chapulina added a commit that referenced this pull request Jul 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants