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

Fix flaky transmission_interface tests by making them deterministic. #1665

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

sgmurray
Copy link
Contributor

Fixes #1555

The transmission_interface tests would give non deterministic spurious failures. The non determinism was because tests were randomly generated using the system time to seed the random number generator. The spurious failures were due to occasionally occurring tiny rounding errors from floating point math.

By seeding the random number generator the tests become deterministic and we avoid the spurious failures.
Additionally, changing the order of some of the multiplications seems to reduce the rounding error.

Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:

  1. Limited scope. Your PR should do one thing or one set of things. Avoid adding “random fixes” to PRs. Put those on separate PRs.
  2. Give your PR a descriptive title. Add a short summary, if required.
  3. Make sure the pipeline is green.
  4. Don’t be afraid to request reviews from maintainers.
  5. New code = new tests. If you are adding new functionality, always make sure to add some tests exercising the code and serving as live documentation of your original intention.

To send us a pull request, please:

  • Fork the repository.
  • Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
  • Ensure local tests pass. (colcon test and pre-commit run (requires you to install pre-commit by pip3 install pre-commit)
  • Commit to your fork using clear commit messages.
  • Send a pull request, answering any default questions in the pull request interface.
  • Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.

Copy link
Contributor

@christophfroehlich christophfroehlich 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 picking this up!

Please fix the pre-commit errors (you can install it locally and run the tests before you push).

Copy link

codecov bot commented Aug 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.07%. Comparing base (a1ad523) to head (457d2f0).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1665   +/-   ##
=======================================
  Coverage   88.07%   88.07%           
=======================================
  Files         108      108           
  Lines       10023    10024    +1     
  Branches      892      892           
=======================================
+ Hits         8828     8829    +1     
  Misses        876      876           
  Partials      319      319           
Flag Coverage Δ
unittests 88.07% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...ission_interface/four_bar_linkage_transmission.hpp 77.89% <100.00%> (ø)
...smission_interface/test/random_generator_utils.hpp 100.00% <100.00%> (ø)

@christophfroehlich christophfroehlich added backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron. labels Aug 12, 2024
Copy link
Member

@bmagyar bmagyar left a comment

Choose a reason for hiding this comment

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

thank you!

@bmagyar bmagyar merged commit ace8416 into ros-controls:master Aug 13, 2024
19 checks passed
mergify bot pushed a commit that referenced this pull request Aug 13, 2024
…1665)

(cherry picked from commit ace8416)

# Conflicts:
#	transmission_interface/test/random_generator_utils.hpp
mergify bot pushed a commit that referenced this pull request Aug 13, 2024
bmagyar pushed a commit that referenced this pull request Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-humble This label should be used by maintaines only! Label triggers PR backport to ROS2 humble. backport-iron This label should be used by maintaines only! Label triggers PR backport to ROS2 Iron.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky transmission_interface tests
3 participants