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

Add logger and clock interfaces from ResourceManager to HardwareComponent interfaces #1585

Merged
merged 23 commits into from
Jul 8, 2024

Conversation

saikishor
Copy link
Member

@saikishor saikishor commented Jun 24, 2024

As discussed in the WG meeting on 19th June 2024, I've added the logging and the clock interfaces to ResourceManager and HardwareComponents. I've also modified all the RCUTILS logging to RCLCPP logging.

[INFO] [1719246718.869627728] [resource_manager]: Loading hardware 'MockHardwareSystem' 
[INFO] [1719246718.869987243] [resource_manager]: Loaded hardware 'MockHardwareSystem' from plugin 'mock_components/GenericSystem'
[INFO] [1719246718.870008000] [resource_manager]: Initialize hardware 'MockHardwareSystem' 
[WARN] [1719246718.870122036] [resource_manager.hardware_component.system.MockHardwareSystem]: Custom interface with following offset 'actual_position' does not exist. Offset will not be applied
[INFO] [1719246718.870130775] [resource_manager]: Successful initialization of hardware 'MockHardwareSystem'
[INFO] [1719246718.870288251] [resource_manager]: 'configure' hardware 'MockHardwareSystem' 

Thank you

Copy link

codecov bot commented Jun 24, 2024

Codecov Report

Attention: Patch coverage is 65.48223% with 68 lines in your changes missing coverage. Please review.

Project coverage is 86.96%. Comparing base (bb85eae) to head (9d72500).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1585      +/-   ##
==========================================
+ Coverage   86.94%   86.96%   +0.01%     
==========================================
  Files         107      107              
  Lines        9306     9379      +73     
  Branches      863      867       +4     
==========================================
+ Hits         8091     8156      +65     
- Misses        899      903       +4     
- Partials      316      320       +4     
Flag Coverage Δ
unittests 86.96% <65.48%> (+0.01%) ⬆️

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

Files Coverage Δ
.../include/controller_manager/controller_manager.hpp 100.00% <ø> (ø)
...er/test/test_controller_manager_with_namespace.cpp 100.00% <100.00%> (+2.94%) ⬆️
...t_controllers_chaining_with_controller_manager.cpp 99.14% <100.00%> (+0.28%) ⬆️
...ler_manager/test/test_hardware_management_srvs.cpp 96.02% <100.00%> (-0.06%) ⬇️
..._interface/include/hardware_interface/actuator.hpp 100.00% <ø> (ø)
.../include/hardware_interface/actuator_interface.hpp 100.00% <100.00%> (ø)
...re_interface/include/hardware_interface/sensor.hpp 66.66% <ø> (ø)
...ce/include/hardware_interface/sensor_interface.hpp 100.00% <100.00%> (ø)
...re_interface/include/hardware_interface/system.hpp 100.00% <ø> (ø)
...ce/include/hardware_interface/system_interface.hpp 100.00% <100.00%> (ø)
... and 12 more

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.

LGTM!

How can we promote this new feature? Please add something to the release notes, maybe also hardware components docs. Possibly we can use this in the demos as well?

@saikishor
Copy link
Member Author

How can we promote this new feature? Please add something to the release notes, maybe also hardware components docs. Possibly we can use this in the demos as well?

Yes, we can use them in the demos as well. I've used it inside the MockHardwareSystem in this PR.

Copy link
Contributor

mergify bot commented Jun 25, 2024

This pull request is in conflict. Could you fix it @saikishor?

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.

👍

@bmagyar
Copy link
Member

bmagyar commented Jul 3, 2024

@ahcorde are we allowed one more breaking change please please?

bmagyar
bmagyar previously approved these changes Jul 3, 2024
Copy link
Member

@destogl destogl left a comment

Choose a reason for hiding this comment

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

It looks great, just a few small comments we can resolve fairly quickly.

controller_manager/src/controller_manager.cpp Show resolved Hide resolved
controller_manager/src/controller_manager.cpp Outdated Show resolved Hide resolved
controller_manager/src/controller_manager.cpp Show resolved Hide resolved
@@ -73,7 +75,8 @@ class ActuatorInterface : public rclcpp_lifecycle::node_interfaces::LifecycleNod
public:
ActuatorInterface()
: lifecycle_state_(rclcpp_lifecycle::State(
lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN, lifecycle_state_names::UNKNOWN))
lifecycle_msgs::msg::State::PRIMARY_STATE_UNKNOWN, lifecycle_state_names::UNKNOWN)),
actuator_logger_(rclcpp::get_logger("actuator_interface"))
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we here use some better name? Or better yet, do we need this actually? As we always have to call init first.

Copy link
Member Author

Choose a reason for hiding this comment

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

You need to define something, if not it complains with the following error. That's the reason, I declared basically the name of the class

 error: ‘rclcpp::Logger::Logger()’ is private within this context

hardware_interface/src/resource_manager.cpp Show resolved Hide resolved
hardware_interface/src/resource_manager.cpp Show resolved Hide resolved
hardware_interface/src/resource_manager.cpp Show resolved Hide resolved
// Logger and Clock interfaces
rclcpp::node_interfaces::NodeClockInterface::SharedPtr clock_interface_;
rclcpp::node_interfaces::NodeLoggingInterface::SharedPtr logger_interface_;
rclcpp::Logger rm_logger_ = rclcpp::get_logger("resource_manager");
Copy link
Member

Choose a reason for hiding this comment

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

maybe to add this above to the constructor to if - else statement. This would increase clarity. (I mean the right side).

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

hardware_interface/src/resource_manager.cpp Show resolved Hide resolved
@saikishor saikishor dismissed stale reviews from christophfroehlich and bmagyar via 303c846 July 4, 2024 20:58
Copy link
Member

@destogl destogl 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 clarifications!

hardware_interface/src/resource_manager.cpp Show resolved Hide resolved
hardware_interface/src/resource_manager.cpp Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants