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

How can a C++ state machine communicate with a python script?

asked 2011-12-17 06:41:22 -0500

madmax gravatar image

Hi,

I am wondering how I could tell a python script to execute from a c++ code.
My specific problem is, to activate a pocketsphinx script to recognize spoken commands.
But pocketsphinx is written in python...

Is the solution to make an action client / server for the communication?
I am new to ROS and a bit confused on how this transition between C++ and python works.

Regards, Max

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2011-12-17 07:13:12 -0500

joq gravatar image

You can define a simple service in Python with a C++ client.

If you need a more elaborate structure for controlling the service, actionlib may provide a better solution.

edit flag offensive delete link more

Comments

So, actionlib when I want to have feedback?
madmax gravatar image madmax  ( 2011-12-17 07:55:28 -0500 )edit
You can return a result message from a simple service. Actionlib provides more sophisticated features, such as cancelling or preempting an earlier request.
joq gravatar image joq  ( 2011-12-17 08:01:49 -0500 )edit
I see, thank you for the explanation!
madmax gravatar image madmax  ( 2011-12-17 21:37:11 -0500 )edit

Question Tools

Stats

Asked: 2011-12-17 06:41:22 -0500

Seen: 1,137 times

Last updated: Dec 17 '11