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

Python and C++ nodes [closed]

asked 2012-02-08 11:03:38 -0600

ing_jluispr gravatar image

updated 2014-01-28 17:11:18 -0600

ngrennan gravatar image

Hi!. I'm usung ubuntu 10.04 and ROS electric. I'm trying to move the turtlesim in the beginners_tutorials with voice using the pocketsphinx package. All nodes in pocketsphinx are made in Python, and as you should know turtlesim nodes are made in C++. I'm programming my node in Python but it can't import the Velocity message from the turtlesim package,(For that I'm using: from turtlesim.msg import Velocity.) My publisher is defined as: self.pub = rospy.Publisher("turtle/command_velocity", Velocity) What am I doing wrong?, Is it possible to publish/subscribe python and c++ nodes between each other?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by kwc
close date 2012-02-29 07:47:15

Comments

Please be more specific with exact error message that you're getting. What do you mean it "can't import the Velocity message"
David Lu gravatar image David Lu  ( 2012-02-08 11:40:07 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted
2

answered 2012-02-08 11:44:03 -0600

Thomas D gravatar image

It is possible to use Python and C++ nodes together. The ROS message system is language agnostic. I wrote a tutorial showing how to do that.

We do need more details about your error message importing the Velocity message to help with that part.

edit flag offensive delete link more

Comments

I'm following your tutorial. I have all the files you need for running the examples, but when I'm trying to run the talker.py node surprisingly it shows me the same error that it showed when I was trying to run my own voice control node. It says: ImportError: No module named node_example.msg.
ing_jluispr gravatar image ing_jluispr  ( 2012-02-09 04:56:50 -0600 )edit
0

answered 2012-02-08 11:40:49 -0600

David Lu gravatar image

Yes, it's possible if the turtlesim has properly generated its messages, which it will do when it is rosmade.

edit flag offensive delete link more
0

answered 2012-02-09 01:39:03 -0600

ing_jluispr gravatar image

Thank you very much!

I will follow the tutorial and try to lear how to mix the nodes. I'm using 3 nodes for my test. The recognition node whitch is provided by the pocketsphinx package (everything running well), my own voice control node and the turtlesim_node. When I make my package everything seems to be right. But when I run the launch whitch shows my 3 nodes, the voice control node starts and then stops inmediatly. The console shows that the module turtlesim.sms coundn't be found, that maybe it doesn't exit.

edit flag offensive delete link more
0

answered 2012-02-09 07:36:14 -0600

ing_jluispr gravatar image

It's done!. It was just a dependeces problem. But actually the tutorial posted above was quite usefull. Thank you!

edit flag offensive delete link more

Question Tools

Stats

Asked: 2012-02-08 11:03:38 -0600

Seen: 4,809 times

Last updated: Feb 09 '12