# Conceptual Design of BCI for Mobile Robot Control
## 3 Results  
### Verification of BCI Control System  
To verify the correct operation of the MainController-based BCI control system, the necessary tests were carried out. Testing was performed by \"injecting\" recorded signals, i.e., (EEG) electro-encephalographic signals from one measuring electrode and its corresponding impedance value. In addition, a set of simulation signals was introduced into the system: activation of the start button (variable start), connection to the TruScan 24 device (variable eegStatus) and execution of the task by the mobile robot (isDone variable).  
There are two control scenarios realized in the experimental study:  
1. [label=(0)]
2. properly operating machine;
3. occurrence of impedance error.  
The first scenario which presents one cycle of the correct functioning of the BCI control system is shown in the work. Data \"injected\" into the BCI system is presented in Figure 9.  
The operation of the BCI control system is shown in Figure 10. The initial state (initializing) is the Idle state. It is a waiting state from which the output takes place when a connection is established with the TruScan 24 device (variable error1 = 0) and the start button is on (variable start = 1). Calling the errorConnection function in each simulation step determines the value of the error1 variable.  
Because the connection to the TruScan 24 device has been established correctly, after the start button is triggered in a 0.5 s simulation (Figure 10a) the system goes into the Running state, activating its default Waiting condition. Switching to the Running state means leaving the Idle state, which reflects the change in the idle value and the light stimulator activation (Figure 10c).  
After 1 s, the Waiting sub-state switches to the DataRecording sub-state, in which the control system waits for 5 s for the recorded data from the TruScan 24 device. This step illustrates the variable datRec shown in Figure 10d. The quality of the received data is checked by the errorLen and errorImp  
Figure 9: Time series: (**a**) EEG signal, (**b**) electrode impedance.  
functions, and their results are assigned to the error variables error2 and error3 respectively. Then the logical value of these variables is checked. The quality of the \"injected\" data met the above criteria, and the system went into the DataProcessing state. This moment (in 6.5 s) reflects the change in the value of the led variable and dataRec of Running status (Figure 10d) and the variable dataProc of the DataProcessing state (Figure 10e).  
Transitions between consecutive substates: DataShowing, DataPreprocessing, FeatureExtraction and Classification are shown in the DataProcessing graph in Figure 10e. After classifying and sending a control command (6.9 s), the system moves from the DataProcessing state to the RobotWorking state. This is shown in Figure 10f by the variable robProc. In 8.8 s of the simulation, the system receives information about the robot completing the task, which is shown by the isDone variable on the RobotWorking chart (Figure 10a,f).  
After leaving the RobotWorking state, the Running status is activated again. It was activated for 0.5 s because the start button was turned off, which caused the system transition to the Idle state. The system remained in this state till the end of the simulation.  
Figure 10: Auxiliary variables for the properly operating state machine scenario, i.e. (**a**) set of Inputs signals entered into the system, (**b**) set of variables Errors, (**c**) Idle state variable, (**d**) Running state variables, (**e**) set of DataProcessing state variables, (**f**) RobotWorking state variable.