Book a Demo

Author Topic: Anyone really using STM_C++ (State Machine code generation)?  (Read 2669 times)

bknoth2

  • EA User
  • **
  • Posts: 129
  • Karma: +2/-0
    • View Profile
Anyone really using STM_C++ (State Machine code generation)?
« on: March 12, 2018, 02:35:26 pm »
Any seasoned STM_C++ users out there?

We have an extensive, three-level state machine and we've generated the code for it using the STM_C++ template. I'm surprised about the generated code in some ways. Loosely speaking, the state machine is implemented in one large loop and every time it goes around the loop it checks for transition conditions. When it enters a state it calls the onEntry() behavior as expected, then exits that and calls the Do() behavior. Once it exits the Do() behavior it goes around the loop but won't enter the Do() behavior again. That means that the the code for the Do() behavior has to sit in a tight loop if it is doing something that takes time, which then means the rest of the state machine can't execute (and check triggers, for example).

We've been working with the templates a lot to try to get the behavior we want (keep calling Do() until a state transition happens), but we're not fully successful yet.

I'd like to know what experiences others have had or if there are recommendations.

Thanks
Bruce