Ask Your Question
2

private nodehandles in ros 2

asked 2018-06-19 05:38:07 -0600

Skyking gravatar image

Will ros 2 support anything similar to private nodehandle concept of ROS 1 ?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-06-19 14:37:34 -0600

William gravatar image

updated 2018-06-19 14:41:22 -0600

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...

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", ...);
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

2 followers

Stats

Asked: 2018-06-19 05:38:07 -0600

Seen: 199 times

Last updated: Jun 19 '18