-1

I'm using the Boost 1.64.0 MSM library to produce a hierarchical state machine. For test the transition mechanism, I implement a state machine like this

+------------------------------------------------+
|                       S                        |
|   +-------------+          +-------------+     |
|   |      S1     |          |      S2     |     |
|   |  +-------+  |          |  +-------+  |     |
|   |  |  S11  |  |          |  |  S21  |  |     |
|   |  +-------+  |          |  +-------+  |     |
|   +-------------+          +-------------+     |
|                                                |
+------------------------------------------------+

So how to define transition from S11 to S21, according to the same situation described in wiki the transition execution sequence should be 'exit S11' -> 'exit S1' -> 'enter S2' -> 'enter S21'.

szh
  • 41
  • 2

1 Answers1

0

According to the document https://www.boost.org/doc/libs/1_66_0/libs/msm/doc/HTML/ch03s02.html#d0e875,

  • it is only possible to explicitly enter a sub- state of the target but not a sub-sub state.
  • it is not possible to explicitly exit. Exit points must be used.

So you cannot do explicit exit from S11.

You can use exit point pseudo state instead of the explicit exit. And I recommend that use entry point pseudo state instead of the explicit entry.

Here is an example code of the entry point pseudo state

http://redboltz.wikidot.com/entry-point-pseudo-state

and the exit point pseudo state.

http://redboltz.wikidot.com/exit-point-pseudo-state

Takatoshi Kondo
  • 3,111
  • 17
  • 36