Linear single-stage inverted pendulum control based on LQR
2026-04-06 07:38:27··#1
Abstract: Based on the mathematical model of the inverted pendulum system, the performance of the system is analyzed. An optimal controller based on LQR is designed for the single-stage inverted pendulum and applied to the actual control of the inverted pendulum, achieving good real-time control results. Keywords:LQR , Inverted Pendulum, Real-time Control 0 IntroductionThe inverted pendulum system is a nonlinear, strongly coupled, multivariable, and naturally unstable system. The Linear Quadratic Regulator (LQR) problem occupies a very important position in modern control theory. Because the performance index of linear quadratic (LQ) is easy to analyze, process and calculate, and the control system obtained by the optimal design method of linear quadratic has good robustness and dynamic characteristics, linear quadratic has been widely valued in the control field. Using LQR to make the optimal control system of the inverted pendulum, and starting from the real-time control effect, 1 Analysis of the inverted pendulum system The single-stage linear inverted pendulum GIP-100-L developed by Shenzhen Gogo Company is a single-input multi-output fourth-order control system, and its structure is shown in Figure 1. [align=center] Figure 1 Composition of the inverted pendulum system[/align] 1.1 Model of the inverted pendulum system Force analysis of the inverted pendulum system[1] can be obtained as the state space expression of the system: 1.2 Stability analysis of the inverted pendulum system Step response analysis of the inverted pendulum system described by equation (1)[2]. The step response curves of the trolley displacement and the pendulum angle are shown in Figure 2 and Figure 3. [align=center] Figure 2 Step response curve of the trolley displacement Figure 3 Step response curve of the trolley angle[/align] The trolley displacement and the pendulum angle are divergent, and the inverted pendulum system is unstable. 1.3 Controllability analysis of the inverted pendulum system The controllability of the system is the premise of the controller design. From the controllability matrix M=[B AB …A[sup]n-1[/sup]B ], the ctrb command of the controllability matrix in MATLAB is used to calculate, and Rank(M)=4, so the system is controllable. 2 LQR controller design 2.1 Quadratic optimal control principle Let the state equation of the given linear time-invariant system be a quadratic performance index function[3]: Where: the weighting matrix Q and R are used to balance the weights of the state vector and the input vector, Q is a positive semi-definite matrix, and R is a positive definite matrix. Optimal control law: Where: K is the optimal feedback gain, and P is the solution of the Riccati matrix equation. Riccati matrix equation: Then, the optimal feedback gain K is: 2.2 LQR parameters are obtained by using the MATLAB statement K=lqr(A,B,Q,R) and taking Q=diag(1000,0,70,0), which gives K=[-31.623,-20.151,72.718,13.155], which is the LQR controller parameter[5]. 3 System simulation and actual control 3.1 System simulation The simulation model shown in Figure 4 is built in the MATLAB/Simulink environment[4]. [align=center] Figure 4 Simulation model[/align] The running results are shown in Figure 5: [align=center] Figure 5 Simulation results[/align] As can be seen from Figure 5, the system can track the step signal well, the overshoot of the pendulum is small enough, and the steady-state error, rise time and settling time also meet the design requirements. If Q is increased further, the system response will improve further. However, when Q is sufficiently small and other response indicators are taken into account, the system response already meets the requirements. 3.2 System Real-Time Control Using the MATLAB real-time control platform of the Gogo inverted pendulum system, a system time-control model is established as shown in Figure 6: [align=center] Figure 6 Time-Control Model Diagram[/align] Using the controller designed by LQR to control the inverted pendulum in real time, the inverted pendulum can be stabilized. The response curves of the trolley position and pendulum angle during the start-up are shown in Figures 7 and 8. [align=center] Figure 7 Actual Control Curve of Trolley Displacement During Start-up Figure 8 Actual Control Curve of Pendulum Angle During Start-up[/align] When the inverted pendulum system is stable, a disturbance is applied to the system. The response curves of the trolley position and pendulum angle are shown in Figures 9 and 10. [align=center] Figure 9 Actual Control Curve of Trolley Displacement Disturbed Figure 10 Actual Control Curve of Pendulum Angle Disturbed[/align] The trolley can adjust quickly, allowing the entire system to recover balance in a very short time. 4 Conclusion The LQR controller was used to control the single-stage inverted pendulum. Simulation and actual control proved the effectiveness of the controller design. The system has good stability and robustness. References: [1] Gogo Technology Co., Ltd. Gogo Inverted Pendulum and Automatic Control Principle Experiment Guide [M]. Shenzhen: Gogo Technology Co., Ltd., September 2005. [2] Zou Bomin. Automatic Control Theory [M]. Beijing: Machinery Industry Press, 2003. [3] Liu Bao. Modern Control Theory [M]. Beijing: Machinery Industry Press, 2007. [4] Wu Xiaoyan, Zhang Shuangxuan. Application of MATLAB in Automatic Control [M]. Xi'an: Xi'an University of Electronic Science and Technology Press, 2006. [5] Wang Shiying, Zhang Feng, Chen Zhiyong, Zhao Xieguang. LQR Controller Design of Linear Single-Stage Inverted Pendulum [J]. Information Technology. 2006, 35 (6): 98-99. [6] Wang Zhongmin, Sun Jianjun, Yue Hong. Research on optimal control system of inverted pendulum based on LQR [J]. Industrial Instrumentation and Automation Devices. 2005, 3(6): 28-32.