Application of LQR Full-State Feedback Controller for Rotational Inverted Pendulum

The rotational inverted pendulum is an interesting subject for some researchers, especially control engineers. Its nonlinear and underactuated characteristic make it quite challenging to stabilize it. Hence, a proper control law is a must to make it stable. Here, in this paper, we present a control law using LQR (Linear-Quadratic Regulator) to stabilize the rotational inverted pendulum. The experiments are carried out by linearizing the model and simulate the response in MATLAB. The results show that the controller succeeds to stabilize the states of rotational inverted pendulum to their respective equilibrium points. Even more, it provides zero settling errors.


Introduction
Over the years, the inverted pendulum has been an interesting topic for many researchers, especially in control engineer. It is due to its nonlinearity and unstable behavior. Therefore, in order to stabilize it, we need to design a proper controller [1]. There are some approaches to design the controller, either using linear or nonlinear methods [2]. Codrons et al. [3] and Morimoto et al. [4], have designed a nonlinear controller for an inverted pendulum. Meanwhile, Sugie et al. [5] and Renou et al. [6] are applying linearization method to design the controller.
Unlike the linear controller, the nonlinear one is quite difficult to design. Nevertheless, we need to linearize the model before designing the controller. Here, we utilize Linear-Quadratic Regulator (LQR), a linear controller, to stabilize the rotational inverted pendulum with some advantages. First, LQR is such an optimal controller that can provide not only a good stability, but also the stability margin of a system is guaranteed [7]. It provides a better optimal energy compared againts PID and fuzzy controller [8]. Next, we do not need to do the loop-shaping to obtain the gain parameters. Lastly, it can work on Single-Input Multi-Output (SIMO) systems, which necessary for our rotational inverted pendulum.
Practically, the rotational inverted pendulum as depicted in Figure 1, is an underactuated system. It means, the number of degree-of-freedom (DoF) that needs to be controlled, is more than the number of actuators. Meanwhile, if those numbers are equal, thus the system is fully actuated. Despite the difficulties to stabilize it, the underactuated systems have some advantages over the other one. Their main advantages are the control efforts and energy consumption which are relatively lower than the fully actuated systems. Technically speaking, there are three main parts of rotational inverted pendulum, they are motor, rotational arm, and the pendulum [9]. The rotational arm can be fully rotated on a horizontal plane since it is connected to the motor shaft. Meanwhile, the pendulum is connected to the other end of the arm. It makes the pendulum can be rotated vertically.
It is necessary to mention that this research is conducted by modeling the rotational inverted pendulum, then designing the controller using Matlab. Furthermore, the organization of this paper is as follows. It has mentioned before, that the model of rotational inverted pendulum is necessary, and it is elaborated in Section 2. Later, in Section 3, the design of the controller is presented. The results and analysis of the controller can be seen in Section 4. Lastly, the conclusion of this paper can be found in Section 5.

Model of Rotational Inverted Pendulum
In this section, there are two main topics that will be presented. First, the nonlinear equations of the model can be found in Subsection 2.1. Next, we take linearization into account, it is briefly explained in Subsection 2.2.

Nonlinear Equations
We can use Euler-Lagrange equation to obtain the nonlinear model of the system as = ( sin( ) cos( )̇2 + sin( )) , where respectively θ and α are the pendulum and rotating arm angle. Meanwhile, I, m, l, R, u, and g that consecutively denote moment inertia of the DC motor, mass of the pendulum, length of the pendulum, length of the arm, input torque, and gravity constant.
where the states be

Linearization
In order to design a linear controller, we need to linearize those equations. We decide the equilibrium points such as the state vector x = [0 0 0 0] and the input torque u = 0, then it can be linearized as Respectively the state matrix and input vector can be denoted as where b is viscous coefficient. As for the output we have = where the output matrix be

Controller Design
LQR is an optimal control that offers the robustness of a system with small steady state errors [10]. The block diagram of a full-state feedback controller can be seen in Figure 2. As an optimal control, it comes with a cost function such as that must be minimized. In our case, we have four states and one input, therefore Q is a 4-by-4 matrix, meanwhile R is a scalar. Both Q and R affect differently towards gain feedback K. We can obtain a larger gain feedback K by increasing Q. On the other hand, by assigning a larger value of R, we can obtain a smaller gain feedback K [10]. Next, we need to find an auxiliary matrix S by solving this Algebraic Ricatti Equation (ARE) where The auxiliary matrix S is needed to determine the gain feedback K such as

Results and Discussion
This section covers the results of this paper, including the parameters and its analysis. The parameters of rotational inverted pendulum used in this paper is presented in Subsection 4.1. Then, in Subsection 4.2 we will elaborate system response with fully-state feedback controller.

System Parameters
Before any further, we need to define the parameters used in this simulation. Consecutively, we have m, l, R, I, and b that denote mass of the pendulum, length of the pendulum, length of the arm, and viscous coefficient. Those are based on the previous research conducted by Cahyadi et al. [1], meanwhile as for the gravity constant we have g = 9.8ms −2 .

Simulation and Analysis
First we can analyze the stability of the open-loop system. Let us substitute those values on Table 1  (20) Indeed, Co is a 4-by-4 matrix, that corresponds to the number of state variables. Here, we have the rank of Co = 4, it means that the system is controllable.
After investigating the controllability of the system, we can move further to design a proper control law to make it stable. In order to design a control law using LQR, first we have to decide both Q and R. Here, we have (22) We chose those values to obtain an appropriately small feedback gain K that leads to a lower energy drive. Even though it will take longer settling time, the sparseness and small values of Q can give us zero settling error [10]. Since the feedback gain has been obtained, we can define the control law for the full-state feedback system in Figure 2 as It takes almost 4 seconds for the controller to regulate the pendulum angle from the initial condition at θ0 = 0.5rad to the equilibrium at θd = 0rad. Nevertheless, it succeeds to reach the equilibrium without settling error. In corresponds to the pendulum angle, we have the angle rate θ˙ as shown in Figure 4. Initially, we have angle rate 0 = 0 / . We can see that if the angle rate ̇ is turning to negative values, then θ will follow, and vice versa. It is apparent that θ˙ will change over the time until the pendulum angle settling at θd = 0rad. It is also worth to be mentioned that the angle rate indicates the direction of rotation, either it is clockwise or counterclockwise.
In our case, if the angle rate has negative values, it is supposed to rotate clockwise. On the contrary, it will rotate counterclockwise when the angle rate is positive. Just like the pendulum angle, the arm angle also affected by the changes on its rate. Here we have the response of arm angle α and its rate ˙α as illustrated in Figure 5 and Figure 6.  At first, we have the initial arm angle at = 0.4rad, meanwhile ̇ = 0rad/s. It indicates that at the beginning the arm angle α is stand still, does not move. To regulate the arm angle α to its equilibrium at αd = 0rad, then it needs to rotate. Therefore, as long as α has not settle the equilibrium, then the arm angle rate ̇ is not supposed to be 0rad/s. Eventually, both of them prevail to settle at their equilibrium points in 3 seconds.
Inspite that the responses are quite slow, it can still be tolerated. The settling times for both θ and α are not our main concern here. It is due to the fact that the controller is designed to stabilize the states to their equilibrium points with zero settling error.

Conclusion
The rotational inverted pendulum is an underactuated system that cannot be made stable by its mechanical structure. Therefore, we need a proper control law to make it stable. In this paper we present the design of LQR controller for rotational inverted pendulum by considering the sparseness and small value of Q. Although the response is supposed to be slower, but it can give us zero settling error. The experiments are conducted by employing Matlab to simulate the response of the system with our proposed controller. The results verify that the proposed controller can be used to stabilize the pendulum and arm angle to their respective equilibrium. Respectively, it takes around 3 and 4 seconds to stabilize