SCXML editors
Unfortunately, there doesn’t seem to be too many available free SCXML editors, and even less of them are actively maintained. I tried to gather on this page all usable tools that I was able to find.
Qt Creator
Qt Creator is the easiest one to start with. Though personally, I feel like arranging transitions is a bit sloppy. I hope they will add “snap-to-grid” feature in future releases.
Can be downloaded from:
installed together with Qt SDK
Warning
Ubuntu version of Qt Creator crashes quite often when working with state machines. It’s highly recommended to save often to avoid frustration.
Warning
using parallel element in version 4.14.2 on Ubuntu crashes editor when saving file. This happens after editing state machine for awhile and doesn’t seem to occur if only a couple of modifications were made. Hopefully will get fixed.
Basics of how to define a state machine in Qt Creator can be checked here:
Now let’s go through working with hsmcpp specific features.
Specifying callbacks in editor
There are 4 types of callbacks (see State actions and Transitions for details):
state entering
state changed
state exiting
transition
They are specified as a C++ callback name which will be generated in HSM class.
State changed callback can be specified in state->Invoke->srcexp or state->Invoke->src:
State entering callback can be specified in state->onentry->script->Content:
State exiting callback can be specified in state->onexit->script->Content:
Transition callback can be specified in transition->script->Content:
Working with timers and actions
State actions in HSM provide following operations:
start timer
stop timer
restart timer
trigger transition on timer
trigger a regular transition
Actions can be specified in:
state->onentry
state->onexit
Command format is:
start_timer(<timer_id>, < interval in milliseconds >, <is singleshot: true | false>)
stop_timer(<timer_id>)
restart_timer(<timer_id>)
transition(<event_id>, {arg1, arg2, …})
Note
arguments are optional. at the moment only strings and numbers are supported
Using any of the above timer actions will result in availability of timer event. Name format: ON_TIMER_<timer_id>
Conditional transitions
Condition for transitions can be specified in transition->cond:
Possible formats:
<callback_name> is false
<callback_name> is true
<callback_name> (same as “is true”)
Conditional entry points
Hsmcpp library supports Conditional entry points, but defining them through editor directly is not possible.
First, create your substates, define an entry point and add a single transition.
Now you need to save the file and open SCXML file in some text editor (Qt Creator doesn’t allow editing SCXML files directly). Find your section.
Modify it to look like this (ignore <qt:editorinfo> tag). Add as many transitions as you need.
After reloading SCXML file in Qt Creator your HSM should look like this.
scxmlgui
Website: https://github.com/fmorbini/scxmlgui
Simple editor written in Java. Requires a bit more manual work than Qt Creator, but does the job. Binary can be downloaded from GitHub repository.
YAKINDU Statechart Tools
Website: YAKINDU Statechart Tools
This tool comes with a lot of extra features, but what’s important is that it has a state machine editor and a way to export it in SCXML format.
Note
Editor is commercial, but has a free license for personal usage.
ScxmlEditor
Website: ScxmlEditor
Simple editor. Available only as a binary for Windows platform.