ENME403 LAB REPORT 3-Cart System and Inverted Pendulum Ben Buckley 96647561 1. Introduction An investigation into the aspects of controller design was conducted for an inverted pendulum system and a triple cart system. In both cases, control was implemented with the aim of meeting a set of design criteria when responding to a sequence of unit steps. The inverted pendulum controller design was conducted using both pole placement and an LQR approach with the results compared. A controller for the 3-cart system was designed using LQR, with the focus centred around robustness to additional weight added to the system. 2. Inverted Pendulum Control Design The system comprised of a metal rod balanced on top of a motorised cart, creating an inverted pendulum. A feedback control design was required to balance the inverted pendulum as the system is inherently unstable. The system was also subject to step inputs of 0.1m in both directions. The feedback system varied the voltage on the motor, moving the cart back and forth to balance the rod. A free body diagram can be seen in Figure 1. Figure 1: Free body diagram of the inverted pendulum system There was a total of 4 possible pendulum configurations, therefore the control design needed to be robust enough to successfully operate under all 4 possible configurations as well as withstand as much sensor noise as possible as a further test of robustness. Successful operation was defined by the design criteria in Table 1. Table 1: Design criteria for the inverted pendulum Settling time Rise time Overshoot Steady-state error Input voltage Slew rate 2.1 5-7 s 1-3 s 10 degrees < 2% < 10 V < 30 V/s Method Both pole placement and LQR control designs were implemented on the inverted pendulum system. Using the gains generated from each design, the system was simulated in MATLAB, with the results compared against design criteria. Further incrementation of gains was performed to further refine the gains to achieve a fast response with minimal oscillation when subjected to step inputs and increasing signal noise. Pole placement was conducted by selecting a set of closed-loop poles for the system and deriving the gains required to place the poles. Starting from a set of poles along the left-hand side of the real axis suitably far from the origin. The system was then simulated, and the resulting system behaviour compared to the design criteria. Adjustments to the pole locations were then made, with increasing imaginary components tending to an oscillatory response and real components increasing damping. The process was iterated until the design criteria were met, with minimal controller effort. The LQR approach to calculating controller gains required the tuning of a control weighting matrix Q. The weightings in Q represent the cart position (x), pendulum angle (θ), change in 𝑑𝑥 𝑑θ cart position ( 𝑑𝑡 ) and change in pendulum angle ( 𝑑𝑡 ) respectively. As the focus of the controller was to balance the pendulum, a greater weighting was placed on pendulum angle, with cart position also weighted. Change in position and angle were determined to be less important and therefore were left at 1. 2.2 Results Table 2 shows the controller parameters found by pole placement and LQR designs, and their respective gains. Table 2: Control designs and their gains Parameters Gains Pole Placement [-5-3j -5+3j -1.5-2j -1.5+2j] K = [1.0 5.1 4.0 1.1] LQR Diag(Q) = [100 1000 1 1] K = [10.0 42.0 13.0 9.0] Figure 2 shows the system response to step inputs from 0.1 m to -0.1 m for the LQR designed control system. The characteristics of the response are recorded in Table 3. The pole placement control system was unable to stabilise the system, unsuccessfully balancing the pendulum. Figure 2: Cart position (left) and pendulum angle (right) for LQR control gains Table 3: System response characteristics for LQR and pole placement control designs Pole Placement Characteristic Simulated Experimental 2.9 s N/A ts 0.5 s N/A tr 0.80° N/A Mp 0.8 V N/A Vmax 2.3 LQR Simulated Experimental 2.2 s N/A 1.2 s 1.9 s 2.86° 5.73° 1.60 V 4.58 V Discussion As expected, the LQR method of controller design was more successful in stabilising and controlling the system. The system response was within the design criteria of rise time, overshoot and motor voltage. Due to the oscillatory nature of the system at rest, settling time and steady-state error could not be determined. The oscillations also have the added effect of rise time and system behaviour during switching being largely dependent on the current position of the cart. The continuous oscillations stem from the natural instability of the system. The oscillations are not seen in the simulated displacement due to experimental factors that were not modelled such as friction, gear backlash and limited slew rate. The simulations unlimited slew rate allows for the simulation to instantly react to small changes in the system. Despite the slew rate limitations in the experiment, maximum voltage was significantly higher than in the simulation, but still within the design criteria limit. This is caused by factors such as friction within the system and gear backlash. 3. 3-Cart Control Design The system investigated consisted of three carts connected by springs. A full-state feedback controller was designed to damper the system so that the position of cart 3 can be successfully tracked through step inputs of 250mm and 500mm applied to cart 1 as fast and accurately as possible. The system is shown in Figure 3. Figure 3: 3-cart system Accounting for the possibility of 500g masses placed on either cart 2 or 3 or both, and the three possible springs used, there is a total of 12 system configurations. As such the designed controller had to be robust enough to successfully operate in each configuration. A successful controller satisfies the design criteria shown in Table 4. Table 4: Design criteria for the 3-cart system Steady-State Error Motor Voltage Motor Voltage Slew Rate 3.1 <10 mm < +/-12 V < +/-30 V/s Method The control design was conducted using LQR. Through iteratively changing the weighting matrix Q and simulating the system on MATLAB, a set of gains were found that satisfy the design criteria. As cart 3 position was the observed output, emphasis was placed on its weighting. As cart 3’s position is highly dependant on carts 1 and 2, weighting was also placed on their positions. As there were restrictions on controller effort, motor voltage was also simulated to ensure criteria were met. The Q matrix weightings were increased proportionally until motor voltage approached its limits, making full use of the system for the fastest response possible. 3.2 Results Table 5 shows the controller parameters found by pole placement and LQR designs, and their respective gains. Figure 4 shows the system response to step inputs from 0.125 m to -0.125 m for the LQR designed control system. The characteristics of the response are recorded in Table 6. The experimental data uses a 3-cart system with a 0.5 kg mass added to cart 3, with step inputs every 2 seconds. Table 5: LQR parameters and gains for the 3-cart system: Parameters Gains LQR Diag(Q) = [100 100 1000 1 1 1] K = [22.3 8.6 3.7 3.9 2.0 1.8] Figure 4: Cart position (left) and Controller effort (right) for LQR control gains Table 6: System response characteristics for LQR control design LQR Characteristic Simulated Experimental 1.8 s 1.2 s ts 0.20 s 0.33 s tr 5.9% 10.1% Mp N/A 12.5 mm ess 5.40 V 9.05 V Vmax 3.3 Discussion While the controller was able to successfully respond to the step inputs and settle within the required time frame of 2 seconds, its steady state error exceeded the design criteria. This error is likely to be caused by friction forces in the system that are not modelled in MATLAB. The experimental data appears as less oscillatory than the simulations, possibly caused by unmodelled damping in the system. As a result, the experimental response surprisingly has a faster settling time. The delay seen between the commanded step input and the simulated and experimental data is caused by the system driver being cart 1. The maximum voltages in both simulation and experiment were within the criteria with the experimental having a significantly higher peak voltage due to the extra force required to overcome static and dynamic friction and gear backlash. The limited slew rate in the experiment does not appear to have a noticeable effect on the resulting response. 4. Conclusion An experiment into control design was conducted on two systems, an inverted pendulum and a 3-cart system. In both cases the LQR method of controller design provided the better response, with pole placement requiring further iteration to stabilise the inverted pendulum. Methods of iteration were required for both designs, with focuses on meeting the design criteria while minimising controller effort. Throughout the experiment, simulations were compared to experimental responses and the differences in responses were apparent. This is due to unmodelled factors present in the system such as friction, gear backlash and limited slew rates. The inverted pendulum LQR controller was able to stabilise the system and respond to 200 mm step input commands, while having a controller cost of 4.58 V. The LQR controller for the 3-cart system was able to respond with a settling time of 1.2 s but had a steady-state error outside the design criteria.