Ask Your Question
1

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

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

Shawn Schaerer gravatar image

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

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 ([ http://wiki.ros.org/ROS/Tutorials/Usi... ])

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
1

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

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

Comments

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

Shawn Schaerer gravatar imageShawn Schaerer ( 2016-01-24 13:07:51 -0600 )edit
0

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

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

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: 2016-01-22 14:25:25 -0600

Seen: 152 times

Last updated: Jan 22 '16