-
Notifications
You must be signed in to change notification settings - Fork 310
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
Integrate pal_statistics for introspection of controllers, hardware components and more #1918
base: master
Are you sure you want to change the base?
Integrate pal_statistics for introspection of controllers, hardware components and more #1918
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1918 +/- ##
==========================================
- Coverage 88.61% 88.60% -0.01%
==========================================
Files 122 122
Lines 13304 13357 +53
Branches 1207 1215 +8
==========================================
+ Hits 11789 11835 +46
- Misses 1062 1064 +2
- Partials 453 458 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 could write an AI agent commenting on PRs 😆
- Please update the docs
- Please update the release_notes
Sure! Boss 😆😆 |
This pull request is in conflict. Could you fix it @saikishor? |
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.
Thanks! I tested this successfully and discussed some details with Sai, just add some notes here:
- pal_statistics name/values pair is parsed by plotjuggler to be able to select the values by name without a custom message layout/no need for sending the names on a regular basis.
- statistics from [Diagnostics] Add diagnostics of execution time and periodicity of the controllers and controller_manager #1871 will be added in a later PR.
- we have to fix clang so that it doesn't check system packages, maybe with this setup
I added some minor comments below.
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.
Approving as we have fixed clang now.
Thank you @christophfroehlich |
This pull request is in conflict. Could you fix it @saikishor? |
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.
Thanks for detailed answers @saikishor, I think this looks like a great addition!
Thanks to you for taking time and reviewing it |
b9d892c
to
90d12f2
Compare
Conflicts resolved! ;) |
…ses and add helper macros
Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
90d12f2
to
da34b78
Compare
Co-authored-by: Christoph Fröhlich <christophfroehlich@users.noreply.github.com>
da34b78
to
aa19ef9
Compare
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.
A few comments to clarify before continuing.
@@ -26,6 +26,7 @@ | |||
#include "hardware_interface/loaned_command_interface.hpp" | |||
#include "hardware_interface/loaned_state_interface.hpp" | |||
|
|||
#include "pal_statistics/pal_statistics_utils.hpp" |
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.
This adds a new dependency to almost everything. Should we at first have this removed by on compiler flags and one can enable it if required.
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 the change is minimal, or may be I can add it to the hardware_interface/introspection and add it eveywhere, that way it is minimal
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.
Done
@@ -283,6 +284,8 @@ ControllerManager::ControllerManager( | |||
init_controller_manager(); | |||
} | |||
|
|||
ControllerManager::~ControllerManager() { CLEAR_ALL_REGISTRIES(); } |
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 am not a fan of global macros if those are not required. If this is the only way, OK, but then I would propose to have a more explicit name, e.g., CLEAR_ALL_INTROSPECTION_REGISTRIES
.
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.
This global macro is from PAL statistics. The macros are added for simplistic integration. May be I can add another macro, that can call this.
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.
Done. I added more explicit name as you requested
@@ -321,6 +324,10 @@ void ControllerManager::init_controller_manager() | |||
diagnostics_updater_.add( | |||
"Controller Manager Activity", this, | |||
&ControllerManager::controller_manager_diagnostic_callback); | |||
INITIALIZE_REGISTRY( |
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.
Also here, can we do this on an object? If not, can we rename this to INITIALIZE_INTROSPECTION_REGISTRY
?
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.
This is from the PAL statistics. I'm not sure that this can be renamed :(
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.
Done. I've also changed this and others
@@ -93,7 +94,7 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod | |||
*/ | |||
ActuatorInterface(const ActuatorInterface & other) = delete; | |||
|
|||
ActuatorInterface(ActuatorInterface && other) = default; | |||
ActuatorInterface(ActuatorInterface && other) = delete; |
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.
Why do we need to delete this constructor? It is obviously not used, but if this is the reason for deletion, then why not do this in a separate PR.
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.
Sure
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.
@destogl I just checked the code. This is a part of the change as the pal_statistics::RegistrationsRAII stats_registrations_
is non moveable. As we already deleted the copies, I think it makes sense to remove the move operations as well
rclcpp::get_logger("command_interface"), "Registering handle: " << get_name()); | ||
std::function<double()> f = [this]() | ||
{ return value_ptr_ ? *value_ptr_ : std::numeric_limits<double>::quiet_NaN(); }; | ||
REGISTER_ENTITY(DEFAULT_REGISTRY_KEY, "command_interface." + get_name(), f); |
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.
Kind or too generic name. I understand this is from the pal_statistics
, but maybe we can sub-specify it.
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.
Sure
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'll take a look at it
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.
Changed it with specific naming
{ | ||
RCLCPP_INFO_STREAM( | ||
rclcpp::get_logger("command_interface"), "Unregistering handle: " << get_name()); | ||
UNREGISTER_ENTITY(DEFAULT_REGISTRY_KEY, "command_interface." + get_name()); |
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.
Kind of too generic.
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.
Yeah, PAL statistics uses that. I'll what I can do wiht it
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.
Done. Also changed it to be more generic
Co-authored-by: Dr. Denis <denis@stoglrobotics.de>
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.
@destogl Thanks for the review.
I've addressed all your comments in the PR.
@@ -26,6 +26,7 @@ | |||
#include "hardware_interface/loaned_command_interface.hpp" | |||
#include "hardware_interface/loaned_state_interface.hpp" | |||
|
|||
#include "pal_statistics/pal_statistics_utils.hpp" |
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.
Done
@@ -283,6 +284,8 @@ ControllerManager::ControllerManager( | |||
init_controller_manager(); | |||
} | |||
|
|||
ControllerManager::~ControllerManager() { CLEAR_ALL_REGISTRIES(); } |
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.
Done. I added more explicit name as you requested
@@ -321,6 +324,10 @@ void ControllerManager::init_controller_manager() | |||
diagnostics_updater_.add( | |||
"Controller Manager Activity", this, | |||
&ControllerManager::controller_manager_diagnostic_callback); | |||
INITIALIZE_REGISTRY( |
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.
Done. I've also changed this and others
rclcpp::get_logger("command_interface"), "Registering handle: " << get_name()); | ||
std::function<double()> f = [this]() | ||
{ return value_ptr_ ? *value_ptr_ : std::numeric_limits<double>::quiet_NaN(); }; | ||
REGISTER_ENTITY(DEFAULT_REGISTRY_KEY, "command_interface." + get_name(), f); |
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.
Changed it with specific naming
{ | ||
RCLCPP_INFO_STREAM( | ||
rclcpp::get_logger("command_interface"), "Unregistering handle: " << get_name()); | ||
UNREGISTER_ENTITY(DEFAULT_REGISTRY_KEY, "command_interface." + get_name()); |
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.
Done. Also changed it to be more generic
Added integration of pal_statistics into the ros2_control infrastructure
You can find more examples at #1897