Skip to content

Conversation

vatanaksoytezer
Copy link
Contributor

@vatanaksoytezer vatanaksoytezer commented Sep 21, 2021

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

@vatanaksoytezer vatanaksoytezer changed the title Add lifecycle nodes WIP: Add lifecycle nodes Sep 21, 2021
@vatanaksoytezer vatanaksoytezer marked this pull request as draft September 21, 2021 00:49
@vatanaksoytezer
Copy link
Contributor Author

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.

@vatanaksoytezer vatanaksoytezer marked this pull request as ready for review September 21, 2021 13:53
@destogl destogl changed the title WIP: Add lifecycle nodes Add lifecycle nodes Mar 9, 2022
@destogl destogl changed the title Add lifecycle nodes Use lifecycle node as base for controllers Mar 9, 2022
@bmagyar
Copy link
Member

bmagyar commented Mar 11, 2022

depends on ros-controls/ros2_control#538 but otherwise LGTM

@destogl destogl marked this pull request as draft March 11, 2022 08:24
@destogl destogl marked this pull request as ready for review March 11, 2022 08:24
*/
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)
Copy link
Member

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.

Copy link
Contributor

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.

Copy link

@harderthan harderthan left a 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 */)
Copy link
Contributor

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.

Copy link
Member

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)
Copy link
Contributor

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.

@bmagyar
Copy link
Member

bmagyar commented Mar 24, 2022

There's a bunch of warnings reported due to the use of LifecyclePublishers, here's an example:

Trying to publish message on the topic '/test_joint_trajectory_controller/state', but the publisher is not activated
    /root/target_ws/src/ros2_controllers/joint_trajectory_controller

@bmagyar
Copy link
Member

bmagyar commented Mar 25, 2022

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

@bmagyar bmagyar merged commit 2529db8 into ros-controls:master Mar 25, 2022
mechwiz pushed a commit to mechwiz/ros2_controllers that referenced this pull request Apr 5, 2022
* 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]>
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.

7 participants