-
Notifications
You must be signed in to change notification settings - Fork 304
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
Compute the actual update period for each controller and parse it #1140
Compute the actual update period for each controller and parse it #1140
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the idea behind the change? That the cm-update is jittering, or that controller's and cm's update rate don't have an integer divisor?
const auto controller_actual_period = | ||
(time - *loaded_controller.next_update_cycle_time) + controller_period; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be something like time-time_old_
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The next_update_cycle_time
is computed such that there is a condition that checks if the time is greater than or equal to the current time and if the condition passes, then it triggers the update. Usually, when it is equal this difference is zero, but that means you have a control period in between.
If not, I can check if I can move some logic around to see if I can avoid adding this controller period at this stage. I will check this evening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, maybe this is fine as it is.
Not really, we already dealt with this in the previous PR. It's just the controller update method gets the desired I think it makes sense that the controller get's the actual one instead of the desired as this can always be computed with |
But why would the desired not be the actual one? If it is not a perfect divisor, then we have some jitter. and if it the cm itself has not a constant update rate. But anyways, your fix should deal with both cases. |
You are right. It is because of jitter in some cases and in the non-perfect divisor cases, it will be a bit different per cycle but as in the test it should be within some bounds |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1140 +/- ##
==========================================
+ Coverage 47.61% 47.68% +0.06%
==========================================
Files 40 40
Lines 3442 3437 -5
Branches 1865 1861 -4
==========================================
Hits 1639 1639
- Misses 479 480 +1
+ Partials 1324 1318 -6
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Let's give this some time in rolling before backporting to Iron, hope that's ok |
Right now, the period is the desired controller update period, however, it make sense to have the actual update period in the update cycles of the controller, and the desired can be computed inside the controller always using the update_rate available through
get_update_rate
method.This is changed as it is brought up at the ros2_control workshop