Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Finite State Machine in multithread enviroment

Finite State Machine in multithread enviroment

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    inejose
    wrote on last edited by
    #1

    Hi,

    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:

    !http://s1.postimg.org/ba5tphhin/maquina_Deestados.png(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.

    call it version 1.0 <a href="http://www.clicpsicologos.com">psicologo online</a> & <a href="http://www.isomus.com">musicoterapia</a>

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cincirin
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        inejose
        wrote on last edited by
        #3

        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! :)

        Regards.

        call it version 1.0 <a href="http://www.clicpsicologos.com">psicologo online</a> & <a href="http://www.isomus.com">musicoterapia</a>

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cincirin
          wrote on last edited by
          #4

          [quote author="inejose" date="1396958638"]I finally started to implement the state machine with the QState Machine Framework.[/quote]

          Good luck ! & happy coding :-)

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved