## 1. Introduction

Fuzzy logic (FL) and artificial neural networks (ANNs), despite their successful use in many challenging control situations, still have drawbacks that limit them to only some applications. Their combined advantages have thus become the subject of much research into ways of overcoming their disadvantages. Neuro-fuzziness is one resulting rapidly emerging field. ANFIS network, proposed by Jang, is one popular neuro-fuzzy system [1-4].

For specific-problem training of an ANFIS network, [1] proposes use of hybrid learning rule, which combines gradient descent technique and least-square estimator (LSE). Being a method of supervised learning, it needs a teaching signal, which can be difficult to provide when the ANFIS network is to be a feedback controller, as the desired control actions that the teaching signal represents are unknown. Literatures have proposed several ANFIS learning methods in which ANFIS is applied as a MIMO controller. Djukanović *et al.*, for example, uses a special ANFIS learning technique called temporal back propagation (TBP); control of a nonlinear MIMO system is by considering both the controller and the plant as a single unit each time step. The method, however, is complex and distinctly computation-heavy [5-9].

Another training approach for ANFIS-controller of nonlinear MIMO systems is inverse learning; the ANFIS network is trained to learn the inverse dynamics of the plant it controls. Its success, however, is crucial on three elements: accurate modeling of the original system (a problem when the system is complex), availability of the system’s inverse dynamics (they do not always exist), and appropriate distribution of the training data (could be impossible, given the constraints of the system’s dynamics). [10-13] has another training approach besides the ones already mentioned.

Present robot navigation systems demand controllers that can solve complex problems under uncertain and dynamic environments. ANFIS garners interest because it offers the benefits of both neural network (NN) and FL, and removes their individual disadvantages by combining them on their common features. ANN is a new motivation for studies into FL. It can be used as a universal learning paradigm in any smooth parameterized models, including fuzzy inference systems [14-15].

Traditional robot control methods rely on strong mathematical modeling, analysis, and synthesis. Existing approaches suit control of mobile robots operating in unknown environments and performing tasks that require movement in dynamic environments. Operational tasks in unstructured environments such as remote planets and hazardous waste sites, however, are more complex, yet the analytical modeling is inadequate. Many researchers and engineers have tried to solve the navigational problems of mobile robot systems [16-18]. Though fuzzy systems can use knowledge expressed in linguistic rules (and thus could implement expert human knowledge and experience), fuzzy controller lacks a systematic design method. Tuning of membership-function parameters takes time. NN learning techniques can automate the process so development can be hastened and performance improved. The combination of NN and FL has produced neuro-fuzzy controllers and created their present popularity. In real-time autonomous navigation, a robot must be able to sense its environment, interpret the sensed information to obtain knowledge of its position and environment, and plan a route that gets it to the target position from an initial position and with obstacle avoidance and control of its direction and velocity. Ng et al. [19-23] propose a neural-integrated fuzzy controller that integrates FL representation of human knowledge with NN learning to solve nonlinear dynamic control problems. Pham et al. focus on developing intelligent multi-agent robot teams capable of both autonomous action and dynamic-environment collaboration in achieving team objectives. They also propose a neuro-fuzzy adaptive action selection architecture that enables a team of robot agents to achieve adaptive cooperative control of cooperative tasks, track dynamic targets, and push boxes. Crestani et al. defines autonomous navigation in mobile robots as a search process within a navigation environment that contains obstacles and targets, and propose a fuzzy-NN controller that considers navigation direction and navigation velocity as controllable. Rutkowski et al. derived a flexible neuro-fuzzy inference system; their approach increases structural and design flexibility in neuro-fuzzy systems. Hui et al. and Rusu et al. discuss neuro-fuzzy controllers for sensor-based mobile robot navigation. Garbi et al. implemented an adaptive neuro-fuzzy inference system in robotic vehicle navigation [24-26].

Robots are one way to improve industrial automation productivity. Robotic manipulators have been used in routine and dangerous-environment manufacturing jobs. They are highly nonlinear dynamic systems subject to uncertainties. Obtaining accurate dynamic equations for their control laws is thus difficult. Uncertainties in their dynamic models include unknown grasped payloads and unknown frictional coefficients. Adaptive control or model-free intelligent control has been much proposed as able to compensate for those uncertainties [26-28].

