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 invalid tick frequency in core library. #130

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

Oberacda
Copy link
Contributor

Related to #129

This PR should fix two issues:

  • Invalid reporting of tick performance
  • Non adherance to the specified tick frequency

Signed-off-by: David Oberacker <[email protected]>
@Oberacda Oberacda added bug Something isn't working Core Library Issues concerning the core BT library. labels Oct 22, 2024
@Oberacda Oberacda requested a review from nspielbau October 22, 2024 14:52
@Oberacda Oberacda self-assigned this Oct 22, 2024
@Oberacda Oberacda marked this pull request as draft October 22, 2024 14:52
@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 14 lines in your changes missing coverage. Please review.

Project coverage is 49.62%. Comparing base (e2a5386) to head (dc22460).

Files with missing lines Patch % Lines
ros_bt_py/ros_bt_py/tree_manager.py 0.00% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #130      +/-   ##
==========================================
+ Coverage   49.60%   49.62%   +0.01%     
==========================================
  Files          59       59              
  Lines        7678     7675       -3     
  Branches     1647     1647              
==========================================
  Hits         3809     3809              
+ Misses       3805     3802       -3     
  Partials       64       64              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Oct 22, 2024

Test Results

  3 files  ±0    3 suites  ±0   41s ⏱️ -1s
181 tests ±0  181 ✅ ±0  0 💤 ±0  0 ❌ ±0 
543 runs  ±0  543 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit dc22460. ± Comparison against base commit e2a5386.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@nspielbau nspielbau left a comment

Choose a reason for hiding this comment

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

I am still not sure if we want to calculate it this way, because the reported tick frequency can be faster than the set rate with this measurement (as we check after the tick is done, not after the rate.sleep is)
While this is great for benchmarking it could also confuse people in the future when they look at the tick rate and ask themselves (why is it this fast? I thought it was 10 Hz, why is the parameter not doing anything). Maybe we should publish both an tick_freq_theory and tick_freq_real to combat this

@@ -371,8 +371,6 @@ def __init__(
if tick_frequency_hz == 0.0:
tick_frequency_hz = 10.0

self.tick_sliding_window = [tick_frequency_hz] * 10
Copy link
Contributor

Choose a reason for hiding this comment

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

I like removing the sliding window stuff, that is something for the monitoring GUI to do if we even want it

Comment on lines +577 to -580
tick_start_timestamp = self.ros_node.get_clock().now()
while True:
tick_start_timestamp = self.ros_node.get_clock().now()
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if I understand this change? Why not get the new timestamp at the beginning of each iteration instead of before the loop and at the end of each iteration?

Signed-off-by: David Oberacker <[email protected]>
Comment on lines +614 to 615
tick_start_timestamp = self.ros_node.get_clock().now()
self.rate.sleep()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this make sense? We first start our new timer and then sleep the rest of the rate of the old one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we can also switch this around, but we need to include the rate time in the tick calculation. Indeed it might be more correct to the reporting after wakeing up from the rate.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would switch it around and start at the beginning of the loop and end after the rate

Base automatically changed from dev to main October 28, 2024 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Core Library Issues concerning the core BT library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants