Ask Your Question

ROS 2 Composable Node Pass NodeHandler

asked 2019-08-16 16:05:33 -0600

zipp39 gravatar image

I have an object that does some internal publishing and subscribing within my Component Class. In ROS 1 we passed the node_handler to the constructor so that class had access to things of that nature. However, I believe the concept of node_handler is obsolete in ROS 2. Is there something similar that I can pass into the constructor to have access to node functions, etc..? Are there other solutions?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-08-29 09:55:34 -0600

mjcarroll gravatar image

In ROS1, the ros::NodeHandle was provided as a protected member of the ros::Nodelet class. In contrast, in ROS2, it is expected that user will create their own rclcpp::Node from the rclcpp::NodeOptions structure passed into the user's constructor.

In the composition paradigm, the thing that you want to compose will either directly inherit from rclcpp::Node or keep a rclcpp::Node as a member.

A demonstration of an object that inherits from rclcpp::Node is available in the ROS2 Demos package:

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-08-16 16:05:33 -0600

Seen: 208 times

Last updated: Aug 29 '19