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

Controlling transitions between states in SMACH

asked 2014-06-02 01:13:42 -0600

Mehdi. gravatar image

Hello, i started working with SMACH few days ago and I was wondering how I could control the transition between my states from external events. For example a transition would be triggered by the event "voice detected" or "light turned on" which could be published to a topic. I'm aware that it is possible to use acitonlib with SMACH but the tutorial is really confusing and not clear and there is no complete working example as far as I know. I'm also working with a central state machine where many smaller states are nested. Somebody has an idea how to implement event driven state transitions?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-06-02 03:43:17 -0600

hawesie gravatar image

If your external event is going to correspond to something being published on a topic, then you should look at MonitorState.The python docs are here.

edit flag offensive delete link more


Thanks, this does what I need. I previously did it manually using an endless loop at the end of my state checking for a global variable that is changed to true in a callback function of a subscribed topic.

Mehdi. gravatar image Mehdi.  ( 2014-06-02 22:32:26 -0600 )edit

Question Tools



Asked: 2014-06-02 01:13:42 -0600

Seen: 1,455 times

Last updated: Jun 02 '14