finite-state models transitions are labeled by events.
We note that an event-driven system is typically based
on a software architecture built around stimuli-driven
call-backs or interrupts, a subscribe mechanism and
listeners that enact such call-backs. Reacting to
stimuli in this way implies uncontrolled concurrency
(e.g. using separate threads or event queues). Lam-
port (Lamport, 1984) provided fundamental proofs
of the limitations of event-driven systems. Reactive-
systems are responsive systems without much pro-
cessing, as opposed to deliberative systems (which
reason, plan, learn). Real-time systems are required to
meet time-deadlines in response to stimuli and time-
triggered systems have been shown very effective for
this (Kopetz, 1993). Therefore, although closely re-
lated, these terms are not the same, our preference for
LLFSMs is supported by the work of Lamport (Lam-
port, 1984) that provides solid reasons why real-time
systems may be better served by time-triggered sys-
tems and pre-determined schedules, rather than the
unbounded delays that may occur in event-driven sys-
tems.
The clfsm
1
scheduler executes an arrangement
of compiled LLFSMs, with the capacity to upload
and suspend LLFSM that represent behaviours dur-
ing runtime (Estivill-Castro and Hexel, 2016). The
clfsm scheduler offers very efficient, in-memory,
data-centric communication between different be-
haviour modules. This works very well if the num-
ber of listeners for a message are known well before
compile-time, but does not work so well if the role of
consumer and producers is to be decided at run-time.
Task planning technology has advanced signif-
icantly. Now, generic plans that solve generic
task planning problems can be synthesised as logic-
labeled finite-state machines with parameters and re-
cursion (Segovia-Aguas et al., 2016). This poses
the challenge of executing these behaviours as com-
piled routines on board a robot, even where several
instances are deployed recursively. Parameterisation
brings the challenge that the middleware cannot stati-
cally determine senders and receivers. Moreover, the
number of LLFSMs in an arrangement can dynam-
ically vary, e.g., through recursive invocation. The
missing link to improve communication, is that invo-
cation of a behaviour (modelled by a LLFSMs) should
be similar to a procedure or function call.
This paper provides such a model, demonstrated
first with the original that clfsm provides and then
proposing the semantics that parameterised LLFSM
invocations should have.
1
Available at http://mipal.net.au/downloads.php
2 INSTANTIATING SUSPENDED
MACHINES
An arrangement of parameterised LLFSMs can be de-
fined dynamically. LLFSMs can be loaded and un-
loaded by request from another machine. This mech-
anism is similar to the suspend/restart mechanism.
However, in the case of unload, the machine is re-
moved from the arrangement, while the load mecha-
nism adds the named LLFSM to the arrangement. We
introduce a variant we name load suspended. The se-
mantics of this new command is similar to the previ-
ous load command with the exception that rather than
loading a LLFSM that executes from the initial state,
with load suspended the child machine is set with its
suspended state as the current state.
Because a LLFSM can be loaded more than once,
LLFSM instances can be logically replicated in an ar-
rangement to execute concurrently, but, as we men-
tioned earlier, this facility was limited to communi-
cation patterns where the total number of LLFSM
was predictable at compilation time to create con-
trol/status communication messages.
We introduce the concept of setting parameters for
a loaded LLFSMs from a caller LLFSM. With this fa-
cility, we can now treat LLFSMs as a function call or
procedure invocation, precisely suitable to enact the
Hierarchical Finite State Controllers inferable with
task planning (Segovia-Aguas et al., 2016).
To demonstrate this facility and illustrate its se-
mantics, we present an example where we recursively
compute the factorial (Fig. 1). The Initial state of
this recursive LLFSM has two transitions. If the
value of its parameter (the variable value) is zero, the
returned value will be set to 1 (state END), and no
further recursion will occur (the machine will pause
in its RETURN state until its caller collects the return
value and such caller unloads the machine).
More interestingly, when the value of the in-
put parameter is greater than zero, the LLFSM
will use the loadSuspended command to load a
new instance of itself (in the OnEntry section
of the LOAD MYSELF SUSPENDED state). The
SET INPUTS state obtains a reference to the recently
loaded and, importantly, suspended machine and sets
the parameter to one less than the current value
(OnEntry section). The caller then requests that the
child resumes (Internal section) and once the child is
running (is running() predicate of the transition), it
will transition to the state MONITOR STATE.
The state MONITOR STATE retrieves the current
state of the child machine, exiting if the child is in
the RETURN state. Once that happens, the caller re-
trieves the returned value from the local variable of
Verifiable Parameterised Behaviour Models - For Robotic and Embedded Systems
365