-
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
A method to get node options to setup the controller node #api-breaking #1169
A method to get node options to setup the controller node #api-breaking #1169
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1169 +/- ##
==========================================
- Coverage 48.02% 48.00% -0.03%
==========================================
Files 41 41
Lines 3525 3529 +4
Branches 1912 1915 +3
==========================================
+ Hits 1693 1694 +1
Misses 442 442
- Partials 1390 1393 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
This pull request is in conflict. Could you fix it @saikishor? |
7934dde
to
0636984
Compare
@bmagyar @destogl @christophfroehlich As we are breaking the API, do you think this PR make sense to go into rolling?. I'm asking because most of the time, you tend to override the init method to just replace the What's your opinion on this 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.
I would never have needed to overwrite NodeOptions (or at least never thought of a solution using this), but the changes look simple and clean for me.
I just ask for some API documentation, which is published here.
@christophfroehlich Thanks for the reminder, I've just added some documentation to the newly added API method |
The motivation behind it is, if someone wants to override the NodeOptions to have ros2_control/controller_manager/src/controller_manager.cpp Lines 1298 to 1301 in 2056d6c
|
9b45446
to
feb6dcf
Compare
This pull request is in conflict. Could you fix it @saikishor? |
feb6dcf
to
a949fc5
Compare
a949fc5
to
f36675e
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.
Should we add any explicit hint that this method can/should be overridden?
Sure, why not. I can add it to the documentation of the method. Thank you |
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 one thing to clarify in the test change.
One more thing. What do you think if we named the method define_node_options
or define_custom_node_options
, rather then get_node_options
. The last one sounds more like getter, not sure if name "invites" people to override it when reading it. @christophfroehlich @bmagyar what do you think too?
controller_interface::return_type TestControllerFailedInit::init( | ||
const std::string & /* controller_name */, const std::string & /* urdf */, | ||
unsigned int /*cm_update_rate*/, const std::string & /*node_namespace*/, | ||
const rclcpp::NodeOptions & /*node_options*/) | ||
{ | ||
return controller_interface::return_type::ERROR; | ||
} | ||
|
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 we still keep this test?
What I understand, you are here not moving the node options only, but changing how init is provoking error in this case. It could be that I am missing a detail or something.
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.
Ideally, you don't need to have this as the same behavior will be achieved as the main init
method in the base class will call the get_node_options
method
virtual return_type init( | ||
const std::string & controller_name, const std::string & urdf, unsigned int cm_update_rate, | ||
const std::string & node_namespace = "", | ||
const rclcpp::NodeOptions & node_options = rclcpp::NodeOptions().enable_logger_service(true)); | ||
const std::string & node_namespace = ""); |
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.
@bmagyar @destogl @christophfroehlich
I need some feedback from you guys. Do you think it makes sense to package these arguments into a structure so that next time we like to add or remove entities we won't be breaking any API (Similar to PImpl implementation)?
Moreover, this PR only provides a method for the user to override the node_options of this particular controller. As per the PR: #1293, the CM will need to get these node options from the newly added method and modify them with the arguments of the params-file
and then somehow feed it back to the init
method to initialize the LifeCycleNode.
- We can still keep this
node_options
parameter in theinit
method, but we will have to remove the default argument and also mark it asfinal
so it won't be overridden - We can package them all together into a single struct (PImpl approach) and then mark this
init
method asfinal
, then we can do the logic without many issues.
One of the above should be fine. Any more ideas are welcome.
I asked already for a more explicit API description that this can be overridden, but renaming is a good idea! I'd go for |
f36675e
to
90f31c4
Compare
1b3d33c
to
a4d9fd9
Compare
@destogl @christophfroehlich @bmagyar I've applied the suggestion proposed by you guys, and then modified a few things to have it ready for the other PR that fixes the parameters: #1293 Let me know your opinion |
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, minor text changes only
controller_interface/include/controller_interface/controller_interface_base.hpp
Outdated
Show resolved
Hide resolved
controller_interface/include/controller_interface/controller_interface_base.hpp
Outdated
Show resolved
Hide resolved
This pull request is in conflict. Could you fix it @saikishor? |
Co-authored-by: Christoph Fröhlich <[email protected]>
4d63bcd
to
a0c1341
Compare
This PR adds a new API
get_node_options
method that other controllers will be able to override, this would make it easy for other controllers to be able to setup their own custom node options