Virtual reality (VR) has become important to applications in engineering, medicine, statistics, and other areas where 3D images can aid understanding of system complexity. The interactability of a virtual system can in many applications be enhanced by touch sensing. Haptic feedback can convey to a human user, virtual environment forces. It has become useful in tele-surgery, where a master manipulator guides robotic surgical tools while providing realistic-force feedback to the surgeon. It is already available in many systems under development but these often still are specifically developed research prototypes (i.e., providing specific-force feedbacks and for specific problems) [29, 30].

Kinematics analysis is key to motion control of humanoid manipulators. Its main problems are forward kinematics and inverse kinematics. The inverse kinematics of a 7-DOF manipulator has multiple solutions; obtaining anthropomorphic solutions is thus a problem. Detailed research in it has yet to be found, though works on design, control, and obstacle avoidance in humanoid manipulator exist. In serial manipulators, between forward kinematics and inverse kinematics, solution of the latter is a lot more difficult. Solution methods of inverse kinematics generally are numerical, analytical, or geometric. Numerical method is most widely used, but it cannot obtain all possible solutions. Analytical method can derive all possible solutions but is much more difficult. Geometric method is simple and easy to understand but suits only a few types of manipulators [31, 32].

A human-manipulator skeleton has 7-DOF mechanism; other degrees of freedom of the arm are performed by the tendon. A 7-DOF anthropomorphic arm has been developed; it has the manipulability criterion and uses 3-DOF planar manipulator theory (i.e., the mechanism of the human limb can be modeled by three moving links). 3-DOF planar mechanism is fundamental to an anthropomorphic arm; its evaluation criteria can be used to analyze the arm’s operational performance. 3-DOF planar manipulator theory is a supposition that the three link lengths are of the upper arm, the forearm, and the hand, and the three joints are 3-DOF shoulder joint, 1-DOF elbow joint, and 3-DOF wrist joint [33].

This chapter presents the design of an ANFIS controller of a VR manipulator model and simulation of the ANFIS-controlled system’s command execution. Simulation results of the 7-DOF human-manipulator show an improved control system. Section II presents the manipulator’s kinematic model whereas Section III the structure of the ANFIS controller and its learning methods. Section IV presents the manipulator’s VR model, whereas Section V, the simulation of the case study, the system design, and the conclusions.

## 2. Kinematics of the 7-DOF manipulator

Forward kinematics was used to calculate the racket’s posture according to the joint angles. It is quite useful for analysis of the manipulator’s workspace and verification of the inverse kinematics. Denoting the shoulder width as *D*, the upper arm length as *L*_{1}, and the lower arm length as *L*_{2}, the position of the shoulder is thus P_{1}(0, -*D*, 0) and the position of the elbow is P_{2} (*x*_{p2}*,* *y*_{p2}*,* *z*_{p2} ). Denoting the joint angles as *q*_{1} … *q*_{7}, the posture of joint *i* relative to joint *i*-1 can thus be described by a 4×4 homogeneous matrix ^{i-1}*T*_{i} [34]:

Where: sq_{i} ≡sin(q_{i}); cq_{i} ≡cos(q_{i})

Assuming the position of Joint-7 in the fixed coordinate is P_{3} (*x*_{p3}*,* *y*_{p3}*,* *z*_{p3} ) and its pose as described by RPY (Roll Pitch Yaw) angles is (φ, θ, ψ), the posture of Joint-7 can thus be described by a homogenous matrix ^{0}*T*_{7}:

Matrix ^{0}*T*_{7} also stands for the racket’s posture and can be derived also as:

From (1) and (2), the racket’s posture can be calculated as:

with atan2( ) being the four-quadrant inverse tangent function and (3) the manipulator’s forward kinematics. All the commands (e.g., the racket’s hitting position and hitting speed) are given by the visual system, in the operation space. They must be transformed into joint space values. Jacobian matrix is used to calculate the joint space speed according to the operation space speed. The mapping relationship between them is [35]:

with *V* being the racket’s speed in the operation space and *J* is the 6×7 Jacobian matrix and can be derived by differential transformation method. The *i*^{th} item of *J* is:

Where *n*_{i}*(n*_{ix}*, n*_{iy}*, n*_{iz}*), o*_{i}*(o*_{ix}*, o*_{iy}*, o*_{iz}*), a*_{i}*(a*_{ix}*, a*_{iy}*, a*_{iz}*)* and *p*_{i}*(p*_{ix}*, p*_{iy}*,p*_{iz}*)* are the items of matrix

The parameter *k* stands for the rotational axis of joint *i*. For example, if the joint rotates around the *x*-axis, then *k* is *x*. Racket speed *V* can be calculated by (4) whereas joint space speed *J* is not a square matrix. This problem can be solved by Moore-Penrose method:

with *J*.

The inverse kinematics is used to calculate the joint angles according to the racket’s posture. The manipulator is redundant, so the elbow’s position is not uniquely determined when the racket’s posture is given. The motion characteristics of a human arm show the mapping relationships between elbow position and racket posture. In a general configuration of the manipulator (see Fig. 2), any three points on the manipulator’s neck, shoulder, elbow, and wrist are not collinear. The position of elbow P_{2}, whose axis is P_{1}P_{3}, is in circle*r* of the circle are determined by positions P_{1} and P_{3}, and arm length parameters *L*_{1} and *L*_{2}. Ω_{1} denotes the plane constructed by points P_{1}, P_{2}, and P_{3}, and Ω_{2} the plane constructed by points O, P_{1}, and P_{2}. *α* denotes the separation angle between Ω_{1} and Ω_{2}. Once the position of P3 is known, *α* can uniquely determine P2 elbow position. If the points O, P_{1}, P_{3} are collinear whereas P_{1}, P_{2}, P_{3} are not, the plane Ω_{2} does not exist. Angle *α* can be defined as the separation angle between Ω_{1} and the horizontal plane. Also, if the points P1, P2, P3 are collinear, the plane Ω_{1} does not exist and P2 position can be calculated according to positions P_{1} and P_{3} and arm length parameters *L*_{1} and *L*_{2}. Considering the general configuration of the manipulator (see Fig. 2), the inverse kinematics can be solved if angle *α* and the racket’s posture are given. According to the motion characteristics of human arms, the mapping relationship between *α* and the racket posture can be built offline. Denoting with *i* (*i*_{1}, *i*_{2}, *i*_{3}) the unit vector pointing from P_{3} to P_{1}, and assuming the angle *α* to have been calculated by a well-trained ANN model, the circle

The plane Ω2 and the circle _{w} (*x*_{w}, *y*_{w}, *z*_{w}) and angle ∠P_{2}O^{׳} P_{w} is the separation angle *α* between Ω_{1} and Ω_{2}. Denoting Ω_{2} norm vector as *n* and position as P_{w} should satisfy this equation:

P_{w} position can be calculated from (8) and (9). P_{2} position (*x*_{p2}, *y*_{p2}, *z*_{p2}) satisfies this equation:

P_{2} position can be calculated from (8) and (10). With P_{1}, P_{2}, P_{3} positions and the cosine theorem, Joint-4 angle can be calculated as:

With P_{2} position, this can be obtained:

The angles of Joints 1 and 2 can thus be derived as:

With P_{3} position, this can be obtained:

Joint-3 angle can thus be derived as:

From (2),

The angles of Joints 5-7 can thus be derived as:

with *i*^{th} row and *j*^{ij} the column item of *T*

## 3. General structures of ANFIS

ANFIS integrates ANN with FIS. The ANFIS analyzed here was a first-order Takagi Sugeno Fuzzy Model. The analysis has four inputs: front obstacle distance (x_{1}), right obstacle distance (x_{2}), left obstacle distance (x_{3}), and target angle (x_{4}). The output is steering angle. The ‘if-then’ rules are [26, 37]:

Where

