The fundamental approach used for task oriented decision making for the vessel uses a Finite State Machine (FSM) algorithm. A FSM contains several modes of operation (or states), which are switched through automatically by internal flags. For this project, each task was an individual state, with particular flags to trigger the switch to the next one.
A state is also allocated for initialization – during which the low level controller is not sent any messages, and the high level controller simply waits for 50 seconds to assure all sensors and systems are booted and communicating properly. Once the 50 second timer is complete, the next state is triggered – which can either be the first task, or an RC hold state.
The RC hold state is for pausing the code when the RC controller is enabled. It is on the highest level and can interrupt any particular task. The high level controller technically sends the low level controller zero commands for each thruster, however the low level controller is taking priority from the RC at this point – ignoring the high level commands. The high level controller only activates this state when the RC controller toggles for command priority, and leaves once the toggle is switched off. When the RC hold state is left, the system continues wherever it left off in the previously executing task.
A final state is allocated for termination. During this state, the high level controller tells the low level controller to hold pose where the vessel currently is. This state is simply meant for vessel recovery at the end of the run.