Robotics StackExchange | Archived questions

Python and C++ nodes

Hi!. I'm usung ubuntu 10.04 and ROS electric. I'm trying to move the turtlesim in the beginnerstutorials 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/commandvelocity", Velocity) What am I doing wrong?, Is it possible to publish/subscribe python and c++ nodes between each other?

Asked by ing_jluispr on 2012-02-08 12:03:38 UTC

Comments

Please be more specific with exact error message that you're getting. What do you mean it "can't import the Velocity message"

Asked by David Lu on 2012-02-08 12:40:07 UTC

Answers

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

Asked by David Lu on 2012-02-08 12:40:49 UTC

Comments

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.

Asked by Thomas D on 2012-02-08 12:44:03 UTC

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.

Asked by ing_jluispr on 2012-02-09 05:56:50 UTC

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.

Asked by ing_jluispr on 2012-02-09 02:39:03 UTC

Comments

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

Asked by ing_jluispr on 2012-02-09 08:36:14 UTC

Comments