A, B, C, and D are the fuzzy membership sets defined for input variables x_{1}, x_{2}, x_{3}, and x_{4}. q_{1}, q_{2}, q_{3}, and q_{4} are the number of membership functions, respectively for the fuzzy systems of inputs x_{1}, x_{2}, x_{3} and x_{4}. fi is the linear consequent functions defined in terms of inputs x_{1}, x_{2}, x_{3}, and x_{4}. q_{i}, r_{i}, s_{i}, ti, and ui are consequent parameters of an ANFIS fuzzy model. Same-layer nodes of an ANFIS model have similar functions. Output signals from the nodes of a preceding layer are input signals to a present layer. The output obtained through the node function will be input signals to the next layer (see Figure 2) [38, 39].

_{1}, x

_{2}, x

_{3}, and x

_{4}.

Layer 2: Every node in this layer is an adaptive node (square node) with a particular fuzzy membership function (node function) specifying the degrees to which the inputs satisfy the quantifier. For four inputs, the node outputs are:

The membership functions considered here for A, B, C, and D are bell-shaped functions and defined as:

with a_{g}, b_{g}, and c_{g} being the parameters for fuzzy membership function. The bell-shaped function changes its pattern with changes to the parameters. This change will give various contours of the bell-shaped function, as needed and in accordance with the data set for the problem considered.

Layer 3: Every node in this layer is a fixed node (circular) labeled ‘π’. L_{2i} output is the product of all incoming signals.

Each of the second layer’s node output represents the firing strength (degree of fulfillment) of the associated rule. The T-norm operator algebraic product {T_{ap}(a,b) = ab} was used to obtain the firing strength (W_{i}).

Layer 4: Every node in this layer is a fixed node (circular) labeled “N”. The output of the i^{th} node is the ratio of the firing strength of the i^{th} rule (W_{i}) to the sum of the firing strength of all the rules [40].

This output gives a normalized firing strength.

Layer 5: Every node in this layer is an adaptive node (square node) with a node function.

with _{i}, r_{i}, s_{i}, t_{i}, u_{i}} the steering-angle parameter set. Parameters in this layer are consequent.

Layer 6: The single node in this layer is a fixed node (circular) labeled “Σ”. It computes the overall output as the summation of all incoming signals.

This work’s ANFIS development has six-dimensional space partitions and q_{1}, q_{2}, q_{3}, and q_{4} regions. Each region is governed by a fuzzy if-then rule. The first layer is the input layer. The second contains premise or antecedent parameters of the ANFIS and is dedicated to fuzzy sub-space. Consequent parameters of the fifth layer were used to optimize the network. During the forward pass of the hybrid learning algorithm, node outputs go forward until Layer-5 and the consequent parameters are identified by least-square method. In the backward pass, error signals propagate backwards and the premise parameters are updated by gradient descent method [40, 41].

## 4. VR Modeling of the 7-DOF manipulator

Design requirements for Virtual Reality Modeling Language (VRML) are described in finite processing allocations, autonomy, consistent self-registration, and calculability. VRML design procedure will be presented. Design in VRML depends on the information available to the designer and his imaging of the object. There are two choices for VR design: one is standard configuration such as sphere, cone, cylinder, etc., another is free design by selecting indexed face set button to get many configurations with free rearrangement of points; every real-form design is thus considered to be the latter [42-45], which starts with building parts one by one and comparing the shape’s similarity against that of the real manipulator part. Manipulator parts cannot be simulated in VR when the VR library’s standard shapes (they are not uniform) are used. Designing thus uses indexed face set in VR. The second choice to be made in design work is very important as it is about connecting all parts to get the final object, and limiting the object’s original point. This is the starting point of the design work. The first shape (e.g., the shoulder) is first set, and then the next shape (forearm) is connected to the “children” button. The same procedure is repeated for other parts. Figure 3 presents the full design of the 7-DOF human arm manipulator [46-50].

## 5. Design of the ANFIS controller for the 7-DOF manipulator

The design work considered many parameters related to the system’s real values (see Table 1 for real limits of the joints of a human arm). The joints motor is considered a real DC-motor with a transfer function similar with that in Equation (1).

Figure 4 is a block diagram of the control system. The inputs to the system design have two sets of targets: orientation (θ_{T1}, θ_{T2}, θ_{T3}) and position (T_{x}, T_{y}, T_{z}). In the proposed technique, each joint has its own controller, so in all, seven identical (same structure, same training algorithm) ANFIS controllers were used. Inputs of the training algorithm were the desired joint angle and the actual angle. The desired values were calculated by using analytical solution of the IKP algorithm shown previously. Actual values of the joint angle were obtained by feedback from the virtual model.

The structure of the ANFIS controller was built in Matlab software Ver.2011b, with two inputs, an error signal, and change in the error. The fuzzy inference method used was Mamdani's, because it is intuitive, widely accepted, and well-suited to human input, and, for the proposed control structure, it gives better results than does Sugeno inference method. In designing the controller, types of membership functions were tried before selecting the best: triangular built-in membership function (trimf). The trial-and-error design approach for the ANFIS controller, i.e., selecting the interference type, the membership function type, and the number of this membership function in the hidden layer, gave optimal results: minimum number of rules and simple simulation. The design uses seven parallel-connected ANFIS to compute the optimal deflection of the joints and get the desired angle. Figures (5-7) show the procedure of the Matlab-fuzzy-toolbox-based design.

Figure 8 shows in Matlab Simulink GUI window the internal structure of the ANFIS controller and the training output for the input signal, with the various steps used in instructing the manipulator’s movement. The ANFIS training used hybrid training algorithm, with the input nodes (3, 3) to the membership functions each having nine rules (see Figure 5). Epoch length was used in training eighty iterations for each sample, with 0.01s Simulink sampling time.

## 6. Simulation results

Figure 9(a) is a block diagram of the simulation done for the ANFIS-controlled manipulator. Seven ANFIS controllers were used, one each for each degree of freedom of the three joints (3 for the shoulder, 1 for the elbow, and 3 for the wrist). The seven were effective in tracking the trajectory desired for the 7-DOF manipulator. The controller’s rules base has 9 rules, each determined by fuzzy neural network (FNN). The desired position and orientation were, in simulation entered as input signal, whereas actual positions for the joints were given as feedback from the output signal. Figure 9(b) shows the results of using both ANFIS and PID controllers on the joints and for the ANFIS controller’s implementation into the virtual model. Performance of the ANFIS-controlled joint was better than that of the PID-controlled one. The ANFIS controller effected fast response in the manipulator and reduced errors, for various complex trajectories of the manipulator.

The manipulator’s movements used the link between Matlab-Simulink and VR environment. Computation for the order of movement was done in Matlab-Simulink. The order was then sent to the VR model to implement, with considerations for the axes between Matlab’s and VR’s to get the real movement (i.e., for general motion: elbow flexion/extension, elbow rotation (supination/pronation), shoulder adduction/abduction, shoulder flexion/extension, shoulder interior/exterior rotation, wrist flexion/extension, wrist ulnar/radial deviation, shoulder horizontal flexion/extension; for special motion: arm reaching towards the head, arm reaching to the right and the head, arm reaching to the left and the head, and arm reaching to the right) (see Figure 10 for examples).

## 7. Conclusion

This work aimed to design an ANFIS-based controller that overcomes the general problems of FL and NN in a dynamic system. To obtain excellent manipulator postures, training of the ANFIS controller for all the elements (fuzzy interference, membership function, number of neurons, number of rules) was by trial and error. The controller was compared with classical PID controller, in tracking the speed and the joint angle’s accuracy. The simulation results allowed these conclusions to be drawn:

For any speed, the ANFIS controller has the better transient response and the steadier state response than does a PID controller; even the best-tuned PID controller is unable to perform well in both slow-speed and high-speed ranges.

With only 9 neurons, 4 layers, and 9 rules, the proposed ANFIS controller is simpler than other adaptive neuro-fuzzy controllers reported by many other researches.

The ANFIS controller does not require an accurate model of the plant. Its relative simplicity makes it fairly easy to construct and implement. High-level knowledge of system is not needed to build a set of rules for a fuzzy controller or for the identification needed in an NN controller.

The ANFIS controller was used in both simulation and experiment in trajectory tracking of multiple manipulators. Kinematic analysis of the 7-DOF manipulator produced the calculation for the envelope of similar manipulators.

VR implementation of the manipulator was able to show the latter’s accuracy. The manipulator can be depended on for many high-accuracy applications such as collecting of minute/fragile items.