report furuta pendulum

18
Introduction The furuta pendulum is a device widely used in the development of different types of controllers as well as a learning tool in academic settings to show and teach students in universities how to design and implement controllers. The furuta pendulum is a device that incorporates two important elements, an arm and a simple pendulum. The arm is driven by a servomotor that allows rotation in the horizontal plane, while the pendulum is attached to the other end of the arm and it consist of a simple mass suspended at the end of a mass-less rigid string. The pendulum can rotate in the vertical plane and its main characteristic is that it has a fixed period, meaning that it always takes the same amount of time to complete a single revolution about its rest position when a small displacement is given. This is called the time period. As already mentioned before this type of pendulum is used to develop different types of controllers which goals are to bring the pendulum to the inverted position and to maintain it fixed at such position using two degrees of freedom and one actuator. One example can be seen in figure 1. During the course of this Lab we will design and implement a controller based in the energy concept, which will allow us to bring the pendulum to an upward position. Later an LQR controller and observer will be employed for the task of keeping the pendulum in the inverted position. Finally a pole cross fader will be implemented in order to improve the catching of the system. Figure 1: Inverted Pendulum Description of the Furuta pendulum As stated above, the furuta pendulum consist of one actuator. The actuation is done by the help of a servo motor. The motor gets its signals from a board coupled to a computer using a special board. A simplified diagram of the pendulum is shown below in figure 2. The degrees of freedom are the ‘α’ and ‘β’. They represent the rotation of the arms. However both of Figure 2: Simplified Model

Upload: syed-haider-jawad-abidi

Post on 02-Mar-2015

192 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Report Furuta Pendulum

Introduction

The furuta pendulum is a device widely used in the development of different types of controllers as well as a learning tool in academic settings to show and teach students in universities how to design and implement controllers. The furuta pendulum is a device that incorporates two important elements, an arm and a simple pendulum. The arm is driven by a servomotor that allows rotation in the horizontal plane, while the pendulum is attached to the other end of the arm and it consist of a simple mass suspended at the end of a mass-less rigid string. The pendulum can rotate in the vertical plane and its main characteristic is that it has a fixed period, meaning that it always takes the same amount of time to complete a single revolution about its rest position when a small displacement is given. This is called the time period.

As already mentioned before this type of pendulum is used to develop different types of controllers which goals are to bring the pendulum to the inverted position and to maintain it fixed at such position using two degrees of freedom and one actuator. One example can be seen in figure 1. During the course of this Lab we will design and implement a controller based in the energy concept, which will allow us to bring the pendulum to an upward position. Later an LQR controller and observer will be employed for the task of keeping the pendulum in the inverted position. Finally a pole cross fader will be implemented in order to improve the catching of the system.

Figure 1: Inverted Pendulum

Description of the Furuta pendulum

As stated above, the furuta pendulum consist of one actuator. The actuation is done by the help of a servo motor. The motor gets its signals from a board coupled to a computer using a special board. A simplified diagram of the pendulum is shown below in figure 2.

The degrees of freedom are the ‘α’ and ‘β’. They represent the rotation of the arms. However both of

Figure 2: Simplified Model

Page 2: Report Furuta Pendulum

them are not actuated. Only ‘α’ is controlled, by the use of a motor. The motion of ‘β’ is simply due to inertia.

The masses and the lengths are as shown in the diagram. The Motor is not shown in the picture. Motor applies a torque and as a result we have a change in α. β changes due to the inertia of the motion caused in the arm.

For simplification we have considered the masses of the elements as point masses, as shown in figure 3. This helps in the modelling.

Obtaining the Model

The following considerations have been taken into account for the modeling of the furuta pendulum:

The zero for 2

has been chosen at the upright position. That makes the controller design an easier task; otherwise the controller would be switching at the stable position between and -. At the same time it allows have a better visualization in the graphs.

The coordinate axes have been chosen so that they match with a Denavit Hartenberg representation.

The arms have been modeled as a thin rod such that, the coordinate axes of the thin rod are the principal axes of inertia, hence the inertia tensor is in its diagonal form. Furthermore, due to the geometric characteristics of the rod, the moment of inertia associated to the axis of rotation can be neglected.

Figure 3: Simplification as used in Model

Page 3: Report Furuta Pendulum

The coordinate axes have been chosen as are shown in the figure. It also shows the zero angular position (1=0°, 2

To derive the equations of motion of the system a Lagrangian formulation [x] is to be used, hence energies involved in the system need to be computed, which in turn involves the computation of velocities and positions.

=0°).

We need to know centers of mass velocities; first we calculate the velocities of the joints:

Angular velocity of joint 1:

𝜔1 = [0 0 �̇�1]′

Linear velocity of joint 1:

𝑣1 = [0 0 0]′

Rotation matrix of joint 2 relative to joint 1:

𝑅21 = �sin (𝜃2) cos (𝜃2) 0

0 0 1cos (𝜃2) −sin (𝜃2) 0

Position of joint 2 relative to joint 1:

𝑃21 = [0 𝐿1 0]′

Velocities of joint 2 can be derived with the formulas [x]:

Page 4: Report Furuta Pendulum

Angular velocity of joint 2:

𝜔2 = ( 𝑅21 )−1 ∙ 𝜔1 + [0 0 �̇�2]′ = �cos (θ2)�̇�1−sin (θ2)�̇�1

�̇�2

Linear velocity of joint 2:

𝑣2 = ( 𝑅21 )−1 ∙ (𝑣1 + 𝜔1 × 𝑃21 ) = �−sin (θ2)�̇�1𝐿1− cos(θ2) �̇�1𝐿1

0�

Position of joint 3 relative to joint 2:

𝑃32 = [𝐿2 0 0]′

Angular velocity of joint 3:

𝜔3 = 𝜔2 + [0 0 0]′ = 𝜔2

𝑅 is the identity matrix23

Linear velocity of joint 3:

𝑣3 = 𝑣2 + 𝜔2 × 𝑃32 = �−sin (θ2)�̇�1𝐿1

− cos(θ2) �̇�1𝐿1 + �̇�2𝐿2sin (θ2)�̇�1𝐿2

Position of center of mass 1 relative to joint 1:

𝑃 = [0 ℓ1 0]′𝑐𝑚11

Liner velocity of center of mass 1:

𝑣𝑐𝑚1 = 𝑣1 + 𝜔1 × 𝑃 = �−�̇�1ℓ1

00

�𝑐𝑚11

Angular velocity of center of mass 1:

𝜔𝑐𝑚1 = 𝜔1

Position of center of mass 2 relative to joint 2:

𝑃 = [ℓ2 0 0]′𝑐𝑚22

Page 5: Report Furuta Pendulum

Liner velocity of center of mass 2:

𝑣𝑐𝑚2 = 𝑣2 + 𝜔2 × 𝑃 = �−sin (θ2)�̇�1𝐿1

− cos(θ2) �̇�1𝐿1 + �̇�2ℓ2sin (θ2)�̇�1ℓ2

�𝑐𝑚22

Angular velocity of center of mass 2:

𝜔𝑐𝑚2 = 𝜔2

To calculate kinetic energy inertia tensors are needed:

Inertia tensor of arm 1:

𝐽1 = �𝐽𝑥𝑥1 0 0

0 𝐽𝑦𝑦1 00 0 𝐽𝑧𝑧1

� ≈ �𝑗1 0 00 0 00 0 𝑗1

Inertia tensor of arm 2:

𝐽2 = �𝐽𝑥𝑥2 0 0

0 𝐽𝑦𝑦2 00 0 𝐽𝑧𝑧2

� ≈ �0 0 00 𝑗2 00 0 𝑗2

Now energies can be computed.

Kinetic energy of arm 1:

𝑇1 =12𝑚1𝑣𝑐𝑚1𝑇𝑣𝑐𝑚1 +

12𝜔𝑐𝑚1

𝑇𝐽1𝜔𝑐𝑚1 =12

�̇�12(𝑚1ℓ1

2 + 𝑗1)

Potential energy of arm 1:

𝑈1 = 0

Kinetic energy of arm 2:

𝑇2 =12𝑚2𝑣𝑐𝑚2𝑇𝑣𝑐𝑚2 +

12𝜔𝑐𝑚2

𝑇𝐽2𝜔𝑐𝑚2

=12

�̇�12�𝑚2𝐿12 + sin(𝜃2)2 (𝑚2ℓ2

2 + 𝑗2)� +12

�̇�22�𝑚2ℓ2

2 + 𝑗2� − �̇�1�̇�2𝑚2cos (𝜃2)𝐿1ℓ2

Position of center of mass 2 relative to origin:

𝑃 = �ℓ2 cos(𝜃1) sin(𝜃2) − 𝐿1sin (𝜃1)ℓ2 sin(𝜃1) sin(𝜃2) + 𝐿1cos (𝜃1)

ℓ2cos (𝜃2)�𝑐𝑚2

0

Potential energy of arm 2:

Page 6: Report Furuta Pendulum

𝑈2 = 𝑚2𝑔ℓ2 + 𝑚2�̅� 𝑃𝑐𝑚20 = 𝑚2𝑔ℓ2(1 + cos (𝜃2))

The total kinetic energy is:

𝑇 = 𝑇1 + 𝑇2 =

12

�̇�12�𝑚1ℓ1

2 + 𝑗1 + 𝑚2𝐿12 + sin(𝜃2)2 (𝑚2ℓ22 + 𝑗2)� +

12

�̇�22�𝑚2ℓ2

2 + 𝑗2� − �̇�1�̇�2𝑚2cos (𝜃2)𝐿1ℓ2

The total potential energy is:

𝑈 = 𝑈1 + 𝑈2 = 𝑚2𝑔ℓ2(1 + cos (𝜃2))

The Lagrangian is:

𝐿 = 𝑇 − 𝑈 =

12

�̇�12�𝑚1ℓ1

2 + 𝑗1 + 𝑚2𝐿12 + sin(𝜃2)2 (𝑚2ℓ22 + 𝑗2)� +

12

�̇�22�𝑚2ℓ2

2 + 𝑗2� − �̇�1�̇�2𝑚2 cos(𝜃2) 𝐿1ℓ2− 𝑚2𝑔ℓ2(1 + cos (𝜃2))

The equation of motion of joint 1 is:

𝑑𝑑𝑡�𝜕𝐿𝜕 �̇�1

� −𝜕𝐿𝜕 𝜃1

+ 𝑏1 �̇�1 = 𝜏1

This yields:

�̈�1(𝑚1ℓ12 + 𝑗1 + 𝑚2𝐿12 + sin(𝜃2)2 (𝑚2ℓ2

2 + 𝑗2)) − �̈�2(𝑚2 cos(𝜃2) 𝐿1ℓ2)+ �̇�2

2𝑚2 sin(𝜃2)𝐿1ℓ2 + �̇�1�̇�2sin (2𝜃2)(𝑚2ℓ22 + 𝑗2) + 𝑏1 �̇�1 = 𝜏1

The equation of motion of joint 2 is:

𝑑𝑑𝑡�𝜕𝐿𝜕 �̇�2

� −𝜕𝐿𝜕 𝜃2

+ 𝑏2 �̇�2 = 𝜏2

This yields:

−�̈�1(𝑚2 cos(𝜃2) 𝐿1ℓ2) + �̈�2�𝑚2ℓ22 + 𝑗2� −

12

�̇�12 sin(2𝜃2) (𝑚2ℓ2

2 + 𝑗2) −𝑚2𝑔ℓ2 sin(𝜃2) + 𝑏2 �̇�2 = 𝜏2

Making the following substitutions (parallel axis theorem):

Page 7: Report Furuta Pendulum

𝐽1 = 𝑚1ℓ12 + 𝑗1

𝐽2 = 𝑚2ℓ22 + 𝑗2

𝐽0 = 𝐽1 + 𝑚2𝐿12

The simplified equations of motion are:

�̈�1�𝐽0 + 𝐽2 sin(𝜃2)2� − �̈�2�𝑚2 cos(𝜃2) 𝐿1ℓ2� + �̇�22𝑚2 sin(𝜃2)𝐿1ℓ2 + �̇�1�̇�2 sin(2𝜃2) 𝐽2 + 𝑏1 �̇�1 = 𝜏1

−�̈�1�𝑚2 cos(𝜃2) 𝐿1ℓ2� + �̈�2𝐽2 −12

�̇�12 sin(2𝜃2)𝐽2 − 𝑚2𝑔ℓ2 sin(𝜃2) + 𝑏2 �̇�2 = 𝜏2

Separating �̈�1 and �̈�2 and rearranging terms yields:

�̈�1 = ⎣⎢⎢⎢⎢⎢⎡ 𝑏1𝐽2

𝑏2�𝑚2𝐿1ℓ2 cos(𝜃2)�

𝐽22 sin(2𝜃2)

− 12 𝐽2𝑚2𝐿1ℓ2 cos(𝜃2) sin(2𝜃2)

𝑚2𝐿1ℓ2𝐽2 sin(𝜃2) ⎦⎥⎥⎥⎥⎥⎤

⎣⎢⎢⎢⎢⎡ �̇�1

�̇�2�̇�1�̇�2 �̇�1

2

�̇�22 ⎦⎥⎥⎥⎥⎤

+ �−𝐽2

−𝑚2𝐿1ℓ2 cos(𝜃2)

−12𝑚2

2 ℓ22𝐿1 sin(2𝜃2)

� �𝜏1𝜏2𝑔�

𝑚22 ℓ2

2𝐿12 cos(𝜃2)2 − �𝐽0 + 𝐽2 sin(𝜃2)2�𝐽2

�̈�2 = ⎣⎢⎢⎢⎢⎢⎡ −𝑏1𝑚2𝐿1ℓ2 cos(𝜃2)

−𝑏2�𝐽0 + 𝐽2 sin(𝜃2)2�

−𝐽22𝑚2𝐿1ℓ2 cos(𝜃2) sin(2𝜃2)

12 𝐽2 sin(2𝜃2)�𝐽0 + 𝐽2 sin(𝜃2)2�

−12𝑚2

2 ℓ22𝐿12 sin(2𝜃2) ⎦

⎥⎥⎥⎥⎥⎤

⎣⎢⎢⎢⎢⎡ �̇�1

�̇�2�̇�1�̇�2 �̇�1

2

�̇�22 ⎦⎥⎥⎥⎥⎤

+ �𝑚2𝐿1ℓ2 cos(𝜃2)�𝐽0 + 𝐽2 sin(𝜃2)2�

𝑚2ℓ2 sin(𝜃2)�𝐽0 + 𝐽2 sin(𝜃2)2�� �𝜏1𝜏2𝑔�

−𝑚22 ℓ2

2𝐿12 cos(𝜃2)2 + �𝐽0 + 𝐽2 sin(𝜃2)2�𝐽2

Linearization of the nonlinear model

The last equations are nonlinear, they are correct but they are not suitable for the controller design, because the controller deals with linear equations, hence a linearization is needed.

A Taylor linearization is employed and is about the fixed point 2

The basic procedure is to use a linear equation derived from the linear terms in a Taylor series expansion (high order terms are neglected) about the fixed point [x]:

𝑓(�̅�) ≈ 𝑓(�̅�) + ∇𝑓|𝑝(�̅� − �̅�)

= 0°. At that point the system must be stabilized (after the swing up).

Where,

Page 8: Report Furuta Pendulum

�̅� is the vector of variables

�̅� is the fixed point

Applying the previous formula to our nonlinear equations and considering 2 additional states (1, 2

Where,

𝐴32 =𝑔𝑚2

2𝑙22𝐿1

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

𝐴33 =−𝑏1𝐽2�

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

𝐴34 =−𝑏2𝑚2𝑙2𝐿1

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

) yields to the following state space representation:

⎣⎢⎢⎢⎡𝜃1̇𝜃2̇�̈�1�̈�2⎦⎥⎥⎥⎤

= �

0 0 1 00 0 0 10 𝐴32 𝐴33 𝐴340 𝐴42 𝐴43 𝐴44

⎣⎢⎢⎡𝜃1𝜃2𝜃1̇𝜃2̇⎦⎥⎥⎤

+ �

0 00 0𝐵31 𝐵32𝐵41 𝐵42

� �𝜏1𝜏2�

𝐴42 =𝑔𝑚2𝑙2𝐽0�

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

𝐴43 =−𝑏1𝑚2𝑙2𝐿1

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

