Page 122 - Robot Design Handbook ROBOCON Malaysia 2019
P. 122

2.2.3 Software Design

                       The main function of the MR2 is a loop function, which means that the code will

               keep looping once the power source is on. ‘ModeBtn’ is the main button that was used for
               whether to reset the mode or to select the operation mode. Once the operation mode is

               selected, the MR2 will perform based on several mode buttons that are toggled, which are

               ‘mode1’, ‘mode2’, ‘mode3’, ‘mode4’ and ‘mode5’. The selection of those mode buttons
               will be based on the game field and situation that it faces during every match. For example,

               if only ‘mode1’ is LOW, the MR2 will be moving forward after a correct signal was given
               by the controller or the Gerege dropped. The flow-chart is given in Figure 5(a)-(b).


                       Next, the ‘sensorscanning’ function is used to detect the presence of the Gerege
               when it is passed to the MR2 from the MR1. After the Gerege is detected, the boolean

               ‘stable’ becomes true, the next function will be executed. The ‘handscanning’ function is
               similar to the ‘sensorscanning’ function, but the ‘handscanning’ function is used to detect

               the presence of the hand of the controller. The boolean variable ‘hand’ is used when there

               are ‘sensorscanning’ and ‘handscanning’ functions used in the same loop. It becomes true
               if and only if the hand of the controller is detected by the ‘handscanning’ function. When

               ‘hand’ is true, the ‘startsignal’ function will be executed.










































                                                          118
   117   118   119   120   121   122   123   124   125   126   127