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

How do I get a valid NodeHandle in a rqt plugin

asked 2013-06-24 04:41:08 -0500

Daniel Robin Reuter gravatar image

updated 2013-06-24 18:38:08 -0500

130s gravatar image

I need a NodeHandle in order to make my library work properly. I am also using this library in a rqt plugin. Should I just create a new Nodehandle (don't think that this is a good idea) or is there any API which gives me a valid NodeHandle.

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
1

answered 2013-06-24 05:07:37 -0500

Daniel Robin Reuter gravatar image

It seems like I can just instantiate a new NodeHandle. According to the documentation there is no problem with that:

When a NodeHandle is constructed, it checks to see if the global node state has already been started. If so, it increments a global reference count. If not, it starts the node with ros::start() and sets the reference count to 1.

But still are there any better options and do I need to be aware of anything?

edit flag offensive delete link more
0

answered 2016-02-01 12:25:17 -0500

lucasw gravatar image

getNodeHandle() or getPrivateNodeHandle() according to http://answers.ros.org/question/32061...

edit flag offensive delete link more
2

answered 2013-06-24 19:49:27 -0500

130s gravatar image

updated 2013-06-24 21:10:03 -0500

There's no special need for handling nodes in your rqt plugins. Implementation of node in ROS is well modularized so that you can operate nodes either via NodeHandle (C++) or via rospy.

Also, inspired by your question, I added some practices you may want to consider on making rqt plugins here.

edit flag offensive delete link more

Comments

So you would also suggest just to construct a NodeHandle (in C++)?

Daniel Robin Reuter gravatar image Daniel Robin Reuter  ( 2013-06-25 22:26:39 -0500 )edit

I'm not sure what you mean by "construct a NodeHandle". I would instantiate NodeHandle as a variable and use it.

130s gravatar image 130s  ( 2013-06-30 17:23:02 -0500 )edit

Question Tools

Stats

Asked: 2013-06-24 04:41:08 -0500

Seen: 940 times

Last updated: Feb 01 '16