*2.8. Finite State Machine*

The integration of environmental data acquired by 3D sensors and user intentions has been evaluated in several studies [11–15]. The AIDE system also incorporates an activity recognition algorithm to improve the performance of the control interfaces. This algorithm has been evaluated with patients [16]. The experience gained in these studies resulted in two different state machines (Figures 5 and 6). Both finite state machines (FSMs) describe the general operation of the system, so they have to be adapted according to the user's residual capabilities, in other words depending on the control user interfaces employed. The system can be controlled by means of EEG, EMG, EoG, gaze, voice commands, etc., and/or a combination of these. In this way, the system is adapted to the user's needs or preferences. These FSMs were evaluated in the different studies cited. In addition, in these studies, the different functions of the finite state machines were explained.

#### 2.8.1. Hygiene Task

Due to the complexity of this type of task, the hygiene task is primarily intended to allow the user to be able to clean his/her face or brush his/her teeth. Figure 5 shows the state machine developed to carry out this type of task.

**Figure 5.** Finite state machine (FSM) for the eating, drinking, and hygiene tasks. They are are sequential implemented allowing the user to continue or abort the task in anytime. Black arrows refer to automatic processes. Green arrow refer to an action confirmed by the user, and the red arrows refer to the decision to abort the current activity by the user.

**Figure 6.** FSM for preparing a meal. The states are sequentially implemented, allowing the user to continue or abort the task at anytime. Black arrows refer to automatic processes. Green arrows refer to an action confirmed by the user, and red arrows refer to the decision to abort the current activity by the user.
