## 4 Control Scheme  
A robotic manipulator modeled with link structural flexibility during execution of a task requires the end-effector to contact the smartphone. It uses the information of the target position obtained as per the previous section. Using this methodology, position control of the end point is possible when the end effector moves to the desired position. The number of fuzzy rules grows exponentially with the number of input variables. To overcome the problem, the idea of using a hierarchical structure in the design of a fuzzy system was reported by [PERSON] and [PERSON] [21], where the input variables were put into a collection of low-dimensional fuzzy logic units (FLUs) and the outputs of the FLUs used as the input variables for the FLUs in the next layer, as shown in Figure 22. According to their findings, the number of fuzzy rules employed in the hierarchical fuzzy system (HFS) is proportional to the number of input variables. A hierarchical fuzzy controller and a conventional fuzzy controller have different input and output architectures, and the difference affects the number of fuzzy rule-based structures. Using hierarchical fuzzy theory in the controller design can effectively reduce the establishment of fuzzy rules. In Figure 22, \(x_{i}\) are the inputs and \(y_{i}\) are the outputs of the fuzzy logic controllers.  
Figure 21: Different conditions corrected by the dictionary process. (**a**) One of the original commands: Locate you (the third letter “c” is recognized as a capital and the letter “a” is missing); (**b**) The other case of the original command: Locate you (missing the first letter, \(\mathrm{L}\)); (**c**) Corrected by a dictionary process.  
Figure 23 shows the position control scheme with the fuzzy controller: the target coordinate obtained from the camera is sent to the fuzzy controller to find four angles for each joint to make the robot arm move. The entire position control process is shown in Figure 24.  
Figure 24: Flow chart of the control sequence.  
Figure 23: Position control scheme with fuzzy controller.  
Figure 22: Typical structure of hierarchical fuzzy system.  
From Figure 25a-c, \(\theta_{3}\) and \(\theta_{4}\) particularly determine the length of \(r\); Point \(A\) is the current coordinate of the arm's end-effector; and point \(B\) is the desired target. When \(r\) is equal to \(r\), \(\theta_{2}\) is equal to \(\theta_{42}\); and \(\theta_{1}\) is equal to \(\theta_{41}\), and represents a successful move from point \(A\) to the expected point \(B\) (\(x_{d},y_{d},z_{d}\)).  
Figure 25: Relationship of the robot arm’s joints. (**a**) Joints 3 and 4; (**b**) Joint 2; (**c**) Joint 1.  
Fuzzy theory was used in the position control for the four servo motors, which did not require a complex mathematical model of the robot arm. Computations were in the order of \(0_{3}\to 0_{4}\to 0_{2}\to 0_{1}\). The use of the hierarchical fuzzy system effectively reduces the number of fuzzy inputs and outputs, layer by layer, with each layer having only one input and one output. Fuzzy rules are given in Appendix B. The fuzzy control scheme is shown in Figure 26.  
Table 1 shows the position control of one test point using three rules and five rules. We can see that the error values for each joint are less than \(1^{\circ}\), as shown in Table 2. The error is within the preset threshold, so the robot arm still moves to the right positions.