mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
2878 lines
70 KiB
HTML
2878 lines
70 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html>
|
|
<head>
|
|
<link rel="stylesheet" href="stylesheet.css" type="text/css"/>
|
|
</head>
|
|
<body>
|
|
<div id="container">
|
|
<div id="product">
|
|
<div id="product_logo"></div>
|
|
<div id="product_name"><big><b></b></big></div>
|
|
<div id="product_description"></div>
|
|
</div>
|
|
<div id="main">
|
|
<div id="navigation">
|
|
<h2>Modules</h2>
|
|
<ul><li>
|
|
<a href="index.html">index</a>
|
|
</li></ul>
|
|
<ul>
|
|
<li><a href="AI_A2A.html">AI_A2A</a></li>
|
|
<li><a href="AI_A2A_Cap.html">AI_A2A_Cap</a></li>
|
|
<li><a href="AI_A2A_Dispatcher.html">AI_A2A_Dispatcher</a></li>
|
|
<li><a href="AI_A2A_GCI.html">AI_A2A_GCI</a></li>
|
|
<li><a href="AI_A2A_Patrol.html">AI_A2A_Patrol</a></li>
|
|
<li><a href="AI_Bai.html">AI_Bai</a></li>
|
|
<li><a href="AI_Balancer.html">AI_Balancer</a></li>
|
|
<li><a href="AI_Cap.html">AI_Cap</a></li>
|
|
<li><a href="AI_Cas.html">AI_Cas</a></li>
|
|
<li><a href="AI_Formation.html">AI_Formation</a></li>
|
|
<li><a href="AI_Patrol.html">AI_Patrol</a></li>
|
|
<li><a href="Account.html">Account</a></li>
|
|
<li><a href="Airbase.html">Airbase</a></li>
|
|
<li><a href="AirbasePolice.html">AirbasePolice</a></li>
|
|
<li><a href="Assign.html">Assign</a></li>
|
|
<li><a href="Base.html">Base</a></li>
|
|
<li><a href="Cargo.html">Cargo</a></li>
|
|
<li><a href="CleanUp.html">CleanUp</a></li>
|
|
<li><a href="Client.html">Client</a></li>
|
|
<li><a href="CommandCenter.html">CommandCenter</a></li>
|
|
<li><a href="Controllable.html">Controllable</a></li>
|
|
<li><a href="DCSAirbase.html">DCSAirbase</a></li>
|
|
<li><a href="DCSCoalitionObject.html">DCSCoalitionObject</a></li>
|
|
<li><a href="DCSCommand.html">DCSCommand</a></li>
|
|
<li><a href="DCSController.html">DCSController</a></li>
|
|
<li><a href="DCSGroup.html">DCSGroup</a></li>
|
|
<li><a href="DCSObject.html">DCSObject</a></li>
|
|
<li><a href="DCSTask.html">DCSTask</a></li>
|
|
<li><a href="DCSTypes.html">DCSTypes</a></li>
|
|
<li><a href="DCSUnit.html">DCSUnit</a></li>
|
|
<li><a href="DCSVec3.html">DCSVec3</a></li>
|
|
<li><a href="DCSWorld.html">DCSWorld</a></li>
|
|
<li><a href="DCSZone.html">DCSZone</a></li>
|
|
<li><a href="DCScountry.html">DCScountry</a></li>
|
|
<li><a href="DCStimer.html">DCStimer</a></li>
|
|
<li><a href="DCStrigger.html">DCStrigger</a></li>
|
|
<li><a href="Database.html">Database</a></li>
|
|
<li><a href="Designate.html">Designate</a></li>
|
|
<li><a href="Detection.html">Detection</a></li>
|
|
<li><a href="DetectionManager.html">DetectionManager</a></li>
|
|
<li><a href="Escort.html">Escort</a></li>
|
|
<li><a href="Event.html">Event</a></li>
|
|
<li>Fsm</li>
|
|
<li><a href="Goal.html">Goal</a></li>
|
|
<li><a href="Group.html">Group</a></li>
|
|
<li><a href="Identifiable.html">Identifiable</a></li>
|
|
<li><a href="Menu.html">Menu</a></li>
|
|
<li><a href="Message.html">Message</a></li>
|
|
<li><a href="MissileTrainer.html">MissileTrainer</a></li>
|
|
<li><a href="Mission.html">Mission</a></li>
|
|
<li><a href="Movement.html">Movement</a></li>
|
|
<li><a href="Object.html">Object</a></li>
|
|
<li><a href="Point.html">Point</a></li>
|
|
<li><a href="Positionable.html">Positionable</a></li>
|
|
<li><a href="Process_JTAC.html">Process_JTAC</a></li>
|
|
<li><a href="Process_Pickup.html">Process_Pickup</a></li>
|
|
<li><a href="Protect.html">Protect</a></li>
|
|
<li><a href="Radio.html">Radio</a></li>
|
|
<li><a href="Rat.html">Rat</a></li>
|
|
<li><a href="Route.html">Route</a></li>
|
|
<li><a href="Scenery.html">Scenery</a></li>
|
|
<li><a href="ScheduleDispatcher.html">ScheduleDispatcher</a></li>
|
|
<li><a href="Scheduler.html">Scheduler</a></li>
|
|
<li><a href="Scoring.html">Scoring</a></li>
|
|
<li><a href="Sead.html">Sead</a></li>
|
|
<li><a href="Set.html">Set</a></li>
|
|
<li><a href="Settings.html">Settings</a></li>
|
|
<li><a href="Smoke.html">Smoke</a></li>
|
|
<li><a href="Spawn.html">Spawn</a></li>
|
|
<li><a href="SpawnStatic.html">SpawnStatic</a></li>
|
|
<li><a href="Spot.html">Spot</a></li>
|
|
<li><a href="Static.html">Static</a></li>
|
|
<li><a href="StaticObject.html">StaticObject</a></li>
|
|
<li><a href="Task.html">Task</a></li>
|
|
<li><a href="TaskZoneCapture.html">TaskZoneCapture</a></li>
|
|
<li><a href="Task_A2A.html">Task_A2A</a></li>
|
|
<li><a href="Task_A2A_Dispatcher.html">Task_A2A_Dispatcher</a></li>
|
|
<li><a href="Task_A2G.html">Task_A2G</a></li>
|
|
<li><a href="Task_A2G_Dispatcher.html">Task_A2G_Dispatcher</a></li>
|
|
<li><a href="Task_Cargo.html">Task_Cargo</a></li>
|
|
<li><a href="Task_PICKUP.html">Task_PICKUP</a></li>
|
|
<li><a href="Unit.html">Unit</a></li>
|
|
<li><a href="Utils.html">Utils</a></li>
|
|
<li><a href="Zone.html">Zone</a></li>
|
|
<li><a href="ZoneCaptureCoalition.html">ZoneCaptureCoalition</a></li>
|
|
<li><a href="ZoneGoal.html">ZoneGoal</a></li>
|
|
<li><a href="ZoneGoalCoalition.html">ZoneGoalCoalition</a></li>
|
|
<li><a href="env.html">env</a></li>
|
|
<li><a href="land.html">land</a></li>
|
|
<li><a href="routines.html">routines</a></li>
|
|
</ul>
|
|
</div>
|
|
<div id="content">
|
|
<h1>Module <code>Fsm</code></h1>
|
|
|
|
<p><strong>Core</strong> -- The <strong>FSM</strong> (<strong>F</strong>inite <strong>S</strong>tate <strong>M</strong>achine) class and derived <strong>FSM_</strong> classes
|
|
are design patterns allowing efficient (long-lasting) processes and workflows.</p>
|
|
|
|
|
|
|
|
<p><img src="..\Presentations\FSM\Dia1.JPG" alt="Banner Image"/></p>
|
|
|
|
<hr/>
|
|
|
|
<p>A Finite State Machine (FSM) models a process flow that transitions between various <strong>States</strong> through triggered <strong>Events</strong>.</p>
|
|
|
|
<p>A FSM can only be in one of a finite number of states.
|
|
The machine is in only one state at a time; the state it is in at any given time is called the <strong>current state</strong>.
|
|
It can change from one state to another when initiated by an <strong><strong>internal</strong> or <strong>external</strong> triggering event</strong>, which is called a <strong>transition</strong>.
|
|
An <strong>FSM implementation</strong> is defined by <strong>a list of its states</strong>, <strong>its initial state</strong>, and <strong>the triggering events</strong> for <strong>each possible transition</strong>.
|
|
An FSM implementation is composed out of <strong>two parts</strong>, a set of <strong>state transition rules</strong>, and an implementation set of <strong>state transition handlers</strong>, implementing those transitions.</p>
|
|
|
|
<p>The FSM class supports a <strong>hierarchical implementation of a Finite State Machine</strong>,
|
|
that is, it allows to <strong>embed existing FSM implementations in a master FSM</strong>.
|
|
FSM hierarchies allow for efficient FSM re-use, <strong>not having to re-invent the wheel every time again</strong> when designing complex processes.</p>
|
|
|
|
<p><img src="..\Presentations\FSM\Dia2.JPG" alt="Workflow Example"/></p>
|
|
|
|
<p>The above diagram shows a graphical representation of a FSM implementation for a <strong>Task</strong>, which guides a Human towards a Zone,
|
|
orders him to destroy x targets and account the results.
|
|
Other examples of ready made FSM could be: </p>
|
|
|
|
<ul>
|
|
<li>route a plane to a zone flown by a human</li>
|
|
<li>detect targets by an AI and report to humans</li>
|
|
<li>account for destroyed targets by human players</li>
|
|
<li>handle AI infantry to deploy from or embark to a helicopter or airplane or vehicle </li>
|
|
<li>let an AI patrol a zone</li>
|
|
</ul>
|
|
|
|
<p>The <strong>MOOSE framework</strong> uses extensively the FSM class and derived FSM_ classes,
|
|
because <strong>the goal of MOOSE is to simplify mission design complexity for mission building</strong>.
|
|
By efficiently utilizing the FSM class and derived classes, MOOSE allows mission designers to quickly build processes.
|
|
<strong>Ready made FSM-based implementations classes</strong> exist within the MOOSE framework that <strong>can easily be re-used,
|
|
and tailored</strong> by mission designers through <strong>the implementation of Transition Handlers</strong>.
|
|
Each of these FSM implementation classes start either with:</p>
|
|
|
|
<ul>
|
|
<li>an acronym <strong>AI_</strong>, which indicates an FSM implementation directing <strong>AI controlled</strong> <a href="GROUP.html">GROUP</a> and/or <a href="UNIT.html">UNIT</a>. These AI_ classes derive the <a href="##(FSM_CONTROLLABLE)">#FSM_CONTROLLABLE</a> class.</li>
|
|
<li>an acronym <strong>TASK_</strong>, which indicates an FSM implementation executing a <a href="TASK.html">TASK</a> executed by Groups of players. These TASK_ classes derive the <a href="##(FSM_TASK)">#FSM_TASK</a> class.</li>
|
|
<li>an acronym <strong>ACT_</strong>, which indicates an Sub-FSM implementation, directing <strong>Humans actions</strong> that need to be done in a <a href="TASK.html">TASK</a>, seated in a <a href="CLIENT.html">CLIENT</a> (slot) or a <a href="UNIT.html">UNIT</a> (CA join). These ACT_ classes derive the <a href="##(FSM_PROCESS)">#FSM_PROCESS</a> class.</li>
|
|
</ul>
|
|
|
|
<p>Detailed explanations and API specifics are further below clarified and FSM derived class specifics are described in those class documentation sections.</p>
|
|
|
|
<h2><strong>Dislaimer:</strong></h2>
|
|
<p>The FSM class development is based on a finite state machine implementation made by Conroy Kyle.
|
|
The state machine can be found on <a href="https://github.com/kyleconroy/lua-state-machine">github</a>
|
|
I've reworked this development (taken the concept), and created a <strong>hierarchical state machine</strong> out of it, embedded within the DCS simulator.
|
|
Additionally, I've added extendability and created an API that allows seamless FSM implementation.</p>
|
|
|
|
<p>The following derived classes are available in the MOOSE framework, that implement a specialised form of a FSM:</p>
|
|
|
|
<ul>
|
|
<li><a href="##(FSM_TASK)">#FSM_TASK</a>: Models Finite State Machines for <a href="Task.html">Task</a>s.</li>
|
|
<li><a href="##(FSM_PROCESS)">#FSM_PROCESS</a>: Models Finite State Machines for <a href="Task.html">Task</a> actions, which control <a href="Client.html">Client</a>s.</li>
|
|
<li><a href="##(FSM_CONTROLLABLE)">#FSM_CONTROLLABLE</a>: Models Finite State Machines for <a href="Controllable.html">Controllable</a>s, which are <a href="Group.html">Group</a>s, <a href="Unit.html">Unit</a>s, <a href="Client.html">Client</a>s.</li>
|
|
<li><a href="##(FSM_SET)">#FSM_SET</a>: Models Finite State Machines for <a href="Set.html">Set</a>s. Note that these FSMs control multiple objects!!! So State concerns here
|
|
for multiple objects or the position of the state machine in the process.</li>
|
|
</ul>
|
|
|
|
<hr/>
|
|
|
|
|
|
<h3>Author: <strong>Sven Van de Velde (FlightControl)</strong></h3>
|
|
<h3>Contributions:</h3>
|
|
|
|
<hr/>
|
|
|
|
|
|
<h2>Global(s)</h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="#FSM">FSM</a></td>
|
|
<td class="summary">
|
|
<h1>FSM class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
|
|
|
|
<p>A Finite State Machine (FSM) models a process flow that transitions between various <strong>States</strong> through triggered <strong>Events</strong>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="#FSM_CONTROLLABLE">FSM_CONTROLLABLE</a></td>
|
|
<td class="summary">
|
|
<h1>FSM_CONTROLLABLE, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_CONTROLLABLE class models Finite State Machines for <a href="Controllable.html">Controllable</a>s, which are <a href="Group.html">Group</a>s, <a href="Unit.html">Unit</a>s, <a href="Client.html">Client</a>s.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="#FSM_PROCESS">FSM_PROCESS</a></td>
|
|
<td class="summary">
|
|
<h1>FSM_PROCESS, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_PROCESS class models Finite State Machines for <a href="Task.html">Task</a> actions, which control <a href="Client.html">Client</a>s.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="#FSM_SET">FSM_SET</a></td>
|
|
<td class="summary">
|
|
<h1>FSM_SET, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_SET class models Finite State Machines for <a href="Set.html">Set</a>s.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="#FSM_TASK">FSM_TASK</a></td>
|
|
<td class="summary">
|
|
<h1>FSM_TASK, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_TASK class models Finite State Machines for <a href="Task.html">Task</a>s.</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<h2><a id="#(FSM)">Type <code>FSM</code></a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).AddEndState">FSM:AddEndState(State)</a></td>
|
|
<td class="summary">
|
|
<p>Adds an End state.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).AddProcess">FSM:AddProcess(From, Event, Process, ReturnEvents)</a></td>
|
|
<td class="summary">
|
|
<p>Set the default <a href="Process.html">Process</a> template with key ProcessName providing the ProcessClass and the process object when it is assigned to a <a href="Controllable.html">Controllable</a> by the task.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).AddScore">FSM:AddScore(State, ScoreText, Score)</a></td>
|
|
<td class="summary">
|
|
<p>Adds a score for the FSM to be achieved.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).AddScoreProcess">FSM:AddScoreProcess(From, Event, State, ScoreText, Score)</a></td>
|
|
<td class="summary">
|
|
<p>Adds a score for the FSM_PROCESS to be achieved.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).AddTransition">FSM:AddTransition(From, Event, To)</a></td>
|
|
<td class="summary">
|
|
<p>Add a new transition rule to the FSM.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).CallScheduler">FSM.CallScheduler</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).Events">FSM.Events</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetEndStates">FSM:GetEndStates()</a></td>
|
|
<td class="summary">
|
|
<p>Returns the End states.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetProcess">FSM:GetProcess(From, Event)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetProcesses">FSM:GetProcesses()</a></td>
|
|
<td class="summary">
|
|
<p>Returns a table of the SubFSM rules defined within the FSM.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetScores">FSM:GetScores()</a></td>
|
|
<td class="summary">
|
|
<p>Returns a table with the scores defined.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetStartState">FSM:GetStartState()</a></td>
|
|
<td class="summary">
|
|
<p>Returns the start state of the FSM.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetState">FSM:GetState()</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetSubs">FSM:GetSubs()</a></td>
|
|
<td class="summary">
|
|
<p>Returns a table with the Subs defined.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).GetTransitions">FSM:GetTransitions()</a></td>
|
|
<td class="summary">
|
|
<p>Returns a table of the transition rules defined within the FSM.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).Is">FSM:Is(State)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).LoadCallBacks">FSM:LoadCallBacks(CallBackTable)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).New">FSM:New(FsmT)</a></td>
|
|
<td class="summary">
|
|
<p>Creates a new FSM object.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).Scores">FSM.Scores</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).SetStartState">FSM:SetStartState(State)</a></td>
|
|
<td class="summary">
|
|
<p>Sets the start state of the FSM.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._EndStates">FSM._EndStates</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._EventSchedules">FSM._EventSchedules</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._Processes">FSM._Processes</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._Scores">FSM._Scores</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._StartState">FSM._StartState</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._Transitions">FSM._Transitions</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._add_to_map">FSM:_add_to_map(Map, Event)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._call_handler">FSM:_call_handler(handler, params, EventName)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._create_transition">FSM:_create_transition(EventName)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._delayed_transition">FSM:_delayed_transition(EventName)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._eventmap">FSM:_eventmap(Events, EventStructure)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._gosub">FSM:_gosub(ParentFrom, ParentEvent)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._handler">FSM:_handler(EventName, ...)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._isendstate">FSM:_isendstate(Current)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM)._submap">FSM:_submap(subs, sub, name)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).can">FSM:can(e)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).cannot">FSM:cannot(e)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).current">FSM.current</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).endstates">FSM.endstates</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).is">FSM:is(state)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).options">FSM.options</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM).subs">FSM.subs</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h2><a id="#(FSM_CONTROLLABLE)">Type <code>FSM_CONTROLLABLE</code></a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).Controllable">FSM_CONTROLLABLE.Controllable</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).GetControllable">FSM_CONTROLLABLE:GetControllable()</a></td>
|
|
<td class="summary">
|
|
<p>Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).New">FSM_CONTROLLABLE:New(FSMT, Controllable)</a></td>
|
|
<td class="summary">
|
|
<p>Creates a new FSM_CONTROLLABLE object.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).OnAfterStop">FSM_CONTROLLABLE:OnAfterStop(Controllable, From, Event, To)</a></td>
|
|
<td class="summary">
|
|
<p>OnAfter Transition Handler for Event Stop.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).OnBeforeStop">FSM_CONTROLLABLE:OnBeforeStop(Controllable, From, Event, To)</a></td>
|
|
<td class="summary">
|
|
<p>OnBefore Transition Handler for Event Stop.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).OnEnterStopped">FSM_CONTROLLABLE:OnEnterStopped(Controllable, From, Event, To)</a></td>
|
|
<td class="summary">
|
|
<p>OnEnter Transition Handler for State Stopped.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).OnLeaveStopped">FSM_CONTROLLABLE:OnLeaveStopped(Controllable, From, Event, To)</a></td>
|
|
<td class="summary">
|
|
<p>OnLeave Transition Handler for State Stopped.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).SetControllable">FSM_CONTROLLABLE:SetControllable(FSMControllable)</a></td>
|
|
<td class="summary">
|
|
<p>Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).Stop">FSM_CONTROLLABLE:Stop()</a></td>
|
|
<td class="summary">
|
|
<p>Synchronous Event Trigger for Event Stop.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE).__Stop">FSM_CONTROLLABLE:__Stop(Delay)</a></td>
|
|
<td class="summary">
|
|
<p>Asynchronous Event Trigger for Event Stop.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_CONTROLLABLE)._call_handler">FSM_CONTROLLABLE:_call_handler(handler, params, EventName)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h2><a id="#(FSM_PROCESS)">Type <code>FSM_PROCESS</code></a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).Assign">FSM_PROCESS:Assign(Task, ProcessUnit)</a></td>
|
|
<td class="summary">
|
|
<p>Assign the process to a <a href="Unit.html">Unit</a> and activate the process.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).Copy">FSM_PROCESS:Copy(Controllable, Task)</a></td>
|
|
<td class="summary">
|
|
<p>Creates a new FSM<em>PROCESS object based on this FSM</em>PROCESS.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).GetCommandCenter">FSM_PROCESS:GetCommandCenter()</a></td>
|
|
<td class="summary">
|
|
<p>Gets the mission of the process.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).GetMission">FSM_PROCESS:GetMission()</a></td>
|
|
<td class="summary">
|
|
<p>Gets the mission of the process.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).GetTask">FSM_PROCESS:GetTask()</a></td>
|
|
<td class="summary">
|
|
<p>Gets the task of the process.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).Init">FSM_PROCESS:Init(FsmProcess)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).Message">FSM_PROCESS:Message(Message)</a></td>
|
|
<td class="summary">
|
|
<p>Send a message of the <a href="Task.html">Task</a> to the Group of the Unit.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).New">FSM_PROCESS:New(Controllable, Task)</a></td>
|
|
<td class="summary">
|
|
<p>Creates a new FSM_PROCESS object.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).Remove">FSM_PROCESS:Remove()</a></td>
|
|
<td class="summary">
|
|
<p>Removes an FSM_PROCESS object.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).SetTask">FSM_PROCESS:SetTask(Task)</a></td>
|
|
<td class="summary">
|
|
<p>Sets the task of the process.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).Task">FSM_PROCESS.Task</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS)._call_handler">FSM_PROCESS:_call_handler(handler, params, EventName)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).onenterAssigned">FSM_PROCESS:onenterAssigned(ProcessUnit)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).onenterFailed">FSM_PROCESS:onenterFailed(ProcessUnit)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_PROCESS).onstatechange">FSM_PROCESS:onstatechange(ProcessUnit, Event, From, To, Task, Dummy)</a></td>
|
|
<td class="summary">
|
|
<p>StateMachine callback function for a FSM_PROCESS</p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h2><a id="#(FSM_SET)">Type <code>FSM_SET</code></a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_SET).Get">FSM_SET:Get()</a></td>
|
|
<td class="summary">
|
|
<p>Gets the SET<em>BASE object that the FSM</em>SET governs.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_SET).New">FSM_SET:New(FSMT, Set_SET_BASE, FSMSet)</a></td>
|
|
<td class="summary">
|
|
<p>Creates a new FSM_SET object.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_SET).Set">FSM_SET.Set</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_SET)._call_handler">FSM_SET:_call_handler(handler, params, EventName)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h2><a id="#(FSM_TASK)">Type <code>FSM_TASK</code></a></h2>
|
|
<table class="function_list">
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_TASK).New">FSM_TASK:New(FSMT, Task, TaskUnit)</a></td>
|
|
<td class="summary">
|
|
<p>Creates a new FSM_TASK object.</p>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_TASK).Task">FSM_TASK.Task</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td class="name" nowrap="nowrap"><a href="##(FSM_TASK)._call_handler">FSM_TASK:_call_handler(handler, params, EventName)</a></td>
|
|
<td class="summary">
|
|
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<h2>Global(s)</h2>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="##(FSM)">#FSM</a></em>
|
|
<a id="FSM" >
|
|
<strong>FSM</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<h1>FSM class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
|
|
|
|
<p>A Finite State Machine (FSM) models a process flow that transitions between various <strong>States</strong> through triggered <strong>Events</strong>.</p>
|
|
|
|
|
|
|
|
<p>A FSM can only be in one of a finite number of states.
|
|
The machine is in only one state at a time; the state it is in at any given time is called the <strong>current state</strong>.
|
|
It can change from one state to another when initiated by an <strong><strong>internal</strong> or <strong>external</strong> triggering event</strong>, which is called a <strong>transition</strong>.
|
|
An <strong>FSM implementation</strong> is defined by <strong>a list of its states</strong>, <strong>its initial state</strong>, and <strong>the triggering events</strong> for <strong>each possible transition</strong>.
|
|
An FSM implementation is composed out of <strong>two parts</strong>, a set of <strong>state transition rules</strong>, and an implementation set of <strong>state transition handlers</strong>, implementing those transitions.</p>
|
|
|
|
<p>The FSM class supports a <strong>hierarchical implementation of a Finite State Machine</strong>,
|
|
that is, it allows to <strong>embed existing FSM implementations in a master FSM</strong>.
|
|
FSM hierarchies allow for efficient FSM re-use, <strong>not having to re-invent the wheel every time again</strong> when designing complex processes.</p>
|
|
|
|
<p><img src="..\Presentations\FSM\Dia2.JPG" alt="Workflow Example"/></p>
|
|
|
|
<p>The above diagram shows a graphical representation of a FSM implementation for a <strong>Task</strong>, which guides a Human towards a Zone,
|
|
orders him to destroy x targets and account the results.
|
|
Other examples of ready made FSM could be: </p>
|
|
|
|
<ul>
|
|
<li>route a plane to a zone flown by a human</li>
|
|
<li>detect targets by an AI and report to humans</li>
|
|
<li>account for destroyed targets by human players</li>
|
|
<li>handle AI infantry to deploy from or embark to a helicopter or airplane or vehicle </li>
|
|
<li>let an AI patrol a zone</li>
|
|
</ul>
|
|
|
|
<p>The <strong>MOOSE framework</strong> uses extensively the FSM class and derived FSM_ classes,
|
|
because <strong>the goal of MOOSE is to simplify mission design complexity for mission building</strong>.
|
|
By efficiently utilizing the FSM class and derived classes, MOOSE allows mission designers to quickly build processes.
|
|
<strong>Ready made FSM-based implementations classes</strong> exist within the MOOSE framework that <strong>can easily be re-used,
|
|
and tailored</strong> by mission designers through <strong>the implementation of Transition Handlers</strong>.
|
|
Each of these FSM implementation classes start either with:</p>
|
|
|
|
<ul>
|
|
<li>an acronym <strong>AI_</strong>, which indicates an FSM implementation directing <strong>AI controlled</strong> <a href="GROUP.html">GROUP</a> and/or <a href="UNIT.html">UNIT</a>. These AI_ classes derive the <a href="##(FSM_CONTROLLABLE)">#FSM_CONTROLLABLE</a> class.</li>
|
|
<li>an acronym <strong>TASK_</strong>, which indicates an FSM implementation executing a <a href="TASK.html">TASK</a> executed by Groups of players. These TASK_ classes derive the <a href="##(FSM_TASK)">#FSM_TASK</a> class.</li>
|
|
<li>an acronym <strong>ACT_</strong>, which indicates an Sub-FSM implementation, directing <strong>Humans actions</strong> that need to be done in a <a href="TASK.html">TASK</a>, seated in a <a href="CLIENT.html">CLIENT</a> (slot) or a <a href="UNIT.html">UNIT</a> (CA join). These ACT_ classes derive the <a href="##(FSM_PROCESS)">#FSM_PROCESS</a> class.</li>
|
|
</ul>
|
|
|
|
<p><img src="..\Presentations\FSM\Dia3.JPG" alt="Transition Rules and Transition Handlers and Event Triggers"/></p>
|
|
|
|
<p>The FSM class is the base class of all FSM_ derived classes. It implements the main functionality to define and execute Finite State Machines.
|
|
The derived FSM_ classes extend the Finite State Machine functionality to run a workflow process for a specific purpose or component.</p>
|
|
|
|
<p>Finite State Machines have <strong>Transition Rules</strong>, <strong>Transition Handlers</strong> and <strong>Event Triggers</strong>.</p>
|
|
|
|
<p>The <strong>Transition Rules</strong> define the "Process Flow Boundaries", that is,
|
|
the path that can be followed hopping from state to state upon triggered events.
|
|
If an event is triggered, and there is no valid path found for that event,
|
|
an error will be raised and the FSM will stop functioning.</p>
|
|
|
|
<p>The <strong>Transition Handlers</strong> are special methods that can be defined by the mission designer, following a defined syntax.
|
|
If the FSM object finds a method of such a handler, then the method will be called by the FSM, passing specific parameters.
|
|
The method can then define its own custom logic to implement the FSM workflow, and to conduct other actions.</p>
|
|
|
|
<p>The <strong>Event Triggers</strong> are methods that are defined by the FSM, which the mission designer can use to implement the workflow.
|
|
Most of the time, these Event Triggers are used within the Transition Handler methods, so that a workflow is created running through the state machine.</p>
|
|
|
|
<p>As explained above, a FSM supports <strong>Linear State Transitions</strong> and <strong>Hierarchical State Transitions</strong>, and both can be mixed to make a comprehensive FSM implementation.
|
|
The below documentation has a seperate chapter explaining both transition modes, taking into account the <strong>Transition Rules</strong>, <strong>Transition Handlers</strong> and <strong>Event Triggers</strong>.</p>
|
|
|
|
<h2>FSM Linear Transitions</h2>
|
|
|
|
<p>Linear Transitions are Transition Rules allowing an FSM to transition from one or multiple possible <strong>From</strong> state(s) towards a <strong>To</strong> state upon a Triggered <strong>Event</strong>.
|
|
The Lineair transition rule evaluation will always be done from the <strong>current state</strong> of the FSM.
|
|
If no valid Transition Rule can be found in the FSM, the FSM will log an error and stop.</p>
|
|
|
|
<h3>FSM Transition Rules</h3>
|
|
|
|
<p>The FSM has transition rules that it follows and validates, as it walks the process.
|
|
These rules define when an FSM can transition from a specific state towards an other specific state upon a triggered event.</p>
|
|
|
|
<p>The method <a href="##(FSM).AddTransition">FSM.AddTransition</a>() specifies a new possible Transition Rule for the FSM. </p>
|
|
|
|
<p>The initial state can be defined using the method <a href="##(FSM).SetStartState">FSM.SetStartState</a>(). The default start state of an FSM is "None".</p>
|
|
|
|
<p>Find below an example of a Linear Transition Rule definition for an FSM.</p>
|
|
|
|
<pre><code> local Fsm3Switch = FSM:New() -- #FsmDemo
|
|
FsmSwitch:SetStartState( "Off" )
|
|
FsmSwitch:AddTransition( "Off", "SwitchOn", "On" )
|
|
FsmSwitch:AddTransition( "Off", "SwitchMiddle", "Middle" )
|
|
FsmSwitch:AddTransition( "On", "SwitchOff", "Off" )
|
|
FsmSwitch:AddTransition( "Middle", "SwitchOff", "Off" )
|
|
</code></pre>
|
|
|
|
<p>The above code snippet models a 3-way switch Linear Transition:</p>
|
|
|
|
<ul>
|
|
<li>It can be switched <strong>On</strong> by triggering event <strong>SwitchOn</strong>.</li>
|
|
<li>It can be switched to the <strong>Middle</strong> position, by triggering event <strong>SwitchMiddle</strong>.</li>
|
|
<li>It can be switched <strong>Off</strong> by triggering event <strong>SwitchOff</strong>.</li>
|
|
<li>Note that once the Switch is <strong>On</strong> or <strong>Middle</strong>, it can only be switched <strong>Off</strong>.</li>
|
|
</ul>
|
|
|
|
<h4>Some additional comments:</h4>
|
|
|
|
<p>Note that Linear Transition Rules <strong>can be declared in a few variations</strong>:</p>
|
|
|
|
<ul>
|
|
<li>The From states can be <strong>a table of strings</strong>, indicating that the transition rule will be valid <strong>if the current state</strong> of the FSM will be <strong>one of the given From states</strong>.</li>
|
|
<li>The From state can be a <strong>"*"</strong>, indicating that <strong>the transition rule will always be valid</strong>, regardless of the current state of the FSM.</li>
|
|
</ul>
|
|
|
|
<p>The below code snippet shows how the two last lines can be rewritten and consensed.</p>
|
|
|
|
<pre><code> FsmSwitch:AddTransition( { "On", "Middle" }, "SwitchOff", "Off" )
|
|
</code></pre>
|
|
|
|
<h3>Transition Handling</h3>
|
|
|
|
<p><img src="..\Presentations\FSM\Dia4.JPG" alt="Transition Handlers"/></p>
|
|
|
|
<p>An FSM transitions in <strong>4 moments</strong> when an Event is being triggered and processed. <br/>
|
|
The mission designer can define for each moment specific logic within methods implementations following a defined API syntax. <br/>
|
|
These methods define the flow of the FSM process; because in those methods the FSM Internal Events will be triggered.</p>
|
|
|
|
<ul>
|
|
<li>To handle <strong>State</strong> transition moments, create methods starting with OnLeave or OnEnter concatenated with the State name.</li>
|
|
<li>To handle <strong>Event</strong> transition moments, create methods starting with OnBefore or OnAfter concatenated with the Event name.</li>
|
|
</ul>
|
|
|
|
<p><strong>The OnLeave and OnBefore transition methods may return false, which will cancel the transition!</strong></p>
|
|
|
|
<p>Transition Handler methods need to follow the above specified naming convention, but are also passed parameters from the FSM.
|
|
These parameters are on the correct order: From, Event, To:</p>
|
|
|
|
<ul>
|
|
<li>From = A string containing the From state.</li>
|
|
<li>Event = A string containing the Event name that was triggered.</li>
|
|
<li>To = A string containing the To state.</li>
|
|
</ul>
|
|
|
|
<p>On top, each of these methods can have a variable amount of parameters passed. See the example in section <a href="#1.1.3)-event-triggers">1.1.3</a>.</p>
|
|
|
|
<h3>Event Triggers</h3>
|
|
|
|
<p><img src="..\Presentations\FSM\Dia5.JPG" alt="Event Triggers"/></p>
|
|
|
|
<p>The FSM creates for each Event two <strong>Event Trigger methods</strong>. <br/>
|
|
There are two modes how Events can be triggered, which is <strong>synchronous</strong> and <strong>asynchronous</strong>:</p>
|
|
|
|
<ul>
|
|
<li>The method <strong>FSM:Event()</strong> triggers an Event that will be processed <strong>synchronously</strong> or <strong>immediately</strong>.</li>
|
|
<li>The method <strong>FSM:<strong>Event( __seconds</strong> )</strong> triggers an Event that will be processed <strong>asynchronously</strong> over time, waiting <strong>x seconds</strong>.</li>
|
|
</ul>
|
|
|
|
<p>The destinction between these 2 Event Trigger methods are important to understand. An asynchronous call will "log" the Event Trigger to be executed at a later time.
|
|
Processing will just continue. Synchronous Event Trigger methods are useful to change states of the FSM immediately, but may have a larger processing impact.</p>
|
|
|
|
<p>The following example provides a little demonstration on the difference between synchronous and asynchronous Event Triggering.</p>
|
|
|
|
<pre><code> function FSM:OnAfterEvent( From, Event, To, Amount )
|
|
self:T( { Amount = Amount } )
|
|
end
|
|
|
|
local Amount = 1
|
|
FSM:__Event( 5, Amount )
|
|
|
|
Amount = Amount + 1
|
|
FSM:Event( Text, Amount )
|
|
</code></pre>
|
|
|
|
<p>In this example, the <strong>:OnAfterEvent</strong>() Transition Handler implementation will get called when <strong>Event</strong> is being triggered.
|
|
Before we go into more detail, let's look at the last 4 lines of the example.
|
|
The last line triggers synchronously the <strong>Event</strong>, and passes Amount as a parameter.
|
|
The 3rd last line of the example triggers asynchronously <strong>Event</strong>.
|
|
Event will be processed after 5 seconds, and Amount is given as a parameter.</p>
|
|
|
|
<p>The output of this little code fragment will be:</p>
|
|
|
|
<ul>
|
|
<li>Amount = 2</li>
|
|
<li>Amount = 2</li>
|
|
</ul>
|
|
|
|
<p>Because ... When Event was asynchronously processed after 5 seconds, Amount was set to 2. So be careful when processing and passing values and objects in asynchronous processing!</p>
|
|
|
|
<h3>Linear Transition Example</h3>
|
|
|
|
<p>This example is fully implemented in the MOOSE test mission on GITHUB: <a href="https://github.com/FlightControl-Master/MOOSE/blob/master/Moose%20Test%20Missions/FSM%20-%20Finite%20State%20Machine/FSM-100%20-%20Transition%20Explanation/FSM-100%20-%20Transition%20Explanation.lua">FSM-100 - Transition Explanation</a></p>
|
|
|
|
<p>It models a unit standing still near Batumi, and flaring every 5 seconds while switching between a Green flare and a Red flare.
|
|
The purpose of this example is not to show how exciting flaring is, but it demonstrates how a Linear Transition FSM can be build.
|
|
Have a look at the source code. The source code is also further explained below in this section.</p>
|
|
|
|
<p>The example creates a new FsmDemo object from class FSM.
|
|
It will set the start state of FsmDemo to state <strong>Green</strong>.
|
|
Two Linear Transition Rules are created, where upon the event <strong>Switch</strong>,
|
|
the FsmDemo will transition from state <strong>Green</strong> to <strong>Red</strong> and from <strong>Red</strong> back to <strong>Green</strong>.</p>
|
|
|
|
<p><img src="..\Presentations\FSM\Dia6.JPG" alt="Transition Example"/></p>
|
|
|
|
<pre><code> local FsmDemo = FSM:New() -- #FsmDemo
|
|
FsmDemo:SetStartState( "Green" )
|
|
FsmDemo:AddTransition( "Green", "Switch", "Red" )
|
|
FsmDemo:AddTransition( "Red", "Switch", "Green" )
|
|
</code></pre>
|
|
|
|
<p>In the above example, the FsmDemo could flare every 5 seconds a Green or a Red flare into the air.
|
|
The next code implements this through the event handling method <strong>OnAfterSwitch</strong>.</p>
|
|
|
|
<p><img src="..\Presentations\FSM\Dia7.JPG" alt="Transition Flow"/></p>
|
|
|
|
<pre><code> function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit )
|
|
self:T( { From, Event, To, FsmUnit } )
|
|
|
|
if From == "Green" then
|
|
FsmUnit:Flare(FLARECOLOR.Green)
|
|
else
|
|
if From == "Red" then
|
|
FsmUnit:Flare(FLARECOLOR.Red)
|
|
end
|
|
end
|
|
self:__Switch( 5, FsmUnit ) -- Trigger the next Switch event to happen in 5 seconds.
|
|
end
|
|
|
|
FsmDemo:__Switch( 5, FsmUnit ) -- Trigger the first Switch event to happen in 5 seconds.
|
|
</code></pre>
|
|
|
|
<p>The OnAfterSwitch implements a loop. The last line of the code fragment triggers the Switch Event within 5 seconds.
|
|
Upon the event execution (after 5 seconds), the OnAfterSwitch method is called of FsmDemo (cfr. the double point notation!!! ":").
|
|
The OnAfterSwitch method receives from the FSM the 3 transition parameter details ( From, Event, To ),
|
|
and one additional parameter that was given when the event was triggered, which is in this case the Unit that is used within OnSwitchAfter.</p>
|
|
|
|
<pre><code> function FsmDemo:OnAfterSwitch( From, Event, To, FsmUnit )
|
|
</code></pre>
|
|
|
|
<p>For debugging reasons the received parameters are traced within the DCS.log.</p>
|
|
|
|
<pre><code> self:T( { From, Event, To, FsmUnit } )
|
|
</code></pre>
|
|
|
|
<p>The method will check if the From state received is either "Green" or "Red" and will flare the respective color from the FsmUnit.</p>
|
|
|
|
<pre><code> if From == "Green" then
|
|
FsmUnit:Flare(FLARECOLOR.Green)
|
|
else
|
|
if From == "Red" then
|
|
FsmUnit:Flare(FLARECOLOR.Red)
|
|
end
|
|
end
|
|
</code></pre>
|
|
|
|
<p>It is important that the Switch event is again triggered, otherwise, the FsmDemo would stop working after having the first Event being handled.</p>
|
|
|
|
<pre><code> FsmDemo:__Switch( 5, FsmUnit ) -- Trigger the next Switch event to happen in 5 seconds.
|
|
</code></pre>
|
|
|
|
<p>The below code fragment extends the FsmDemo, demonstrating multiple <strong>From states declared as a table</strong>, adding a <strong>Linear Transition Rule</strong>.
|
|
The new event <strong>Stop</strong> will cancel the Switching process.
|
|
The transition for event Stop can be executed if the current state of the FSM is either "Red" or "Green".</p>
|
|
|
|
<pre><code> local FsmDemo = FSM:New() -- #FsmDemo
|
|
FsmDemo:SetStartState( "Green" )
|
|
FsmDemo:AddTransition( "Green", "Switch", "Red" )
|
|
FsmDemo:AddTransition( "Red", "Switch", "Green" )
|
|
FsmDemo:AddTransition( { "Red", "Green" }, "Stop", "Stopped" )
|
|
</code></pre>
|
|
|
|
<p>The transition for event Stop can also be simplified, as any current state of the FSM is valid.</p>
|
|
|
|
<pre><code> FsmDemo:AddTransition( "*", "Stop", "Stopped" )
|
|
</code></pre>
|
|
|
|
<p>So... When FsmDemo:Stop() is being triggered, the state of FsmDemo will transition from Red or Green to Stopped.
|
|
And there is no transition handling method defined for that transition, thus, no new event is being triggered causing the FsmDemo process flow to halt.</p>
|
|
|
|
<h2>FSM Hierarchical Transitions</h2>
|
|
|
|
<p>Hierarchical Transitions allow to re-use readily available and implemented FSMs.
|
|
This becomes in very useful for mission building, where mission designers build complex processes and workflows,
|
|
combining smaller FSMs to one single FSM.</p>
|
|
|
|
<p>The FSM can embed <strong>Sub-FSMs</strong> that will execute and return <strong>multiple possible Return (End) States</strong>. <br/>
|
|
Depending upon <strong>which state is returned</strong>, the main FSM can continue the flow <strong>triggering specific events</strong>.</p>
|
|
|
|
<p>The method <a href="##(FSM).AddProcess">FSM.AddProcess</a>() adds a new Sub-FSM to the FSM. </p>
|
|
|
|
<hr/>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="##(FSM_CONTROLLABLE)">#FSM_CONTROLLABLE</a></em>
|
|
<a id="FSM_CONTROLLABLE" >
|
|
<strong>FSM_CONTROLLABLE</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<h1>FSM_CONTROLLABLE, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_CONTROLLABLE class models Finite State Machines for <a href="Controllable.html">Controllable</a>s, which are <a href="Group.html">Group</a>s, <a href="Unit.html">Unit</a>s, <a href="Client.html">Client</a>s.</p>
|
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="##(FSM_PROCESS)">#FSM_PROCESS</a></em>
|
|
<a id="FSM_PROCESS" >
|
|
<strong>FSM_PROCESS</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<h1>FSM_PROCESS, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_PROCESS class models Finite State Machines for <a href="Task.html">Task</a> actions, which control <a href="Client.html">Client</a>s.</p>
|
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="##(FSM_SET)">#FSM_SET</a></em>
|
|
<a id="FSM_SET" >
|
|
<strong>FSM_SET</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<h1>FSM_SET, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_SET class models Finite State Machines for <a href="Set.html">Set</a>s.</p>
|
|
|
|
|
|
<p>Note that these FSMs control multiple objects!!! So State concerns here
|
|
for multiple objects or the position of the state machine in the process.</p>
|
|
|
|
<hr/>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="##(FSM_TASK)">#FSM_TASK</a></em>
|
|
<a id="FSM_TASK" >
|
|
<strong>FSM_TASK</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<h1>FSM_TASK, extends <a href="##(FSM)">#FSM</a></h1>
|
|
|
|
<p>FSM_TASK class models Finite State Machines for <a href="Task.html">Task</a>s.</p>
|
|
|
|
|
|
|
|
<hr/>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<h2><a id="#(Fsm)" >Type <code>Fsm</code></a></h2>
|
|
|
|
<h2><a id="#(FSM)" >Type <code>FSM</code></a></h2>
|
|
<h3>Field(s)</h3>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).AddEndState" >
|
|
<strong>FSM:AddEndState(State)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Adds an End state.</p>
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> State </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).AddProcess" >
|
|
<strong>FSM:AddProcess(From, Event, Process, ReturnEvents)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Set the default <a href="Process.html">Process</a> template with key ProcessName providing the ProcessClass and the process object when it is assigned to a <a href="Controllable.html">Controllable</a> by the task.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#table From </em></code>:
|
|
Can contain a string indicating the From state or a table of strings containing multiple From states.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>:
|
|
The Event name.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em><a href="Core.Fsm.html##(FSM_PROCESS)">Core.Fsm#FSM_PROCESS</a> Process </em></code>:
|
|
An sub-process FSM.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#table ReturnEvents </em></code>:
|
|
A table indicating for which returned events of the SubFSM which Event must be triggered in the FSM.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="Core.Fsm.html##(FSM_PROCESS)">Core.Fsm#FSM_PROCESS</a>:</em>
|
|
The SubFSM.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).AddScore" >
|
|
<strong>FSM:AddScore(State, ScoreText, Score)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Adds a score for the FSM to be achieved.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#string State </em></code>:
|
|
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string ScoreText </em></code>:
|
|
is a text describing the score that is given according the status.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#number Score </em></code>:
|
|
is a number providing the score of the status.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM)">#FSM</a>:</em>
|
|
self</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).AddScoreProcess" >
|
|
<strong>FSM:AddScoreProcess(From, Event, State, ScoreText, Score)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Adds a score for the FSM_PROCESS to be achieved.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#string From </em></code>:
|
|
is the From State of the main process.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>:
|
|
is the Event of the main process.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string State </em></code>:
|
|
is the state of the process when the score needs to be given. (See the relevant state descriptions of the process).</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string ScoreText </em></code>:
|
|
is a text describing the score that is given according the status.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#number Score </em></code>:
|
|
is a number providing the score of the status.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM)">#FSM</a>:</em>
|
|
self</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).AddTransition" >
|
|
<strong>FSM:AddTransition(From, Event, To)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Add a new transition rule to the FSM.</p>
|
|
|
|
|
|
<p>A transition rule defines when and if the FSM can transition from a state towards another state upon a triggered event.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#table From </em></code>:
|
|
Can contain a string indicating the From state or a table of strings containing multiple From states.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>:
|
|
The Event name.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string To </em></code>:
|
|
The To state.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM).CallScheduler" >
|
|
<strong>FSM.CallScheduler</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM).Events" >
|
|
<strong>FSM.Events</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetEndStates" >
|
|
<strong>FSM:GetEndStates()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Returns the End states.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetProcess" >
|
|
<strong>FSM:GetProcess(From, Event)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> From </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> Event </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetProcesses" >
|
|
<strong>FSM:GetProcesses()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Returns a table of the SubFSM rules defined within the FSM.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em>#table:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetScores" >
|
|
<strong>FSM:GetScores()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Returns a table with the scores defined.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetStartState" >
|
|
<strong>FSM:GetStartState()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Returns the start state of the FSM.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em>#string:</em>
|
|
A string containing the start state.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetState" >
|
|
<strong>FSM:GetState()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetSubs" >
|
|
<strong>FSM:GetSubs()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Returns a table with the Subs defined.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).GetTransitions" >
|
|
<strong>FSM:GetTransitions()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Returns a table of the transition rules defined within the FSM.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em>#table:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).Is" >
|
|
<strong>FSM:Is(State)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> State </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).LoadCallBacks" >
|
|
<strong>FSM:LoadCallBacks(CallBackTable)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> CallBackTable </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).New" >
|
|
<strong>FSM:New(FsmT)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Creates a new FSM object.</p>
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> FsmT </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM)">#FSM</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM).Scores" >
|
|
<strong>FSM.Scores</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).SetStartState" >
|
|
<strong>FSM:SetStartState(State)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Sets the start state of the FSM.</p>
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#string State </em></code>:
|
|
A string defining the start state.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM)._EndStates" >
|
|
<strong>FSM._EndStates</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM)._EventSchedules" >
|
|
<strong>FSM._EventSchedules</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM)._Processes" >
|
|
<strong>FSM._Processes</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM)._Scores" >
|
|
<strong>FSM._Scores</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em>#string</em>
|
|
<a id="#(FSM)._StartState" >
|
|
<strong>FSM._StartState</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM)._Transitions" >
|
|
<strong>FSM._Transitions</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._add_to_map" >
|
|
<strong>FSM:_add_to_map(Map, Event)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> Map </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> Event </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._call_handler" >
|
|
<strong>FSM:_call_handler(handler, params, EventName)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> handler </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> params </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._create_transition" >
|
|
<strong>FSM:_create_transition(EventName)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._delayed_transition" >
|
|
<strong>FSM:_delayed_transition(EventName)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._eventmap" >
|
|
<strong>FSM:_eventmap(Events, EventStructure)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> Events </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> EventStructure </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._gosub" >
|
|
<strong>FSM:_gosub(ParentFrom, ParentEvent)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> ParentFrom </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> ParentEvent </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._handler" >
|
|
<strong>FSM:_handler(EventName, ...)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> ... </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._isendstate" >
|
|
<strong>FSM:_isendstate(Current)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> Current </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM)._submap" >
|
|
<strong>FSM:_submap(subs, sub, name)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> subs </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> sub </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> name </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).can" >
|
|
<strong>FSM:can(e)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> e </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).cannot" >
|
|
<strong>FSM:cannot(e)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> e </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).current" >
|
|
<strong>FSM.current</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM).endstates" >
|
|
<strong>FSM.endstates</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).is" >
|
|
<strong>FSM:is(state)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> state </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM).options" >
|
|
<strong>FSM.options</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em></em>
|
|
<a id="#(FSM).subs" >
|
|
<strong>FSM.subs</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
|
|
<h2><a id="#(FSM_CONTROLLABLE)" >Type <code>FSM_CONTROLLABLE</code></a></h2>
|
|
<h3>Field(s)</h3>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a></em>
|
|
<a id="#(FSM_CONTROLLABLE).Controllable" >
|
|
<strong>FSM_CONTROLLABLE.Controllable</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).GetControllable" >
|
|
<strong>FSM_CONTROLLABLE:GetControllable()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Gets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).New" >
|
|
<strong>FSM_CONTROLLABLE:New(FSMT, Controllable)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Creates a new FSM_CONTROLLABLE object.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#table FSMT </em></code>:
|
|
Finite State Machine Table</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
|
|
(optional) The CONTROLLABLE object that the FSM_CONTROLLABLE governs.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_CONTROLLABLE)">#FSM_CONTROLLABLE</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).OnAfterStop" >
|
|
<strong>FSM_CONTROLLABLE:OnAfterStop(Controllable, From, Event, To)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>OnAfter Transition Handler for Event Stop.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
|
|
The Controllable Object managed by the FSM.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string From </em></code>:
|
|
The From State string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>:
|
|
The Event string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string To </em></code>:
|
|
The To State string.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).OnBeforeStop" >
|
|
<strong>FSM_CONTROLLABLE:OnBeforeStop(Controllable, From, Event, To)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>OnBefore Transition Handler for Event Stop.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
|
|
The Controllable Object managed by the FSM.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string From </em></code>:
|
|
The From State string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>:
|
|
The Event string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string To </em></code>:
|
|
The To State string.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em>#boolean:</em>
|
|
Return false to cancel Transition.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).OnEnterStopped" >
|
|
<strong>FSM_CONTROLLABLE:OnEnterStopped(Controllable, From, Event, To)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>OnEnter Transition Handler for State Stopped.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
|
|
The Controllable Object managed by the FSM.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string From </em></code>:
|
|
The From State string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>:
|
|
The Event string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string To </em></code>:
|
|
The To State string.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).OnLeaveStopped" >
|
|
<strong>FSM_CONTROLLABLE:OnLeaveStopped(Controllable, From, Event, To)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>OnLeave Transition Handler for State Stopped.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> Controllable </em></code>:
|
|
The Controllable Object managed by the FSM.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string From </em></code>:
|
|
The From State string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>:
|
|
The Event string.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string To </em></code>:
|
|
The To State string.</p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em>#boolean:</em>
|
|
Return false to cancel Transition.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).SetControllable" >
|
|
<strong>FSM_CONTROLLABLE:SetControllable(FSMControllable)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Sets the CONTROLLABLE object that the FSM_CONTROLLABLE governs.</p>
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> FSMControllable </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_CONTROLLABLE)">#FSM_CONTROLLABLE</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).Stop" >
|
|
<strong>FSM_CONTROLLABLE:Stop()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Synchronous Event Trigger for Event Stop.</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE).__Stop" >
|
|
<strong>FSM_CONTROLLABLE:__Stop(Delay)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Asynchronous Event Trigger for Event Stop.</p>
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#number Delay </em></code>:
|
|
The delay in seconds. </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_CONTROLLABLE)._call_handler" >
|
|
<strong>FSM_CONTROLLABLE:_call_handler(handler, params, EventName)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> handler </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> params </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h2><a id="#(FSM_PROCESS)" >Type <code>FSM_PROCESS</code></a></h2>
|
|
<h3>Field(s)</h3>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).Assign" >
|
|
<strong>FSM_PROCESS:Assign(Task, ProcessUnit)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Assign the process to a <a href="Unit.html">Unit</a> and activate the process.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Task.Tasking.html##(TASK)">Task.Tasking#TASK</a> Task </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> ProcessUnit </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_PROCESS)">#FSM_PROCESS</a>:</em>
|
|
self</p>
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).Copy" >
|
|
<strong>FSM_PROCESS:Copy(Controllable, Task)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Creates a new FSM<em>PROCESS object based on this FSM</em>PROCESS.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> Controllable </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> Task </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_PROCESS)">#FSM_PROCESS</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).GetCommandCenter" >
|
|
<strong>FSM_PROCESS:GetCommandCenter()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Gets the mission of the process.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="Tasking.CommandCenter.html##(COMMANDCENTER)">Tasking.CommandCenter#COMMANDCENTER</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).GetMission" >
|
|
<strong>FSM_PROCESS:GetMission()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Gets the mission of the process.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="Tasking.Mission.html##(MISSION)">Tasking.Mission#MISSION</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).GetTask" >
|
|
<strong>FSM_PROCESS:GetTask()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Gets the task of the process.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="Tasking.Task.html##(TASK)">Tasking.Task#TASK</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).Init" >
|
|
<strong>FSM_PROCESS:Init(FsmProcess)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> FsmProcess </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).Message" >
|
|
<strong>FSM_PROCESS:Message(Message)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Send a message of the <a href="Task.html">Task</a> to the Group of the Unit.</p>
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> Message </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).New" >
|
|
<strong>FSM_PROCESS:New(Controllable, Task)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Creates a new FSM_PROCESS object.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> Controllable </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> Task </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_PROCESS)">#FSM_PROCESS</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).Remove" >
|
|
<strong>FSM_PROCESS:Remove()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Removes an FSM_PROCESS object.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_PROCESS)">#FSM_PROCESS</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).SetTask" >
|
|
<strong>FSM_PROCESS:SetTask(Task)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Sets the task of the process.</p>
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Tasking.Task.html##(TASK)">Tasking.Task#TASK</a> Task </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_PROCESS)">#FSM_PROCESS</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="Tasking.Task.html##(TASK)">Tasking.Task#TASK</a></em>
|
|
<a id="#(FSM_PROCESS).Task" >
|
|
<strong>FSM_PROCESS.Task</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS)._call_handler" >
|
|
<strong>FSM_PROCESS:_call_handler(handler, params, EventName)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> handler </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> params </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).onenterAssigned" >
|
|
<strong>FSM_PROCESS:onenterAssigned(ProcessUnit)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> ProcessUnit </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).onenterFailed" >
|
|
<strong>FSM_PROCESS:onenterFailed(ProcessUnit)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameter</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> ProcessUnit </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_PROCESS).onstatechange" >
|
|
<strong>FSM_PROCESS:onstatechange(ProcessUnit, Event, From, To, Task, Dummy)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>StateMachine callback function for a FSM_PROCESS</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Controllable.html##(CONTROLLABLE)">Wrapper.Controllable#CONTROLLABLE</a> ProcessUnit </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string Event </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string From </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em>#string To </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> Task </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> Dummy </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h2><a id="#(FSM_SET)" >Type <code>FSM_SET</code></a></h2>
|
|
|
|
<p>FSM_SET class</p>
|
|
|
|
<h3>Field(s)</h3>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_SET).Get" >
|
|
<strong>FSM_SET:Get()</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Gets the SET<em>BASE object that the FSM</em>SET governs.</p>
|
|
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="Core.Set.html##(SET_BASE)">Core.Set#SET_BASE</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_SET).New" >
|
|
<strong>FSM_SET:New(FSMT, Set_SET_BASE, FSMSet)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Creates a new FSM_SET object.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#table FSMT </em></code>:
|
|
Finite State Machine Table</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> Set<em>SET</em>BASE </em></code>:
|
|
FSMSet (optional) The Set object that the FSM_SET governs.</p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> FSMSet </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_SET)">#FSM_SET</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="Core.Set.html##(SET_BASE)">Core.Set#SET_BASE</a></em>
|
|
<a id="#(FSM_SET).Set" >
|
|
<strong>FSM_SET.Set</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_SET)._call_handler" >
|
|
<strong>FSM_SET:_call_handler(handler, params, EventName)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> handler </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> params </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
|
|
<h2><a id="#(FSM_TASK)" >Type <code>FSM_TASK</code></a></h2>
|
|
|
|
<p>FSM_TASK class</p>
|
|
|
|
<h3>Field(s)</h3>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_TASK).New" >
|
|
<strong>FSM_TASK:New(FSMT, Task, TaskUnit)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
<p>Creates a new FSM_TASK object.</p>
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em>#table FSMT </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em><a href="Tasking.Task.html##(TASK)">Tasking.Task#TASK</a> Task </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em><a href="Wrapper.Unit.html##(UNIT)">Wrapper.Unit#UNIT</a> TaskUnit </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
<h3>Return value</h3>
|
|
|
|
<p><em><a href="##(FSM_TASK)">#FSM_TASK</a>:</em></p>
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<em><a href="Tasking.Task.html##(TASK)">Tasking.Task#TASK</a></em>
|
|
<a id="#(FSM_TASK).Task" >
|
|
<strong>FSM_TASK.Task</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
</dd>
|
|
</dl>
|
|
<dl class="function">
|
|
<dt>
|
|
|
|
<a id="#(FSM_TASK)._call_handler" >
|
|
<strong>FSM_TASK:_call_handler(handler, params, EventName)</strong>
|
|
</a>
|
|
</dt>
|
|
<dd>
|
|
|
|
|
|
|
|
<h3>Parameters</h3>
|
|
<ul>
|
|
<li>
|
|
|
|
<p><code><em> handler </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> params </em></code>: </p>
|
|
|
|
</li>
|
|
<li>
|
|
|
|
<p><code><em> EventName </em></code>: </p>
|
|
|
|
</li>
|
|
</ul>
|
|
</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|