0
$\begingroup$

Rosanswers logo

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?


Originally posted by Mehdi. on ROS Answers with karma: 3339 on 2014-06-02

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by hawesie with karma: 282 on 2014-06-02

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by Mehdi. on 2014-06-02:
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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.