-
Notifications
You must be signed in to change notification settings - Fork 408
Use lifecycle node as base for controllers #244
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
Use lifecycle node as base for controllers #244
Conversation
So again most of this should be done, but auto declare doesn't seem to work as intended wit lifecycle_nodes as it is with rclcpp::Node. |
c9c1f18
to
1d7fdd6
Compare
depends on ros-controls/ros2_control#538 but otherwise LGTM |
*/ | ||
SegmentTolerances get_segment_tolerances( | ||
const rclcpp::Node & node, const std::vector<std::string> & joint_names) | ||
const rclcpp_lifecycle::LifecycleNode & node, const std::vector<std::string> & joint_names) |
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.
We should probably here use SharedPtr to the node and not the object itself. This is usually done in the rest of the code-base.
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 disagree.
If the function itself doesn't care about the lifetime of the object, then passing by reference should be preferred. Passing a shared pointer has performance costs in incrementing/decrementing the reference count.
See https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters for discussion on this topic.
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.
Looks good to me
std::experimental::optional< | ||
std::reference_wrapper<hardware_interface::LoanedCommandInterface>> /* joint_handle */, | ||
const rclcpp::Node::SharedPtr & /* node */) | ||
std::shared_ptr<rclcpp_lifecycle::LifecycleNode> & /* node */) |
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.
Could have used rclcpp_lifecycle::LifecycleNode::SharedPtr(pretty sure this is defined) as with rclcpp::Node but there is no difference.
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.
Would it be better to pass a reference instead of shard_ptr here too?
*/ | ||
SegmentTolerances get_segment_tolerances( | ||
const rclcpp::Node & node, const std::vector<std::string> & joint_names) | ||
const rclcpp_lifecycle::LifecycleNode & node, const std::vector<std::string> & joint_names) |
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 disagree.
If the function itself doesn't care about the lifetime of the object, then passing by reference should be preferred. Passing a shared pointer has performance costs in incrementing/decrementing the reference count.
See https://herbsutter.com/2013/06/05/gotw-91-solution-smart-pointer-parameters for discussion on this topic.
There's a bunch of warnings reported due to the use of LifecyclePublishers, here's an example:
|
Several CI failures are caused by the lack of release of ros2_control which'd cause similar build issues on the buildfarm. After merging this I'll push a release of both to restore the CI results |
* Add lifecycle nodes * Fix compile issues * Fix trajectory controller * pre-commit fixes * Add time and period to update function * Add lifecycle nodes * Name changes * Final fixes to get things compiled. * Fixing typo in the tests. * More changes to LifecycleNodes. Co-authored-by: Bence Magyar <[email protected]> Co-authored-by: Denis Štogl <[email protected]>
Adds the lifecycle nodes back, that are removed in #124. Depends on ros-controls/ros2_control#538 and #241, since ros-controls/ros2_control#520 is merged but #241 hasn't.Depends on