-
Notifications
You must be signed in to change notification settings - Fork 312
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
Reset moving average #1984
Open
tonynajjar
wants to merge
15
commits into
ros-controls:master
Choose a base branch
from
angsa-robotics:add-window-to-moving-average
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+29
−0
Open
Reset moving average #1984
Changes from 14 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
63de32d
Add call timeout
26c79d3
fix cherrypick
be335ed
Merge branch 'master' into master
tonynajjar 5735f0d
Add docs
tonynajjar 620e2ac
Update controller_manager/doc/userdoc.rst
tonynajjar 274880f
Merge remote-tracking branch 'ros2/master'
tonynajjar a495547
fix order
tonynajjar b537260
rename
tonynajjar f512643
Merge branch 'master' into master
tonynajjar 22d383c
Update controller_manager/doc/userdoc.rst
tonynajjar 87ce781
Merge branch 'ros-controls:master' into master
tonynajjar 2c80244
Reset moving average
tonynajjar 5135ccd
Merge branch 'ros-controls:master' into master
tonynajjar 5023884
Merge remote-tracking branch 'angsa/master' into add-window-to-moving…
tonynajjar b3ac890
Add window_size param
tonynajjar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2322,6 +2322,10 @@ std::vector<std::string> ControllerManager::get_controller_names() | |
|
||
void ControllerManager::read(const rclcpp::Time & time, const rclcpp::Duration & period) | ||
{ | ||
if (periodicity_stats_.GetCount() >= 100) | ||
{ | ||
periodicity_stats_.Reset(); | ||
} | ||
periodicity_stats_.AddMeasurement(1.0 / period.seconds()); | ||
auto [ok, failed_hardware_names] = resource_manager_->read(time, period); | ||
|
||
|
@@ -3347,6 +3351,7 @@ void ControllerManager::controller_manager_diagnostic_callback( | |
const std::string periodicity_stat_name = "periodicity"; | ||
const auto cm_stats = periodicity_stats_.GetStatistics(); | ||
stat.add("update_rate", std::to_string(get_update_rate())); | ||
stat.add(periodicity_stat_name + ".sample_count", std::to_string(cm_stats.sample_count)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know if this is an intuitive diagnostic for the user, moreover it tend to be a constant rather than a varying value |
||
stat.add(periodicity_stat_name + ".average", std::to_string(cm_stats.average)); | ||
stat.add( | ||
periodicity_stat_name + ".standard_deviation", std::to_string(cm_stats.standard_deviation)); | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 window size could be made configurable
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.
good point. Could you please add a param for that? I think 100 is a good default value for resetting
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.
I think it is better to leave it to the user to define it. If not defined, let it accumulate from the beginning.