Full text
Treball de Fi de Màster Double Master’s degree in Industrial Engineering and Automatic Control and Robotics Control System Design of a 3-Axis Gimbal MEMÒRIA Autor: Ariel Medero Borrell Director: Dr. Vicenç Puig Cayuela Convocatòria: July 2020 Escola Tècnica Superior d’Enginyeria Industrial de Barcelona
1 Abstract Gimbals are precise devices used for orientation control in the 3D space. They can be used with mounted cameras to maintain horizontal orientation while being hand-held or even mounted on a helicopter, both of them, examples that are more and more common to see in the film industry. They are also widely used for hardware-in-the-loop tests of sensor technology, from testing smartphones gyroscopes to even test mission critical navigation devices for future spacecrafts. Despite their importance, industry still relies in the use of the classical PID controllers for the control of the gimbal axis. The objective of this master’s thesis is to develop a control system using the modern technique of Linear Parameter-Varying (LPV) control for one of such devices, a 3-Axis Gimbal developed by the Ingenia company. In order to develop this control system, in this master’s thesis it is explained the whole process required. From obtaining the mathematical model for the mechanical dynamics of the 3-Axis Gimbal, LPV controller design and also fault-tolerant strategies To obtain the gimbal model, the selected method was to follow the Lagrange formulation for serial-link objects. For the computation of the controllers, it is shown three different ways in which the LPV models in conjunction with the aid of Linear Matrix Inequalities (LMIs) optimization can be used. Then, an inverse kinematics and path generation algorithm suitable for gimbals designed for mounted camera applications was proposed. Finally, a fault tolerant strategy is implemented to help the gimbal control system to deal with partial sensor faults by making an online estimation of the faults and using virtual sensors to reconstruct the non faulty sensor signal.
3 Acknowledgements I would genuinely like to thank Prof. Vicenç Puig Cayuela for his valuable guidance during the project. He has given me the necessary advises that have been crucial to simplify or improve the work done. I have always been able to freely approach him, and he replied to my doubts quickly in every occasion, and in a very helpful and friendly manner. It was a pleasure to work with him. I would also like to thank the team at Ingenia for the time I spent with them. They patiently taught me how their system and their technology for motion control works. Moreover, their team was always open to any question I may asked them and all of them showed genuinely interest in the success of the project and were eager to help. Finally, I would like to sincerely thank my longtime friend Sergi Cupons Galera for his invaluable help in creating a 3D CAD model of the 3-Axis Gimbal. A key step in the success of the project that I would not had been able to make on my own.
Contents 5 Contents 1 Introduction 9 1.1 Motivation......................................... 9 1.2 ThesisObjectives ..................................... 10 1.3 ThesisStructure...................................... 11 2 3-Axis Gimbal Mathematical Model 13 2.1 3-Axis Gimbal Forward Kinematics . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2 DynamicalModel..................................... 16 2.3 Open-Loop Simulations and Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 19 3 The Controller Design 25 3.1 ModelSimplification ................................... 25 3.2 LPVModelling ...................................... 28 3.3 LPVControllerSynthesis................................. 31 3.4 Closed-LoopSimulations ................................ 36 4 High Level Planner 39 4.1 InverseKinematics .................................... 39 4.2 TrajectoryGeneration................................... 42 4.3 Incorporating the Planner to the 3-Axis Gimbal . . . . . . . . . . . . . . . . . . . . 45 5 Sensor Fault Tolerant Strategy 51 5.1 Sensor Fault Detection and Virtual Sensor Algorithm . . . . . . . . . . . . . . . . 51 5.2 Observer Design for the 3-Axis Gimbal . . . . . . . . . . . . . . . . . . . . . . . . . 61 5.3 Improved FTC Scheme for the 3-Axis Gimbal . . . . . . . . . . . . . . . . . . . . . 65 5.4 Testing the FTC Performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
6 Contents 6 Conclusion 75 6.1 SummaryoftheResults ................................. 75 6.2 Proposed Future Research Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.3 Economic Assessment and Environmental Impact . . . . . . . . . . . . . . . . . . 77 A The mathematical model script 79 A.1 Main script for computing the full 3-Axis Gimbal model . . . . . . . . . . . . . . . 79 B The controller design script 89 B.1 Script for Computing the Gimbal Link Controllers . . . . . . . . . . . . . . . . . . 89 B.2 Scheduling Function for the Controller of Link 2 . . . . . . . . . . . . . . . . . . . 92 C The observers design script 95 C.1 Script for Computing the Observer Gains . . . . . . . . . . . . . . . . . . . . . . . 95
List of Figures 7 List of Figures 1.1 Photo of the 3-Axis Gimbal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.1 Reference frame for each of the three links of the gimbal . . . . . . . . . . . . . . 14 2.2 Diagram form of Equation (2.5). . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.3 Angular position qof the Links in the presence of a sinusoidal torque input. . . . 22 2.4 Angular velocity ˙qof the Links in the presence of a sinusoidal torque input. . . . 22 2.5 Angular velocity ˙qof the Links in the presence of a constant torque input. . . . . 23 3.1 Angular velocity ˙qof Link 2 in the presence of a constant torque input. . . . . . . 26 3.2 First element of the diagonal of e B(q)−1. ........................ 27 3.3 Second element of the diagonal of e B(q)−1........................ 28 3.4 Angular velocity ˙qof Link 2 in the presence of a constant torque input. . . . . . . 28 3.6 Embedded parameter θ3(q, ˙q)............................... 30 3.5 Embedded parameter θ2(q). ............................... 31 3.7 I-PDScheme......................................... 32 3.8 Angular position qfor all links when a step reference is given. . . . . . . . . . . . 36 3.9 Angular position qof Link 2 when a sinusoidal reference is given. . . . . . . . . . 37 4.1 Azimuth and Elevation angles representation. . . . . . . . . . . . . . . . . . . . . 40 4.2 Base frame of the 3-Axis Gimbal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 4.3 Camera image with Tilt angle with respect the Horizontal ground plane. . . . . . 42 4.4 Path generated by the 5th order polynomial spline. . . . . . . . . . . . . . . . . . . 45 4.5 3-Axis Gimbal control system considering the Planner. . . . . . . . . . . . . . . . 46 4.6 Gimbal end-effector path. Controller settling time set at 5 seconds. Planner frequencysetat5Hz. .................................... 47
14 Chapter 2. 3-Axis Gimbal Mathematical Model its origin for each of the three links that compose the gimbal. For selecting the origin of the frames, the DH convention is quite flexible as they do not need to have any explicit relation with the hardware system itself. One interesting aspect of the gimbals is that all the axes of rotation intersect in one point, as shown by the dashed lines in Figure 2.1. Exploiting this fact and the flexibility of the DH convention, all the origin frames have been located at the intersection. With this, all the translational elements of the homogeneous transform matrix will be zero, which will simplify the next steps and computations. This makes sense for this case as gimbals are used for controlling the orientation of its end-effector, so there is no need to track its XYZ position. With the origins of the reference frames chosen, the next step is to select the right orientation for each one. The DH convention gives the following guidelines: •Choose axis zialong the axis of Link Joint i+ 1, the motor axis of rotation. •Choose axis xialong the common normal to axes zi−1and zi. •Choose axis yiso as to complete a right-handed frame. •For Frame 0, only the direction of axis z0is specified, xocan be randomly selected. Following this guideline the resulting reference frames can be seen in Figure 2.1. Figure 2.1: Reference frame for each of the three links of the gimbal With the reference frames selected, then the four DH parameters can be computed. With
Chapter 2. 3-Axis Gimbal Mathematical Model 15 these four parameters it is enough to define each link in relation with its previous link. These parameters are defined as follows: ai:distance along xifrom Oito the intersection of the xiand zi−1axes. di:distance along zi−1from Oi−1to the intersection of the xiand zi−1axes. αi:angle between zi−1and zimeasured about xi. θi:angle between xi−1and ximeasured about zi−1. And the homogeneous transformation matrix given by the DH parameters relating Frame i-1 with Frame iis: Ai i−1= cos θi−sin θicos αisin θisin αiaicos θi sin θicos θicos αi−cos θisin αiaisin θi 0 sin αicos αidi 0 0 0 1 (2.1) According to the given DH parameters definition and the reference frames chosen for the 3-Axis Gimbal, Table 2.1 presents the parameters that define each of gimbal links. Link θiaidiαi 1q∗ 1+π/20 0 π/2 2q∗ 2−π/20 0 −π/2 3q∗ 30 0 0 * variable Table 2.1: DH Parameters for the 3-Axis Gimbal. Notice that because all the origins are in the same point where all the motor axes intersect, all the elements aiand diare zero, meaning that translation between links is not being taken into account, as previously mentioned. Also, the rotation of each link is given by the variables qi, which by construction have a constant offset as can be seen in links 1 and 2. The homogeneous transformation matrix for each link can be easily obtained by replacing the DH parameters of each link from Table 2.1 into Equation (2.1), and the global transformation matrix from Link 1 to Link 3can be obtained by concatenating the homogeneous transform matrix from each link
16 Chapter 2. 3-Axis Gimbal Mathematical Model T3 0(q) = A1 0(q1)A2 1(q2)A3 2(q3)(2.2) T3 0(q) = −c1s3−c3s1s2s1s2s3−c1c3−c2s10 c1c3s2−s1s3−c3s1−c1s2s3c1c20 −c2c3c2s3s20 0 0 0 1 (2.3) Note that ciand siare equal to cos(qi)and sin(qi), respectively. 2.2 Dynamical Model The 3-Axis Gimbal, like most mechanical devices, can have its dynamics explained according to Newton’s Law of motion, as commonly expressed in Robotics B(q)¨q+C(q, ˙q) ˙q+Fv˙q+g(q) = τ(2.4) where B(q):Global inertia tensor of the gimbal, 3x3 symmetrical matrix. C(q, ˙q):Coriolis matrix, 3x3 matrix. Fv:Viscous friction coefficient, 3x3 diagonal matrix. g(q):Torques present in the links joints by the effect of gravity, 3x1 vector. τ:Input torques given by the actuators, 3x1 vector. From this representation, it could be obtained the feed forward torque needed to accomplish a desired trajectory or as we are most interested in control, simulate how the system will evolve when a torque input is applied according to ¨q=B(q)−1[τ−C(q, ˙q) ˙q−Fv˙q−g(q)] (2.5) In this section, it will be explained how to compute the terms in Equation (2.4) for the 3-Axis Gimbal, although most of the content of this section is general and will be applicable to
Chapter 2. 3-Axis Gimbal Mathematical Model 17 other similar mechanical systems. However, note that for a full demonstration on the equations given, the reader is referred to [11, Chapter 7] as this was the main source to develop this part of the project. There are many ways in which to obtain the expressions for the terms of the inertia tensor, the Coriolis matrix and the gravity term. For this case though, given that the gimbal can be expressed as a multi-body serial-link system, the Lagrange method is a perfect fit since it is very systematic when a reference frame, like the one according to the DH convention, is used [9]. The first step is to compute the inertia tensor expression, which after developing the Lagrangian equation is: B(q) = 3 X i=1 (mliJ(li)T PJ(li) P+J(li)T ORi 0Ii liRiT 0J(li) O)(2.6) The most basics elements in Equation (2.6) are the terms mliand Ii li, which are the mass of Link iand the inertia tensor of the Link icomputed in its own center of mass and expressed with respect to its own reference frame, note that both of these elements have a constant value. The rotation matrix Ri 0is used to transform Ii lifrom its the reference frame i-1 to the base reference frame 0. The rotation matrix can be extracted from the first 3x3 subset from Equation (2.1) and for idifferent from 1 it can be obtained by concatenation, analogue to Equation (2.2). The elements J(li) Pand J(li) Oare the translational Jacobian of the center of mass and rotational Jacobian of Link i. Their expressions are: J(li) P=J(li) P1... J(li) Pi0... 0(2.7) J(li) O=J(li) O1... J(li) Oi0... 0(2.8) The columns for the translational Jacobian can be computed as: Jli Pj=zj−1×pli(2.9) where zj−1=Rj−1 0z0(2.10) z0=001T (2.11) pli=Ri 0Ri(2.12)
18 Chapter 2. 3-Axis Gimbal Mathematical Model Note that Riare the XYZ coordinates of the center of mass of Link iin its own reference frame. The columns for the rotational Jacobian can be computed as: Jli Oj=zj−1(2.13) With the global inertia tensor matrix of the gimbal B(q)computed, then, obtaining the elements cij of the 3x3 Coriolis matrix C(q, ˙q)is quite straightforward. cij = 3 X i=1 cijk ˙qk(2.14) cijk =1 2(∂bij ∂qk +∂bik ∂qj +∂bjk ∂qi )(2.15) Note that bij are the elements from the global inertia tensor matrix B(q). The last element that the Lagrange method provide for serial-links allows to easily obtain is the gravitational term g(q) g(q) = g1(q) g2(q) g3(q) (2.16) where gi(q) = 3 X j=1 −mljg0Jlj Pi(2.17) g0=0 0 gT (2.18) Note that the element gin Equation (2.18) is the gravity acceleration constant, it is positive as the zaxis of the base reference frame 0 is pointing downwards, as can be seen in Figure 2.1. The last element from the model, according to Equation (2.4), that needs to be determined is the viscous friction matrix Fv. It can not be theoretically obtained and its value need to be determined in the parameter identification phase using input-output data. However, its general form is known, it is a diagonal matrix with constant elements and due to the construction of the 3-Axis Gimbal all of its three elements can be assumed to be equal. This last assumption is based on the fact that all three actuators are exactly the same gear-motor, so the frictions they experience should be the same or at least very similar.
Chapter 2. 3-Axis Gimbal Mathematical Model 19 With this, all the elements from Equation (2.4) have been presented and explained how they can be computed for obtaining the mathematical model of the 3-Axis Gimbal. The Lagrange method for serial-link objects despite being a very systematic approach is quite tedious to compute if it is attempted to be solved by hand. For this reason, the best approach is to use the aid of a symbolic software package. In Appendix A, the whole MATLAB®script used to obtain the mathematical model for the gimbal can be seen. 2.3 Open-Loop Simulations and Analysis After obtaining the mathematical model of the system, it is always interesting to simulate it. This is important to check if the behaviour of the model corresponds with the dynamics of the real system. But, even more, trough open-loop simulations we can also analyze how it responds to certain inputs and be able to infere some interesting properties of the system that may aid in the controller design and specially in the model simplification step. With this objective in mind, the obtained model was simulated in Simulink®by implementing Equation (2.5) as represented in Figure 2.2. Figure 2.2: Diagram form of Equation (2.5). In the previous section, the elements that compose the model were computed. However, to be able to execute the simulation, the physical properties of the 3-Axis Gimbal are required. Mainly, the mass mliand the inertia tensor Ii liof each Link. Sadly, this information was not available within the gimbal documentation. For this reason, in order to be able to do some approximate simulations and controller prototype, the 3-Axis Gimbal was physically modelled in the 3D CAD software SolidWorks®. Using this software it is possible to extract all this information and since the material that the gimbal is made of is known, these values will be quite
20 Chapter 2. 3-Axis Gimbal Mathematical Model close to the real ones. The list of parameters for the physical properties for the 3-Axis Gimbal are summarized in the following tables, all the parameters appear represented in their units according to the international system of units and computed with respect to the reference frame of each Link, shown in Figure 2.1. Parameter Value Description m12.4292 Mass of the Link comx1-0.09056 X coordinate of the center of mass comz10.11474 Z coordinate of the center of mass Ixx10.014355 Ixx element of the Link inertia tensor Iyy10.029371 Iyy element of the Link inertia tensor Izz10.017526 Izz element of the Link inertia tensor Ixz10.011748 Ixz element of the Link inertia tensor * all non specified parameters have a value equal to zero. Table 2.2: Physical parameters for Link 1. Parameter Value Description m21.624 Mass of the Link comx2-0.00631 X coordinate of the center of mass comz2-0.07338 Z coordinate of the center of mass Ixx20.0089560 Ixx element of the Link inertia tensor Iyy20.0085086 Iyy element of the Link inertia tensor Izz20.0019667 Izz element of the Link inertia tensor Ixz2-0.0006874 Ixz element of the Link inertia tensor * all non specified parameters have a value equal to zero. Table 2.3: Physical parameters for Link 2.
Chapter 2. 3-Axis Gimbal Mathematical Model 21 Parameter Value Description m30.756 Mass of the Link comz30.031 Z coordinate of the center of mass Ixx30.00126 Ixx element of the Link inertia tensor Iyy30.0006552 Iyy element of the Link inertia tensor Izz30.0018648 Izz element of the Link inertia tensor * all non specified parameters have a value equal to zero. Table 2.4: Physical parameters for Link 3. The other parameter needed for simulation is the viscous friction coefficient of the actuators. As mentioned at the end of the previous section, this coefficient is shared between all three actuators, so the viscous friction matrix Fvcould be thought of as: Fv=fv·I(2.19) Parameter Value Description fv1 Viscous friction coefficient Table 2.5: Viscous friction coefficient for simulation. With all the parameters defined, it is finally possible to do the desired open-loop simulations. First, the system was tested in the case that a sinusoidal input was present and in a second test the system was simulated with a constant torque input. This last simulation is not totally realistic, as it would cause the gimbal axes to turn indefinitely, which is not possible in the real system due to construction constraints, but is an interesting test as it gives good insight into the behaviour of the angular velocity of each link.
22 Chapter 2. 3-Axis Gimbal Mathematical Model Figure 2.3: Angular position qof the Links in the presence of a sinusoidal torque input. Figure 2.4: Angular velocity ˙qof the Links in the presence of a sinusoidal torque input. It is well know from basic control theory that the output of a linear plant when the input is a sinusoidal signal, is another sinusoidal signal of the same frequency with some offset and a different amplitude. By evaluating Figures 2.3 and 2.4, it can be seen that the response of Links 1 and 3 are clearly sinusoidal, meaning that these two links have a very high level of linearity in their behaviour. The situation is quite different for the Link 2, which its response shows a clear non-linear behaviour. When analyzing the results presented in Figure 2.5, which shows the angular velocity of each Link when a constant torque is applied, the first conclusion is the same as before, Links 1 and 3 have a quite linear behavior while Link 2 clearly does not. However, in this case a second important conclusion can be reached. It can be seen that despite the erratic behaviour of Link 2, its sudden velocity spikes does not seem to affect greatly the angular velocities of the two other links. This fact indicates that there is a low level of coupling between the links of the gimbal.
Chapter 2. 3-Axis Gimbal Mathematical Model 23 Figure 2.5: Angular velocity ˙qof the Links in the presence of a constant torque input.
30 Chapter 3. The Controller Design ˙q2 ¨q2 = 0 1 θ2(q)θ3(q, ˙q) q2 ˙q2 + 0 52.5 τ2(3.9) θ2(q) = −49.30495 cos(q2)−5.27769 sin(q2) q2 (3.10) θ3(q, ˙q) = −52.5−0.015876 ˙q3sin(2q3)(3.11) . Starting the analysis of its embedded parameters with θ3(q, ˙q), it has a very low level of variation (see Figure 3.6). So, this parameter can be considered to have a constant value. On the other hand, θ2(q)have a high degree of variability. In order to be able to embed this term in the LPV model, the solution was to divide it by q2, as can be seen in Equation (3.10). Because zero is included within the working range of q2, this can cause a discontinuity around zero in θ2(q), as shown in Figure 3.5. To deal with this problem, the solution is to partition the working range of q2into q2∈[−π, −0.1] ∩[0.1, π]. This partition will later force the design of a Hybrid-LPV controller, dependent on the state of q2. Parameter Value minθ2(q2negative) -17.3492 maxθ2(q2negative) 485.3176 minθ2(q2positive) -495.8560 maxθ2(q2positive) 16.0752 θ3≈-52.5 Table 3.2: Link 2 embedded parameters max and min value. Figure 3.6: Embedded parameter θ3(q, ˙q).
Chapter 3. The Controller Design 31 Figure 3.5: Embedded parameter θ2(q). Finally, for Link 3 it can be seen that after applying the simplification from the previous section, the dynamics can be represented by a linear model ˙q3 ¨q3 = 0 1 0−536.25 q3 ˙q3 + 0 536.25 τ3(3.12) This makes sense, since due to the fact that coupling between links have been eliminated in the control model, then Link 3 is basically a motor with a mass attached, which can be represented as a linear system. 3.3 LPV Controller Synthesis In the model simplification section, it was seen that the control of the 3-Axis Gimbal would be split into three independent controllers. Each controller will control one link from the gimbal, whose state space representations are those of a second order system, as seen in Equation (3.6). In addition to being a second order system, given their state space representation structure, it makes the independent i−Link system a perfect fit for the use a Gain-Scheduled PID controller [2]. In order to design this kind of controller, the first step is to augment the state space of the systems with a third state, which is done by adding a new integrator to the model. The augmented state space system for each Link can be expressed as follows
32 Chapter 3. The Controller Design ¨xe= 0 1 0 θj(q, ˙q)θj+1(q, ˙q) 0 1 0 0 xe+ 0 bi 0 τi(3.13) To compute the PID coefficients for the controller, it can easily done by computing a state feedback controller Kfor the augmented system. The relation between this state feedback controller Kand the three PID coefficients is given by u=Kxe= [−kp−kd−ki]xe(3.14) Then, in order to implement the PID controller, the best approach is to use an I-PD scheme as shown in Figure 3.7. Note that in the presented I-PD scheme there is not any derivative, instead, the derivative term Kdis being feedback directly with the velocity measurement. This is possible because both angular position and angular velocity are being measured. By doing this, the implementation issues associated with derivatives can be avoided. Figure 3.7: I-PD Scheme. To compute the state feedback controllers K, a different strategy was used for each link. As a result, three different ways to compute the controllers gains are presented in this section. All the controllers were computed by solving a Linear Matrix Inequalities (LMI) problem, since this is the optimal tool for designing LPV gain-scheduling controllers. The results LMIs have
Chapter 3. The Controller Design 33 been solved using the YALMIP toolbox [4] and the SeDuMi solver [12]. In order to find a detailed demonstration on the LMI presented in this section the reader is referred to [3]. For Link 1, in Table 3.1 we can find the minimum and maximum values of the embedded parameter θ1(q, ˙q)in its LPV representation. It can be seen that the difference between both values is not really that big. For this reason, the most suitable choice is to design a robust controller instead of a gain-scheduling controller. For this case, since the parameter θ1(q, ˙q)involves many variables would also require many computations at every iteration in the case that a gainscheduling controller would be used. On the other hand, having a fixed robust controller for Link 1 would avoid those computations while assuring stability across the working region of θ1(q, ˙q). For this reason and given the low level of non-linearity in Link 1, it is not justified the use of a gain-scheduling controller for this case. To design a robust controller using LMIs and LPV systems, we must use the same controller variable Kfor all the i−vertexes of the LPV polytope. Also, the solution to the LMI problem must guarantee that the Lyapunov matrix Pis positive defined. In the case that the latter is fulfilled, then the controller Kwill guarantee the stability within the working region of the LPV polytope. Since the LPV model for Link 1 have only one embedded parameter θ1(q, ˙q) in this case, then the LPV polytope have only two vertexes. This means that the LMI problem will have a total of three constraints: P > 0(3.15) AiP+PAT i+BW +WTB+ 2αP < 0(3.16) K=WP−1(3.17) The first constraint to guarantee that the Lyapunov matrix must be positive defined, Equation (3.15), and two LMI constraints used for pole placement, each one of them defined at each of the two LPV polytope vertexes. Equation (3.16) defines the LMI constraint used for pole placement. The value of αmarks a vertical line that will split the negative plane of the poles space, all the poles of the system will be forced to be to the left of that line. Thus, with the value of α, we are controlling the reaction speed and settling time of the system. Note that in the LMI set of constraints the Lyapunov matrix Pand the auxiliary vector W
34 Chapter 3. The Controller Design are the decision variables. After solving the LMI problem, the state feedback controller for Link 1 is computed according to Equation (3.17). The design of the controller for Link 2 is more complex. Not only because it has an important non-linear behaviour but also because its embedded parameter θ2(q)have a discontinuity in q2= 0. This forces to split in two the working region of θ2(q)for positive and negative values of q2. Thus, forcing the design of a hybrid LPV gain-scheduling controller. This implies that two sets of controllers, one for each region of q2, will be computed as two independent set of gain-Scheduling controllers within the same LMI problem. Because both regions will share the same Lyapunov matrix P, if it is found to be positive defined, it will not only guarantee the stability and performance within each region but also while switching between them. However, the LPV controller sets for the positive and negative region of q2will be independent between them and will not be scheduled together. On the other hand, θ3(q, ˙q)was found to be almost constant, this simplifies greatly the control design as assuming θ3(q, ˙q)have a constant value means that for each region of q2the LPV polytope have only two vertexes, the minimum and maximum values of θ2(q), which can be seen in Table 3.2. Thus, for each region, the gain-scheduling controller set will be formed by only a pair of controllers, which make the scheduling quite simple as it is a simple linear interpolation between them with θ2(q)as the scheduling variable. The set of LMIs used as constraints to compute the controller for Link 2 are P > 0(3.18) AiP+PAT i+BWi+WT iB+ 2αP < 0(3.19) M⊗(AiP) + MT⊗(PAT i) + M⊗(BWi) + MT⊗(WT iBT)<0(3.20) M= sin ϑcos ϑ −cos ϑsin ϑ (3.21) Equation (3.19) represents the LMI used to set the desired settling time, it is similar to that used for Link 1. However, note that in this case the auxiliary vector of optimization variables Wi is unique for each of the polytope vertexes, as for each vertex a different Kiwill be computed. The LMI presented in (3.20) is used to avoid the oscillations present on the system behaviour.
Chapter 3. The Controller Design 35 By selecting the value of ϑin Equation (3.21) sufficiently small, we can force the system to have all its poles on the negative real axis, thus avoiding the presence of oscillations in the controlled system response. Note that ⊗represents the Kronecker tensor product. After solving the LMI problem, the controllers Kican be computed according Ki=WiP−1.(3.22) The final step is to design the scheduling function. As each region have only two LPV polytope extremes, only one embedded parameter, the scheduling function is a simple linear interpolation h=θ2(q)−θ2 θ2−θ2 (3.23) Finally, the controller to be applied in real-time is computed according to K=K(1 −h) + Kh (3.24) Note that Kand Krepresent the controllers computed in the minimum and maximum values of θ2(q)respectively, θ2and θ2, this is done for each of the two hybrid regions independently. Finally, the design for the controller of Link 3 is the simplest of all, as its simplified model is just a linear system. For the design of the controller only two LMIs are needed, P > 0(3.25) AP +PAT+BW +WTB+ 2αP < 0(3.26) As in the previous cases, after solving the LMI optimization problem the controller for Link 3 is computed with K=WP−1(3.27)
36 Chapter 3. The Controller Design The MATLAB script used for computing the controllers as well as the function implementing the real-time scheduling of the controller for Link 2 can be found in Appendix B. 3.4 Closed-Loop Simulations In this last section, the designed controllers are tested in simulation against the full mathematical model of the 3-Axis Gimbal. The results from the first simulation can be found in Figure 3.8. In this simulation, a step reference for angular position was given to each Link. It can be seen that the controllers are able to take each link of the gimbal to their desired position without any problem. In the controller design section, it was seen that for Link 2 a Hybrid LPV controller had to Figure 3.8: Angular position qfor all links when a step reference is given. be implemented. The hybrid element came from the fact the gain-scheduling controllers for the positive and negative region of q2act independently within their respective region. To test if the stability is maintained while switching from one region to the other Link 2 was given a sinusoidal reference to follow. The results can be seen in Figure 3.9. Only some small disturbances can be seen when the Link crosses the origin, but in general Link 2 can follow the sinusoidal reference without much trouble and without loosing stability when switching between hybrid regions as the sign of q2changes.
Chapter 3. The Controller Design 37 Figure 3.9: Angular position qof Link 2 when a sinusoidal reference is given.
Chapter 4. High Level Planner 39 Chapter 4 High Level Planner In the previous chapter, the low-level control for each of the axis of the gimbal was designed. This level of control is used for giving the individual motors of the 3-Axis Gimbal the torque command required in order to reach the desired angular set-point position. However, since this level of controls makes use of the joint axes coordinates qi, it is not well suited for controlling the gimbal using setpoints from the 3D space referenced in a Cartesian coordinate frame. For this reason, a higher level of control with the capability to translate the real world coordinates to joint axis coordinates and compute the trajectories between set-points is needed. In this chapter, the inverse kinematics for translating between coordinates frames and the methodology for obtaining the required axis path’s is explained. These two tools combined form the so called high level planner. The objective of this planner is to create the trajectories that would make the gimbal transition through a set of real world coordinates in a desired amount of time between transitions. 4.1 Inverse Kinematics Before starting the discussion on the inverse kinematics, first it should be discussed what the gimbal will actually be used for, as this will dictate the coordinate frame that would be required. The 3-Axis Gimbal is designed to be a stationary camera support with full rotational degrees of freedom. So, its objective is to point the camera to a certain position in the scene while maintaining the camera at a certain tilt angle, normally parallel to the ground plane horizontally. This means that our desired coordinates space have four coordinates: the X,Y and Z Carte-
46 Chapter 4. High Level Planner Figure 4.5: 3-Axis Gimbal control system considering the Planner. parallel to the horizontal plane during the test. No. Piti 0 (1,0,0) 0 1 (1,1,0) 10 2 (0,1,1) 20 3 (1,1,1) 30 4 (-1,-1,1) 45 Table 4.2: Position setpoints for the gimbal end-effector. In order to understand the relationship between how the planner sampling frequency and the LPV controller settling time requirement affect the 3-Axis Gimbal, two extreme cases are tested. Figure 4.6 shows the result of using a slow settling time, 5 seconds, and a planner sampling frequency of 5 Hz. It can be seen that the performance is not acceptable, caused by the fact that the slow controller cannot cope effectively with nonlinearities, however the trajectory sampling at 5 Hz can be considered to be adequate. Figure 4.7 is the result of a test with a very fast settling time requirement, 0.1 seconds, and a planner sampling frequency of 1 Hz. The resulting path is far from being smooth as the planner frequency is obviously too slow. Moreover, Figure 4.8 shows the control inputs from this last test, the results are clearly not acceptable as it can be seen that each time the planner updates the controller reference huge spikes appears. The magnitude of these spikes in the control signal, caused by the aggressive settling time requirement, in reality only would cause saturation on the actuators and degrade the control performance.
Chapter 4. High Level Planner 47 Figure 4.6: Gimbal end-effector path. Controller settling time set at 5 seconds. Planner frequency set at 5 Hz. Figure 4.7: Gimbal end-effector path. Controller settling time set at 0.1 seconds. Planner frequency set at 1 Hz.
48 Chapter 4. High Level Planner Figure 4.8: Control input. Controller settling time set at 0.1 seconds. Planner frequency set at 1 Hz. What can be learned from these experiments is that we need a fast planner, at least running at 5 Hz to have good results, and we also need a fast settling time requirement so the controller can cope with the nonlinear effects. However, a value too aggressive would cause an undesired control input characterized by quick sudden spikes of high magnitude, which would quickly lead to actuator saturation. Also, even if those control inputs would be possible, it was seen that when the settling time is lower than the planner sampling rate this leads to a non smooth path resembling a series of steps responses. With these guidelines in mind and after a series of tests a good trade off was found by setting the LPV controller settling time 3 times slower than the sampling frequency set at 5 Hz. The final result can be seen Figures 4.9, 4.10 and 4.11. The resulting path is shown to be smooth and with a good tracking performance, in addition the control input this time are within an adequate magnitude range. With the sampling rate defined, at this points all the parameters and elements that form the High Level Planner have been established and the full algorithm step by step as implemented for the 3-Axis Gimbal is summarized in Algorithm 1.
Chapter 4. High Level Planner 49 Algorithm 1: High Level Planner Algorithm Input: P,T ilt,T,Ts Output: qr 1Given a set of desired reference Cartesian points Ptranslate them into a set of desired angular positions qifor Links 1 and 2 using the inverse kinematics Equations (4.3) and (4.4). 2Do the same for Link 3 from a set of given desired Tilt camera angles using Equation (4.5). 3For each pair of consecutive points Piand Pi+1 compute the splines parameters for the trajectory between them according to Equation (4.19). 4Generate the trajectory S(¯ t)between Piand Pi+1 by using Equation (4.6) and by normalizing the desired transition time Ti∈[0, tf]as shown in Equation (4.16). 5Sample the generated trajectory at a constant rate Tsand feed the sample points S(kTs tf)as the qrreference for the angular position controller of the gimbal axes. 6Repeat steps 3to 5for pairs of consecutive Tiltiand T ilti+1 desired camera angles to generate the reference path for Link 3. Figure 4.9: Gimbal end-effector path. Controller settling time set at 0.6 seconds. Planner frequency set at 5 Hz.
50 Chapter 4. High Level Planner Figure 4.10: Axes tracking the path generated by the planner. Controller settling time set at 0.6 seconds. Planner frequency set at 5 Hz. Figure 4.11: Control input. Controller settling time set at 0.6 seconds. Planner frequency set at 5 Hz.
Chapter 5. Sensor Fault Tolerant Strategy 51 Chapter 5 Sensor Fault Tolerant Strategy The 3-Axis Gimbal counts with a high number of sensors. Each individual axis of the gimbal have halls effect sensors and a differential encoder attached to the motor plus an absolute encoder attached directly to gimbal body. Not counting the hall effect sensors, which are only used internally for the servodrivers, the gimbal have a total of 6 sensors. Three absolute encoders are used to measure the axes position and three incremental encoders are used to measure the angular velocities. With this number of sensors, some of them are susceptible to suffer a malfunction at some point. However, thanks to the sensor redundancy, there is more than one sensor per axis being used, it makes it possible to use fault tolerant techniques to deal with these malfunctions in the case they appear. In this chapter, a fault tolerant technique to deal with partial sensors faults is presented and applied to the case of the 3-Axis Gimbal. 5.1 Sensor Fault Detection and Virtual Sensor Algorithm The main objective behind the Fault Tolerant Control (FTC) techniques are to reconfigure the plant in such a way that the nominal controller could still be used in spite of the fault. In other words, for the case of sensor faults, the objective is to hide to the controller the fault occurring in the sensors by reconstructing the signal, which is done using a virtual sensor. Figure 5.1 give an overview of how the virtual sensor based FTC module fits into the greater picture in the control system for the 3-Axis Gimbal.
52 Chapter 5. Sensor Fault Tolerant Strategy Figure 5.1: 3-Axis Gimbal control system considering the FTC. When dealing with sensors, the faults can be divided into two groups: total faults and partial faults. Total faults represent a total loss of the sensor signal, as if it were unplugged, whereas partial faults are the rest of faults that may affect the sensor without loosing the signal itself, this may be due to an unexpected change in the sensor gain or some unwanted offset or even drift. Total sensor fault for the case of the gimbal is considered to be very unlikely, while partial faults, despite having a low chance of occurring, there exists a real possibility of they being a threat. For this reasons the FTC strategy designed in this chapter is for the case of partial sensor faults only. According to [10], the sensor output can be divided as a part affected by multiplicative faults and a second element representing additive faults. For the case of the 3-Axis Gimbal, the sensor outputs for each of the individual gimbal axes can be expressed according to the mentioned representation as: qyf (k) ˙qyf (k) = γ1(k) 0 0γ2(k) 1 0 0 1 ˆq(k) ˆ ˙q(k) + fy1(k) fy2(k) (5.1) where qyf and ˙qyf (k)represent the faulty output from the sensors, ˆq(k)and ˆ ˙q(k)represent the states without fault, γirepresents the multiplicative sensor fault and fyi represents the additive fault. Notice that in the nominal situation, when there is no fault occurring, the values of the multiplicative and additive fault terms would be γi=1 and fyi=0 respectively. The proposed method for achieving FTC has a first and critical requirement: the online fault detection. The strategy for fault detection is to make an online parameter identification of the fault parameters γiand fyi. In order to accomplish the parameter identification task, the output representation from Equation (5.1) should be transformed into an equivalent regressor
Chapter 5. Sensor Fault Tolerant Strategy 53 form. To do it, first we should look at the output from each sensor individually, focusing on the position sensor Equation (5.1) results in: qyf (k) = γ1(k)ˆq(k) + fy1(k)(5.2) which can be easily transformed into a regressor equation with γand fyas the unknown variables to be determined: qyf (k) = ˆq(k) 1 γ(k) fy(k) (5.3) By solving the regressor problem the fault parameters can be obtained. Given their estimation and by manipulating Equation (5.2) it is straightforward to obtain the virtual sensor output yvequation, and it is a simple static compensation: yv=qyf −fy γ(5.4) However, before being able to compute the virtual sensor equation first the regressor problem should be solved for the parameter identification, using qyf and ˆqas our known variables. The variable qyf is the output from the faulty sensor, so it is trivial to obtain its value. However, as was mentioned, ˆqis the fault free state. Since the objective of the FTC strategy is to reconstruct the faulty sensor signal, to assume the previous knowledge of it for the fault detection may seem contradictory. In practice, the way this is achieved is by using an state observer to estimate it, hence the hat in the formulation. At this point, all the elements from the FTC scheme have been presented. In order to clarify the pretended FTC strategy a visual summary of it can be seen in Figure 5.2. Comparing the faulty sensor with the fault free state, we can detect the faults by means of the parameter identification from the regressor. From the estimated parameters and the faulty signal, the faulty free signal can be reconstructed by means of the virtual sensor using Equation (5.4). Finally, the outputs from the virtual sensor are used for estimating the fault free states of the system. The observers used, as well as the synthesis of the observers gain L, will be discussed in the next section, for now it will be discussed mainly the fault detection method.
54 Chapter 5. Sensor Fault Tolerant Strategy Figure 5.2: FTC scheme diagram representation. Going back to the parameter identification problem, with the knowledge of both variable qyf and ˆq, there exists a number of ways to make an online identication of the fault parameters. The classic approach is to solve the regressor problem using the Moore-Penrose pseudoinverse to isolate the vector of unknown variables as follows γ1(k) fy1(k) = ˆq(k) 1 ˆq(k−1) 1 . . .. . . ˆq(k−n) 1 + qyf (k) qyf (k−1) . . . qyf (k−n) (5.5) A few things should be commented about that equation. First, as can be seen, up to npast data points are required, with nbeing a tunable variable. Also, the fact that previous data points are required implies that the implementation of the parameter identification strategy must be done in discrete time. Since the parameter identification in this case is also the fault detection method, it is considered as a crucial element and as such it should react at a higher frequency in comparison with the gimbal dynamics. Since the 3-Axis Gimbal representation being used so far is only from the mechanical point of view, its dynamics can be considered as medium to slow in the world of discrete systems, for this reason a sampling frequency of 100Hz have been considered sufficient. In order to select how many nprevious data points should be used, the parameter identification is tested in open-loop with different values of n. For clarification, open-loop in this scenario means that the faulty signals are not being fed to the controller and are only used for testing the parameter identification method. For this test, the fault parameters affecting the sensors are shown in Table 5.1 with a time interval of 10 seconds. Figure 5.3 shows the online
Chapter 5. Sensor Fault Tolerant Strategy 55 estimation of the parameters. It can be seen that the estimation does indeed converge to the values shown in Table 5.1, proving that the proposed method is a good strategy for fault detection in the case of partial sensor faults. There does not appear to be much of a difference when the numbers of past samples nbeing used changes, taking this into consideration, the selected value for nis chosen to be n= 10. When using a value of n= 10, there is a minor improvement in convergence speed, in addition a lower number of data samples also implies less computational burden when applying the required Moore-Penrose pseudoinverse at every iteration. 0-10 10-20 20-30 30-40 40-50 50-60 γ1 1 0.6 1 1 1 fy0 0 0 0 0.3 0 Table 5.1: Sensor faults applied Figure 5.3: Open-loop estimation of γiand fyi. The next step is to test the fault parameter identification in closed-loop. This test implies that observers have already been designed and implemented as the fault detection depends on the state estimation of the angular position qand angular velocity ˙q. However, as mentioned before, the design of observers will be explained in next sections and for now the focus will be the fault parameter identification and its performance. For this test, it was used the same sequence of sensor faults shown Table 5.1 as in the open-loop case. Figure 5.4 shows the performance in closed-loop of the FTC scheme using the pseudoin-
62 Chapter 5. Sensor Fault Tolerant Strategy Figure 5.10: State observer-FTC interaction test. In order to check what effects does have the interactions commented between the state observer speed and the rest of the FTC elements a number of tests have been carried, the results can be seen in Figure 5.10. It compares the performance when the observer settling time is set to ts= 2.5s, when it is using a faster settling time at t0= 0.1s and also when it is back to ts= 2.5s but the initial condition from the observer and the real system are different. The settling time at ts= 2.5s is the settling time that was used in the previous section, and as before it has proven to have great performance. With the other two cases the situation is quite different. A fast observer causes the parameter identification to converge to a wrong set of fault parameters γand fy, and as seen before this causes steady state error in the closed loop system. On the other hand, having an slow observer means that if the initial conditions of the observer and real system differ for enough time this will be seen by the FTC elements as a fault. As seen in the results, this causes a big offset with respect the reference. This last problem can be avoided by given the observer a grace period in which the FTC module will not be acting, so the observer will have time to converge. For the rest of the chapter, it will be assumed that observer and gimbal system start from the same initial conditions. With the most important requirement already defined, the next step is the design and implementation of the observers itself. The design philosophy behind the observers is the same as in controller design, there will be a individual observer for each of the three axes that form the gimbal. In order to compute the observers it will be used the LPV models obtained in Section 3.2 and the computation of the observers gain will be done using a very similar approach as in Section 3.3 applying optimization based LMI techniques to obtain L. In fact, using the
Chapter 5. Sensor Fault Tolerant Strategy 63 controller-observer duality property, the same LMI constraints used to compute the controller gain can be used by simply applying the following transformations: A=⇒AT=˜ A(5.10) B=⇒CT=˜ B(5.11) And by transposing the computed gain Kit is obtained the observer gain L: L=KT(5.12) Starting from the first axis of the gimbal with Link 1, lets recall its plant model seen in Equation (3.7) and its embedded parameters from Table 3.1. Due to the small variability in the embedded parameter, the synthesis philosophy for computing the controller for the first link was to obtain a single robust controller for all the space of the LPV polytope. In practice, this is achieved by using only one controller as the variable of the LMI optimization problem that covers both vertexes of the LPV polytope of the Link 1 model. Following the same approach, LMI problem used for computing a robust observer gain are: P > 0(5.13) ˜ AiP+P˜ AT i+˜ BW +WT˜ B+ 2αP < 0(5.14) M⊗(˜ AiP) + MT⊗(P˜ AT i) + M⊗(˜ BW ) + MT⊗(WT˜ BT)<0(5.15) Where M= sin ϑcos ϑ −cos ϑsin ϑ (5.16) And after solving the LMI problem the observer gain is computed as: L= (WP−1)T(5.17) It can be seen that for each of the two vertexes of the LPV polytope, two LMI constraints are applied, plus the Lyapunov feasibility constraint, Equation (5.13), a total of five LMI constraints have been used. By selecting an appropriate value for α, the observer settling time can be chosen and a small value for ϑis used to bound the imaginary part of the observers poles. With the observer gain synthesis done, the implementation of the observer is straightforward by using the classical Luenberg observer, Equation (5.19). Since the system matrix Afrom
64 Chapter 5. Sensor Fault Tolerant Strategy Link 1 had a nonlinear embedded parameter, seen in Equation (3.7), this means that for obtaining the Avalue in real time it would be necessary to use a scheduling approach. However, given the soft nonlinearities of Link 1, the approach used was to approximate Aas the result of evaluating the LPV matrix of the model at the middle point of the LPV polytope, resulting in A= 0 1 0−10.745 (5.18) ˙x=Ax +Bu −L(y−Cx)(5.19) For the synthesis of the observer gain of Link 2 of the gimbal, as in the case of its controller, the situation is a bit more complex due to its heavy nonlinear dynamics and its LPV representation that forces the use of a hybrid observer with two regions depending on the value of the angular position q2of Link 2. The LPV model for the second axis is given in Equation (3.9) and the vertexes of the LPV polytope space are given in Table 3.2. The LMI constraints used are the same as in the case of the first axis, with the minor difference that this time each vertex of the LPV polytope space have its own observer gain. Since each of the two hybrid regions have two vertexes, there are nine LMI constraints used after adding the LMI for enforcing Lyapunov feasibility P > 0(5.20) ˜ AiP+P˜ AT i+˜ BWi+WT i˜ B+ 2αP < 0(5.21) M⊗(˜ AiP) + MT⊗(P˜ AT i) + M⊗(˜ BWi) + MT⊗(WT i˜ BT)<0(5.22) And the individual observer gains are computed as: Li= (WiP−1)T(5.23) As for the implementation of the observer, the real-time observer gain L L=L(1 −h) + Lh (5.24) to be used comes from the scheduling function h=θ2(q)−θ2 θ2−θ2 (5.25)
Chapter 5. Sensor Fault Tolerant Strategy 65 The terms Land Lrefer to the observer gains associated to the minimum and maximum vertex of the relative hybrid region. Finally, the observer is again implemented as a Luenberger observer with the minor difference that the Amatrix comes from evaluating in real-time the embedded parameter θ2(q2) ˙x=A(θ)x+Bu −L(y−Cx)(5.26) Finally, for the design of the observer for Link 3, as in the case of its controller, it is the simplest one. The control model for it is shown in Equation (3.12) and since it is a linear statespace model there are not embedded parameters. The LMI are the same used in the previous axes, and since there are no LPV vertexes only three LMIs are needed to define the constraints. The implementation of the observer is done applying a simple Luenberger observer with the computed gain. P > 0(5.27) ˜ AP +P˜ AT+˜ BW +WT˜ B+ 2αP < 0(5.28) M⊗(˜ AP) + MT⊗(P˜ AT) + M⊗(˜ BW ) + MT⊗(WT˜ BT)<0(5.29) And the observer gain is: L= (WP−1)T(5.30) The MATLAB script used for computing the observer gains can be found in Appendix C. 5.3 Improved FTC Scheme for the 3-Axis Gimbal Notice that in the last chapter there have been no comment about the structure and dimension of the system matrix C. It was not mentioned because the design of the observer can be easily adapted to different dimensions of the Cmatrix. Given that for each axis, both angular position qiand angular velocity ˙qistates are measured, choices for the matrix Care to have it be C=I or it could be build using only the position sensor, C= [1 0]. Using only the velocity sensor, C= [0 1], is not a possibility because the gimbal system representations then results in a non observable system. Using the model of Link 3 as an example, Equation (3.12), it can be seen that the observability matrix when C= [0 1] is not full rank. Ob = C CA = 0 1 0−536.2505 (5.31)
66 Chapter 5. Sensor Fault Tolerant Strategy To begin the design of the observers, the first obvious choice is to use both sensors for estimation, so C=I. With this selection of C, in order to compute the observers gains L, the matrix of optimization variables Wfrom the LMI constraints should be selected to be of dimensions 2x2. The results obtained when using this full observer can be seen in Figures 5.11 and 5.12. The results from the position estimation are great. However, the estimation for the angular velocity of Links 2 and 3 are horrible, completely not usable. Figure 5.11: Angular position estimation. C=I. Figure 5.12: Angular velocity estimation. C=I. The reason behind this behaviour may be in the observer gains. Taking the third axis as an
Chapter 5. Sensor Fault Tolerant Strategy 67 example again, its observer gain is: L3= −2.1724 −1.0000 0 534.0781 (5.32) Clearly the values for the second row presents a great disparity with the rest of the values of the gain matrix, two orders of magnitude greater. Whereas the observer gain for Link 1 presents all values with the same magnitude, as a result it can be seen that its velocity estimation is actually quite good. This points out that the numerical differences within the observers gains is the reason causing the ill estimation problems as suspected. It should be noted that proving different methods to compute the observer gains or also different tuning parameters did not resulted in an improvement with respect to the observed numerical problem L1= −1.0357 −1.0000 0 8.9771 (5.33) Since the angular velocity estimation ˆ ˙qfrom the observers when using both sensors cannot be used because how bad it is, a different approach is needed. The observers are computed again, but this time using only the angular position sensor, so C=[1 0]. For the synthesis of these new observers, the only change required in the observer computation design is to adapt the matrix of auxiliary optimization variables Win the LMI constraints formulation to be of dimensions 1x2. The results from the angular velocity estimation are shown in Figure 5.13, results from the position estimation are not shown for the sake of not cluttering since they do not show any improvement in comparison to the previous observer design using C=I.
68 Chapter 5. Sensor Fault Tolerant Strategy Figure 5.13: Angular velocity estimation. C= [1 0]. The results from the estimation of angular velocity show a great improvement in comparison from the previous tests. This time the observer gain matrix for Link 3 is: L3= −1.9399 0.8465 (5.34) Which this time has values of the same magnitude, as a result the estimation of ˆ ˙q3this time is very good. The estimation for ˆ ˙q2, on the other hand, is an improvement compared to the results obtained with the previous observer but is still far from perfect and still not suitable for its use in closed-loop. It can be seen that the estimation diverges from the real state at the maximum and minimum point of the velocity curve, which are the points where the angular position is switching from positive to negative and vice versa. This points to the hybrid nature of the observer design for Link 2 as the source of the problems in this case. The estimation is not unstable as can be seen, but the resulting transient dynamics during switching are not admissible. Since the cause of the problems in the estimation of ˆ ˙q2was the switching during the change of hybrid regions, the solution is to build a new not hybrid observer. Different techniques for building a nonlinear observer could be used, however taking advantage of the work done until now, there is still a last possibility within the LPV framework to build an observer for the estimation of both states of Link 2. This last opportunity is to compute the observer gain as was done in the case of the first axis, computing just one observer gain that should be robust and give a
Chapter 5. Sensor Fault Tolerant Strategy 69 good estimation within the whole LPV polytope. To do this, the only required modification to the LMI optimization constraints is to use a global matrix of optimization variables Winstead of a different Wiat each of the vertexes of the LPV polytopic space. When using this new robust observer gain for Link 2, it can be seen in Figure 5.14 that this time the estimation is pretty good and is finally usable for feedback in closed-loop. Due to the fact that the observers using both sensors, C=I, were deemed to be not fully Figure 5.14: Angular velocity estimation. C= [1 0]. usable because of the bad estimation of the angular velocities ˆ ˙qi, a new modification to the FTC scheme is proposed. This final scheme can be seen in Figure 5.15. In the diagram, it can be seen that the path for obtaining a fault tolerant estimation of the position ˆqis as it was originally proposed. The changes have been done in order to provide the fault tolerant estimation of the angular velocity ˆ ˙q. The estimation of the fault free state ˆ ˙qis given by the observers which use only the position information, C= [1 0]. The signal being used for this does not come from the sensor, as this would easily provoke that a fault in the position sensor will be transformed into a wrong estimation of the angular velocity. Instead, the already fault free position state ˆqis used, as this will allow for a fault free estimation of the angular velocity. From there, obtaining the output from the virtual sensor for angular velocity is as in the case of the position sensor: using the estimated ˆ ˙qthe fault detection takes place and finally the angular velocity signal can be reconstructed using the virtual sensor Equation (5.4). Finally, the signals used for closing the feedback loop are the fault free position state estimation ˆqand the output from the angular velocity virtual sensor ˙qv. As a side note, the reason to keep using the observers where C=Iis because using both sensors for estimation actually helps to obtain a better position estimation
70 Chapter 5. Sensor Fault Tolerant Strategy during a sensor fault. Figure 5.15: Final FTC scheme diagram representation. 5.4 Testing the FTC Performance In order to test the final proposed FTC scheme, it has been tested in an scenario with multiple occurring partial sensor faults. The fault parameters applied to the sensors are summarized in Tables 5.2 to 5.5. The faults have been only applied to Links 1 and 2 for the sake of clarity in the shown results as they are the most critical axes, in the sense on nonlinearities present, and results for Link 3 do not add any new valuable insight. 0-10 10-20 20-30 30-40 40-45 γ1 0.7 1 1 0.8 fy0 0 0 0.3 0.2 Table 5.2: Sensor faults applied in q1 0-10 10-20 20-30 30-40 40-45 γ1 1 1 0.6 0.9 fy0 0.2 0 0 0.15 Table 5.3: Sensor faults applied in ˙q1
Chapter 5. Sensor Fault Tolerant Strategy 71 0-10 10-20 20-30 30-40 40-45 γ1 1 1 0.6 0.9 fy0 0.2 0 0 0.15 Table 5.4: Sensor faults applied in q2 0-10 10-20 20-30 30-40 40-45 γ1 0.7 1 1 0.8 fy0 0 0 0.3 0.2 Table 5.5: Sensor faults applied in ˙q2 As can be seen in Figure 5.16, in the case of a sensor fault, the performance of the 3-Axis Gimbal control system will be very degraded. Given that in this test multiple faults have been applied in a short amount of time, the results may seem exaggerated. But it was done to showcase how every one the faults had a great impact in the resulting trajectory of the gimbal end effector. It is shown that without using FTC strategies, the appearance of any of these faults would clearly render the gimbal useless as a camera mount. However, as can be seen in Figure 5.17, when the Fault Tolerant Control scheme is being used the system is able to cope and maintain its performance almost intact, as the virtual sensors are able to reconstruct successfully the sensor signal and thus masking the fault to the controller. The obtained path is very smooth and to the users of the gimbal system the sensor fault would pass unnoticed. With the results shown in this section, the development of the FTC module can be considered as successful. From Figure 5.18 onward, the results for the fault parameter estimation are presented. It can be seen that the estimation closely match the applied partial sensor faults, shown in the tables at the beginning of this section. The obtained estimation using the Recursive Least Square method proved to give a clean identification without noises and converges to the expected values in the nominal fault free scenario, γ= 1 and fy= 0. Also, when a fault occurs it quickly converges effectively to real fault occurring in the axis sensor, independently if it is a multiplicative or an additive fault, proving to be robust against both types of failures. In Figure 5.20, it can be seen that in the first interval of 10 seconds, the estimation of the multiplicative fault γis quite noisy. The reason for this noisy estimation is that for that initial 10 seconds interval the Link 2 does not move, and as it is know in order to have a good estimation performance an exciting
78 Chapter 6. Conclusion For assessing the environmental impact of the project, again, it have to be considered the current situation. As explained, most of the development ave been done from a design perspective, as such the principal tool have been my personal computer. With the time assessment of the entire project and considering that the PC was required for all steps, then an estimation of the CO2emission related to the project can be done. For this, an average PC consumption of 50 Watts is assumed and the Spanish 2019 emission factor 1is used. 450 h×0.05 kW ×0.241 kg CO2 kW h = 5.4225 kg CO2(6.1) 1https://canviclimatic.gencat.cat/es/actua/factors_demissio_associats_a_lenergia/
Appendix A. The mathematical model script 79 Appendix A The mathematical model script A.1 Main script for computing the full 3-Axis Gimbal model 1%% Forward Kinematics 2 3syms q1 4syms q2 5syms q3 6assume(q1 , ’ r eal ’ ) 7assume(q2 , ’ r eal ’ ) 8assume(q3 , ’ r eal ’ ) 9 10 DH = [q1+pi /2 0 0 pi /2; 11 q2−pi /2 0 0 −pi /2; 12 q3 0 0 0 ] ; 13 14 A01 = simplify ([ cos (DH(1 ,1) ) −sin(DH(1 ,1) )∗cos (DH(1 ,4) ) sin(DH(1 ,1) )∗ sin(DH(1 ,4) ) 0; 15 sin (DH(1 ,1) ) cos (DH(1 ,1) )∗cos (DH(1 ,4) ) −cos (DH(1 ,1) )∗sin(DH (1 ,4) ) 0; 16 0sin (DH(1 ,4) ) cos (DH(1 ,4) ) 0; 17 0 0 0 1]) ;
80 Appendix A. The mathematical model script 18 19 A12 = simplify ([ cos (DH(2 ,1) ) −sin(DH(2 ,1) )∗cos (DH(2 ,4) ) sin(DH(2 ,1) )∗ sin(DH(2 ,4) ) 0; 20 sin(DH(2 ,1) ) cos (DH(2 ,1) )∗cos (DH(2 ,4) ) −cos (DH(2 ,1) )∗sin (DH (2 ,4) ) 0; 21 0sin (DH(2 ,4) ) cos (DH(2 ,4) ) 0; 22 0 0 0 1]) ; 23 24 A23 = simplify ([ cos (DH(3 ,1) ) −sin(DH(3 ,1) )∗cos (DH(3 ,4) ) sin(DH(3 ,1) )∗ sin(DH(3 ,4) ) 0; 25 sin(DH(3 ,1) ) cos (DH(3 ,1) )∗cos (DH(3 ,4) ) −cos (DH(3 ,1) )∗sin (DH (3 ,4) ) 0; 26 0sin (DH(3 ,4) ) cos (DH(3 ,4) ) 0; 27 0 0 0 1]) ; 28 29 T03 = A01∗A12∗A23 ; 30 31 R01 = A01 ( 1 : 3 , 1 : 3 ) ; 32 R12 = A12 ( 1 : 3 , 1 : 3 ) ; 33 R23 = A23 ( 1 : 3 , 1 : 3 ) ; 34 35 %% Geometric Jacobian (end e f f e c t o r ) 36 37 %Trans alatio nal part of the jacobian i s null 38 JP = zeros(3 ,3) ; 39 40 z0 = [0 0 1 ] ’ ; 41 z1 = R01∗z0 ; 42 z2 = R01∗R12∗z0 ; 43 44 Jw3 = [z0 , z1 , z2 ] ; 45
Appendix A. The mathematical model script 81 46 JO = Jw3 ; 47 48 J = [ JP ; JO ] ; 49 50 %% I n e r t i a Matrix B 51 52 %link mass 53 syms m1 m2 m3 54 assume(m1, ’ r e a l ’ ) 55 assume(m2, ’ r e a l ’ ) 56 assume(m3, ’ r e a l ’ ) 57 58 %center of masses 59 syms com1x com1z 60 assume(com1x , ’ real ’ ) 61 assume(com1z , ’ rea l ’ ) 62 syms com2x com2z 63 assume(com2x , ’ real ’ ) 64 assume(com2z , ’ rea l ’ ) 65 syms com3z 66 assume(com3z , ’ rea l ’ ) 67 68 %I n e r t i a Tensor elements 69 syms Ixx1 Iyy1 Izz1 70 syms Ixz1 71 assume( Ixx1 , ’ real ’ ) 72 assume(Iyy1 , ’ r eal ’ ) 73 assume( Izz1 , ’ rea l ’ ) 74 assume( Ixz1 , ’ real ’ ) 75 I l 1 = [ Ixx1 0 −Ixz1 ; 0 Iyy1 0; −Ixz1 0 Izz1 ] ; 76 77 syms Ixx2 Iyy2 Izz2
82 Appendix A. The mathematical model script 78 syms Ixz2 79 assume( Ixx2 , ’ rea l ’ ) 80 assume(Iyy2 , ’ r eal ’ ) 81 assume( Izz2 , ’ rea l ’ ) 82 assume( Ixz2 , ’ real ’ ) 83 I l 2 = [ Ixx2 0 −Ixz2 ; 0 Iyy2 0 ; −Ixz2 0 Izz2 ] ; 84 85 syms Ixx3 Iyy3 Izz3 86 assume( Ixx3 , ’ rea l ’ ) 87 assume(Iyy3 , ’ r eal ’ ) 88 assume( Izz3 , ’ rea l ’ ) 89 I l 3 = [ Ixx3 0 0 ; 0 Iyy3 0; 0 0 Izz3 ] ; 90 91 %position of center of mass in base frame 92 pl1 = R01∗[com1x 0 com1z ] ’ ; 93 pl2 = R01∗R12∗[com2x 0 com2z ] ’ ; 94 pl3 = R01∗R12∗R23∗[0 0 com3z ] ’ ; 95 96 %Tran saltional Jacabians 97 Jpl1 = simplify ([ cross(z0 , pl1 ) zeros (3 ,1) zeros(3 ,1) ]) ; 98 Jpl2 = simplify ([ cross(z0 , pl2 ) cross(z1 , pl2 ) zeros(3 ,1) ]) ; 99 Jpl3 = simplify ([ cross(z0 , pl3 ) cross(z1 , pl3 ) cross(z2 , pl3 ) ]) ; 100 101 %Rotational Jacobian 102 Jol 1 = [z0 zeros (3 ,1) zeros (3 ,1) ] ; 103 Jol 2 = [z0 z1 zeros (3 ,1) ] ; 104 Jol 3 = [z0 z1 z2 ] ; 105 106 %I n e r t i a matrix 107 R02 = R01∗R12 ; 108 R03 = R02∗R23 ; 109
Appendix A. The mathematical model script 83 110 B1 = simplify (m1∗( Jpl1 ’∗Jpl1 ) + Jol1 ’∗R01∗Il1∗R01 ’∗Jol1 ) ; 111 B2 = simplify (m2∗( Jpl2 ’∗Jpl2 ) + Jol2 ’∗R02∗Il2∗R02 ’∗Jol2 ) ; 112 B3 = simplify (m3∗( Jpl3 ’∗Jpl3 ) + Jol3 ’∗R03∗Il3∗R03 ’∗Jol3 ) ; 113 114 B = simplify (B1 + B2 + B3 ,100) 115 invB = inv (B) ; 116 117 %% C oriol i s Matrix C 118 119 syms qdot1 qdot2 qdot3 120 assume(qdot1 , ’ real ’ ) 121 assume(qdot2 , ’ real ’ ) 122 assume(qdot3 , ’ real ’ ) 123 124 b11 = B(1 ,1) ; 125 b12 = B(1 ,2) ; 126 b13 = B(1 ,3) ; 127 b21 = B(2 ,1) ; 128 b22 = B(2 ,2) ; 129 b23 = B(2 ,3) ; 130 b31 = B(3 ,1) ; 131 b32 = B(3 ,2) ; 132 b33 = B(3 ,3) ; 133 %Function c i j k ( b i j , bik , bjk , qi , qj , qk) computes : 134 %c i j k = simplify (0.5∗( d i f f ( b ij , qk) + d i f f ( bik , qj )−d i f f ( bjk , qi )) ) 135 %c i j k = c i k j 136 c111 = c i j k (b11 , b11 , b11 , q1 , q1 , q1) ; 137 c112 = c i j k (b11 , b12 , b12 , q1 , q1 , q2) ; 138 c113 = c i j k (b11 , b13 , b13 , q1 , q1 , q3) ; 139 c121 = c112 ; 140 c122 = c i j k (b12 , b12 , b22 , q1 , q2 , q2) ; 141 c123 = c i j k (b12 , b13 , b23 , q1 , q2 , q3) ;
84 Appendix A. The mathematical model script 142 c131 = c113 ; 143 c132 = c123 ; 144 c133 = c i j k (b13 , b13 , b33 , q1 , q3 , q3) ; 145 c211 = c i j k (b21 , b21 , b11 , q2 , q1 , q1) ; 146 c212 = c i j k (b21 , b22 , b12 , q2 , q1 , q2) ; 147 c213 = c i j k (b21 , b23 , b13 , q2 , q1 , q3) ; 148 c221 = c212 ; 149 c222 = c i j k (b22 , b22 , b22 , q2 , q2 , q2) ; 150 c223 = c i j k (b22 , b23 , b23 , q2 , q2 , q3) ; 151 c231 = c213 ; 152 c232 = c223 ; 153 c233 = c i j k (b23 , b23 , b33 , q2 , q3 , q3) ; 154 c311 = c i j k (b31 , b31 , b11 , q3 , q1 , q1) ; 155 c312 = c i j k (b31 , b32 , b12 , q3 , q1 , q2) ; 156 c313 = c i j k (b31 , b33 , b13 , q3 , q1 , q3) ; 157 c321 = c312 ; 158 c322 = c i j k (b32 , b32 , b22 , q3 , q2 , q2) ; 159 c323 = c i j k (b32 , b33 , b23 , q3 , q2 , q3) ; 160 c331 = c313 ; 161 c332 = c323 ; 162 c333 = c i j k (b33 , b33 , b33 , q3 , q3 , q3) ; 163 164 c11 = c111∗qdot1+c112∗qdot2+c113∗qdot3 ; 165 c12 = c121∗qdot1+c122∗qdot2+c123∗qdot3 ; 166 c13 = c131∗qdot1+c132∗qdot2+c133∗qdot3 ; 167 c21 = c211∗qdot1+c212∗qdot2+c213∗qdot3 ; 168 c22 = c221∗qdot1+c222∗qdot2+c223∗qdot3 ; 169 c23 = c231∗qdot1+c232∗qdot2+c233∗qdot3 ; 170 c31 = c311∗qdot1+c312∗qdot2+c313∗qdot3 ; 171 c32 = c321∗qdot1+c322∗qdot2+c323∗qdot3 ; 172 c33 = c331∗qdot1+c332∗qdot2+c333∗qdot3 ; 173
Appendix A. The mathematical model script 85 174 C = simplify ([ c11 c12 c13 ; c21 c22 c23 ; c31 c32 c33 ] ,100) ; 175 176 %% Gravity term G 177 178 g0 = [0 0 9 . 8 1 ] ’ ; 179 180 g1 = simplify(−m1∗g0 ’∗J pl1 ( : , 1 )−m2∗g0 ’∗J pl 2 ( : , 1 )−m3∗g0 ’∗J pl 3 ( : , 1 ) ) ; 181 g2 = simplify(−m1∗g0 ’∗J pl1 ( : , 2 )−m2∗g0 ’∗J pl 2 ( : , 2 )−m3∗g0 ’∗J pl 3 ( : , 2 ) ) ; 182 g3 = simplify(−m1∗g0 ’∗J pl1 ( : , 3 )−m2∗g0 ’∗J pl 2 ( : , 3 )−m3∗g0 ’∗J pl 3 ( : , 3 ) ) ; 183 184 G = [g1 g2 g3 ] ’ ; 185 186 %% whole model 187 188 syms qdotdot1 qdotdot2 qdotdot3 189 assume(qdotdot1 , ’ rea l ’ ) 190 assume(qdotdot2 , ’ rea l ’ ) 191 assume(qdotdot3 , ’ rea l ’ ) 192 qdotdot = [ qdotdot1 , qdotdot2 , qdotdot3 ] ’ ; 193 qdot = [qdot1 , qdot2 , qdot3 ] ’ ; 194 195 syms Fv1 Fv2 Fv3 196 assume(Fv1 , ’ r e al ’ ) 197 assume(Fv2 , ’ r e al ’ ) 198 assume(Fv3 , ’ r e al ’ ) 199 Fv = diag([Fv1 Fv2 Fv3]) ; 200 201 syms tau1 tau2 tau3 202 assume(tau1 , ’ real ’ ) 203 assume(tau2 , ’ real ’ ) 204 assume(tau3 , ’ real ’ ) 205 tau = [ tau1 , tau2 , tau3 ] ’ ;
86 Appendix A. The mathematical model script 206 207 TAU = B∗qdotdot+C∗qdot+Fv∗qdot+G 208 QDD = invB∗(tau−C∗qdot−Fv∗qdot−G) 209 210 %% Solid Work values 211 212 % Link 1 213 vm1 = 2 . 4 9 2 ;%kg 214 vcom1x = −90.56/1000; %m 215 vcom1z = 114.74/1000; 216 217 vIxx1 = 14354888.77∗1 e −9; %1e9 = 1/1000^3 conversion de g mm^2 a kg m ^2 218 vIyy1 = 29370510.38∗1e−9; 219 vIzz1 = 17526249.63∗1e−9; 220 vIxz1 = 11748431.07∗1 e −9; 221 222 %Link 2 223 vm2 = 1 . 6 2 4 ;%kg 224 vcom2x = −6.31/1000; %m 225 vcom2z = −73.38/1000; 226 227 vIxx2 = 8955973.99∗1e −9; 228 vIyy2 = 8508639.70∗1 e −9; 229 vIzz2 = 1966741.10∗1 e −9; 230 vIxz2 = −687364.95∗1e−9; 231 232 %Link 3 233 vm3 = 0 . 7 5 6 ;%kg 234 vcom3z = 31/1000; 235 236 vIxx3 = 1260000.00∗1e −9;
Appendix A. The mathematical model script 87 237 vIyy3 = 655200.00∗1 e −9; 238 vIzz3 = 1864800.00∗1 e −9; 239 240 vB = vpa(subs (B , { Ixx1 , Iyy1 , Izz1 , Ixz1 , Ixx2 , Iyy2 , Izz2 , Ixz2 , Ixx3 , Iyy3 , Izz3 , . . . 241 m1,m2,m3, com1x , com1z , com2x , com2z , com3z } , . . . 242 { vIxx1 , vIyy1 , vIzz1 , vIxz1 , vIxx2 , vIyy2 , vIzz2 , vIxz2 , vIxx3 , vIyy3 , vIzz3 , . . . 243 vm1, vm2,vm3, vcom1x , vcom1z , vcom2x , vcom2z , vcom3z}) ) ; 244 245 vinvB = vpa(subs (invB , { Ixx1 , Iyy1 , Izz1 , Ixz1 , Ixx2 , Iyy2 , Izz2 , Ixz2 , Ixx3 , Iyy3 , Izz3 , . . . 246 m1,m2,m3, com1x , com1z , com2x , com2z , com3z } , . . . 247 { vIxx1 , vIyy1 , vIzz1 , vIxz1 , vIxx2 , vIyy2 , vIzz2 , vIxz2 , vIxx3 , vIyy3 , vIzz3 , . . . 248 vm1, vm2,vm3, vcom1x , vcom1z , vcom2x , vcom2z , vcom3z}) ) ; 249 250 vC = vpa( subs(C, { Ixx1 , Iyy1 , Izz1 , Ixz1 , Ixx2 , Iyy2 , Izz2 , Ixz2 , Ixx3 , Iyy3 , Izz3 , . . . 251 m1,m2,m3, com1x , com1z , com2x , com2z , com3z } , . . . 252 { vIxx1 , vIyy1 , vIzz1 , vIxz1 , vIxx2 , vIyy2 , vIzz2 , vIxz2 , vIxx3 , vIyy3 , vIzz3 , . . . 253 vm1, vm2,vm3, vcom1x , vcom1z , vcom2x , vcom2z , vcom3z}) ) ; 254 255 vG = vpa(subs (G, {m2,m3, com2x , com2z , com3z } ,{vm2,vm3, vcom2x , vcom2z , vcom3z}) ) ; 256 257 Fv = diag([1,1,1]) ; 258 259 TAU = vB∗qdotdot+vC∗qdot+Fv∗qdot+vG 260 QDD = vinvB∗(tau−vC∗qdot−Fv∗qdot−vG) 261
Appendix C. The observers design script 95 Appendix C The observers design script C.1 Script for Computing the Observer Gains 1%% 2do Link f u l l 2 3st = 5; 4gamma = st / 4; 5alpha = 1/gamma; 6 7M210 = [0 1; −17.3492 −52.5]’; %min 8M220 = [0 1;485.3176 −52.5]’; %max 9M211 = [0 1; −495.8560 −52.5]’; %min 10 M221 = [0 1;16.0752 −52.5]’; %max 11 B2 = eye (2) ; 12 13 14 theta = pi ∗5/180; 15 M = [ sin ( theta ) cos ( theta );−cos (theta) sin( theta ) ] ; 16 17 P = sdpvar (2 ,2) ; 18 W210 = sdpvar (2 ,2 , ’ f u l l ’ ) ; 19 W220 = sdpvar (2 ,2 , ’ f u l l ’ ) ;
96 Appendix C. The observers design script 20 W211 = sdpvar (2 ,2 , ’ f u l l ’ ) ; 21 W221 = sdpvar (2 ,2 , ’ f u l l ’ ) ; 22 options = sdpsettings ( ’ solver ’ ,’sedumi ’ ) ; 23 24 H1 = kron(M, M210∗P)+kron(M’ , P∗M210 ’ )+kron(M, B2∗W210)+kron(M’ , W210’∗B2 ’ ) ; 25 H2 = kron(M, M220∗P)+kron(M’ , P∗M220 ’ )+kron(M, B2∗W220)+kron(M’ , W220’∗B2 ’ ) ; 26 H3 = kron(M, M211∗P)+kron(M’ , P∗M211 ’ )+kron(M, B2∗W211)+kron(M’ , W211’∗B2 ’ ) ; 27 H4 = kron(M, M221∗P)+kron(M’ , P∗M221 ’ )+kron(M, B2∗W221)+kron(M’ , W221’∗B2 ’ ) ; 28 29 F = [P>=0]; 30 F = [F , M210∗P+P∗M210’+B2∗W210+W210’∗B2’+2∗alpha∗P<=0]; 31 F = [F , M220∗P+P∗M220’+B2∗W220+W220’∗B2’+2∗alpha∗P<=0]; 32 F = [F , M211∗P+P∗M211’+B2∗W211+W211’∗B2’+2∗alpha∗P<=0]; 33 F = [F , M221∗P+P∗M221’+B2∗W221+W221’∗B2’+2∗alpha∗P<=0]; 34 F = [F ,H1<=0,H2<=0,H3<=0,H4<=0]; 35 optimize (F , [ ] , options ) 36 37 Psol = value (P) ; 38 W210sol = value (W210) ; 39 W220sol = value (W220) ; 40 W211sol = value (W211) ; 41 W221sol = value (W221) ; 42 43 L210 = W210sol/ Psol ; 44 L220 = W220sol/ Psol ; 45 L211 = W211sol/ Psol ; 46 L221 = W221sol/ Psol ; 47
Appendix C. The observers design script 97 48 Z. L210 = L210 ’ 49 Z. L220 = L220 ’ 50 Z. L211 = L211 ’ 51 Z. L221 = L221 ’ 52 53 54 %% 3er link f u l l 55 56 st = 2 . 5 ; 57 gamma = st / 4; 58 alpha = 1/gamma; 59 beta = alpha +1; 60 61 M3 = [0 1;0 −536.2505] ’; 62 B3 = eye (2) ; 63 C3 = eye(2) ; 64 65 theta = pi ∗5/180; 66 M = [ sin ( theta ) cos ( theta );−cos (theta) sin( theta ) ] ; 67 68 P = sdpvar (2 ,2) ; 69 W3 = sdpvar (2 ,2 , ’ f u l l ’ ) ; 70 options = sdpsettings ( ’ solver ’ ,’ sedumi ’ ) ; 71 F = [P>=0]; 72 F = [F ,M3∗P+P∗M3’+B3∗W3+W3’∗B3’+2∗alpha∗P<=0]; 73 F = [F,−M3∗P−P∗M3’−B3∗W3−W3’∗B3’−2∗beta∗P<=0]; 74 H1 = kron(M,M3∗P)+kron(M’ , P∗M3’ )+kron(M, B3∗W3)+kron(M’ ,W3’∗B3 ’ ) ; 75 F = [F ,H1<=0]; 76 optimize (F , [ ] , options ) 77 78 Psol = value (P) ; 79 W3sol = value (W3) ;
98 Appendix C. The observers design script 80 L3 = W3sol/ Psol ; 81 Z. L3 = L3 ’ 82 83 L3 ’ 84 85 86 %% 1 er Link 87 st = 5; 88 gamma = st / 4; 89 alpha = 1/gamma; 90 91 theta = pi ∗5/180; 92 M = [ sin ( theta ) cos ( theta );−cos (theta) sin( theta ) ] ; 93 94 M11 = [0 1;0 −10.21]’; 95 M12 = [0 1;0 −11.28]’; 96 B1 = eye (2) ; 97 98 P = sdpvar (2 ,2) ; 99 W1 = sdpvar (2 ,2 , ’ f u l l ’ ) ; 100 options = sdpsettings ( ’ solver ’ ,’sedumi ’ ) ; 101 102 F = [P>=0]; 103 F = [F ,M11∗P+P∗M11’+B1∗W1+W1’∗B1’+2∗alpha∗P<=0]; 104 F = [F ,M12∗P+P∗M12’+B1∗W1+W1’∗B1’+2∗alpha∗P<=0]; 105 H1 = kron(M,M11∗P)+kron(M’ , P∗M11’ )+kron(M, B1∗W1)+kron(M’ ,W1’∗B1 ’ ) ; 106 H2 = kron(M,M12∗P)+kron(M’ , P∗M12’ )+kron(M, B1∗W1)+kron(M’ ,W1’∗B1 ’ ) ; 107 F = [F ,H1<=0,H2<=0]; 108 optimize (F , [ ] , options ) 109 110 Psol = value (P) ; 111 W1sol = value (W1) ;
Appendix C. The observers design script 99 112 L1 = W1sol/ Psol ; 113 Z. L1 = L1 ’ 114 115 %% 3 er l ink q3 116 117 st = 2 . 5 ; 118 gamma = st / 4; 119 alpha = 1/gamma; 120 beta = alpha +1; 121 122 M3 = [0 1;0 −536.2505] ’; 123 B3 = [1 0 ] ’ ; 124 C3 = eye (2) ; 125 126 theta = pi ∗5/180; 127 M = [ sin ( theta ) cos ( theta );−cos (theta) sin( theta ) ] ; 128 129 P = sdpvar (2 ,2) ; 130 W3 = sdpvar (1 ,2 , ’ f u l l ’ ) ; 131 options = sdpsettings ( ’ solver ’ ,’ sedumi ’ ) ; 132 F = [P>=0]; 133 F = [F ,M3∗P+P∗M3’+B3∗W3+W3’∗B3’+2∗alpha∗P<=0]; 134 % F = [F,−M3∗P−P∗M3’−B3∗W3−W3’∗B3’−2∗beta∗P<=0]; 135 H1 = kron(M,M3∗P)+kron(M’ , P∗M3’ )+kron(M, B3∗W3)+kron(M’ ,W3’∗B3 ’ ) ; 136 F = [F ,H1<=0]; 137 optimize (F , [ ] , options ) 138 139 Psol = value (P) ; 140 W3sol = value (W3) ; 141 L3 = W3sol/ Psol ; 142 Z. L3q = L3 ’ 143
100 Appendix C. The observers design script 144 L3 ’ 145 146 %% 1 er Link q1 147 %s t = 0 . 2 ; 148 gamma = st / 4; 149 alpha = 1/gamma; 150 151 theta = pi ∗5/180; 152 M = [ sin ( theta ) cos ( theta );−cos (theta) sin( theta ) ] ; 153 154 M11 = [0 1;0 −10.21]’; 155 M12 = [0 1;0 −11.28]’; 156 B1 = [1 0 ] ’ ; 157 158 P = sdpvar (2 ,2) ; 159 W1 = sdpvar (1 ,2 , ’ f u l l ’ ) ; 160 options = sdpsettings ( ’ solver ’ ,’sedumi ’ ) ; 161 162 F = [P>=0]; 163 F = [F ,M11∗P+P∗M11’+B1∗W1+W1’∗B1’+2∗alpha∗P<=0]; 164 F = [F ,M12∗P+P∗M12’+B1∗W1+W1’∗B1’+2∗alpha∗P<=0]; 165 H1 = kron(M,M11∗P)+kron(M’ , P∗M11’ )+kron(M, B1∗W1)+kron(M’ ,W1’∗B1 ’ ) ; 166 H2 = kron(M,M12∗P)+kron(M’ , P∗M12’ )+kron(M, B1∗W1)+kron(M’ ,W1’∗B1 ’ ) ; 167 F = [F ,H1<=0,H2<=0]; 168 optimize (F , [ ] , options ) 169 170 Psol = value (P) ; 171 W1sol = value (W1) ; 172 L1 = W1sol/ Psol ; 173 Z. L1q = L1 ’ 174 175 %% 2do Link q2
Appendix C. The observers design script 101 176 177 st = 2 . 5 ; 178 gamma = st / 4; 179 alpha = 1/gamma; 180 181 M210 = [0 1; −17.3492 −52.5]’; %min 182 M220 = [0 1;485.3176 −52.5]’; %max 183 M211 = [0 1; −495.8560 −52.5]’; %min 184 M221 = [0 1;16.0752 −52.5]’; %max 185 B2 = [1 0 ] ’ ; 186 187 188 theta = pi ∗45/180; 189 M = [ sin ( theta ) cos ( theta );−cos (theta) sin( theta ) ] ; 190 191 P = sdpvar (2 ,2) ; 192 W210 = sdpvar (1 ,2 , ’ f u l l ’ ) ; 193 W220 = sdpvar (1 ,2 , ’ f u l l ’ ) ; 194 W211 = sdpvar (1 ,2 , ’ f u l l ’ ) ; 195 W221 = sdpvar (1 ,2 , ’ f u l l ’ ) ; 196 options = sdpsettings ( ’ solver ’ ,’ sedumi ’ ) ; 197 198 H1 = kron(M, M210∗P)+kron(M’ , P∗M210 ’ )+kron(M, B2∗W210)+kron(M’ , W210’∗B2 ’ ) ; 199 H2 = kron(M, M220∗P)+kron(M’ , P∗M220 ’ )+kron(M, B2∗W220)+kron(M’ , W220’∗B2 ’ ) ; 200 H3 = kron(M, M211∗P)+kron(M’ , P∗M211 ’ )+kron(M, B2∗W211)+kron(M’ , W211’∗B2 ’ ) ; 201 H4 = kron(M, M221∗P)+kron(M’ , P∗M221 ’ )+kron(M, B2∗W221)+kron(M’ , W221’∗B2 ’ ) ; 202 203 F = [P>=0];
102 Appendix C. The observers design script 204 F = [F , M210∗P+P∗M210’+B2∗W210+W210’∗B2’+2∗alpha∗P<=0]; 205 F = [F , M220∗P+P∗M220’+B2∗W220+W220’∗B2’+2∗alpha∗P<=0]; 206 F = [F , M211∗P+P∗M211’+B2∗W211+W211’∗B2’+2∗alpha∗P<=0]; 207 F = [F , M221∗P+P∗M221’+B2∗W221+W221’∗B2’+2∗alpha∗P<=0]; 208 F = [F ,H1<=0,H2<=0,H3<=0,H4<=0]; 209 optimize (F , [ ] , options ) 210 211 Psol = value (P) ; 212 W210sol = value (W210) ; 213 W220sol = value (W220) ; 214 W211sol = value (W211) ; 215 W221sol = value (W221) ; 216 217 L210 = W210sol/ Psol ; 218 L220 = W220sol/ Psol ; 219 L211 = W211sol/ Psol ; 220 L221 = W221sol/ Psol ; 221 222 Z. L210q = L210 ’ 223 Z. L220q = L220 ’ 224 Z. L211q = L211 ’ 225 Z. L221q = L221 ’
Bibliography 103 Bibliography [1] Pierre Apkarian, Pascal Gahinet, and Greg Becker. “Self-scheduled Hinf control of linear parameter-varying systems: a design example”. In: (1995). [2] F. Bianchi and R. Mantz. “Robust LPV Gain Scheduled PID Control”. In: (2004). [3] Guang-Ren Duan and Hai-Hua Yu. LMIs in Control Systems: Analysis, Design and Applications. CRC Press, 2013. [4] J. Löfberg. “YALMIP: A toolbox for modeling and optimization in MATLAB”. In: (2004). [5] I. Masubuchi, T. Akiyama, and M. Saeki. “Synthesis of output feedback gain-scheduling controllers based on descriptor LPV system representation”. In: 42nd IEEE International Conference on Decision and Control (IEEE Cat. No.03CH37475). Vol. 6. 2003, 6115–6120 Vol.6. [6] Mathworks. MATLAB Documentation: cart2sph @ONLINE.url:https://es.mathworks. com/help/matlab/ref/cart2sph.html. [7] Mathworks. MATLAB Documentation: Recursive Least Squares Estimator @ONLINE.url: https://es.mathworks.com/help/ident/ref/recursiveleastsquaresestimator. html. [8] Kamyar Mehran. “Takagi-Sugeno Fuzzy Modeling for Process Control”. In: (2008). [9] Jan Rosell. Robotics: Kinematics, Dynamics and Control @ONLINE.url:https://sir.upc. edu/projects/kinematics_dynamics_control/. [10] Damiano Rotondo, Fatiha Nejjari, and Vicenç Puig. “A virtual actuator and sensor approach for fault tolerant control of LPV systems”. In: Journal of Process Control (2014). [11] B. Siciliano et al. Robotics: Modelling, Planning and Control. Springer, 2009. [12] J. F. Sturm. “Using SeDuMi 1.02, a MATLAB toolbox for optimization over symmetric cones”. In: (1999).