[ros-users] [Discourse.ros.org] [ROS Projects] State Machine Visualization

Nick Fragale ros.discourse at gmail.com
Tue May 2 00:09:36 UTC 2017

Relative to PLC state machines I find SMACH very difficult to setup and understand. But compared to the spaghetti code that would result with a complex project and no state machine, SMACH is a vast improvement.

In the PLC world there is a very common state machine structure called [PackML](https://en.wikipedia.org/wiki/PackML). Almost all automated manufacturing lines can use this same state machine, modified only slightly. Where I worked there was a file that contained the state transitions and at the top was written DO NOT EDIT THIS CODE! In your own code you set flags which were then used to change the state. You get the hang of it in about a day and then it's very easy to program with. (BTW there is no parallel processing done in PLC's)

Now with SMACH and robotics there is no such common state machine, and its very temping to mix your functional code with the state machine code, making it more difficult to understand. These are two of the major reasons I think I find it confusing, but I do appreciate the fact that SMACH is a much more powerful tool than something like PackML, so it makes sense that its harder to setup and understand. 

I think that one day there could be a very common state machine setup using SMACH that does serve as a jumping off place for any robot. For example there may be a 'teleop' state, a 'autonomous' state, a 'pause' state, and a 'recharge' concurrence state would make up a pretty basic state machine that would apply to a lot of robots. I may try to create something like that and post it to github if I have the time. But right now I'm trying to learn FlexBe.

[Visit Topic](https://discourse.ros.org/t/state-machine-visualization/1691/8) or reply to this email to respond.

More information about the ros-users mailing list