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

Controlling transitions between states in SMACH

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

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
5

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

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

Comments

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 -0500 )edit

Question Tools

3 followers

Stats

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

Seen: 1,502 times

Last updated: Jun 02 '14