ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The same syntax can be used in ROS 2 as in ROS 1, e.g. ~/chatter will become /node_namespace/node_name/chatter. See:

http://design.ros2.org/articles/topic_and_service_names.html#private-namespace-substitution-character

The same syntax can be used in ROS 2 as in ROS 1, e.g. ~/chatter will become /node_namespace/node_name/chatter. See:

http://design.ros2.org/articles/topic_and_service_names.html#private-namespace-substitution-character

EDIT:

Sorry, I guess you mean the roscpp::NodeHandle object in C++, right now we don't have that, but it's possible we could have it in the future.

In stead, if ROS 1 code used to do something like:

NodeHandle pnh("~");
pnh.advertise<...>("chatter", ...);

In ROS 2, you'd need to instead do:

auto node = std::make_shared<rclcpp::Node>("...", ...);
node->create_publisher<...>("~/chatter", ...);