Ask Your Question

Revision history [back]

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: