Control Design of an Inverted Pendulum on a Moving Base Using State Feedback

A fascinating and essential control problem for researchers is the inverted pendulum. It remains a generally accepted standard used in control and robotics for validation of emerging control technologies. A mathematical model of the inverted pendulum on a moving base system was derived, an expression of the linearised state space representation of the system was also presented, a controller to achieve specific criterion of the steady state error, rise and settling time, and was obtained, an implementation of this control on MATLAB was carried out together with the simulated animation of the system using Simulink and Simscape.


Introduction
The inverted pendulum is one in which the mass center is beyond the fulcrum position.The structure is inverted ණ from its equilibrium position, with a solid rod and held firmly at its pivot.It is generally unstable without control.It is the most popular standard used in nonlinear control to authenticate the effectiveness of developing control technologies and substantiate their execution [1] .To achieve inverted pendulum control, a feedback system for control is adopted, which records angle of the pendulum and changes the pivot point sideways to effect corrective action.The inverted pendulum remains a conventional problem in control.It has many variations such as the rotational inverted pendulum [2], a moving base inverted pendulum [3], triple inverted pendulum [4], the parallel type dual system [5], the quadruple type [6], and the spherical pendulum-type [7].Other examples of the inverted pendulum comprise the human body, the central component in the design of early seismometers.In the recent past, it is used in robotics, personal transporters such as scooters that selfbalance and electric unicycles [7].
In this paper, a mathematical model using a representation in state space of inverted pendulum on a moving base was achieved, and controller design using state-space was implemented with MATLAB.The simulated open-loop and closed loop simulation of inverted pendulum using Simulink and Simscape were obtained.The significance of this work is to provide a comprehensive study of the full state feedback control design for an inverted pendulum system on a moving base.Control design has been used in several mechatronics and robotics [8] applications and is, therefore, an integral component in the design of any structure, be it electrical, mechanical or structural [9].
The rest of this article is as follows; materials and methods which contained mathematical modelling and state-space representation, controller design and implementation on MATLAB and simulation of an inverted pendulum on Simulink and Simscape.Next section is the results and discussion and conclusion.

Mathematical model and State-space Representation of Inverted Pendulum Structure on a Moving Base:
Figure 1 illustrates the basic structure of an inverted pendulum structure on a moving base.Where . is the base mass, is the pendulum mass, the frictional coefficient of the moving base, is the pendulum length with respect to mass center, represents the pendulum's moment-of-Inertia.A Force, is given to the base which causes the structure to move by a distance .The angle of the pendulum measured from the vertical is given by The summation of all the horizontal forces in the FBD of Fig. 1 will result in equation ( 1) The reaction force, is obtained as shown in equation 2.

c th t
The perpendicular forces to the pendulum are added up to yield equation ( 4).

th th t
P and N terms of equation 4 are eliminated to give rise to equation ( 5).

th t
The combination of equations 4 and 5, gives equation 6

Transfer Function:
The Laplace transformations of equations 10 and 11 give: The output is Φ(s) while the input is .is obtained as: Equation 14 is substituted into equation 13 to give: The transfer function with the position as the output can be obtained in a comparable fashion to give rise to equation 19.

Representation in State-Space:
The equations describing the inverted pendulum are nonlinear.A linearised state space representation is derived as shown in the following subsections.

Derivation of State -Space and Output Equations
Chosen states are

Design Assumptions
The following design specifications are given for the inverted pendulum:  ⺂ for the base position, x and pendulum angle, should be less than 5s  ⺂ for the base position, x must be less than 0.5s  must be less than 20 0 (or 0.35rad)  Ͳ should not be greater than 2% for base position and pendulum angle

State-space controller design dynamic equations
The state space equations of the inverted pendulum system with operating parameters substituted into equations ( 19) and ( 20) is shown in equation 21;

State feedback Design
The control system with k being the matrix of control gain is shown in Fig 2 .IOP Publishing doi:10.1088/1757-899X/1107/1/012064 The system's open-loop poles were determined.From the results, there was a positive pole which confirms that the open loop response is unstable.Next, a check of the controllability of the system was carried out.Results showed that the system is controllable (Controllability of 4 which is equivalent to the number of control states).

The Linear Quadratic Regulator (LQR)
The LQR was utilised to find the gain (k matrix) and plot its step response.Different values of Q were tested and plotted to give the resulting step response.

Adding a Pre-Compensator
The schematic diagram of the inverted pendulum with pre-compensator added is as shown in Fig 3.
IOP Publishing doi:10.1088/1757-899X/1107/1/012064The value of was computed.The step response plot of the inverted pendulum with compensator and LQR was obtained.

Observer-Based Control
The observability of the system was checked for with selected observer poles at -40, -41, -43, -44 (about 4 times higher values).The state-feedback of the controller is then combined with the state estimator to get full compensation as shown by the matrix equations 14 and 15; This was implemented in MATLAB with the step response plot.

Simulink Modelling
The arrangement is indicated in Figure 4.Here the input force makes the base to move in the horizontal direction and (angular position and the base horizontal position ).Next, the above equations were modelled with Simulink, as shown in section 2.5.3.

Building the Nonlinear Model with Simulink
Using Simulink, the above equations were modelled into four function blocks (Figure 5).The initial condition of the inverted pendulum ( ) was set to t t to signify the inverted pendulum starts directed upwards.The mux block has its number of inputs increased from 2 to 3 to accommodate the set requirements.Finally, a subsystem of the first model shown in Figure 5b was created from that of Figure 5a The non-linear model was also designed in Simscape, thereby enabling viewing of the animation.The Simscape model was constructed after updating Simscape multibody first Generation 1G add-on in MATLAB.The resulting model and its equivalent subsystem model are as shown in Figure 6.
Figure 6: Non-linear model with Simscape The base block was given the following parameters; mass = 0.5kg, Inertia = eye(3) and 3 ports were enabled.The pendulum block was given the following, mass = 0.2kg, Inertia =0.006.eye(3) with one port allowed.Other blocks were connected as shown in Figure 6a.

Generating the open-loop response
An impulse function was generated, and a scope was used to observe the output.The pulse generator block was configured to Amplitude of 1000, pulse width set to 0.01% of the period and period of 10s. Figure 7 shows the connection.

Results /Discussions
The MATLAB code for the system is represented in Figure 8.   From Figure 10, one of the poles is positive meaning that the system is naturally unstable.The check for controllability of the system results in a value of 4, indicating that the system is CC. Figure 11 shows the response of the system to a step input.The open loop response of the simulation on Simscape and Simulink is shown in Figure 11.As expected, the system is unstable and therefore requires control action in order to achieve stability.
The animation of the closed loop simulation is given in Figure 12.The system was stable after the application of the state-space control design.

Conclusion
In this work, a mathematical model for an inverted pendulum on a moving base was established, which is naturally unstable without control and obtained its transfer function in both time and frequency domain and its state-space representation and implementation in MATLAB.A state-space controller for this generally accepted benchmark of dynamics and control was designed.Using Simulink and Simscape the simulation and animation of the system on a moving base with both openloop and closed-loop state-space controlled system was carried out.The necessary mathematical relationships were analysed.The design specifications of reducing the time ⺂ for the base parameter and the pendulum angle to ; reducing the rise time for the base position to less than 0.5s; setting the angle of the pendulum to be less than 20 0 and minimising the error, Ͳ of base parameter and pendulum angle to ch was satisfied.Future work will include control design of the same system on a rotating base.
6 are linearised about the vertical equilibrium position, t .The approximations of the equations are obtained:The substitutions of eqs 7 -9 in the nonlinear equations gives the linearised equations of motion with replacing F are derived

Figure 4 :
Figure 4: Schematic of the system From Fig 4, it can be seen that the base and the pendulum possess a single-degree-of-freedom h㌠ .Using the second Newton equation of motion t , the following are gotten:

Figure 5 :
Figure 5: The Non-linear model with Simulink

Figure 8 :
Figure 8: MATLAB code for the systemThe representation of the system in state space is seen in Figure9

Figure 9 :
Figure 9: MATLAB code for state-space representation

Figure 10 :
Figure 10: Impulse and step response of the state space model Figure 11: Step Response Position of the moving base in the horizontal direction,