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

How to program a series of different tasks? SMACH?

asked 2011-12-14 09:20:24 -0600

madmax gravatar image

updated 2011-12-14 09:21:12 -0600

Hi,

I am wondering how I can learn my robot to execute a series of tasks.

Like this example:
First: move to a position on map
Second: say something
Third: move to docking station

I came across SMACH and built a state machine.
But when it comes to actions and sending goals like PoseWithCovarianceStamped, I don't know how to do it. I looked through some tutorials but it didn't help me a lot.

Also the switching between C++ and Python is a bit annoying to me, because I practically programme C++ and don't really know Python.

Is it an acceptable solution to just have a main.cpp and use "if" clauses as a "state machine"?
So I can programme all in C++?

Help appreciated :)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
6

answered 2011-12-14 11:37:36 -0600

joq gravatar image

You can certainly program state machines in C++. There are several techniques, amd it is not particularly hard.

Smach is a nice interface, however. It provides several tools you are unlikely to come up with on your own.

edit flag offensive delete link more

Comments

Thanks, I think I will stick with C++, besides you know a good tutorial where sending a goal in a state machine in python is shown ;)
madmax gravatar image madmax  ( 2011-12-14 20:17:10 -0600 )edit

After a decade I still have the same question: Is there any example with which we can call our .cpp scripts from the SMACH .py file?

AlexandrosNic gravatar image AlexandrosNic  ( 2021-05-06 10:19:22 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2011-12-14 09:20:24 -0600

Seen: 845 times

Last updated: Dec 14 '11