𝐴44 =−𝑏2𝐽0�

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

𝐵31 =𝐽2�

𝐽0�𝐽2� − 𝑚22𝑙2

2𝐿12

𝐵32 =𝑚2𝑙2𝐿1

𝐽0�𝐽2� − 𝑚22𝑙2

2𝐿12

𝐵41 =𝑚2𝑙2𝐿1

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

𝐵42 =𝐽0�

𝐽0�𝐽2� −𝑚22𝑙2

2𝐿12

Page 9: Report Furuta Pendulum

http://www.ece.jhu.edu/~pi/Courses/454/NotesA.pdf

An accurate model of the furuta pendulum has yet to be agreed upon. Even though the subject has been under study for a considerable time, yet due to the non-linear nature of the pendulum the system dynamics have been a problem. The model used here has been developed at the University of Adelaide, Australia. Some changes were made n the model, as will be discussed later. The model simulates the system dynamics of the pendulum with a complete inertia tensor by Lagrangian formulation. From that governing equations of the pendulum are derived.

The lengths and mass of the arms were measured from the pendulum. In order to make the model as in figure 2, the masses were lumped. This was done using the moments of inertia concepts. The calculations are done in the matlab file named ‘ParamsReal_edited’.

Figure 4: Furuta Pendulum

Free fall Test:

The model is found with viscous damping caused by the friction of the bearings. However we do not have the values of this damping. In order to have a model we are required to find a method to find these values.

The free fall tests are a simple and effective means of finding these values. Tests of this nature can only be validated if they are reproducible, so we needed an effective reference point from where we could start the free motion of the pendulum. Inverting the pendulum to its topmost position is an effective strategy. It also induces a motion on the horizontal arm so we can use it to find the damping of both arms.

A test response was taken by recording readings of the free fall. This response was then imitated by varying values of damping for both arms and simulating the model in Matlab. This gave us the required values.

Page 10: Report Furuta Pendulum

It must be noted however that the time period of these vibrations will vary and this will depend on the length of the pendulum and the masses attached. This fact will be useful at the end of the report.

Model Normalization:

The model uses some simple assumptions for its formulation. One of these assumptions is that the masses are considered to lumped masses.

In order to accomplish this we need to normalize the model according to the real model. This is done by equalizing the real system as shown in Fig. 1 to that of the system as in Fig. 2.

To accomplish this we have to find the corresponding masses and lengths of Fig.1 from the given values of Fig.1. We also need to find the moment of inertia of the arms with these lumped masses and corresponding lengths.

Fig. 1 Fig. 2

Page 11: Report Furuta Pendulum

The Moments of inertias are calculated according to their respective axis. However we need them to be about their pivot points. We use the parallel axis theorem to find this value.

The parallel axis theorem states that if we have the moment of inertia ‘I’ of a body of mass ‘M’ about some axis, the moment of inertia of the body about another parallel axis, separated by a distance ‘d’ is given by

𝐼𝑐𝑚 = 𝐼 + 𝑀𝑑

Using this theorem we find the expression of the moments of each arm at the pivots as a function of the lumped masses ‘m’, distances separating the axes ‘l’ and moments at original axes ‘J’. Thus we have the moment of arm 1 and 2 as

𝐽1� = 𝐽1 + 𝑚1𝑙12

𝐽2� = 𝐽2 + 𝑚2𝑙22

And the total moment that is acting on the origin as in the Fig. 2 is as follows

𝐽0� = 𝐽1 + 𝑚1𝑙12 + 𝑚2𝐿12

This is important as we want to have the mass as a variable and not fixed value. We will need this because we want the system to be able to adjust itself to a variation in the masses and lengths of the pendulum. Thus increasing the robustness of the system.

Procedure

We used the nonlinear model from the said paper. To check if the model is working properly we made some checks using small displacements for both angles. At first the system showed an unstable behaviour. Upon deriving the equations a change of sign was found in the model with respect to θ̇12 Changing the sign made the system stable.

After the implementation of the model we needed to apply the controller. The controller could only be applied at the linear range, so we had to choose a smaller operating range for it.

The objective of the pendulum is to stay in the inverted position, so the fixed point was made to be at 180° from the rest position. An energy based controller was made to swing the pendulum and increase the

