Full text
Guide for the control of an industrial manipulator Nagaoka, July 2014 Presented by PAU RAMOS RAMÍREZ Advisor: Kiyoshi Ohishi, Assoc. Prof. Electrical Engineering 2014 The Department of Electrical and Electronic Systems Engineering NAGAOKA UNIVERSITY OF TECHNOLOGY, Niigata, Japan
Abstract The aim of this work is to present a practical guide to implement a controller for an industrial manipulator. The contents here presented are especially dedicated to a beginner in robotics. The necessary equations and methodologies are presented, although sometimes the explicit derivations are omitted, as this could lead to a loss of interest. The reader is encouraged to work in his or her specic control problem while reading this work. Of course, whenever the urge of knowing the steps leading from one expression to another appears, the source is available so that the person concerned may nd what is looking for. Along with the theory, during the course of the explanations a controller for a real manipulator is designed. After every step, the results of applying the presented equations to the example are shown. This work ends with the numerical simulation of the aforesaid manipulator, including the recording of the movements of a 3D model of the robot. Even when no experimental results are presented, by the use of the 3D model it is possible to have an insight on how the robot would react with the designed controller. Also, some other control strategies dierent from the main one are introduced. Furthermore, the reader will nd in the bibliography all the necessary to keep learning long after nished reading these pages.
Contents 1 Introduction 1 1.1 Objectiveandmotivation ......................................... 1 1.2 Structureofthisthesis........................................... 1 2 Theoretical study of the manipulator 2 2.1 Robotmanipulatormodel......................................... 3 2.2 Kinematics of robot manipulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3 Dynamics of robot manipulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3 Controller design 10 3.1 Computed torque control (PD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 3.1.1 Selection of the natural frequency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.2 Computed torque control (PID) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.3 PIDcalibration............................................... 15 3.4 Dissipativeforces.............................................. 18 3.5 ParameterEstimation ........................................... 20 3.5.1 Estimation of kinematic parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.5.2 Estimation of dynamic parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.6 Robustcontrol ............................................... 24 3.7 Othercontrolstrategies .......................................... 28 4 Simulations 33 4.1 Numericalsimulationmodel........................................ 33 4.2 Trajectory path and evaluation items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.2.1 Evaluationitems.......................................... 36 4.2.2 Trajectorypath........................................... 36 4.3 Numerical simulation results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.3.1 Gainsandpoles........................................... 44 4.3.2 Trajectories............................................. 44 4.3.3 Simulationresults ......................................... 46 4.3.4 Commentsontheresults ..................................... 54 5 Conclusions and recommendations 56 6 Acknowledgement 57 A Simulink R 3D Animation TM tutorial 60 B Trajectory maker algorithms 69 B.1 Oinealgorithm.............................................. 69 B.2 Onlinealgorithm.............................................. 71 C Remaining simulation results 73
List of Figures 2.1 3Dmodelofthemanipulator ....................................... 2 2.2 Frames location as seen from the 0-conguration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3.1 Block diagram of the computed torque control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3.2 Simple model vs 2-mass model of a servomotor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 3.3 Block diagram of the 2-mass model motor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 3.4 Block diagram of the PID-CT controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 3.5 Pole allocation of the sets in table 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.6 Computed error response to a ramp of slope 1 rad/s for four PID gain sets. . . . . . . . . . . . . . 18 3.7 Friction model: γ= [80,400,5,40,50,10] ................................. 19 3.8 PID computed torque control with motor dynamics included. . . . . . . . . . . . . . . . . . . . . . 25 3.9 Block diagram of the linearised system after applying the CTC. . . . . . . . . . . . . . . . . . . . . 26 3.10 Weighted H∞ controlconguration. ................................... 26 3.11 Standard H∞ controlconguration. ................................... 27 3.12 Block diagram for the computed torque plus H∞ compensation method. . . . . . . . . . . . . . . . 28 3.13 Block diagram of the control for one joint. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.1 Simulink R modelofthesystem. ..................................... 34 4.2 Simulink R modelofthecontroller..................................... 34 4.3 Snapshotofthe3Dmodel.......................................... 35 4.4 Interface Simulink R -Virtualworld .................................... 35 4.5 Online computation of the inverse Jacobian. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.6 Flow chart comparison: oine vs online. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.7 On the left, the load for runs 1, 2 and 3. On the right, load for run 4. . . . . . . . . . . . . . . . . 43 4.8 Trajectoryforload1............................................. 44 4.9 Trajectoryforload2............................................. 45 4.10Poleallocationforrun1........................................... 46 4.11Performanceofrun1.1. .......................................... 46 4.12Performanceofrun1.4. .......................................... 47 4.13Poleallocationforrun2........................................... 48 4.14Performanceofrun2.1. .......................................... 48 4.15Performanceofrun2.4. .......................................... 49 4.16Poleallocationforrun3........................................... 50 4.17Performanceofrun3.1. .......................................... 50 4.18Performanceofrun3.4. .......................................... 51 4.19Poleallocationforrun4........................................... 52 4.20Performanceofrun4.1. .......................................... 52 4.21 Tilt of the barrel over time for run 4.1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 4.22Performanceofrun4.4. .......................................... 53 4.23 Tilt of the barrel over time for run 4.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 A.1 CAD pieces of the manipulator: link 0 and 1 ............................... 60 A.2 CAD pieces of the manipulator: link 2 and 3 ............................... 61 2
A.3 Exportoptions. .............................................. 61 A.4 Viewerwindow................................................ 62 A.5 Editorwindow................................................ 62 A.6 Virtual world with all the links and 3 viewpoints. . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 A.7 Tree of a moving box with texture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 A.8 Virtualworld. ............................................... 65 A.9 VRSinkparameters. ........................................... 66 A.10 Simulink R model. ............................................. 66 A.11 Viewer windows with the nal model. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 A.12Recordingsettings.............................................. 67 C.1 Performanceofrun1.2. .......................................... 73 C.2 Performanceofrun1.3. .......................................... 74 C.3 Performanceofrun2.2. .......................................... 75 C.4 Performanceofrun2.3. .......................................... 75 C.5 Performanceofrun3.2. .......................................... 76 C.6 Performanceofrun3.3. .......................................... 76 C.7 Performanceofrun4.2. .......................................... 77 C.8 Tilt of the barrel over time for run 4.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 C.9 Performanceofrun4.3. .......................................... 78 C.10 Tilt of the barrel over time for run 4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
List of Tables 3.1 PID's set of gains for testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 4.1 Pros and Cons of the trajectory maker alternatives. . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 4.2 Contents of the simulations (I). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.3 Contents of the simulations (II). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 4.4 Gains used for the simulations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.5 Pole allocation for the simulations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 4.6 Statistics of the simulations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Chapter 1 Introduction 1.1 Objective and motivation The objective of the thesis is to present a guided path to control an industrial manipulator. A non-initiated person seeking to know how to implement the control system for a robot can have trouble looking for a step to step procedure. The handbooks that consider all the aspects of the control have to present a lot of theory, which requires a great amount of time and eort for the reader to become able to apply it. On the other hand, searching for those aspects separately could lead the interested to a cloud of research papers, where each one uses a dierent approach in order to have the best performance. When trying to gure out which approach is the best to design a controller, facing such amount of dierent opinions can be discouraging. For example, let's imagine that we could split the problem in three steps, and in any of these there were lots of dierent ways to proceed. Considering every each of them at the beginning makes the design dicult and probably slower. For that reason, the intention of this work is to briey sum up the main ideas of the control but considering as many aspects of it as possible. Choices have to be made which means that some alternatives are not explored. However, in those cases, if the reader feels the need for deeper knowledge, a reference to a book or paper will be given. 1.2 Structure of this thesis This work is divided into three main parts. The approach is more practical, with the use of a real manipulator as example. By the end of this thesis, the presented robot will be able to follow pre-design trajectories or to move from a given point to another. Every part will have a resume of the necessary theory and then, this knowledge will be applied to the manipulator to obtain the expressions and equations. The sections are like follows: 1. Theoretical study . The start is always the same: derivation of the mathematical expressions that describe the kinematics and dynamics of the robot. A common method is presented and applied to the sample manipulator. 2. Control design . From the expressions obtained in 1 , a widely used strategy is presented along with some improvements that can be added. Other control strategies are briey commented. 3. Simulation . Here, the reader will nd the simulation model, as well as the trajectory path maker algorithm. Moreover, the results of applying the designed control to the sample manipulator's model are also shown. 1
Chapter 2 Theoretical study of the manipulator In this section, the manipulator is presented. The frames that describe the position and orientation, as well as the kinematics and dynamics expressions of interest, are deduced and shown in the following subsections. Figure 2.1: 3D model of the manipulator 2
2.1. ROBOT MANIPULATOR MODEL 3 2.1 Robot manipulator model The manipulator robot is a six-degree-of-freedom industrial manipulator. However, only the rst three degrees of freedom (DOF) will be considered. That means that the joints 4 , 5 and 6 will be considered xed to the default position. The remain degrees of freedom are, from bottom to top, rotation 1 , 2 and 3 . From now on, as there are only three movements, the robot will be associated to a human arm. Terms like forearm or shoulder can appear. The robot has four parts: in black, the two parts of the base, one xed to the ground and the other, mobile; in grey, the upper-arm and the forearm. The rst DOF is a rotation of the whole arm with respect to the xed base. That is, the joint 1 is the one that makes the hole arm rotate about the vertical axis. The second rotation allows relative movement, about an axis parallel to the ground, of the upper arm with respect to the moving base. Finally, the last rotation acts like an elbow, allowing the movement of the forearm with respect to the upper arm. That last rotation axis also remains parallel to the ground. The point that is the objective of the positioning control could be though as the wrist 1 , or end-eector, and is situated at the end of the forearm. A description like the one given above is not enough to describe the system with precision. For that reason, a mathematical description is required. However, the shape of the manipulator will change for sure, function of the relative angle that the servo-motors impose between one part and the adjacent. A way of describing the robot with precision is by using coordinate systems . These coordinate systems, or frames , are attached to the dierent parts, or links , of the manipulator. That means that, considering a robot with three degrees of freedom, there will be four links that are together thanks to the joints. That means, at least 4 frames have to be dened. Going back to the human reference, is like a skeleton where the links represent the bones and the articulations allow relative motion. The force that makes the links approach or separate is given by the servo-motors and their torque s. These frames are attached to the links, making possible to know the position of one of the points, the frame's origin, and orientation. For further information, a more accurate denition of the frames and links can be found at [3]. The frames that describe the position and orientation of the links of the sample robot are allocated as shown in 2.2. Frame {4} is at the wrist. It will be useful to know where the wrist is in space when designing the trajectories, although adding it does not make the description more accurate. As it was commented before, the minimum required number of frames is n+ 1 , being n the number of degrees of freedom or, for most serial robots, the number of joints. The frame that comes before {4} is frame {3}, located at the rotation axis 3 . Both {3} and {4} have the same orientation because, as said before, the joints 4 , 5 and 6 will be considered xed. The axis of frame {3}, then, are such that the Y-axis is collinear with the rotation -3 axis and the X-axis is perpendicular to the surface of the wrist. The Z-axis is then chosen to point upwards, which in turns determines the direction the Y-axis is pointing to. To see it clearer, at 2.2 it is noticeable how the X-axis is perpendicular to the frontal face of the wrist. The previous frame is {2}, which has its origin on the rotation axis 2 . Its Y-axis is also collinear with the rotation axis and points in the same direction as the Y-axis of {3}. The X-axis and Z-axis are such that, when all the rotation angles are set to zero (0-conguration from now on), both {2} and {3} have the same orientation. Frame {1} is also chosen to be the same as {2} and {3} while being in the 0-conguration. However, its Z-axis is collinear with the rotation axis 1 and the whole frame is xed to the moving part of the 1 This is a common notation for the last frame of the kinematic chain. Usually, the robot is holding a tool. That tool is thought to be in a hand so that is why the last frame at the free end of the robot is called wrist .
Chapter 3 Controller design There are several ways to approach the motion control of a robot manipulator. There are those that work with a linear model of the robot and consider the non-linearities as a perturbation. Others are based on a non-linear control so that the model of the system can also be a non-linear one. The control chosen on this work is a commonly used for trajectory following, named Computed Torque Control. The response, as the system is not linear, will depend not only of the controller, but also the input. This chapter discusses the control law and briey comment how to design the gains. The input, or trajectories, will be discussed further. Some other strategies are also commented. 3.1 Computed torque control (PD) This method takes advantage of knowing the non-linear character of the system. As the acceleration of the input aects directly to the command intensity, as it will be shown afterwards, signals such as steps or ramps with a high slope are not suitable. Due to the abrupt discontinuity present on this type of inputs, the acceleration can reach undesirable high values, making the controller useless. On the contrary, smooth signals should be used. The main applications are those which involve following a trajectory, such as spray painting or welding. This control technique was proposed in [14]. If we consider that the robot obeys the equation 2.22 1 , once the noise is added, the system as a function of the torque is: ¨q=M(q)−1·(τcontrol + ¯τdist −B(q)·[ ˙q˙q]−C(q)·[ ˙q]2−G(q)−F f(q, ˙q)−f(q)) (3.1) Then, by applying the following control law ¯τcontrol =M(q)·v+B(q)·[ ˙q˙q] + C(q)·[ ˙q]2+G(q) + Ff(q, ˙q) + f(q) = M(q)·v+N(q, ˙q) (3.2) v= ¨qd+Kv( ˙qd−˙q) + Kp(qd−q) = ¨qd+Kv˙e+Kpe (3.3) by substituting 3.2 in 3.1, the hole system with the control and the feedback reduces to the second order dierential equation: ¨e+Kv˙e+Kpe=wdist =−M(q)−1·¯τdist (3.4) e=qd−q where e , a 3x1 vector, is dened as the dierence between the desired trajectory and the actual trajectory, and wdist is some external disturbance or noise. This is a second-order dierential equation with selectable 1 Note that the dynamics of the joint actuators are neglected. It is a common practice to simplify the problem. 10
3.1. COMPUTED TORQUE CONTROL (PD) 11 coecients , so that the response can be shaped at will. That means that, if one manage it to make the servo-motors deliver a torque that behave as 3.2, then the angular positioning error should behave as 3.4. This equation is always stable as long as both matrix Kv and Kp are positive dened. Furthermore, those matrices are usually chosen to be diagonal, so the equation 3.4 is in fact decoupled: ¨ei+kvi ˙ei+kpiei=wdisti (3.5) As it can be seen in [3], a property of stable linear systems known as bounded-input (boundedoutput (BIBO) stability) exists. The result of this property states that if the disturbance is bounded, then also the solution of the dierential equation is bounded. In fact, in the case that the disturbance is constant, when the system achieves the steady-state of the system, the error between the desired trajectory and the real trajectory would be: eiss =wdisti/kpi (3.6) By this equality it possible to see that as bigger the proportional constant is the smaller the steadystate error will be. − + Kvs Kp + M(q) N( ˙q, q) + + M¨q+N=τ Manipulator qd q ˙q v τ ¨qd Figure 3.1: Block diagram of the computed torque control. Equation 3.4 can be seen in a state-space form d dt "e ˙e#="0I3 −Kp −Kv#"e ˙e#+"0 I3#wdist (3.7) where I3 is the identity matrix of dimension 3. The closed-loop characteristic polynomial is 4c(S) = s2I3+Kvs+Kp As the matrix Kv and Kp are diagonal, then: 4c(S) = Y(s2+kvis+kpi) and the error is always asymptotically stable as long as the kvi and kpi are positive. To give an idea of how those parameters aect the evolution of the error over time, it is necessary to think of the standard form for the second-order characteristic polynomial:
3.1. COMPUTED TORQUE CONTROL (PD) 12 p(s) = s2+ 2ξωns+ω2 n= 0 s2+kvis+kpi = 0 (3.8) By inspection, kvi = 2ξωnikpi =ω2 ni (3.9) The most common choice is to design for critical damping ( ξ= 1 ). That means that there will be, theoretically, no overshooting or, in other words, that the trajectory will never surpass the desired one. This is important if high precision is required as an overshooting could result in a collision. Then, both coecients are function of the natural frequency. This frequency governs the speed of response: the higher it is, the faster the system will response and the error will decrease to zero in less time. However, the value of ωn has a limitation. Although the servo-motors are mostly massive, they have some exibility. That means that, as all the oscillating systems, a resonance frequency exists [2]. Figure 3.2: Simple model vs 2-mass model of a servomotor. In the picture above, in the left, the basic model for a motor is shown. However, a more realistic one is presented at the right. In this model, the position and velocity of the load and the motor are not the same due to the exibility of the transmission. This compliance in the coupling is the cause for which a resonance frequency exists, as now the excitation frequency plays a role in the way the load is moved by the motor. 3.1.1 Selection of the natural frequency To avoid exciting the resonance mode, an consider the rigidly coupled model without many error, usually the natural frequency is selected so that: ωn≤ωar 2 (3.10) Below that frequency, the system will behave mostly like there is no compliance in the coupling. As the frequency approaches the anti-resonance frequency, the amplitude of the response decreases. Once surpassed this frequency, the amplitude will increase more and more, until it reaches its maximum at the resonance frequency. If the 2-mass model is considered, the block diagram resulting is the following:
3.1. COMPUTED TORQUE CONTROL (PD) 13 KT+ −1 JMs+DM 1 s 1 Rgn + − 1 s KS 1 Rgn 1 JLns+DLn 1 s τmωM θS ωL θM θL Icmd Figure 3.3: Block diagram of the 2-mass model motor. Then, the transfer function from the intensity to the angular speed of the load is: G(s) = ωL(s) Icmd(s)=Kn(s2+2ζ2ωar s+ω2 ar) (τns+1)(s2+2ζ1ωress+ω2 res) (3.11) where the resonance ( ωres ) and anti-resonance ( ωar ) frequencies are: ωres =qKS JL+KS JMR2 gn (3.12) ωar =qKS JL (3.13) where KS is the rotational stiness [ Nm rad ], KT is the motor torque constant [Nm A] , J is the inertia [ Kg·m2 ] and Rgn is the gear ratio ( ˙qm→˙q when no compliance exists). As the resonance frequency depends on the inertia which varies in function of the conguration, the maximum inertia value should be considered when computing ωar . If those values are not given by the manufacturer, now a method to measure them is proposed. However, the inertia of the motor and the gear ratio are values that must be included in the characteristics of the servomotors. The nominal values are good enough so those are the ones that should be considered. Measurement of the resonance frequency To measure resonance frequency and the anti-resonance frequency for each joint: 1. Input a sinusoidal signal of increasing frequency over time of intensity 2 to the motor under test, while the rest stay blocked. 2. Read, by the position coders, the angular position of the motor. Then, by applying 3.14, the angular speed of the motor can be obtained. ωL(k) = θL((k+1)Ts)−θL(kTs) TS, for all k. (3.14) where TS is the sampling period and k is the kth value of the vector. 3. Plot the angular speed versus the intensity frequency at that time. The resulting gure should show an oscillation the amplitude of which changes with the frequency. 2 The amplitude of the intensity should not be small to avoid possible damage to the manipulator when the resonance frequency is reached. However, if it is too small it can be dicult to read the output.
3.2. COMPUTED TORQUE CONTROL (PID) 14 4. Read the frequency at which the amplitude is minimum and maximum. Those values are the anti-resonance and resonance frequency, respectively. 5. Repeat 1 to 4 for the other joints. 6. With the values of both ωres and ωar , the value of KS can be calculated for each joint. To obtain those frequencies with dierent loads, a parameter estimation algorithm can derive JL . Once the maximum for Kp and Kv is known, their exact value should be selected depending on the desired performance. The trajectory that the manipulator will have to follow also plays a role here. 3.2 Computed torque control (PID) Until now, the controller proposed was a proportional-derivative one. Nevertheless, equation 3.5 showed that the noise is part of the dierential equation. Whenever there is a noise with a non-zero continuous component or, in other words, that has some oset, it will make the robot unable to reach the desired point by some dierence (3.6). The system itself is a low-pass lter due to the integers it has. That means that high-frequency noise will not be able to aect the position. Still, if high precision is required it would be better to eliminate it completely instate of just reducing it. To eliminate the noise, the controller should be a PID one. The integrative part is added as it can be seen in gure 3.4: − + Kvs Kp Ki s + M(q) N( ˙q, q) + + M¨q+N=τ Manipulator qd q ˙q v τ ¨qd Figure 3.4: Block diagram of the PID-CT controller The dierential equation has to be rewritten: ¨ei+kvi ˙ei+kpiei+kii ´e=wdisti (3.15) That means that, by dierentiating both sides: ... ei+kvi¨ei+kpi ˙ei+kiiei= ˙wdisti (3.16) So now, the disturbance aects the system in a dierent way: the continuous part of the noise will not aect in steady-state. By assuming a constant noise as in 3.6, now:
3.3. PID CALIBRATION 15 kiieiss = 0 However, adding another constant to the controller means that the error no longer obeys a second order dierential equation, but a third order one. Replicating the process from 3.7 to 3.9: e ˙e ¨e = 0I30 0 0 I3 −Ki−Kp−Kv ´e e ˙e + 0 0 wdist (3.17) 4c(S) = s3I3+Kvs2+Kps+Ki 4c(S) = Y(s3+kvis2+kpis+kpi) A third order system has three poles. One is real and the other two are complex that can, eventually, have the imaginary part equal to zero. That means it is possible to associate that characteristic polynomial to: p(s) = (s+1 τ)(s2+ 2ξωns+ω2 n) = 0 s3+kvis2+kpis+kii = 0 (3.18) By doing the necessary manipulations, then: kv=1 τ+ 2ζωnkp=2ζωn τ+ω2 nki=ω2 n τ (3.19) Knowing these relations allows allocating the poles of the dierential equation with precision. As a consequence, the response can now be shaped at will. p1=−1 τp2,3=−ωnζ±ωnp1−ζ2 (3.20) As in the case of the PD controller, the equation is stable as long as ωn , ζ and τ are positive, which will make the gain constants positive as well. On the other hand, those values are always positive by denition so as long as the constants are positive the dierential equation will be stable. 3.3 PID calibration In equation 3.19 and 3.20, the relation between the pole location and the PID gains was shown. However, there are many strategies to design the poles. For example, it is possible to make the rst pole, p1 , fast enough so that the system behaves almost like a second order one. In other words, with a real part signicantly smaller than the real part of p2,3 . By doing this, the response is much easier to shape. Nevertheless, is a loose of freedom and, also, make the gains bigger. To design the gains, whatever the strategy is, is necessary to know the relationship between the response and the controller. As said before, a non-linear system such as the one that is being controlled depends on both the PID and the input. That means that the responds cannot be characterized in terms only of the gains. Nevertheless, some aspects can be known. It is beyond the scoop of this work to go deeper in this matter, so the next few lines will give a hint on how the gains can be design based on specication. A parameter that is almost independent of the input signal is the settling time of the error. Whether the steady-state error is zero or not depends on whether the acceleration of the desired trajectory is zero or not, and noise as well. The settling time, though, can be considered independent and just a function of the pole allocation. When there is a fast pole and a slow one, the slow will dictate when the error achieves the steady-state. Considering the settling time as the instant when the error signal enters the region of ±2% its nal value, then it can be approximated by:
3.3. PID CALIBRATION 16 ts(2%) ≈6 |Real(dominant pole)| where Real(x) is a function that returns the real part of x. However, the accuracy of this expression relies on how dominant is the pole. The numerator will change from 6 to 10 depending on the distance in the real-imaginary plane between the poles, being 10 the case when the three poles have the same real part. The real value of ts can only be approximated, but is enough if a factor of safety is considered. The need for this time to be respected, even to the point of considering a safety factor, is because if the trajectory ends before reaching the steady-state, the remaining error is accumulated. By exiting with dierent trajectories too close to each other, the error could grow unsustainable. For that reason, is important to respect the settling time. To sum up, the error should be stable before the trajectory ends, and the next input should not start before ts seconds. Once the real part of the dominant pole has been decided, how far the other pole is placed will aect the maximum error. The bigger it is its absolute value, the smaller the error response will be. Whether the dominant pole is p1 or p2,3 is arbitrary and maybe the best choice would be that one that lead to smaller gains. Usually, making p1=−1 τ the fast pole and p2,3 the dominant, the resulting gains are smaller. To avoid vibrations, the best alternative is to design for the critical dumping case, just as the PD case in section 3.1. That means, p2=p3∈R . By doing so, the poles have no imaginary part and the error response will not oscillate. The maximum value of the gains will be limited by two factors: the maximum current admissible and the maximum acceleration possible of the actuators. Whatever the strategy is, though, solving equation 3.17 with a mathematical tool will give an accurate idea of how the error will evolve under certain conditions. Now, an example is presented. The solver used is ode45 , a MATLAB R function that returns a vector of time and a vector containing the solution of the given dierential equation. The function demands a function that computes the derivation, given a state, the initial and nal time as well as the initial conditions (IC). IC = ´e(0) e(0) ˙e(0) (3.21) For the following results, the system begins at rest at the 0-conguration. Then, a ramp of slope m is applied at time zero. For this case, the initial conditions are [0,0, m]T . The vector time is [0 tf] and the function is dened as:
3.3. PID CALIBRATION 17 function de=odefunc(t,e) %gain values ki=150; kp=100; kv=25; %noise a=0.5; b=2*pi*50; noise=a*sin(b*t); %differential equation de=zeros(3,1); de(1)=e(2); de(2)=e(3); de(3)=- ki*e(1) - kp*e(2) - kv*e(3) + noise; end Once the gain values are dened, the ode45 function can be executed, obtaining the response. It is important to note that the error is, in fact, the second column of the vector MATLAB R returns. By trying dierent sets, this procedure is repeated until the desired performance is achieved. Of course, the function can be modied so that instead of dening the PID gains, the program itself derived them from the pole allocation as seen in 3.19. Let's consider that, for dierent sets as the ones in table 3.1, the expected response is computed. The corresponding poles can be seen in gure 3.5. Set Kp Ki Kv 1 9 5 5.25 2 114 1000 24 3 208 640 44.8 4 954 900 55 Table 3.1: PID's set of gains for testing. Figure 3.5: Pole allocation of the sets in table 3.1
3.4. DISSIPATIVE FORCES 18 Figure 3.6: Computed error response to a ramp of slope 1 rad/s for four PID gain sets. For those sets, the error will behave as shown in gure 3.6. By taking the time of the last to peaks of set 2 and 3, the oscillation frequency can be calculated: 6,920 rad s and 3,200 rad s respectively. On the other hand, the pole's location reveals also an oscillation frequency: the one the system would have if it was a second order one. The expected frequencies are, then: 7,141 rad s for set 1 and 3,200 rad s for set 2. As commented before, when the rst pole is fast enough the response is almost like a second order one. It is also interesting to note a few more things: • For the rst set, although there should be no overshooting base on the poles, it exists due to the fact that what is actually being shaped is the integral of the error. This is because of the dierential equation's nature, where the less order variable is, in fact, ´e as it was shown in 3.15. • For the last set, the overshooting is almost null as the dominant pole is just one: p1 . To sum up, although there are many ways to assign the PID gains, solving the dierential equation as explained above is recommended to have an idea of what to expect. 3.4 Dissipative forces Before going any further, let's take the change to include a new part to the system's model: the dissipative forces. Until now, the friction was not part of the model. Moreover, given the chance to estimate the parameters as it will be seen in 3.5, adding it is a possibility. C. Makkar and her team at the University of Florida proposed a model in 2005 ([5]). The equation is: ff( ˙q) = γ1(tanh(γ2˙q)−tanh(γ3˙q)) + γ4tanh(γ5˙q) + γ6˙q (3.22) where: 1. γi∈R∀i= 1,2, ..6 are unknown positive constants. 2. Friction model is symmetric about the origin. 3. The static coecient of friction can be approximated by the term γ1+γ4 . 4. The term tanh(γ2˙q)−tanh(γ3˙q) captures the Stribeck eect where the friction coecient decreases from the static coecient of friction with increasing slip velocity near the origin.
3.4. DISSIPATIVE FORCES 19 5. A viscous dissipation term is given by γ6˙q . 6. The Coulombic friction coecient is present in the absence of viscous dissipation and is modelled by the term γ4tanh(γ5˙q) . This is a useful model as it is continuous, unlike others such as Stribeck model, which allows its inclusion into digital controllers without risk. Otherwise, discontinuous models are sensitive to quantization. Equation 3.22 can be shaped at will. It is interesting to note, however, how the dierent components aect the function: Figure 3.7: Friction model: γ= [80,400,5,40,50,10] where: • The nal value of the green curve is γ4 . • The slope of the red curve is γ5 . • The width of the blue curve is proportional to the relation γ2 γ3 , considering γ2> γ3 . Otherwise, the blue component will be reversed with respect to the x-axis. • The spike of the function is related not only with the previous point, but also with γ1 and the Coulombic friction coecient. In order to be able to estimate the friction parameters easily, a more suitable form for 3.22 is: τfi =aiFi(˙ θi) + bi˙ θi (3.23) where, τfi is the friction torque at joint 'i', Fi is a known non-linear function and ai and bi are the values that are to be estimated. The relation between 3.22 and 3.23 is: •a=γ1 •b=γ6 •F( ˙q) = tanh(γ2˙q)−tanh(γ3˙q) + γ4 γ1tanh(γ5˙q) That means that { γi, i = 2,3,5 } as well as γ4 γ1 have to be dened beforehand.
3.6. ROBUST CONTROL 26 where v0= ¨qd+Kv˙e+Kpe . Then, the linearised system in state-space form is (similarly to 3.7): d dt "e ˙e#="OnIn −Kp −Kv#"e ˙e#+"On In#(∆v+η) = A"e ˙e#+B(∆v+η) (3.51) d dte=Ae +B(∆v+η), e ="e ˙e# Which has the following block diagram representation, + + B + +1 s A ∆v η δe δt e Figure 3.9: Block diagram of the linearised system after applying the CTC. Figure 3.9 shows how, if it is possible to design ∆v in such a way that it compensates the disturbances, then the system would be self-governed. The only signal aecting the manipulator's movement would be qd , contained inside e . Dening P= (sIn−A)−1B , this diagram can be simplied. Then, the closed-loop H∞ control system is added and the result is shown in gure 3.10. The objective of this uncertain dynamic system is to nd a dynamic control law ∆v such that the closed-loop system is asymptotically stable and the eects of the uncertainty η and noise n on the output e are minimized. + + P Wd WiWe Wn + + ˆ K∆v η ∆¯v ¯η ¯e ¯n n y' e Figure 3.10: Weighted H∞ control conguration. The schematic in gure 3.10 can be rearranged to match the standard H∞ control conguration.
3.6. ROBUST CONTROL 27 G ˆ K ˜w˜z ˜u˜y Figure 3.11: Standard H∞ control conguration. Where G is usually called the augmented plant and ˆ K is the controller to be designed. The following equations relate gures 3.10 and 3.11, showing the value of G in state-space representation. ˜w="¯η ¯n#˜u= ∆¯v˜z="¯e ∆¯v#˜y=y0 G= A B1B2 C1D11 D12 C2D21 D22 (3.52) with A="OnIn −Kp−Kv#2n x 2n B1="OnOnOn WdOnOn#2n x 3n B2="On Wi#2nxn C1="We OnOn#3n x 2n C2=I2nD11 =O3nD12 = On On In 3nxn D21 ="On On Wn#2n x 3n D22 ="On On#2nxn Then, to obtain a stabilizing controller, it is necessary that the following conditions are guaranteed: a) (A, B2) is stabilisable and (C2, A) is detectable. b) D12 is full column rank and D21 is full row rank. c) "A−jωI2nB2 C1D12# has a full column rank for all frequencies. d) "A−jωI2nB1 C2D21# has a full column rank for all frequencies. Hence, the weighting matrices Wn, We, Wd and Wi should be full rank so that this assumptions can be true. Finally, the steps to obtain a robust computed torque control are: 1. Select Kp, Kv like there was no compensator, and obtain the numerical value of the linear plant P(s) = (sIn−A)−1B .
3.7. OTHER CONTROL STRATEGIES 28 2. Design the internal weighting Wi=α(s+β s+γ)·In , where α, β and γ(β >> γ) are arbitrary constants. Then, using this Wi , nd a provisional stabilizing controller ˆ K which grants that the condition for robust stabilization (3.54 10 ) is fullled. "In ˆ K#(In−PWiˆ K)−1hI2nPi ∞ ≤−1 (3.53) 3. Select proper values of Wd, Wn, and We for ne tuning, according to the importance of each signal. 4. Evaluate a state space realization of the augment plant G (3.52). 5. Find the nal stabilizing controller ˆ K using the program HINFSYN in MATLAB toolbox [17]. 6. Calculate the dynamic controller KC=Wiˆ K, KC∈Mn x 2n and simulate the system to evaluate the performance. 7. If the performance does not achieve the expected requirements, go back to step 2 and choose another weightings. Once the KC is design, then the nal block diagram for the computed torque plus H∞ compensation method is 11 : − + − + Kvs Kp KC + ˆ D(q) ˆ h( ˙q, q) + +ˆ Q(q)Q[D¨q+h] = E Manipulator ˙qd qd q ˙q v τ E ¨qd e ˙e Figure 3.12: Block diagram for the computed torque plus H∞ compensation method. 3.7 Other control strategies Force control This control strategy is useful whenever the end-eector has to make contact with the environment. In those cases, the position control may not suce. For that reason, an introduction to the hybrid position/force controller is now presented. The reader will nd more about this topic in [12]. During contact, some constrains to the free movement of the end-eector appear, referred as kinematic constraints. When that constrains exist, then it is called a constrained motion. Under these circumstances, only a very well planned motion control could work. Otherwise, it is more than likely that high contact forces will occur, damaging either the servo or the environment. Before introducing the hybrid control, let's take the time to take a look to the indirect force control . The indirect force control can be divided into two: passive and active. 10 The operator k•k∞ denotes the H∞ norm which is the supremum of the largest singular value over all frequencies. is the stability margin of the uncertain dynamic system, dened in [16]. 11 KC multiplies the vector e=e ˙e .
3.7. OTHER CONTROL STRATEGIES 29 • Passive: The inherent compliance of the robot grants some adaptation capacity. By enhancing this compliance with the use of elastic joints, as the soft robots for human interaction, or using mechanical devices attached to the end-eector, such as the RCC [13]), the desired trajectory is modied automatically. The robot itself absorbs the energy as to avoid that the contact forces surpass a certain threshold. No force/torque sensors are involved. It is fast and cheap, but every application needs a specic design, so it lacks some exibility. Also, only a certain amount of energy can be absorbed and, as the contact forces are not being tracked, it is not guaranteed that high forces do not appear. • Active: The compliance is ensured by the controller, which requires measuring the contact forces. Then, the desired trajectory is modied, or even generated, online. This overcomes the problems of the passive interaction control. On the other hand, this approach is slower, more expensive and, of course, more sophisticated. As both passive and active have strong and weak points, the most suitable option is to combine them appropriately. The hybrid control lies inside the direct force control approach, as an alternative of the indirect force control. The direct force control requires a model of the interaction task. That means that the user has to specify the desired motion and the desired contact forces in a consistent way with respect to the constraints imposed by the environment. The hybrid position/force control is a widely adopted strategy to do so. Direct force control In a real contact situation, there are a lot of forces actuating on the end-eector and can be classied by their nature (friction, local deformation, constrains violation, etc.). However, the common approach is to simplify the interaction and only consider two cases: both the robot and the environment are perfectly rigid, or the robot is rigid and the environment compliant. Those are just ideal models and any of them does not even consider the friction. Nevertheless, it is expected that the robustness of the controller can cope with the non-modelled eects, and the control laws may be adapted. After dening properly the environment as explained in [12], the task is specied. To do that, a special frame called task frame is dened. Such frame can be attached to the end-eector or to the environment. It is used because it makes it much easier to dene the task. The main idea is to obtain the desired forces and torques ( hd ) and the velocities and angular velocities ( veld ) at the end-eector. Both are 6x1 vectors, describing the wrenches and twists in every axis of the task frame. When the end-eector replicates those desired hd and veld , then for sure the task will be well performed. This vectors, though, have to be consistent with the kinematic constrains, and that is why equations 3.54 and 3.55 are for. hd=Sfλd (3.54) veld=Svνd (3.55) where λd∈Mmx1, νd∈M(n−m)x1 , being n the number of degrees of freedom and m the number of constrains, express the value of the constrains. Matrices Sf and Sv are used to translate from one to another. Let's consider, for example, the case of inserting a cylindrical peg into a hole with a 6-degrees of freedom robot. Once the peg is well located over the hole, the insertion begins. During this stage, it is important that the peg only moves perpendicular to the hole (along z-axis). Rotation about the z-axis is not prohibited. However, the force in the rest of the axis has to be zero.
3.7. OTHER CONTROL STRATEGIES 30 n-m=2 1. Move along z-axis with a certain speed. 2. Rotate about z-axis with an arbitrary angular speed. m=4 1. Force in x-axis equal to zero. 2. Force in y-axis equal to zero. 3. Torque in x-axis equal to zero. 4. Torque in y-axis equal to zero. Then, λd= 0 0 0 0 νd="vz ωz# (3.56) Which turn into, Sf= 1000 0100 0000 0010 0001 0000 Sv= 0 0 0 0 1 0 0 0 0 0 0 1 (3.57) And nally, hd= 0 0 Fz 0 0 Γz vd= 0 0 vz 0 0 ωz (3.58) As the performance relies on knowing with precision matrices in equation 3.58, using the measured values to update them online is common. The hybrid force/motion control is based on splitting the task of controlling the motion and the contact forces into two decoupled sub-problems. For the case where the environment is rigid, the control law is the one in 3.59, where αv and fλ are the input signals dened in equations 3.60 and 3.61. τcmd =J(q)[(J(q)M(q)−1J(q)T)−1(Svαv+˙ Svν) + Sffλ+N(q, ˙q)] (3.59) αv= ˙ν(t) = ˙νd(t) + KP v[νd(t)−ν(t)] + KIv ´t 0[νd(τ)−ν(τ)]δτ (3.60) fλ=λ(t) = ˙ λd(t) + KP λ[λd(t)−λ(t)] + KIλ ´t 0[λd(τ)−λ(τ)]δτ (3.61)
3.7. OTHER CONTROL STRATEGIES 31 where the system is stable as long as the four gain matrix, KP v, KIv, KP λ and KIλ , are positive-denite. Then, by the use of this control law, it is possible to control, independently, both the velocity and the contact forces by inputting the desired values in the task frame. To create a position control, is as easy as replacing equation 3.60 for equation 3.62. αv= ¨rd(t) + KDr[ ˙rd(t)−ν(t)] + KP r[rd(t)−r(t)] (3.62) For the details, please refer to [12] 12 . Linear control This controller is especially useful with input signals such as steps or ramps. As it considers the behaviour of the servo motors, and the response can be shaped with precision, high speed response times are possible. In this strategy, the motors are modelled as in gure 3.2 and controlled independently. Once each motor is turned into a transfer function, such as the one in gure 3.3, a PID controller can be used to control the speed and, afterwards, another one to control the position. All this together can be seen in gure 3.13, where both the noise and the non-linear phenomena, such Coriolis or friction, are considered a disturbance on the load side, τdist . PID KT+ −1 JMs+DM 1 s 1 Rgn + − 1 s KS 1 Rgn 1 JLns+DLn 1 s − + FF + + PID Fpd − + + − Icmd ωM θS ωL θM θL ω∗ cmd ωcmd θref ωref τdist Figure 3.13: Block diagram of the control for one joint. There are also two more blocks, called feed-forward ( Fpd and FF ), used to gain more degrees of freedom. By using those feed-forward it is possible to avoid overshooting. Equations 3.63 to 3.68 present the most relevant transfer functions of the system. In 3.64, the feed-forward blocks are dened. The mathematical work of deriving the equations is given as an exercise for the reader. Fdp =Fdp FF =KF(s+pα1)(s+pα2) (s+pα3)(s+pα4) (3.63) ωL ωM=F(s) = KS JLnRgn(s2+ωLs+ω2 ar) (3.64) ωM ωcmd =G(s) = KF(s+pα1)(s+pα2)(s2+ωLs+ω2 ar)(KDv s2+KP v s+KI v ) (s+pα3)(s+pα4)(V4s4+V3s3+V2s2+V1s+V0)=N(G) D(G) (3.65) 12 The notation adopted in that book diers from the one here presented. For that reason, it was necessary to adapt it: M(q) = H(q) ; N(q, ˙q) = µ(q, ˙q) ;
3.7. OTHER CONTROL STRATEGIES 32 V4=JM+KT V3=DM+ (JM+KT)ωL+KTαv V2= (JM+KT)ω2 ar + (DM+KTαv)ωL+KS R2 gn V1= (DM+KTαv)ω2 ar + (βv+KS R2 gn )ωL V0=βvω2 ar where: ωL=DLn JLn ;ωM=DM Jm;ωar =qKS JLn (3.66) αv=KP v KDv ;βv=KIv KDv (3.67) θL θref =H(s) = KSKF JLnRgn (FDp+KDp)s2+KP ps+KIp s2+ωLs+ω2 ar N(G) D(G)+N(G)(KDps2+KP ps+KIp) (3.68) By using an appropriated method to assign the poles, all the gains can be calculated to obtain the desired response of the system. Which one is the desired response is dened by a set of specications such as, for example, response time or maximum overshooting allowed. Which one is the appropriated method is hard to say, as the system has up to 8 poles in the case of 3.68. However, the best procedure is to split the assignation in two stages. First, the speed control is solved by using {KDv, KP v, KIv} and {pα1, pα2, pα3, pα4} . This means, allocating up to 4 poles and 3 zeros. There are other options, depending on how the DOF are used. Still, the problem is of great complexity. Once the speed loop is controlled, solving 3.68 should be easier as there are only 4 DOF left, {FDp, KDp, KP p, KIp} . A method to design the gains is the coecient diagram method 13 , proposed by S. Manabe in [18]. This is a quick way to assign the gains and, at the same time, make the system robust. There are some possible upgrades to make to this control. Here are two of them: 1. Observer: Using a system that, from the values of Icdm and ωM , can calculate some intermediate states, such as the derivative part of the PID's. The idea is to avoid using the derivative part inside the PID by computing it inside the observer. 2. Feed-forward compensator: A feed-forward thought to compensate the disturbance generated by eects such as Coriolis or the centrifugal forces. 13 It also have a Wikipedia article resuming the main advantages of this method.
Chapter 4 Simulations Before going any further, let's sum up what has been done until now. First thing was nding the closed-form of the joint torques which describes the torque required at a certain position, velocity and acceleration. Also, some other valuable expressions were derived such as the position of the end-eector and its velocity. The next step was to create a controller from a certain specications: steady-state error, settling time, or others. It was shown how to estimate the response without even considering the manipulator. If the approach is dierent, with a linear model, then the response will not depend on the input and it can be fully determined by the pole allocation of the system. All that is left then is to simulate the whole system, as if the controller would be acting directly on the robot. That will be useful to gain some experience and to prevent future problems, when the control is applied in the real manipulator. It allows the designer to introduce disturbances, such as noise, to see how the system reacts. Nevertheless, some previous work is necessary: dene the simulation model used, create an algorithm to design the desired trajectories and chose the evaluation items that measure the performance. 4.1 Numerical simulation model The simulations run on MATLAB R R2013a 1 . The Simulink R model is an analogue system that includes the model of the manipulator (friction included), a control law as the one shown in gure 3.4, with dissipative force compensation (considered inside the feed-forward block N(q, ˙q) of the controller). The manipulator is considered to behave following the equation 3.1. Some gains are added at the output of the controller and, inverted, at the input of the manipulator. Those gains allow the control signal to be a current, which is the input to the servomotors and what can really be modied through the external power source. Figure 4.1 and 4.2 show the model by parts. The reader will see that some sources of noise are added. This noise can be generated by the motor itself, or created by the supplying net. Also, the eect of the load is considered 2 : a steady mass 'm' attached to frame {4} with its centre of mass at coordinates 'S', as seen from frame {4}. 1 This version comes with a bug that makes impossible the compilation of Simulink R models. Fortunately, it is solved and a patch is available at the MATLAB R support website (registration may be required). 2 The fact that the load can be dened as a mass plus a CoM permits dening its shape, which actually have an impact on the torques. 33
4.1. NUMERICAL SIMULATION MODEL 34 Figure 4.1: Simulink R model of the system. Figure 4.2: Simulink R model of the controller. where the block called external force computes, at each time, the vectors F4 ext and N4 ext dened in 2.17 and 2.18. KT(i) = [Nm A] is the constant that relates the torque given by motor 'i' and the intensity is circulating through it. gr(i) = wm wL= [φ] is the gear rate and describes how many revolutions the motor does for every revolution of joint 'i'. The saturation block is used to guarantee that the current does not surpass the maximum allowed. Also, in this work, another model will be used as well: a 3D model of the real manipulator. The objective is to evaluate, visually, the performance. By linking the 3D model to the Simulink R model of the manipulator, it is possible to have and accurate idea, as accurate as the model is, of the behaviour of the robot. To do so, a tool called Simulink R 3D animation is used. It allows shaping a virtual world and moving the objects that it contains from both the terminal and a Simulink R model. In gures 4.3 and 4.4, the model of the manipulator is presented. In appendix A, a brief tutorial on how this model was build can be found.
4.1. NUMERICAL SIMULATION MODEL 35 Figure 4.3: Snapshot of the 3D model. Figure 4.4: Interface Simulink R -Virtual world In gure 4.4, the input is the conguration of the manipulator at each sample time, q . The blocks at the right-side are the ones that modify the virtual world (VR). Each link has a position and orientation that can be modied inside VR and, as it can be read in appendix A, the model is built in such way that those values match the frame's position and orientation. That means that by computing the orientation and position of each frame at every time (q-> T matrix) it is possible to move the manipulator's 3D model. Matrices (T-> r) and (T-> p) are, respectively, one that maps the rotation vectors 3 and one that maps the position of the frames. It is important to note that, as the translations and rotations are referred to the standard frame in VR, the transformation matrices have also to be from {0} to {i}. This is possible by using equations (2.1) to (2.3). T1 = T0 1T2 = T0 2T3 = T0 3 (4.1) Using a virtual world allows the user, by implementing some physics, to simulate interaction between the manipulator and the environment. This is not necessary if the objective is just to see how the robot is moving. However, it is interesting to know that a deeper and more realistic simulation is possible. 3 The Simulink R 3D Animation TM requires to express the orientation as a vector through the space origin and a certain angle. The toolbox, however, incorporates a function to translate rotation matrices to rotation vectors.
4.2. TRAJECTORY PATH AND EVALUATION ITEMS 42 the tk−1 ended, and gradually increases its value, h seconds at a time, until ∆tk seconds have passed. Also, t0= 0 and tN−1(end) = UN−1 k=1 tk . Then, both the matrix of reference points and the assembled time vector are introduced to the Simulink R model shown in gure 4.5. Figure 4.5: Online computation of the inverse Jacobian. It is important to note that, at some points called singularities, the inverse Jacobian cannot be inverted. It would be wise to prevent this problem when creating the trajectories by adapting the spline to avoid them. 4.2.2.3 Online vs Oine In this part, both alternatives are compared. First of all, a ow chart will show schematically the process followed by the two algorithms. On the left, the oine alternative. On the right, the online alternative where the oine stage has been framed in red. Figure 4.6: Flow chart comparison: oine vs online. Table 4.1 contains a quick overview on the good and bad points of each alternatives. Table 4.1: Pros and Cons of the trajectory maker alternatives.
4.3. NUMERICAL SIMULATION RESULTS 43 4.3 Numerical simulation results The system that will be simulated was described at section 4.1. Also, a load will be considered. By dening its weight, material and shape, both the mass and the gravity centre are implicit. The simulations will be divided into four runs, and each run will be performed four times under dierent circumstances. Tables 4.2 and 4.3 describe in detail the contents of each run. The third simulation is the special case of transporting a liquid, which requires the use of the special evaluation item described before. Run ωnτ Load Joint1 Joint2 Joint3 Joint1 Joint2 Joint3 1 10 12 15 0.1 0.08 0.07 Steel(7850kg m3)/50Kg/Cube 2 10 12 15 0.01 0.008 0.007 Steel(7850kg m3)/50Kg/Cube 3 100 120 150 0.1 0.08 0.07 Steel(7850kg m3)/50Kg/Cube 4 8 7 9 0.025 0.03 0.02 Gasoline(680kg m3)/70Liters/φ=0.4m h=0.6m Table 4.2: Contents of the simulations (I). Sub-run Noise Parameter Error 1 X X 2 O X 3 X O 4 O O Table 4.3: Contents of the simulations (II). The noise is generated by randomly selecting values of a normal distribution with 0-mean and a variance equal to the 10% of the maximum intensity of the motor it acts on. The parameter error assumes an error of 10% over the parameter estimation. About the loads, the containers are considered to be of negligible mass and the grip can be seen in gure 4.7. The relative position between frame {4} and the load's centre of mass creates the external torque and is considered by the parameter 'S' (gure 4.1). Figure 4.7: On the left, the load for runs 1, 2 and 3. On the right, load for run 4. Before starting the simulations, there is some previous work: Calculate the gains and the poles, and generate the trajectories.
4.3. NUMERICAL SIMULATION RESULTS 44 4.3.1 Gains and poles By using equations 3.19 and 3.20, the gains and poles are calculated: Run kvkpki Joint1 Joint2 Joint3 Joint1 Joint2 Joint3 Joint1 Joint2 Joint3 1 30.00 36.50 44.29 300 444 653 1e31.8e33.2e3 2 120 149 173 2100 3144 4511 1e41.8e43.2e4 3 210 252.5 314.3 1.2e41.74e42.68e41e51.8e53.2e5 4 56 47.3 68 704 515.67 981 2.56e31.63e34.1e3 Table 4.4: Gains used for the simulations. Run p1p2 Joint1 Joint2 Joint3 Joint1 Joint2 Joint3 1 -10 -12.5 -14.29 -10 -12 -15 2 -100 -125 -142.9 -10 -12 -15 3 -10 -12.5 -14.29 -100 -120 -150 4 -40 -33.33 -50 -8 -7 -9 Table 4.5: Pole allocation for the simulations. 4.3.2 Trajectories For the simulations, the algorithm chosen is the o-line path maker. As the trajectories used are dierent depending on the load, the following lines describe those trajectories and present a 3D representation in gures 4.8 and 4.9. • For the steel cube, the manipulator grabs the load at the 0-conguration and takes to station A. After one second, the load is transported to station B, where the process ends. Figure 4.8: Trajectory for load 1. • For the barrel, the priority is to transport it horizontally. By specifying, to the path maker algorithm, points where the sum of θ2 and θ3 is zero, then the sum will remain zero all along the
4.3. NUMERICAL SIMULATION RESULTS 45 trajectory. That is because the input for both joints will be exactly the same but opposite sign. Figure 4.9: Trajectory for load 2.
4.3. NUMERICAL SIMULATION RESULTS 46 4.3.3 Simulation results For the sake of simplicity, this subsection only shows results for sub-runs 1 and 4 , as those two are the most interesting ones. The rest of the plots can be seen in appendix C. Also, at the beginning of each run, the poles are shown in the real-imaginary plane. 4.3.3.1 Run 1 −24 −22 −20 −18 −16 −14 −12 −10 −8−6−4−2 0 2 4 6 8 10 −0.2 −0.1 0 0.1 0.2 real imag Poles of the system Joint1:p1 Joint1:p2 Joint1:p3 Joint2:p1 Joint2:p2 Joint2:p3 Joint3:p1 Joint3:p2 Joint3:p3 Figure 4.10: Pole allocation for run 1. Run 1.1 Figure 4.11: Performance of run 1.1.
4.3. NUMERICAL SIMULATION RESULTS 47 Run 1.4 Figure 4.12: Performance of run 1.4.
4.3. NUMERICAL SIMULATION RESULTS 48 4.3.3.2 Run 2 −150 −140 −130 −120 −110 −100 −90 −80 −70 −60 −50 −40 −30 −20 −10 0 10 −0.2 −0.1 0 0.1 0.2 real imag Poles of the system Joint1:p1 Joint1:p2 Joint1:p3 Joint2:p1 Joint2:p2 Joint2:p3 Joint3:p1 Joint3:p2 Joint3:p3 Figure 4.13: Pole allocation for run 2. Run 2.1 Figure 4.14: Performance of run 2.1.
4.3. NUMERICAL SIMULATION RESULTS 49 Run 2.4 Figure 4.15: Performance of run 2.4.
4.3. NUMERICAL SIMULATION RESULTS 50 4.3.3.3 Run 3 −160 −150 −140 −130 −120 −110 −100 −90 −80 −70 −60 −50 −40 −30 −20 −10 0 10 −0.2 −0.1 0 0.1 0.2 real imag Poles of the system Joint1:p1 Joint1:p2 Joint1:p3 Joint2:p1 Joint2:p2 Joint2:p3 Joint3:p1 Joint3:p2 Joint3:p3 Figure 4.16: Pole allocation for run 3. Run 3.1 Figure 4.17: Performance of run 3.1.
4.3. NUMERICAL SIMULATION RESULTS 51 Run 3.4 Figure 4.18: Performance of run 3.4.
Bibliography [1] Farzin Piltan , Mohammad Hossein Yarmahmoudi, PUMA-560 Robot Manipulator Position Computed Torque Control Methods Using MATLAB/SIMULINK and Their Integration into Graduate Nonlinear Control and MATLAB Courses. [2] http://en.wikipedia.org/wiki/Mechanical_resonance [3] John J. Craig, Introduction to Robotics: Mechanics and Control, Prentice Hall, 2005. [4] Computer Vision, D. Ballard and C. Brown, Prentice-Hall, Englewood Clis, NJ, 1982. [5] A New Continuously Dierentiable Friction Model for Control Systems Design, C. Makkar, W. E. Dixon, W. G. Sawyer, and G.Hu Mechanical and Aerospace Engineering University of Florida, July, 2005. [6] Estimation and Calibration of Robot Link Parameters with Intelligent Techniques, M. Barati, A. R. Khoogar and M. Nasirian, Iranian Journal of Electrical & Electronic Engineering, 2011. [7] Closed-loop Dynamic Parameter Identication of Robot Manipulators Using Modied Fourier Series, Wenxiang Wu, Shiqiang Zhu, Xuanyin Wang and Huashan Liu,International Journal of Advanced Robotic Systems, 2012. [8] M. M. Olsen and H. G. Petersen, A new method for estimating parameters of a dynamic robot model, IEEE Transactions on Robotics and Automation,vol 17, N o 1, Frebruary 2001. [9] Direct Calculation of Minimum Set of Inertial Parameters of Serial Robots, M.Gautier, W.Khalil, IEEE Transactions on robotics and automation, Vol 6, N o 3, June 1990 . [10] Bartels, R. H.; Beatty, J. C.; and Barsky, B. A. "Bézier Curves." Ch. 10 in An Introduction to Splines for Use in Computer Graphics and Geometric Modelling. San Francisco, CA: Morgan Kaufmann, pp. 211-245, 1998. [11] http://pomax.github.io/bezierinfo/ [12] Springer Handbook of robotics, Bruno Siciliano and Oussama Khatib, Springer-Verlag, 2008, (161-185). [13] T.L. De Fazio, D.S. Seltzer, D.E. Whitney: The instrumented remote center of compliance, Ind. Robot 11(4), 238242 (1984) [14] PAUL, R.: `Modeling, trajectory calculation and servoing of a computer controlled arm.' Stanford University Artlcial Iutelligence Laboratory, AIM-77, 1972 [15] G .-W. Lee F.-T.Cheng: Robust control of manipulators using the computed torque plus H∞ compensation method. Electron. Div., Chung Shan Inst. of Sci. & Technol., Lung-Tan, Taiwan ; Control Theory and Applications, IEE Proceedings - (Volume:143 , Issue: 1 ), Jan 1996. 58
BIBLIOGRAPHY 59 [16] MCFARLANE, D , and GLOVER, K `A loop shaping design procedure using H, synthesis', IEEE Trans, June 1992, AC-37, (6), pp 759-769 [17] BALAS, G J , DOYLE, J C , GLOVER, K , PACKARD, A , and SIMTH, R `p-analysis and synthesis toolbox' The Math- Works and MUSYN Inc , South Natick, MA, USA, 1991 [18] S. Manabe (1998), "Coecient Diagram Method", 14th IFAC Symp. on Automatic Control in Aerospace, Seoul. [19] Somsawas Tungpataratanawong, Study on Fast Motion Control Robot Manipulator Based on Inverse Dynamics Compensation and Robust Control, Electrical and Electronic Systems Engg. Dept., Nagaoka University of Technology, Niigata, Japan, 2003.
Appendix A Simulink R 3D Animation TM tutorial This brief tutorial will show the process followed to create the 3D model of the manipulator shown in section 4.1. It will be considered that a 3D model is already available. The format that the Simulink R 3D Animation TM used is one called .wrl . There are programs that can create virtual worlds by using Virtual Reality Modelling Language (VRML). However, some CAD software such as Solid Works R allows exporting in this format. The example presented begins from a Solid Works R model. 1) Post-procesing of the Solid Works R model. The parts of the manipulator are created by separated for reasons that will be presented afterwards. Each part is a link of the robot. Once created, the link is orientated so that the axes of its frame are aligned with the axis of the default coordinate system, as it can be seen in the gures below. Also, the origin of the frame has to be located at the origin of the piece. By doing that, when the piece is exported to VRML, the coordinate system that will dene it will be the frame chosen at the theoretical study stage. In other words, the orientation and position of each link will be modied by the transformations found in section 2.2. Figure A.1: CAD pieces of the manipulator: link 0 and 1 . As it can be seen clearly in the link 3 at gure A.2, the frame orientation (the big axis attached to the piece) is the same as the default one (left-down corner). Also, both the origin of the frame and the piece are the same, as the blue point is on the frame origin. Once the pieces are ready, they are exported from the CAD in format .wrl. It is important to bear in mind the units. When saving in .wrl format, the option button (gure A.3) allows to modify two things: version and units. For the latest releases of MATLAB R , the version chosen should be VRML97 . About the units, in this example the measures introduced for the drawings were in millimetres. However, when exporting, the units specied were meters as to obtain them in real scale inside the virtual world. 60
61 Figure A.2: CAD pieces of the manipulator: link 2 and 3 . Figure A.3: Export options. 2) Pre-processing of VR model Once the pieces are saved in the appropriate format, then it is time to switch to MATLAB R . To open the virtual reality editor, there are two ways: type on the command line vredit and then open from the menu the saved model or open the desired document directly. If the model is opened from MATLAB R , then it is not the editor but the viewer windows that will pop up (gure A.4 1 ). From there, by clicking File>>Open in editor the editor shall appear. 1 The gures have been modied with GIMP to change the black background to a white background to save ink.
62 Figure A.4: Viewer window. Figure A.5 shows the inside of the editor. Let's explain a little bit this window: • On the right-upper side, a screen shows the current viewpoint: It is also possible to move freely by using the left-click+mouse or the arrows and the keyboard keys shift and alt . • The bottom part is for the descriptions and options: From there, it is possible to modify the properties of the dierent objects. • Left-upper part is where the objects, or nodes, are listed: The basic object used in this example is the transformation. These objects have orientation and position 2 . A wide variety of nodes is available, and those of interest for the example will be explained when necessary. Figure A.5: Editor window. 2 As the origin and orientation of the links match the position and orientation of the CAD piece, now the transformation for one link is controlled easily.
63 As it can be seen, however, the imported piece has been split into several transformations. To avoid unnecessary work, the dierent parts are combined into one single object by selecting them all and then Right-click>>Wrap by>>Transformation. This new object can be named by Right-click>>Edit name. Once done, copy the object by also Right-click>>Copy (ctrl+c is not available). Then, a new virtual world is created (File>>New...). It will be empty with only the ROOT. To paste here the object, select the ROOT and Edit>>Paste. The process is repeated with all the links. The result is shown in gure A.6. In that gure, though, the origins of the frames have already been modied. To modify the position of the origin, the vector used is translation . For example, Link3 has a translation of [0.145 0.124 0.868], which corresponds to the vector P0 3(0 −configuration) . So, to move the robot, the rst important thing is to introduce inside each link#.translation the value of P0 # , using the same joint angles for all of them. The orientation is governed by the vector rotation . This is a vector, not a matrix as the ones used since now, yet MATLAB R incorporates a function called vrrotmat2vec that deals with this problem for us. By inputting the matrix R0 # to this function, the vector it returns can be used directly inside the VR. Furthermore, this function has a Simulink R equivalent called Rotation Matrix to VRML Rotation inside the Simulink R 3D Animation TM toolbox. To sum up, the orientation of a link is controlled by a rotation vector obtained from the rotation matrix, R0 i , and its position can be modied by a translation vector equal to P0 i . Figure A.6: Virtual world with all the links and 3 viewpoints. 3) How to use the editor The basic idea behind virtual worlds is the concept of nodes and trees. Nodes can be shapes, properties or even the background. Basically, anything the user wants to dene has to be done through nodes. On the other hand, each node possess an inside tree called children. Inside one node's children, more nodes can be added. For example, in gure A.6 it can be seen how the main nodes are transformations. Inside link3 ,
64 however, there are more nodes. The rst transformations are the result of the wrap by operation done before. There are two more transformations linked to the axis (in grey) and a camera (right-upper part of the grill) called cameraLink3 . As these nodes are inside the main one, they describe link3 and all their coordinates are now with respect to this transformation origin and main axis. In other words, all the nodes under the sub-tree of another node will move only with respect to their superior. In the case of Camera3 , this means that it will move as if xed to link3 . This property also applies to appearance. To create a moving box with an attached image, the tree would be: Figure A.7: Tree of a moving box with texture. where the blue is for the main node, green for the nodes inside the sub-tree and orange for the elds of a node. By using this same tree, the environment is created as it will be shown in the next step. 4) Layout and nal aspects. By creating dierent objects, like walls and the oor, with the tree seen in gure A.7, and moving them by the appropriated translation, the scene is created. Figure A.8 shows the nal result.
65 Figure A.8: Virtual world. In this picture, it is possible to see all the nodes involved. There is the oor, the metal base for the robot and the four walls. Each one of them has a picture in the eld Image Texture that can be scaled and panned with texture Transform . There are more nodes, however. The cameras can be situated hanging from the ROOT, which means total freedom of position and orientation, or from another node like cameraLink3. The SpotLight is used to guarantee a good illumination of the scene. Also, to make it easier, a good option is to set, inside the eld Material , a certain emissivity for the walls and oor. By doing so, those objects will have no shadow and always be visible no matter the lack of light. Finally, three more nodes are added: • WorldInfo: contains two elds, info and title . The rst one is a matrix of strings that describe the model and the second one is the given name. • NavigationInfo: describe the defaults for the free navigation inside the virtual world. Basically, how you move when panning or rotating the scene. By Right-click inside the viewer, these options can be changed. • Background: denes the colours and their shape on the background of the scene. 5) Connection with Simulink R . From a new Simulink R model, inside the Simulink R 3D Animation TM toolbox there are all the block necessary. In this example only two are used: VRsink and Rotation Matrix to VRML Rotation. The function of the second block has already been commented. About the rst block, each VRsink acts as a bridge between Simulink R and one virtual world. When setting this block for the rst time, a window like the one in gure A.9 will appear.
66 Figure A.9: VR Sink parameters. From this window, the virtual world is selected as source le. Now, the list of nodes is loaded on the right-side to select the desired parameters to modify during the simulation. Once nished, the Simulink R model should look like this: Figure A.10: Simulink R model. The virtual model of the manipulator is ready to be connected to a Simulink R model through q.
67 6) Recording Once the model is connected to a simulation, it is time to prepare the recording. To do so, double click on the VRSink to open the viewer (gure A.11). To modify the block parameters again, click Simulation>>Block parameters. To record a video, press Recording>>Capture and Recording Parameters. A window like the one in gure A.12 will pop up. To create a video, enable the option Record to AVI and then name the le. There are many options available such as the frames per second (FPS), quality and compression. Those factors will aect how good the video will be. The better, the bigger the le will result. Another critic factor is the sampling time of the simulation. A big sampling time will lead to rough movement whereas to achieve a smooth motion a low one is required. The lower it is, the more time the simulation will consume and the bigger the video le will be. It is all about nding the middle term between comfort and beauty. Figure A.11: Viewer windows with the nal model. Figure A.12: Recording settings.
74 Run 1.3 Figure C.2: Performance of run 1.3.
75 Run 2.2 Figure C.3: Performance of run 2.2. Run 2.3 Figure C.4: Performance of run 2.3.
76 Run 3.2 Figure C.5: Performance of run 3.2. Run 3.3 Figure C.6: Performance of run 3.3.
77 Run 4.2 Figure C.7: Performance of run 4.2. 0 0.511.5 2 2.5 3 3.544.5 −10 0 10 time [s] Tilt [degrees] Tilt of the barrel Tilt Maximum tilt allowed Figure C.8: Tilt of the barrel over time for run 4.2
78 Run 4.3 Figure C.9: Performance of run 4.3. 0 0.511.5 2 2.5 3 3.544.5 −10 0 10 time [s] Tilt [degrees] Tilt of the barrel Tilt Maximum tilt allowed Figure C.10: Tilt of the barrel over time for run 4.3