-
Notifications
You must be signed in to change notification settings - Fork 352
Addition of a Default Node for Hardware Component #2348
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2348 +/- ##
==========================================
+ Coverage 88.83% 88.88% +0.05%
==========================================
Files 148 148
Lines 16896 16938 +42
Branches 1440 1443 +3
==========================================
+ Hits 15009 15056 +47
+ Misses 1319 1317 -2
+ Partials 568 565 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
hardware_interface/include/hardware_interface/actuator_interface.hpp
Outdated
Show resolved
Hide resolved
hardware_interface/include/hardware_interface/sensor_interface.hpp
Outdated
Show resolved
Hide resolved
hardware_interface/include/hardware_interface/system_interface.hpp
Outdated
Show resolved
Hide resolved
hardware_interface/include/hardware_interface/actuator_interface.hpp
Outdated
Show resolved
Hide resolved
hardware_interface/include/hardware_interface/sensor_interface.hpp
Outdated
Show resolved
Hide resolved
hardware_interface/include/hardware_interface/system_interface.hpp
Outdated
Show resolved
Hide resolved
…ce.hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
….hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
….hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
…ce.hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
….hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
….hpp Co-authored-by: Sai Kishor Kothakota <[email protected]>
if (auto locked_executor = params.executor.lock()) | ||
{ | ||
std::string node_name = params.hardware_info.name; | ||
std::replace(node_name.begin(), node_name.end(), '/', '_'); |
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.
Should we later convert it to lower case just in case?. What's your opinion here?.
I'm okay to merge it as it is and then we can deal with it 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.
refer
7750bd7
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.
In general looks great :)
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.
LGTM
Co-authored-by: Sai Kishor Kothakota <[email protected]>
2d70891
@@ -48,6 +48,54 @@ The following is a step-by-step guide to create source files, basic tests, and c | |||
In the first line usually the parents ``on_init`` is called to process standard values, like name. This is done using: ``hardware_interface::(Actuator|Sensor|System)Interface::on_init(info)``. | |||
If all required parameters are set and valid and everything works fine return ``CallbackReturn::SUCCESS`` or ``return CallbackReturn::ERROR`` otherwise. | |||
|
|||
#. **(Optional) Adding a Diagnostic Publisher** |
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.
@soham2560 Can you modify this section here? it would makes sense to be regarding the addition of the node, and how it can be accessed, and the user can use it to add services, publishers etc. May be the below example code, can be an example on what the user can do. It's better to focus on generic things rather than a specific one in the documentation.
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.
check now
Co-authored-by: Sai Kishor Kothakota <[email protected]>
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 method2 looks good. The described method1 needs some changes
@soham2560 there are some failing tests, can you review them? Thanks |
Co-authored-by: Sai Kishor Kothakota <[email protected]>
Co-authored-by: Sai Kishor Kothakota <[email protected]>
Co-authored-by: Sai Kishor Kothakota <[email protected]>
Co-authored-by: Sai Kishor Kothakota <[email protected]>
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.
Just thinking if we can move the logic into any helper methods file, instead of duplicating it in every interface class?
Theres a future PR where we merge system, sensor and actuator since theres a lot of overlapping code, that should take care of this imo, or should it be done here regardless? |
ok if there are already plans in doing so, i'm also fine with that |
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.
Is there anything special we need to do to make it so that the interface_node and the CM_node do shared memory ros topics because they are part of the same component?
"Executor is not available during hardware component initialization for '%s'. Skipping " | ||
"node creation!", |
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.
How often does this happen? Can we try for the lock more than once?
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 doesn't happen as long as the Executor is a valid pointer. We had to add it as we started adding this new API now, so all the tests are calling this without a valid executor.
This can be done through NodeOptions by setting the ros2_control/controller_interface/include/controller_interface/controller_interface_base.hpp Lines 215 to 226 in ad47e2a
May be we can do it in a separate PR? |
Brief
Now that we have access to the CM's executor from #2323, the user can add their nodes to it and create publishers and subscribers from them. The next step, which this PR addresses, is adding a node by default, with the hardware components name, and giving the user access to it through a
get_node
method.