Page 12: Report Furuta Pendulum

amplitude. Once the pendulum got close to the top the LQR controller was switched on. This was used to fine tune the control input and steady the pendulum at the top position.

Controllers

As mentioned before the goal is to keep the furuta pendulum in the upward position. In order to achieve this, two controllers were implemented, one to swing the arm of the pendulum until it reached a position close enough to the inverted position and the second to keep it in the upward position in spite of perturbations. For the first an energy controller was implemented, while for the latter an LQR controller was chosen.

Energy Controller

Before stabilizing the pendulum, it must be in the stabilizing region. The energy controller drives the pendulum from the downward (initial) position to close to the upright position and with a sufficiently small velocity, conditions preferred to be able to switch to the stabilizing controller, in order to have a more accurate performance, thus the pendulum can be stabilized.

How does the energy controller works?

The energy controller does not work in the entire domain of 2 (the work region can be selected), the objective is to let the energy controller dominate in the non linear region (green region), and accomplish stabilization by the LQR controller (blue region, small 2

The energy controller makes the pendulum oscillate (in the green region) until a desired level of energy is reached, given only by the potential energy (we desire a zero velocity) of the upright position.

).

When the pendulum is about to enter the blue region, the energy controller switches off automatically, letting the stabilizing controller works. If a disturbance forces the pendulum again to the green region, the energy controller switches on and it will drive the pendulum again to the blue region

The controller scheme is shown in figure 4:

As we can see, the input data are the state variables (1

Inside the “Treshold” block, we can specify the region in which the energy controller will be switched on/off.

is not involved because potential energy of Arm 1 is 0), an “Energy reference” value which is the desired value of energy to achieve, and a constant gain “K”, which just multiply the output in order to have a stronger/weaker control signal.

Figure 5: Working region of the controller

Page 13: Report Furuta Pendulum

Inside the “Energy controller” block we find

Figure 7: Energy Controller block

The control law is given by:

𝑢 = 𝑘 ∗ 𝑠𝑖𝑔𝑛(𝐸𝑜 − 𝐸) ∗ �̇�2cos (𝜃2)

The control law it is composed by 3 important parts:

A constant gain k, which just “amplifies” the control signal to make it sufficiently strong, this value is tunable.

The direction of the controller is given by the sign of an error signal. At each sample instant the energy of the system is computed, then the error signal is calculated and the sign is extracted. Generally this sign is positive (because most of the time the pendulum is below the desired energy level).

A variable gain given by �̇�2cos (𝜃2), which tells the controller when to swing, i.e. the sign of the product of the cosine and the velocity “tells” if the controller has to “push or pull” to make the pendulum swing. The change between “pulling and pushing” occurs when the velocity goes from negative to positive or viceversa, or when the pendulum moves from the lower region to the upper region or viceversa (change in the sign of the cosine).

Figure 6: Controller scheme

Page 14: Report Furuta Pendulum

In figure 8 we can see the energy behavior, the blue line is the desired value to achieve, and the red one represents the actual energy of the system.

We can notice that at the beginning, the energy is swinging (as pendulum does) and little by little it reaches de desired level, but it has an overshoot (due to the high velocity of 2

), but it recovers itself and drives the pendulum again to the desired value without overshoot and now the LQR controller can be switched on.

Stabilizer Controller

Once the energy controller has brought the arm near the upright position the next step is to activate a second controller which will maintain the pendulum in such position. For this purpose an LQR controller was implemented.

Linear Quadratic Regulator (LQR)

The LQR is an optimal control technique which objective is to find a control input which brings the system back to its equilibrium as quickly as possible but with reasonable control effort. One way to achieve these requirements is evaluating a cost function with the following form.

𝑉 = ∫ (𝑥𝑇𝑄𝑥 + 𝑢𝑇𝑅𝑢)𝑑𝑡∞0 (X)

Where 𝑥 refers to the state variables of the system, 𝑢 the control input, Q is a symmetric, positive semi-definite matrix which determines the weight of each of the state variables and R is the penalization of the system’s control effort. The values of the Q and R matrices should be chosen such that they meet the energy, velocity and final equilibrium position requirements. The result of minimizing the cost function is a full state feedback gain and the control input takes the form

