Finite State Machine in multithread enviroment
we are working for a project where we have to control a complex robotical system. The external interface module is performed by a TCP modbus server, and internally, the robot have to deal with three CAN slaves (two motors and a robotic hand).
All the code is Qt C++ with some CANopen and Modbus libraries.
The behavior of the robot has been designed according to the following state machine:
We are in the design stage and have some general question:
What is the best design pattern to develop a robust and efficient state machine in a multithread enviroment?.
Is the "Qt State Machine Framework":http://qt-project.org/doc/qt-4.8/statemachine-api.html suitable for this or just for graphical widgets pourposes?
There are so many information about State Machine in C++ that cannot figure out what's the best way, maybe someone in the forum has experience with this and can advice us! :)
Thanks a lot.
I have to admit I used Qt State Machine framework too little for an advice, but I can say it's part of the QtCore, so for sure is suitable for any type of application, not just for graphical widgets.
EDIT: regarding multi-threading, almost all features are already async.
bq. The state machine executes asynchronously, i.e. it becomes part of your application's event loop.
Thank you for your opinion, cincirin, I finally started to implement the state machine with the QState Machine Framework.
I will tell you how it went! :)
[quote author="inejose" date="1396958638"]I finally started to implement the state machine with the QState Machine Framework.[/quote]
Good luck ! & happy coding :-)