There has been a lot of discussion in the C++ community regarding the use of coroutines in state machines. And while I do think they will make an important contribution to the SMACC libraries once the usage of C++17 and C++20 becomes more widespread, they will remain in an auxiliary role for robotic state machines for the following reasons…
At their heart, coroutines are functions, and as functions most of their “state” is implicit.
This, and coroutines, are great for simplifying io type programming and making that code more robust, something like..
But this is not a replacement for complex behavioral state machines.