𝑢𝑜𝑝𝑡(𝑡) = 𝑓𝑥(𝑡)

Where 𝑓 refers to a static optimal state feedback gain.

Some advantages of this technique are that the controller is easy to implement, the gains are easy to calculate using a numerical computational program such as MATLAB and robustness is similar to a PID controller. On the other hand one of its disadvantages is that it assumes that all the states are available for feedback, which is usually not the case due to lack of sensors. To overcome this physical limitation an observer will be later designed.

LQR Design

As already mentioned before the state feedback gains is obtained by minimizing (XX). For this purpose we need the linearized model of the pendulum (see chapter XX).

Figure 8: Energy Behavior

Page 15: Report Furuta Pendulum

The next step is to define the effort weighting matrix and the control input penalization. Once these two matrices are defined we can minimize the cost function either by solving the Ricatti Equation or using a numerical computing environment such as MATLAB. For this case MATLAB was used and both matrices were defined as follows:

𝑄 = �

500 0 0 00 1000000000 0 00 0 85000 00 0 0 40000000

𝑅 = 10000

With both matrices and the linearized model loaded in the MATLAB workspace we can use the “lqr” command as follows

K=LQR(A,B,Q,R);

In this case this yields the following result.

𝐾 = [0.2236 −367.3225 3.4294 −67.7390]

Finally a simulation was performed to validate the performance of the controller. The following image shows the response of the controller when applied an initial condition giving an acceptable response of the controller.

Figure 9: Simulation of the LQR controller

Problems encountered

Page 16: Report Furuta Pendulum

During the LQR design some minor problems were faced. This method provides an easy and straightforward way to compute the gains of the feedback loop; nevertheless the selection of the weighting matrix Q and the control input penalization R weren’t that straightforward to choose because the matrices don’t directly reflect how much they actually affect the dynamics of the system, contrary to other methods, like pole placement for example.

To solve this, the matrices were initially proposed on an initial guess and with the help of the “initial” command in MATLAB the response of the system was simulated. Based on the simulated results we were able to tune the matrices in order to achieve a better performance for the controller.

State Observer

As discussed before due to the lack of velocity sensors an observer has to be implemented. An observer is basically a model of the real system that provides an estimation of the internal states given the input and the output of the system. A typical example of a system diagram for an observer is shown below.

Figure 10: Observer-based state feedback [XX]

Where the elements inside the dashed rectangle belong to the plant while the rest of the elements belong to the observer.

State Observer Design

To design the observer for the furuta pendulum the first step is to define the system matrices for the observer. The matrices were defined as follows

𝐴𝑜 = 𝐴

𝐵𝑜 =𝐵

100

Page 17: Report Furuta Pendulum

𝐶𝑜 = �0 1 0 01 0 0 0�

In this case 𝐵𝑜 is defined as B/100 because the DS1104 interface amplifies the output 10 times and also because we want to make the observer faster than the plant itself.

In the case of 𝐶𝑜, it was defined as such because only two states out of the four were required. In this case we are interested in the positions so we can subtract them from the measured ones. The result is the error between the actual plant values and the calculated from the observer, giving a correcting term to the controller.

Now that the matrices are defined the next step is to calculate the observer gain, but for that we need to make the observer dynamics faster than the plant dynamics, therefore we first compute the real poles of the system with the state feedback implemented and from those poles we can place the observer poles farther to the left in order to have an aggressive controller and assure that the observer can react correctly to disturbances. For such task we can use the following MATLAB command

P=min(real(eig(Ao+Bo(:,1)*k)));

Next we compute the desired observer poles from the smaller system pole. To assure that the observer will be faster than the plant we place the observer poles two times farther with the following command

Po=2*P*ones(1,4)-[0 1 2 3]*1;

Finally with the aid of pole placement we compute the observer gain and we get the following results

L=-place(A0’,Co’,Po)’;

𝐿 = �

−0.1502 0.00950.0106 −0.1472−5.5518 0.64840.7937 −5.4322

� 𝑥103

The observer along with the observer gains were implemented in Simulink as follows.

Page 18: Report Furuta Pendulum

Figure 11: Simulink model of the observer