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

Using roscpp_init and raspy.init in python (Using a C++ class in Python)

asked 2016-01-22 14:25:25 -0500

Shawn Schaerer gravatar image

updated 2016-01-22 14:29:55 -0500

I am trying to use roscpp_init and rospy.init in the same python program but get errors when I do. if I try to use the rospy interface I get duplicate node created and ROS shuts down. not sure what I can do. Is it possible to use both together?

" I wrapped a C++ class that uses ROS systems in python. I followed the tutorial here ([ ])

in the tutorial is state that I must call roscpp_init('name', argv) because ROSCPP is not initialized. (Class with NodeHandle section of tutorial)

I call roscpp_init('name', argue) and next I call rospy.init('name', agrv) this causes a duplicate named nodes and my first node shuts down. my launch file has the node name defined in it. "

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-01-22 16:49:35 -0500

Dirk Thomas gravatar image

Be aware that the C++ node and the Python node have nothing in common. If you use both APIs you will effectively create two separate nodes.

edit flag offensive delete link more


Thanks, that was unclear until I discovered the duplicate node errors.

Shawn Schaerer gravatar image Shawn Schaerer  ( 2016-01-24 13:07:51 -0500 )edit

answered 2016-01-22 15:22:40 -0500

Shawn Schaerer gravatar image

I think I answered my own question. I had to pass in rospy.myargv(sys.argv) into ropy.init_node

edit flag offensive delete link more

Question Tools



Asked: 2016-01-22 14:25:25 -0500

Seen: 390 times

Last updated: Jan 22 '16