ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

C++ RAII interface to ROS?

asked 2015-08-07 06:16:00 -0500

drewm1980 gravatar image

Is there a supported RAII interface to ROS? i.e. a class that encapsulates the ros connection, with initialization in the constructor and teardown in the destructor, etc?

The tutorials all seem to start with a call to ros::init, for example, and I don't understand why that can't just be done in the NodeHandle constructor.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-08-08 13:58:42 -0500

NEngelhard gravatar image

So far, there is nothing (afaik). If often happens (at least for me) that you have several NodeHandels in a single Node. I have one for the global namespace and one local ( NodeHandle("~") ) so that it's a bit easier to see where a parameter comes from.

But the concept of a node lifecycle will probably end up in ROS 2:

edit flag offensive delete link more


Thanks for the confirmation.... I thought that was the case.

drewm1980 gravatar image drewm1980  ( 2015-08-10 08:21:46 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower


Asked: 2015-08-07 06:16:00 -0500

Seen: 161 times

Last updated: Aug 08 '15