1. mutex_initialize();

2. if(mutex)then

3. waiting_start_flag();

4. update();

5. while(stop_criterion)do

6. communication();

7. PID();

8. end while

9. while(period_end≠0)do

10. PID();

11. end while

12. end if