Lab 6a: Pole Placement for the Inverted Pendulum

Similar documents
Lab 5a: Pole Placement for the Inverted Pendulum

Lab 3: Quanser Hardware and Proportional Control

Laboratory 11 Control Systems Laboratory ECE3557. State Feedback Controller for Position Control of a Flexible Joint

Lab 3: Model based Position Control of a Cart

State Feedback Controller for Position Control of a Flexible Link

SRV02-Series Rotary Experiment # 1. Position Control. Student Handout

The control of a gantry

ECE-320: Linear Control Systems Homework 8. 1) For one of the rectilinear systems in lab, I found the following state variable representations:

ECEN 420 LINEAR CONTROL SYSTEMS. Lecture 6 Mathematical Representation of Physical Systems II 1/67

The Control of an Inverted Pendulum

Rotary Motion Servo Plant: SRV02. Rotary Experiment #01: Modeling. SRV02 Modeling using QuaRC. Student Manual

Lab 6d: Self-Erecting Inverted Pendulum (SEIP)

Quanser NI-ELVIS Trainer (QNET) Series: QNET Experiment #02: DC Motor Position Control. DC Motor Control Trainer (DCMCT) Student Manual

University of Utah Electrical & Computer Engineering Department ECE 3510 Lab 9 Inverted Pendulum

SRV02-Series Rotary Experiment # 7. Rotary Inverted Pendulum. Student Handout

Real-Time Implementation of a LQR-Based Controller for the Stabilization of a Double Inverted Pendulum

Positioning Servo Design Example

Review: control, feedback, etc. Today s topic: state-space models of systems; linearization

Updated 2013 (Mathematica Version) M1.1. Lab M1: The Simple Pendulum

MECH 3140 Final Project

Inverted Pendulum. Objectives

Rotary Motion Servo Plant: SRV02. Rotary Experiment #11: 1-DOF Torsion. 1-DOF Torsion Position Control using QuaRC. Student Manual

Lab 4 Numerical simulation of a crane

Torque. Physics 6A. Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB

Rotary Inverted Pendulum

In the presence of viscous damping, a more generalized form of the Lagrange s equation of motion can be written as

Controlling the Inverted Pendulum

Linear Experiment #11: LQR Control. Linear Flexible Joint Cart Plus Single Inverted Pendulum (LFJC+SIP) Student Handout

The Control of an Inverted Pendulum

1. [30] Y&F a) Assuming a small angle displacement θ max < 0.1 rad, the period is very nearly

Laboratory handout 5 Mode shapes and resonance

Rotational Kinetic Energy

System Parameters and Frequency Response MAE 433 Spring 2012 Lab 2

Oscillations. Oscillations and Simple Harmonic Motion

MEM04: Rotary Inverted Pendulum

FEEDBACK CONTROL SYSTEMS

Unit 7: Oscillations

Rotary Flexible Joint

CHAPTER 12 OSCILLATORY MOTION

CALIFORNIA INSTITUTE OF TECHNOLOGY Control and Dynamical Systems

kx m x B N 1 C L, M Mg θ

THE REACTION WHEEL PENDULUM

sc Control Systems Design Q.1, Sem.1, Ac. Yr. 2010/11

Inverted Pendulum System

EE 476 DC Motor Control Lab

Physics 8 Friday, October 20, 2017

Double Inverted Pendulum (DBIP)

SHM Simple Harmonic Motion revised May 23, 2017

Lab 1: Dynamic Simulation Using Simulink and Matlab

28. Pendulum phase portrait Draw the phase portrait for the pendulum (supported by an inextensible rod)

Lab #2: Digital Simulation of Torsional Disk Systems in LabVIEW

Chapter 14 Oscillations. Copyright 2009 Pearson Education, Inc.

Chapter 14. Oscillations. Oscillations Introductory Terminology Simple Harmonic Motion:

Represent this system in terms of a block diagram consisting only of. g From Newton s law: 2 : θ sin θ 9 θ ` T

Mechatronics Engineering. Li Wen

PARAMETER IDENTIFICATION, MODELING, AND SIMULATION OF A CART AND PENDULUM

Simple Harmonic Motion - MBL

Chapter 14 Periodic Motion

State Feedback MAE 433 Spring 2012 Lab 7

Assignments VIII and IX, PHYS 301 (Classical Mechanics) Spring 2014 Due 3/21/14 at start of class

Oscillations. Phys101 Lectures 28, 29. Key points: Simple Harmonic Motion (SHM) SHM Related to Uniform Circular Motion The Simple Pendulum

MCE 366 System Dynamics, Spring Problem Set 2. Solutions to Set 2

Designing Information Devices and Systems II Spring 2018 J. Roychowdhury and M. Maharbiz Homework 7

= y(x, t) =A cos (!t + kx)

3 Lab 3: DC Motor Transfer Function Estimation by Explicit Measurement

Example: DC Motor Speed Modeling

Position Control Experiment MAE171a

!T = 2# T = 2! " The velocity and acceleration of the object are found by taking the first and second derivative of the position:

PHYSICS 221, FALL 2011 EXAM #2 SOLUTIONS WEDNESDAY, NOVEMBER 2, 2011

LAST TIME: Simple Pendulum:

QNET Experiment #04: Inverted Pendulum Control. Rotary Pendulum (ROTPEN) Inverted Pendulum Trainer. Instructor Manual

Mechatronic System Case Study: Rotary Inverted Pendulum Dynamic System Investigation

Mechatronics. MANE 4490 Fall 2002 Assignment # 1

Earth s Magnetic Field Adapted by MMWaite from Measurement of Earth's Magnetic Field [Horizontal Component] by Dr. Harold Skelton

Linear control of inverted pendulum

AP Physics. Harmonic Motion. Multiple Choice. Test E

ECE 5670/6670 Lab 8. Torque Curves of Induction Motors. Objectives

State space control for the Two degrees of freedom Helicopter

State Space Representation

Linear Motion Servo Plant: IP02. Linear Experiment #4: Pole Placement. Single Pendulum Gantry (SPG) Student Handout

t = g = 10 m/s 2 = 2 s T = 2π g

System simulation using Matlab, state plane plots

EECS C128/ ME C134 Final Wed. Dec. 15, am. Closed book. Two pages of formula sheets. No calculators.

Physics 201, Exam 3 -- Summer 2017

ACKNOWLEDGEMENTS Quanser Inc., All rights reserved.

EE 474 Lab Part 2: Open-Loop and Closed-Loop Control (Velocity Servo)

Table of Contents 1.0 OBJECTIVE APPARATUS PROCEDURE LAB PREP WORK POLE-PLACEMENT DESIGN

Review for 3 rd Midterm

AP Physics QUIZ Chapters 10

Lecture 18. In other words, if you double the stress, you double the resulting strain.

ME 132, Fall 2017, UC Berkeley, A. Packard 334 # 6 # 7 # 13 # 15 # 14

Rotational motion problems

Implementation Issues for the Virtual Spring

LAB 5: ROTATIONAL DYNAMICS

Big Idea 4: Interactions between systems can result in changes in those systems. Essential Knowledge 4.D.1: Torque, angular velocity, angular

III. Angular Momentum Conservation (Chap. 10) Rotation. We repeat Chap. 2-8 with rotatiing objects. Eqs. of motion. Energy.

Problem 1. Mathematics of rotations

Lab 1g: Horizontally Forced Pendulum & Chaotic Motion

Project Lab Report. Michael Hall. Hao Zhu. Neil Nevgi. Station 6. Ta: Yan Cui

Lab M1: The Simple Pendulum

Transcription:

Lab 6a: Pole Placement for the Inverted Pendulum Idiot. Above her head was the only stable place in the cosmos, the only refuge from the damnation of the Panta Rei, and she guessed it was the Pendulum s business, not hers. Umberto Eco (from Foucault s Pendulum) 1 Objectives The objective of this lab is to achieve simultaneous control of both the angular position of the pendulum and horizontal position of the cart on the track using full-state feedback. We will be considering small angle perturbations and sine wave reference tracking of the cart position. Note that the system is a SIMO a Single Input Multiple Output system, since we are trying to control both the position of the cart and the angle of the pendulum by using only the motor voltage. 2 Theory The setup consists of a pendulum attached to the movable cart from Labs 3 and 4. The free body diagram of this setup is shown in Figure 1. We ignore friction and assume that the mass of the rod is uniformly distributed, e.g. its center of mass is located at the center of the rod, L p = L/2. N and P are the horizontal and vertical components, respectively, of the reaction force between the cart and the pendulum. The parameter values of the physical system are given in Table 1 in the Appendix. Figure 1: Free body diagram of the inverted pendulum setup (ignoring friction) October 25, 2017 1 of 7

3 Pre-Lab 3.1 Equations of Motion of the Mechanical System Under the small-angle approximation sin θ θ and cos θ 1, derive the equations of motion (1) and (2) of the inverted pendulum-cart system. In (1), F a is the force exerted on the cart by the motor. (M + m) ẍ + ml p θ = Fa (1) ml p ẍ + 4mL2 p 3 θ mgl p θ = 0 (2) One way of doing this is by considering the free-body diagrams of the cart and the pendulum separately and writing their respective equations of motion. Hint: Consider the following force/torque balance equations: horizontal acceleration on the cart, acceleration of the center of mass of the pendulum, and torsion of the pendulum. An easy way to analyze the torque equation for the pendulum is to consider its motion as observed from the frame of the cart. However, this will introduce a fictitious force, known as D Alembert s effect. The associated free body diagram of the cart and the pendulum are given in Figure 2 and Figure 3, respectively. Apply Newton s laws to obtain the required equations. y x N P Mg F a x Figure 2: Free body diagram of the cart (ignoring friction; normal force not depicted) m x θ mg N P Figure 3: Free body diagram of the pendulum (ignoring friction; the mẍ vector will appear in the torsion equation due to D Alembert s effect) October 25, 2017 2 of 7

3.2 Full System Dynamics of Linearized System 1. Use the motor dynamics derived in Lab 3 (in the form F a = f(v, x, ẋ)) and substitute them into the linearized cart-pendulum dynamics from the previous section to obtain the complete system dynamics. The outputs of interest for us are x, the position of the cart, and θ, the pendulum angle. The control input available is V, the voltage applied to the motor. Thus, our system is a 1-input, 2-output system (SIMO). 2. Now derive the state-space model (A, B, C and D matrices) for the complete system. Use x = [ x ẋ θ θ] T as your state vector. Make sure you do this derivation symbolically. Your A and B matrix should be of the following form: 0 a 12 0 0 0 a 22 a 23 0 A = 0 0 0 a 34 0 a 42 a 43 0 0 b 2 B = 0 b4 (3) Once you have the expressions for your state space representation, use a MATLAB script file to plug in your values. This will make things much easier if parameters need to be adjusted. 3.3 Analysis and Controller Design 1. Determine the eigenvalues of the state matrix A and the poles of the state-space representation. Is the open-loop system internally stable? Is it BIBO stable? (for this part, you can use the MATLAB command eig). 2. Simulate the output response of the system for a step input in the motor voltage. What would you expect to happen to x and θ in the physical system (assuming infinite track length)? What are the discrepancies between the simulation and the physical system? Why might be the reasons for these discrepancies? 3. We will use a full state-feedback controller to achieve the desired performance specifications. For the purpose of design, we assume that all the state variables are available for measurement and can use them for feedback (i.e. the entire state vector x is known). The full-state feedback controller is u = Kx. The gain matrix K is chosen such that the closed-loop eigenvalues lie at some desired values. These desired values of the eigenvalues are found based on the performance specifications desired to be achieved. We would like our closed-loop eigenvalues to lie at s 1,2 = 2.0 ± 10j and s 3,4 = 1.6 ± 1.3j. In lecture you will discuss design techniques for determining these values. For the purpose of this lab we will assume them given. (a) (b) The feedback gain matrix K is of the form K = [k 1 k 2 k 3 k 4 ]. The closed-loop system matrix is given by A K = A BK. Using your A and B matrices (with the values plugged in) from (3), compute the matrix A K as a function of the k i. Compute the characteristic polynomial P (K; s) = det(si A K ) of the closed-loop system as a function of k 1 through k 4. (c) Compute the desired characteristic polynomial P des (s) = 4 i=1 (s s i) determined by the desired October 25, 2017 3 of 7

(d) (e) locations of the closed-loop poles given above. Comparing the coefficients of P (K; s) and P (s), determine the system of linear equations that the gains k 1,..., k 4 have to satisfy. Plug in numerical values and use MATLAB to solve for K. Now verify the result you obtained for K using MATLAB. You may use the acker or place commands for pole placement. 4. With input u = K(r x), the dynamics of the closed-loop system are ẋ = Ax + Bu = A K x + BKr, where r is your reference input. Observe that the reference input has the same dimension as the system state. Using the calculated gain matrix K and MATLAB, calculate the closed loop transfer function from the first component in the reference r (position reference input) to the output x (the position of the cart). Plot the Bode plot of this transfer function. You should notice that the DC gain for this transfer function is unity. October 25, 2017 4 of 7

4 Lab During this lab, you will implement your state-feedback controller from the PreLab and run it on the actual hardware. Make sure to save all the models and script files used and attach them to your lab report submission. 4.1 Implementing the Controller in Simulink Implement the state-feedback controller with the Quanser I/O blocks in Simulink. Here is a review of some of the blocks you will use: HIL Initialize block: change the board type to Q4 HIL Read Encoder block: change the encoder indices to [0, 1] to obtain readings from both encoders HIL Write Analog block: see notes about gear protection below dx/dt derivative blocks: The encoders only provide measurements for x and θ. We will need to approximate ẋ and θ in order to perform full state feedback. In this lab, we will use the derivative blocks for this (taking numerical derivatives should generally be AVOIDED). In one of the following labs, you will build an observer and estimate the ẋ and θ from the measurements of ẋ and θ alone. Mux and Demux blocks: This will help keep your diagram tidy. You can combine all four signals (x, ẋ, θ, θ) into a vector signal with the mux block, and break them out with the demux block. Gain block: You can use a single gain block to implement the matrix K. Change the multiplication option from element-wise to matrix. Scopes and To Workspace blocks: Don t forget to instrument your system to allow you to save data for your lab report. Gear Protection In order to prevent the gear from slipping, you must put a saturation block before the Analog Output block. You have two choices: a conventional saturation block, set to ±6V as in Lab 3 and 4 An Embedded MATLAB code block use the following code: 1 function [u sat,max lim,min lim]= fcn(xdot,u) 2 % Setting the bounds 3 max lim = min(8,max(4,10*xdot+5)); 4 min lim = min( 4,max( 8,10*xdot 5)); 5 % Dynamic Saturation 6 u sat = max(min lim,u); 7 u sat = min(max lim,u sat); 8 end You must connect this block to the ẋ signal as well as the control signal for saturation. It applies different bounds depending on ẋ: once the cart is moving, it allows higher forward voltages, while prohibiting big reverse voltages. The u sat output is the saturated signal, while max lim and min lim allow you to plot/analyze the limits. October 25, 2017 5 of 7

Sign of θ The direction we have defined θ to increase and the direction the hardware encoder increases are reversed. Make sure to use a negative factor for angular unit conversion! Units Watch your units. Everything in this system should match the units you used for your state-space derivation. When in doubt, always work with SI units. 4.2 Running the Controller on the Hardware 1. Run the controller on the hardware (with reference r set to r = [0 0 0 0] T ) and make sure it balances. Important: You will need to hold the pendulum exactly vertical before connecting to the real time target (our controller tries to stabilize the unstable equilibrium θ = 0, and the encoder position is reset to zero every time you connect to the hardware). What do you think would happen if you were to connect to the hardware with the pendulum in its stable equilibrium position? 2. With the pendulum balancing, manually apply small perturbations to the pendulum and check the response. Make sure to start the system with the cart in the center of the track, so there is enough space for the controller to move the cart and catch the pendulum. (a) (b) If you perturb the top of the pendulum in a given direction, how does the controller actuate the cart? Why is this? Plot the variation of the cart and pendulum position with time for small perturbations (manuallyinduced) about the equilibrium value. Comment on the controller s general performance. Why does the hardware continue to oscillate about the equilibrium point? 3. Introduce a sine wave reference signal and and analyze the results. Your reference input will be r = [ Msin ωt 0 0 0 ] T. Start with a reasonable amplitude (M 0.1 m), and use frequencies ω = 1, 2, 5 rad/s. Again make sure to start at the center of the track and to hold the pendulum vertical when you start the program. Check your response and include plots of cart position, cart velocity and pendulum angle in your report. (a) (b) Calculate the gain and phase for each of the frequencies in your frequency response (ignoring the offset from the hardware response). Locate these frequencies on the Bode plot from Part 3.3.4 of your Pre-Lab and compare the results. Do your values match for each frequency? If not, explain possible causes for the difference. Slightly change the position of the desired closed-loop poles. Try a couple of different values and run the resulting controllers on the hardware. Again include plots of cart position, cart velocity and pendulum angle in your report. Discuss how the changes in the position of the poles affect the behavior of the system. You do not need to repeat part 3a. 4. Plot the cart velocity ẋ and the pendulum s angular velocity θ, which are obtained by numerically differentiating the signals x and θ, respectively. Comment on the quality of the obtained signals. October 25, 2017 6 of 7

A System Parameters Parameter Value Description 439.6 counts/cm Resolution of the cart position encoder 651.9 counts/rad Resolution of the angle encoder M 0.94 kg Mass of cart and motor m 0.230 kg Mass of pendulum L p 0.3302 m Pendulum distance from pivot to center of mass I c m L 2 p/3 Moment of inertia of pendulum about its center I e 4m L 2 p/3 Moment of inertia of pendulum about its end K t 7.67 10 3 Nm/A Motor torque constant K m 7.67 10 3 Vs/rad Motor back EMF constant K g 3.71 Motor gearbox ratio R m 2.6 Ω Motor winding resistance r 6.36 10 3 m Radius of motor gear J m 3.9 10 7 kg m 2 Motor moment of inertia Table 1: Parameters of the inverted pendulum setup October 25, 2017 7 of 7