Skip to content

Let derived sensors call Sensor::Update#187

Merged
chapulina merged 2 commits intomainfrom
chapulina/7/update
Jan 12, 2022
Merged

Let derived sensors call Sensor::Update#187
chapulina merged 2 commits intomainfrom
chapulina/7/update

Conversation

@chapulina
Copy link
Contributor

@chapulina chapulina commented Jan 11, 2022

🦟 Bug fix

Summary

Ignition Gazebo calls update directly on non-rendering sensors, but it's easy to call the "wrong" function if one is not careful. There are 2 Update functions on the base class:

  1. public: bool Update(const std::chrono::steady_clock::duration &_now, const bool _force);
  2. public: virtual bool Update(const std::chrono::steady_clock::duration &_now) = 0;

Most (all?) of the time, one would want to call 1., which calls 2. under the hood and performs extra steps. But since 2. is also public, and easier to call, we often call 2. directly by mistake.

This PR solves one of the issues by making it easier to call the base class's function. The test changes in this PR wouldn't be possible without the using lines, for example. Also see the ign-gazebo PR:

We should consider also making the virtual function private, which will require a tick-tock cycle.

Checklist

  • Signed all commits for DCO
  • Added tests
  • 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 and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

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

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

codecov bot commented Jan 11, 2022

Codecov Report

Merging #187 (971c1e0) into main (53bcc7f) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #187   +/-   ##
=======================================
  Coverage   70.31%   70.31%           
=======================================
  Files          28       28           
  Lines        2975     2975           
=======================================
  Hits         2092     2092           
  Misses        883      883           
Impacted Files Coverage Δ
include/ignition/sensors/ForceTorqueSensor.hh 100.00% <ø> (ø)

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 53bcc7f...971c1e0. Read the comment docs.

@chapulina
Copy link
Contributor Author

The warning on Jenkins is not introduced by this PR and should be solved when #188 is merged forward.

@chapulina chapulina merged commit 994d191 into main Jan 12, 2022
@chapulina chapulina deleted the chapulina/7/update branch January 12, 2022 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🌱 garden Ignition Garden

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants