A Virtual Environment for Studying Flexible Robot Manipulators

—The paper presents a virtual environment for simulation and modeling a single-link flexible robotic manipulator. Simulation algorithm is based on the finite difference method where the systems governing dynamic equation is discretized and implemented. Intelligent modeling techniques are developed using neural network and genetic al-gorithm based techniques. All these have been developed and realized within a virtual environment using the Matlab, Simulink, and associated toolboxes. An interactive user friendly graphical user interface has also been presented. This environment has proven to be a valuable educational tool for understanding the behavior of flexible manipulator systems and can also be used as a computer aided teaching facility and a testbed for controller designs.

INTRODUCTION Considering the advantages of flexible robot manipulators, some of the current applications of such manipulators include spacecraft, remote manipulation, and radioactive material handling in nuclear power plants [1]. However, due to their flexible nature, induced vibrations appear in the system during and after a positioning motion [2][3]. This restricts their widespread use in industry. A considerable amount of research work has already been carried out on the vibration control of flexible robot manipulators. However, a generic solution to the problem is yet to be obtained [4][5].
To formulate and implement an effective control strategy for efficient vibration suppression of the system, it is essential to develop a mathematical model for the system that accounts for the interactions with actuators and payload [6]. Such a model can be constructed by solving the partial differential equations (PDEs) that describe the system. However, the computational complexity and subsequent software coding involved in the process is a major disadvantage of this technique [7]. An alternative solution is to utilize intelligent techniques, such as neural network (NN) and genetic algorithm (GA) for modeling of flexible robot manipulator systems [8]. The approaches have proven to be effective in modeling and can be used for test and verification of controller designs.
As far as this authors' knowledge there is no interactive virtual environment that will allow one to study the behavior of flexible robot manipulators without going into the software coding details. To address this problem, the authors have developed a virtual environment that will allow the users to study the behavior of flexible robot manipulators through classical simulation and intelligent modeling techniques. The environment is developed by using Matlab, Simulink and few associated toolboxes.
The rest of the paper is structured as follows: Section 2 briefly describes the flexible robot manipulator system considered for this development. Section 3 presents the theoretical analysis of finite difference (FD) simulation, NN modeling, GA modeling, and subsequent model validation strategies. Section 4 describes the developed virtual environment with some examples. The paper is concluded in Section 5.

II. THE FLEXIBLE ROBOT MANIPULATOR SYSTEM
The flexible robotic manipulator system under consideration is modeled as a pinned-free flexible beam, with a mass at the hub, which can bend freely in the horizontal plane but is stiff in vertical bending and torsion. The model development utilizes the Lagrange equation and modal expansion method [9][10]. To avoid the difficulties arising due to time varying length, the length of the manipulator is assumed to be constant.
A schematic representation of the manipulator is shown in Figure 1, where o o OY X and XOY represent the stationary and moving co-ordinate frames, respectively. The axis OX coincides with the neutral line of the link in its undeformed configuration and is tangent to it at the clamped end in a deformed configuration. The τ represents the applied torque at the hub. E , I , ρ , S , h I and p m represent the Young modulus, area moment of inertia, mass density per unit volume, cross sectional area, hub inertia and payload of the manipulator, respectively. ) (t θ denotes an angular displacement (hub-angle) of the manipulator and ) , ( t x w denotes an elastic deflection (deformation) of a point along the manipulator at a distance x from the hub of the manipulator. In this work, the motion of the manipulator is confined to the o o OY X plane. The width of the arm is assumed to be much greater than its thickness, thus, allowing the manipulator to vibrate (be flexible) dominantly in the horizontal direction. The shear deformation and rotary inertia effects are also ignored. http://www.i-joe.org For an angular displacement θ and an elastic deflection u , the total (net) displacement ( ) t x y , of a point along the manipulator at a distance x from the hub can be described as a function of both the rigid body motion ) (t θ and elastic deflection ( ) To obtain equations of motion of the manipulator, the associated energies have to be obtained. These include the kinetic, potential, and dissipated energies. To obtain equations of motion of the manipulator, the associated energies have to be obtained. These include the kinetic, potential, and dissipated energies. Thus, using the Hamiltonian's extended method, the dynamic equation of the flexible robot manipulator with the associated boundary and initial conditions can be expressed as [2]: where, E is the Young modulus, I is the second moment of inertia of the manipulator, and ( )

III. SIMULATION AND INTELLIGENT MODELING
The system modeling techniques using NN and GA require input output(s) data of a system for their model de-velopment. To address this issue, a simulation algorithm has been developed to provide required input output(s) data for a user specified flexible robot manipulator system. A FD algorithm has been used to develop this simulation. The accuracy of the simulation outcome can be adjusted by changing the number of grid points along the length of the manipulator.

A. FD simulation
The PDE in equation (2) describing the flexible robot manipulator system is of a hyperbolic type and can be classified as a boundary value problem. This can be solved using an FD method [11]. This involves dividing the arm into a finite number of equal-length sections and developing a linear difference equation describing the deflection of end of each section (grid-point). Thus, using the FD method, a solution of the PDE in equation (2) can be obtained as [2]; Equation (5) gives the displacement of section i of the manipulator at time step 1 + j . It follows from this equation that, to obtain the displacements y n j Manipulating equation (5) using equations (6) to (9) yields a matrix formulation of the above as is the displacement of grid points ). A and B are constant n x n matrices iJOE -Volume 5, Issue 4, November 2009 whose entries depend on the flexible robot manipulator specification and the number of sections the manipulator is divided into, C is a constant matrix related to the time step t Δ and mass per unit length of the manipulator and F is an n x 1 matrix related to the given input torque [2]. Equation (10) thus represents the dynamic equation of the manipulator in the presence of hub-inertia and payload, which can easily be implemented within the Matlab and Simulink environments.

B. Intelligent modeling
In many cases, when it is difficult to obtain a model structure for a system with traditional system identification techniques, intelligent techniques are desired that can describe the system in the best possible way [11]. NN and GA are two intelligent techniques used commonly for system identification and modeling. The major advantage of utilizing GA for system identification is that GA simultaneously evaluates many points in the parameter space and converges towards the global solution [12]. The superiority of a GA over recursive least squares (RLS) algorithm in modeling a fixed-free flexible beam is addressed by [13]. In contrast, NN approaches for system identification offer many advantages over traditional ones, especially in terms of flexibility and hardware realization [14]. This technique is quite efficient in modeling non-linear systems or if the system possesses nonlinearities to any degree.
Once a model of the system is obtained, it is required to validate whether the model is good enough to represent the system. A number of such validation tests are available in the literature [14]. These are one-step ahead (OSA) prediction; model predicted output (MPO), and correlation tests. Such techniques are incorporated within SCEFMAS for validating developed models. Moreover, with NN modeling, the input-output data set is divided into two halves. The first half is used to train the NN and the output computed. The NN usually tracks the system output well and converges to a suitable error minimum. New inputs are presented to the trained neural network and the predicted output is observed. If the fitted model is correct, i.e., correct assignment of lagged inputs and outputs, then the network will predict well for the prediction set. In this case, the model will have captured the underlying dynamics of the system. If both the OSA and the MPO of a fitted model are good over the estimation and prediction data sets, then most likely the model is unbiased.
NN modeling: Various modeling techniques can be used with neural networks to identify a non-linear dynamical system. These include state-output model, recurrent state model, and non-linear autoregressive moving average process with exogeneous (NARMAX) input model. However, from the literature, it has been established that if the plant's input and output data are available, the NARMAX model is a suitable choice, for modeling systems with nonlinearities. Mathematically, the model is given as [15][16]: Where, ) ( t y is the output vector determined by the past values of the system input vector, output vector and noise with maximum lags y n , u n and e n , respectively, ) (⋅ f is the system mapping constructed through multilayer perceptron or radial basis function neural networks with an appropriate learning algorithm. The model is also known as NARMAX equation error model. However, if the model is good enough to identify the system without incorporating the noise term or considering the noise as additive at the output, the model can be represented in a NARX form [15][16][17] as: The system is shown in Figure 2. GA modeling: With the GA modelling, an initial population of potential solutions is created in the first step. In the second step, the performance of each member of the population is assessed through an objective function imposed by the problem. This establishes the basis for selection of pairs of individuals that will be mated together during reproduction. For reproduction, each individual is assigned a fitness value derived from its raw performance measure, given by the objective function [18]. In the manipulation phase, genetic operators such as crossover and mutation are used to produce a new population of individuals (offspring) by manipulating the genetic information, usually called genes, possessed by the members (parents) of the current population. In this way, the average performance of individuals in a population is expected to increase, as good individuals are preserved and breed with one another and the less fit individuals die out. The GA is terminated when some criteria are satisfied, e.g., a certain number of generations completed or when a particular point in the search space is reached.
For parametric identification of the manipulator with GA, randomly selected parameters are optimised for different arbitrarily chosen order to fit to the system by applying the working mechanism of GA as described above. The fitness function utilised is the sum-squared error between the actual output, ) (n y , of the system and the predicted output, ) ( n y , produced from the input to the system and the optimised parameters: Where, n is the number of input/output samples. With the fitness function given above, the global search technique of the GA is utilized to obtain the best set of parameters among all the attempted orders for the system. The output of the system is thus simulated using the best sets of parameters and the system input. Model validation: It is important to devise an effective model validation process once a model has been developed. There are various methods of validating a model, such as: one step ahead (OSA) prediction, model predicted output (MPO), and correlation tests. Both the MPO and correlation tests are implemented for this virtual environment. The MPO method can be expressed as: and the deterministic error or deterministic residual is If only lagged inputs are used to assign network input nodes, then The implication that the fitted model behaves well for the MPO does not necessarily imply that the model is unbiased. The prediction over a different set of data often reveals that the model could be significantly biased. One way to overcome this problem is by splitting the data set into two sets, an estimation set and a test set (prediction set). A section of the data is used for training the network and the remaining portion of the data for validating and testing the network.
A more convincing method of model validation is to use correlation tests. If a model of a system is adequate, then the residuals or prediction errors ε( ) t should be unpredictable from all linear and non-linear combinations of past inputs and outputs. The derivation of simple tests, which can detect these conditions, is complex, but it can be shown that the following conditions should hold [19].
Ideally the model validity tests should detect all the deficiencies in network performance, including bias due to internal noise. The cause of the bias will however be different for different assignments of network input nodes.
Consequently, the full five tests defined by equation (11) should be satisfied if u(.)'s and y(.)'s are used as network input nodes. In practice normalized correlations are computed. The sampled correlation function between two sequences ) ( 1 t ψ and ) ( 2 t ψ is given by, Normalization ensures that all the correlation functions lie in the range 1 , irrespective of the signal strengths. The correlations will never be exactly zero for all lags, and the 95% confidence bands defined as N / 96 . 1 are used to indicate if the estimated correlations are significant or not, where N is the data length. Therefore, if the correlation functions are within the confidence intervals, the model is regarded as adequate.

IV. THE VIRTUAL ENVIRONMENT
The development is composed of two main components, one is the Matlab (and associated toolboxes) driven computing part and the other is the Guide driven front panel known as GUI [20][21][22]. The user provides the system specification through a GUI that is subsequently passed to the Matlab for computation. The computation outcomes are then passed to other GUIs for presentation of the results. A flowchart representing the environments' structure is shown in Figure 3.
There are three main parts of the computing component: a) FD simulation; b) NN modeling and validation; and c) GA modeling and validation. As the name implies the FD simulation part provides the computation for FD simulation of a flexible robot manipulator system. While the NN modeling and validation and GA modeling and validation parts provide computation for NN and GA modeling and subsequent model validation, respectively. The training data used for NN and GA modeling processes are obtained from an open-loop FD simulation, using random or composite PRBS torque inputs.
The GUI component has six parts: a) Initial GUI; b) Results GUI; c ) NN modeling GUI; d) GA modeling GUI; e) NN model validation GUI; and f) GA model validation GUI. Initial GUI is the home of the SCEFMAS and is used to specify a desired flexible robot manipulator, FD simulation parameters, nature of excitation input, and direct the users towards a desired intelligent modeling technique. Results GUI is used to display the FD simulation input and output both in time and frequency domains along with a three dimensional display of the system movement. The NN modeling GUI allows the users to provide the NN modeling structure and also guides them through the NN modeling process. The GA modeling GUI allows the users to pass the GA modeling parameters and also guides them through the GA modeling process. NN and GA model validation GUIs are used to present the validation graphs after NN and GA modeling, respectively.

A. The FD simulation and verification
The FD simulation is one of the main parts of the environment. This provides an open-loop simulation of a specified flexible robot manipulator system.
The output data generated through this simulation process along with the excitation inputs are stored and subsequently used for NN and GA modeling. The input types, which have been provided within the environment, are the random and composite PRBS. The implementation flowchart for the FD simulation is shown in Figure 4.
Within the Initial GUI a user provides the desired system specification, simulation parameters, and input types ( Figure 5). The system specification consists of: Manipulator Specifications, Material Properties, and Simulation Parameters. Manipulator specifications involve the length, thickness, and width of the manipulator along with the hub inertia and payload. While the material properties constitute a damping factor, Young's modulus, and mass density per volume. Finally, the total simulation time, number of segments, and stability factor for the FD algorithm constitute the simulation parameters. At the bottom of the option selection box, there are two radio buttons, which can be used to select excitation input of the manipulator. The inputs are Random input and Composite PRBS input. Only these kinds of inputs provide sufficient excitation for all the modes associated with a flexible robot manipulator system within the frequency range of excitation. After providing all the information within the initial GUI, one can click on the FD simulation button within the GUI. This will bring up a pre-developed Simulink model of the flexible robot manipulator system connected in an open-loop manner.  The model consists of a FD arm in SS block, which implements the FD algorithm for the flexible robot manipulator in state-space form. The composite PRBS torque input is provided from the Matlab workspace through the Open_loop_input block. Along with the FD arm in SS block, this torque input is also passed to the Auxiliary and yin blocks. The Auxiliary block produces data for 3D displacement of the manipulator, while the yin block passes the input torque values to the Matlab workspace for further analysis. The output of the FD arm in SS block contains the displacement, velocity, and acceleration data for the hub point and end point of the flexible robot manipulator. These data are passed to the Matlab workspace through the Mux and yout block. A simulation run of the Simulink model will produce outputs and will be passed to the Matlab workspace along with excitation input data. After the completion of the simulation run, a new button will appear within the Initial GUI, next to the FD Simulation button. This button is called the Results button ( Figure 5). A click on this button will open the Results GUI that can be used to display the input and all the outputs produced through this simulation process (Figure 7).
The left hand side of the Results GUI includes option buttons, the top right part contains time domain and frequency domain result windows fo r the selected input or Figure 7. Displaying the results obtained from FD Simulation output parameter, bottom middle window is for displaying a 3D plot of the complete motion of the manipulator for a given simulation run. The drop down menus at the bottom right side can be used to choose properties of the 3D plot. After viewing the result, the user can choose to return to the Initial GUI by clicking on the New Simulation button or may exit the environment by clicking on the Quit button within the Results GUI (Figure 7).

B. B. NN modeling and validation
The NN Modeling GUI is used to carry out the NN modeling of a flexible robot manipulator system. The implementation flowchart for the NN modeling and subsequent model validation is shown in Figure 8.
This NN Modeling GUI can be invoked by clicking on the NN Modeling button within the Initial GUI (Figure 9). The user can choose three, four, or five layers of neurons. The types of neurons along with the number of neurons in each layer can also be selected. For this specific case, a three layer structure was chosen with 5 neurons in each of the inside layers.   After specifying the desired NN structure, the user can use the available input-output data set from a previous run or generate a new set of training data by clicking on the Generate Data Set button ( Figure 9). This will open a Simulink model with open-loop input as shown in Figure 6. A subsequent run of the open-loop FD simulation model will produce the input-output data necessary for the NN training.
After having training data, the user needs to click on the Train Network button within the NN Modeling GUI. This will start the NN training process ( Figure 10). The progress through the training can be monitored through the graph window shown on the left hand side of the GUI. The graph will plot the sum-squared error. At the completion of the training process, a message Simulation Done will appear within the NN Modeling GUI. This will be followed by the appearance of another button called the Model Validation button.
The Model Validation button will allow the users to examine the quality of the developed NN model by observing all the three model outputs (input to hub angle, input to hub velocity, and input to end-point acceleration). The model validation process involves the MPO and correlation tests that are presented through the NN Model Validation GUI. The GUI with MPO validation plots for a hub angle model in the time and frequency domains are shown in Figure 11. All the graphs show close matches between the real and model predicted outputs. The performance of models from the input to the remaining two outputs can be displayed by clicking on the appropriate button. In addition to the MPO validation plots, one can obtain correlation test plots for each of the three model outputs. The hubangle validation plots with correlation tests are shown in Figure 12. The auto-correlation and cross-correlation graphs show close proximity between the real output and predicted output obtained from the NN model. The user can click on the Quit button to return to the Initial GUI and start simulation all over again with a different set of system parameters.

C. GA modeling and validation
This section describes the GA modeling and model validation process. The user will have the choice of specifying GA model parameters, such as number of individuals, maximum number of generations, generation gap, binary precision, and the order of the GA model.
Similar to the NN modeling, the input and outputs from a FD simulation model will be used as a reference for the model development process. A flowchart describing the GA modeling steps is shown in Figure 13. The quality of the developed model can be verified both in time and frequency domains along with suitable correlation tests.
The GA Modeling GUI is used to carry out the GA modeling of a flexible robot manipulator system ( Figure  14). This GUI can be invoked by clicking on the GA Modeling button within the Initial GUI ( Figure 5). The left hand side of the GUI is provided with sliders, where a user can set the GA modeling parameters. These are   down menu to choose a model type, such as input to Hub Angle, input to Hub Velocity, and input to End-point Acceleration. After entering all the model parameters and model types, the user can generate training data by clicking on the Generate Data button (one of the right bottom buttons) or can use the previously generated simulation data available within the system. The user can proceed with the GA modeling by clicking on the GA Modeling button within the GUI. The progression through the GA modeling along with the fitness performance will be displayed in the figure window at the middle of the GUI (Figure 14). After the completion of the modeling process, the Validation Plots button will be activated (bottom right corner of the GUI). The user can click on this button to observe the performance of the developed GA model through GA Validation GUI (Figure 15). The left hand side of the GUI is provided with buttons for choosing model types. The model validation outputs are displayed through four figure windows. The top two figure windows are for comparing the magnitudes of actual and predicted outputs. The bottom right window shows the comparison between actual and predicted outputs in the frequency domain. The bottom left window shows the sum-squared error for each generation. All the validation plots show a close match between the real data and the output produced by the develop GA model. At the end of the GA model validation process, the user can return to the Initial GUI for further modeling exercises.

V. CONCLUSION AND DISCUSSION
The FD based simulation of a single-link flexible robotic manipulator is the backbone of the environment. The user can specify a desired flexible robot manipulator system and observe the behavior of the system (both in time and frequency domains) before moving into the intelligent modeling process. As a part of intelligent modeling techniques, NN and GA models have been developed and realized using the Matlab, Simulink, Guide, and other associated toolboxes. Results of various modeling techniques have been validated through various tests, including input/output mapping, training and test validation, and correlation tests. The interactive GUIs allow the user to choose a model structure and monitor the developed model performance without going into the programming details. Moreover, a data analysis provision has been made within the package to enable users to analyze data obtained from a test run. This makes the environment more user-friendly and saves the time and effort to transfer the data to another environment for analysis.
The environment is in use with the Automatic Control and Systems Engineering Department of The University of Sheffield (UK). This package is used as a supporting tool to deliver a module of a M.Sc. program within the department. The virtual environment enables the students to understand the behavior of a flexible robot manipulator system and also the effect of parameter variations. The learning process could be much more difficult without this package. In addition to this, students can test the ef-fectiveness of their controller designs without spending much time on system modeling. The addition of these new features will enhance the learning outcomes from this environment.
The NN and GA modeling features can easily be extended to the development of intelligent controllers to investigate various aspects of active vibration control in flexible robot manipulator systems. With the advent of Internet technology and the Matlab web server, the package can be further developed to be used as a distance learning facility.