# Design and Implementation of Composed Position/Force Controllers for Object Manipulation
## 5 Grasping Stage
### Type-I and Type-II Fuzzy Controllers
#### 5.4.1 Type-I Fuzzy Controller for Position and Force Control  
Figure 7 presents the design of the type-I fuzzy controller. As can be seen, the controller works as follows:  
1. Firstly, crisp values are obtained from each finger of the gripper. Specifically, angular positions (\(Pos_{R\omega}(t)\), \(Pos_{L\omega}(t)\)) and the two readings of force sensors (\(F_{R}(t)\)\(F_{L}(t)\)) of each finger are inputs to the fuzzy controller. 2. Secondly, these crisp values are translated into input-linguistic values using trapezoidal membership functions. This stage is called fuzzification. 3. Thirdly, rules are evaluated to compute the output-linguistic values. This process is called fuzzy inference. 4. Finally, the output-linguistic values are translated into two crisp values--\(M_{R}(t)\) and \(M_{L}(t)\), which are the speed values for the right and left servo motors using a defuzzification method. Eight fuzzy input sets were designed and implemented using trapezoidal membership functions for transforming the angular positions and force readings into linguistic values. Focusing on force readings, four trapezoidal membership functions were implemented to transform \(F_{R}(t)\) and \(F_{L}(t)\) into the following four possible linguistic values: _Sensor X Off (SXO)_, _Sensor X Soft Touch (SXTS)_, _Sensor X Touch Hard (SXTH)_, and _Sensor X Squeeze (SXSQ)_, where X is \(R\) for the right sensor and \(L\) for the left sensor. Figure 7: Block diagram of the type-I fuzzy controller with the gripper. Regarding the angular positions of the motor, four trapezoidal membership functions were implemented in order to transform \(Pos_{R\omega}(t)\), \(Pos_{L\omega}(t)\) into the following linguistic values: _Very Open X Motor_ (\(VOXM\)), _Open X Motor_ (\(OXM\)), _Center X Motor_ (\(CXM\)), and _Closed X Motor_ (\(CLXM\)), where \(X\) is \(R\) for the right motor and \(L\) for the left motor. On the other hand, in terms of fuzzy output sets, sixteen singleton membership functions were used for the two outputs of the fuzzy inference, eight for each finger. Moreover, it can be seen from Figure 8 that the linguistic labels are named \(R1,R2,R3,R4,R5,R6,R7\), and \(R8\) for the right finger and \(L1,L2,L3,L4,L5,L6,L7\), and \(L8\) for the left finger. These linguistic values are ordered from the lowest speed value to the highest possible speed value of the command motor. Table 1 presents the fifty fuzzy rules that were created using th fuzzy sets. The rules have the following structure: IF \(F_{L}\) AND \(F_{R}\) AND \(Pos_{L\omega}(t)\) AND \(Pos_{R\omega}(t)\), THEN \(M_{L}(t)\), \(M_{R}(t)\). As can be seen, these rules correspond to the type of Mamdani fuzzifier using minimum implication, i.e., the \"AND\" operator for connecting the antecedents. In order to design the set of fuzzy rules, two basic scenarios were considered: the gripper has an object between its fingers, and there is no object between the gripper fingers (see Figure 9). In the first scenario, the gripper might be located at different positions with respect to the center of the object to be grasped. Specifically, there are three basic cases that the gripper might face in terms of the position of the object to be grasped:  
Figure 8: Type I membership functions for the inputs \(F_{R}(t)\) and \(Pos_{R\omega}(t)\) and for the output \(M_{R}(t)\). Case 1. The object is located on the left side concerning the center of the gripper (Table1: rules 1-3). * Case 2. The object is at the center of the gripper (Table 1: rules 4-9). * Case 3. The object is located on the right side with respect to the center of the gripper (Table 1: rules 6, 10-11). On the other hand, in the second scenario, there are two cases:  
Case 4. The gripper fingers are open (Table 1: rule 12). * Case 5. The gripper fingers are closed (Table 1: rule 13). Additionally, there are other cases in which the object might be located at a position which is between two cases (Table 1: rules 14-50); i.e., the object might be located at a position between the left region (case 1) and the center point (case 2).