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

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

Double Inverted Pendulum (DBIP)

Lab 6a: Pole Placement for the Inverted Pendulum

Lab 3: Quanser Hardware and Proportional Control

Controlling the Inverted Pendulum

Inverted Pendulum. Objectives

FUZZY SWING-UP AND STABILIZATION OF REAL INVERTED PENDULUM USING SINGLE RULEBASE

Lab 4 Numerical simulation of a crane

Stabilizing the dual inverted pendulum

THE REACTION WHEEL PENDULUM

YTÜ Mechanical Engineering Department

State Feedback MAE 433 Spring 2012 Lab 7

YTÜ Mechanical Engineering Department

El péndulo invertido: un banco de pruebas para el control no lineal. XXV Jornadas de Automática

1 Introduction. 2 Process description

Modeling and Experimentation: Compound Pendulum

Digital Pendulum Control Experiments

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

Matlab-Based Tools for Analysis and Control of Inverted Pendula Systems

The Control of an Inverted Pendulum

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

SWINGING UP A PENDULUM BY ENERGY CONTROL

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

State Feedback Controller for Position Control of a Flexible Link

Lab 3: Model based Position Control of a Cart

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

Application of Neural Networks for Control of Inverted Pendulum

LMI Methods in Optimal and Robust Control

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

Simple Harmonic Motion - MBL

Linear control of inverted pendulum

MAE143a: Signals & Systems (& Control) Final Exam (2011) solutions

Kinematics Lab. 1 Introduction. 2 Equipment. 3 Procedures

Nonlinear Oscillators: Free Response

Lab 1: Dynamic Simulation Using Simulink and Matlab

Partner s Name: EXPERIMENT MOTION PLOTS & FREE FALL ACCELERATION

Lecture 14 - Using the MATLAB Control System Toolbox and Simulink Friday, February 8, 2013

LAB 3: VELOCITY AND ACCELERATION

Static and Kinetic Friction

Mass on a Horizontal Spring

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

ES205 Analysis and Design of Engineering Systems: Lab 1: An Introductory Tutorial: Getting Started with SIMULINK

Angle estimation using gyros and accelerometers

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

Positioning Servo Design Example

Dynamics Final Report

Joseph D. Galloway II Robotics and Motion Laboratory, Dept. of Mechanical Engineering San Antonio, TX, USA Gerardo Aaron Rios

Experiment # 5 5. Coupled Water Tanks

2.004 Dynamics and Control II Spring 2008

Lab #2 - Two Degrees-of-Freedom Oscillator

State space control for the Two degrees of freedom Helicopter

Lecture 6: Control Problems and Solutions. CS 344R: Robotics Benjamin Kuipers

EE Homework 3 Due Date: 03 / 30 / Spring 2015

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

EE 4443/5329. LAB 3: Control of Industrial Systems. Simulation and Hardware Control (PID Design) The Torsion Disks. (ECP Systems-Model: 205)

MECHANICS AND CONTROL OF PUMPING A PLAYGROUND SWING AND ROBOTIC IMPLEMENTATION ABSTRACT INTRODUCTION NOMENCLATURE

The dynamics of a Mobile Inverted Pendulum (MIP)

ACKNOWLEDGEMENTS Quanser Inc., All rights reserved.

MODELLING AND SIMULATION OF AN INVERTED PENDULUM SYSTEM: COMPARISON BETWEEN EXPERIMENT AND CAD PHYSICAL MODEL

The Liapunov Method for Determining Stability (DRAFT)

Laboratory handouts, ME 340

You will return this handout to the instructor at the end of the lab period. Experimental verification of Ampere s Law.

The Control of an Inverted Pendulum

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

CONTROL SYSTEMS LABORATORY ECE311 LAB 1: The Magnetic Ball Suspension System: Modelling and Simulation Using Matlab

Inverted Pendulum System

CALIFORNIA INSTITUTE OF TECHNOLOGY Control and Dynamical Systems

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

FUZZY LOGIC CONTROL Vs. CONVENTIONAL PID CONTROL OF AN INVERTED PENDULUM ROBOT

DC-motor PID control

IfA Fachpraktikum - Experiment 3.7A : Flexible Shaft A

Application Note #3413

Lab 10: Harmonic Motion and the Pendulum

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

The Pendulum. Goals and Introduction

Lab 10: Ballistic Pendulum

Angle estimation using gyros and accelerometers

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

PHY 221 Lab 3 Vectors and Motion in 1 and 2 Dimensions

MEAM 510 Fall 2012 Bruce D. Kothmann

Neural Network Control of an Inverted Pendulum on a Cart

Reverse Order Swing-up Control of Serial Double Inverted Pendulums

Project 3: Pendulum. Physics 2300 Spring 2018 Lab partner

MEM04: Rotary Inverted Pendulum

MEAM 510 Fall 2011 Bruce D. Kothmann

Lecture 9. Introduction to Kalman Filtering. Linear Quadratic Gaussian Control (LQG) G. Hovland 2004

LAB 3 - VELOCITY AND ACCELERATION

Lecture 5: Linear Systems. Transfer functions. Frequency Domain Analysis. Basic Control Design.

Department of Electrical and Computer Engineering. EE461: Digital Control - Lab Manual

Exercise 4: Markov Processes, Cellular Automata and Fuzzy Logic

PHY 123 Lab 9 Simple Harmonic Motion

EE 16B Midterm 2, March 21, Name: SID #: Discussion Section and TA: Lab Section and TA: Name of left neighbor: Name of right neighbor:

Figure 1: Doing work on a block by pushing it across the floor.

Laboratory handout 5 Mode shapes and resonance

Lab 10 - Harmonic Motion and the Pendulum

The Spring-Mass Oscillator

HW#9: Energy Conversion and Conservation of Energy

Designing Information Devices and Systems II Spring 2017 Murat Arcak and Michel Maharbiz Homework 9

Flexible Pendulum (FLEXPEN)

PHY 221 Lab 5 Diverse Forces, Springs and Friction

Transcription:

Lab 6d: Self-Erecting Inverted Pendulum (SEIP) Arthur Schopen- Life swings like a pendulum backward and forward between pain and boredom. hauer 1 Objectives The goal of this project is to design a controller that starts with the pendulum in the down position and then swings it into and maintains it in the up position. In this lab you have a lot of freedom in implementing the controller, and you are encouraged to experiment. That said, these instructions will guide you through the design of a non-linear controller based on a so-called energy-pumping method. Since this class is primarily about control techniques for linear systems, you will not be tested on the content of this lab. 2 Introduction You already have the model of the plant when the pendulum is in the vertical position. The challenge now is to understand how to swing the pendulum up. The key to making this work is to split the controller into two parts: one part will be the swing-up controller while the second part will be the balancing controller. Once the swing up controller manages to position the pendulum almost upright, almost at rest, the balancing controller should take over and maintain the pendulum in a vertical state. One way to implement this in Simulink is by using the Switch block, which is depicted below. Input 1 Threshold output Input 2 Switch Figure 1: Simulink Switch block with relevant signals labeled Its usage is pretty intuitive. It acts like a two signal multiplexer it will pass on only one of the two inputs that it is given based on the threshold input. Make sure you double-click on the block to set your threshold value and other threshold options. The usage of different controllers based on different conditions turn this system into what is known as a switched system. The theory of switched systems falls under the topic of hybrid systems, which we will not touch on here 1. Our switched system is simple and intuitive enough to not require any knowledge of hybrid systems techniques. At this point, you should have a few (pole placement, LQR) working linear balancing controllers, so feel free to use whichever one you prefer to keep the pendulum in the up position, once you have reached it. 1 Hybrid systems are the topic of EE291E / ME290Q. October 25, 2017 1 of 8

3 Pre-Lab For the swing-up controller, we will use an energy-pumping method. This technique is described in [?], for example. The idea is to use the control input to inject into the system the right amount of mechanical energy which will bring the pendulum to the upright position. 3.1 Energy of the Pendulum Figure 2: Free body diagram of the inverted pendulum setup (ignoring friction) 1. Consider the referential attached to the pivot of the pendulum. Write the expression of the total mechanical energy of the pendulum (without the cart) E(θ, θ), as a function of θ, θ, and the system constants (m, J, L p ). The mechanical energy will have a kinetic term plus a potential term. Use a potential energy offset such that the total energy is zero when the pendulum is at rest in the upright position, i.e. E(0, 0) = 0. 2. Calculate the energy E(π, 0) of the pendulum at rest at θ = π. 3. The idea of the swing-up controller is to increase the energy from this initial value to the target value 0. In order to increase the energy, we will compute the derivative of E: Let ẍ be the acceleration of the pivot point. Given the dynamics of the pendulum J θ = mgl p sin(θ) ml p cos(θ)ẍ where J = 4 3 ml2 p, show that the derivative of the total energy of the pendulum is d dt E(θ, θ) = ml p ẍ θ cos(θ) Therefore to increase the energy of the system as fast as possible, we would like to apply maximal positive acceleration when θ cos(θ) < 0, and negative acceleration when θ cos(θ) > 0. Recalling (from lab 6a) the relation between acceleration and voltage applied to the motor: ẍ = αv βẋ γθ (where α > 0, β and γ are constants that depend on the physical parameters of the system), we October 25, 2017 2 of 8

observe that ẍ is maximal when V is maximal. (sometimes called bang-bang control) 0 when E(θ, θ) 0 V = V max when E(θ, θ) < 0 and θ cos(θ) < 0 V max when E(θ, θ) < 0 and θ cos(θ) > 0 This results in the following simple control law where V max = 6V. In practice, we ll approximate this bang-bang control with a control policy that doesn t have discontinuities, as you will see in the Lab section. 3.2 Obtaining Derivatives Obtaining estimates for ẋ and θ. Recall from the previous labs that the numerical derivatives of the state and angle are of very poor quality. To remedy this, in Lab 6b we built an observer to obtain an estimate x of the system state. However, the observer uses the linear system model and is therefore only valid for θ 0. Since we are building a Swing-Up controller, we are using the full range θ [0, 2π), so we have to take the non-linearities in the system into account. The linear observer would not be adequate anymore, and in fact might diverge 2. Instead, we will use a dynamical system approximating a derivative for obtaining estimates of ẋ and θ. Recall that the derivative operation ẋ(t) in the Laplace domain is described by sx(s) (assuming initial conditions are zero). Since we cannot implement a pure differentiator with transfer function G(s) = s in Matlab, we will approximate it by a transfer function of the form 1 D(s) = sh lp (s) = s c lp s + 1 with parameters c lp (lp for low-pass). Note that this can be viewed as a differentiator combined with a lowpass filter. Multiplying by the low-pass filter will result in a phase-shift. We would like to design in such a way as to ensure that the phase shift remains small, while not attenuating frequencies of interest too much. Calculate the largest value of c lp such that at the natural frequency ω 0 = g l, the phase shift is φ(h lp (jω 0 )) 5 degrees. 2 Observer design for nonlinear systems is very hard and for general cases largely remains an open problem. October 25, 2017 3 of 8

4 Lab We will design a switched Simulink system that starts with the pendulum pointing vertically down and then self-erects and balances it vertically upwards. The controller used in this lab is more complex than the ones we have seen in previous labs, so these instructions will walk you through the design. You are encouraged to also try other methods and report your findings. 4.1 Implementing the Swing-Up Controller on the Hardware 4.1.1 The Full System Figure 3 shows the Simulink block diagram of the overall controller. The main tasks are abstracted away in the following subsystems: IP Hardware: Interface to the pendulum hardware. Swing-Up Controller: Controller capable of swinging up the pendulum from the down position. This block implements the control strategy discussed in the PreLab. Mode Selector: Chooses between the Swing-Up and the linear stabilizing controller, depending on the current system state. Observer: Observer for getting a good state estimate when the pendulum is in the up position. Note the delay block that outputs into Switch1 in Figure 3. This is to ensure that we use our linear observer only after it has had sufficient time to converge to a good estimate. These subsystems are discussed in detail in the following sections. 4.1.2 The Inverted Pendulum Hardware The interface to the pendulum hardware 3 is shown in Figure 4. Since we have to take the non-linearities in the system into account when swinging up we cannot simply use a linear observer for providing estimates of the cart velocity ẋ and pendulum angular velocity θ. Instead, we will use the dynamical systems approach discussed in section 3.2 of the Pre-Lab to obtain estimates of ẋ and θ from the measured outputs x and θ. This happens in the Derivative x and Derivative theta blocks in Figure 4. Use the value of c lp determined in the Pre-Lab. The saturation block should be familiar from Lab 6a (if you implement the custom saturation block, you can use that one instead). The Angle Initialization block is used to transform the coordinates of the system such that θ = 0 in the up position (recall that the zero positions of x and θ are the respective positions when connecting to the target). This can be achieved by letting θ = mod(θ, 2π) π 3 Ignore the Bad Link blocks in this and the following figures this is due to the fact that the model was printed from a machine that does not have the QuaRC software installed. October 25, 2017 4 of 8

Figure 3: SEIP block diagram with subsystems Figure 4: IP Hardware subsystem where θ is the angle reading from the encoder (after the conversion factor). Implement this function using Simulink blocks and create a subsystem just as done in Figure 4. 4.1.3 The Mode Selector The Mode selector block is shown in Figure 5. In this block we check whether the absolute value of θ is less than some threshold thresh and choose the value of the mode signal accordingly. In particular, we want the following behavior: { 1 if θ thresh mode = 1 otherwise The mode signal is used to switch between Swing-Up and stabilizing controller, and also to switch to using the state estimate x(t) provided by the observer for the stabilizing control. You will be tuning the value of the threshold during the lab. A good starting point is thresh = 10 deg. October 25, 2017 5 of 8

Figure 5: Mode selector subsystems 4.1.4 The Swing-Up Controller Figure 6 shows the internals of the Swing-Up controller. The Block E computes the energy of the pendulum as a function of the angle θ and the angular velocity θ, as derived in the Pre-Lab. Implement this function using Simulink blocks and create a subsystem. Note that, when the pendulum is at rest in the down position then θ = 0, so E θ cos(θ) = 0. Thus, it is ambiguous whether the swing-up controller will swing left or right initially; small noise factors would likely decide. Thus, Switch1 in Figure 6 ensures that for the first 50 ms, the pendulum will go to the right. The gain K pump should be large so as to maximize the rate at which energy is pumped into the pendulum. A good starting value is K pump 50. The switch in 6 makes sure that the Swing-Up controller stops pumping energy into the pendulum as soon as E 0. Figure 6: Swingup Controller subsystem 4.1.5 The Observer Figure 7 shows the observer subsystem. The part on the right should be familiar from Lab 6b. The part of the left is necessary to ensure that the observer is only in use when the linearization of the system is reasonably accurate (i.e. when the mode signal is non-negative, which is the case whenever θ thresh. In particular, if θ > thresh the observer is provided with zero voltage input signal, V = 0, and zero output signal, y = [0 0] T. As soon as mode = 1, i.e. when θ thresh, the observe is provided with the true inputs V and the true system output y. Note that this will force the observer state x to converge to October 25, 2017 6 of 8

zero whenever the pendulum is not near its upright position (this ensures that the observer is only used when the linearized model is valid). When the pendulum gets close to the upright position (θ 0), then the observer will converge quickly to the true state x. The main point here is that if the observer were to run the whole time, the estimate x might diverge since the linear model used in the observer is not a good approximation anymore. Figure 7: Observer subsystems 4.2 Testing and debugging the Swing-Up Controller Before testing your swing-up controller, re-verify the following: make sure the angle estimate is correct. The angle should be 0 in the upright position and π when pointing down. In particular, it is important that the angle is exactly 0 when upright, otherwise the linear controller will try to stabilize around a non-vertical angle. You may need to adjust the conversion factor of the angle encoder. make sure you have the correct energy estimate. The energy should be minimal when the pendulum is at rest pointing down, and 0 when the pendulum is at rest upwards. Also test that the energy transfer between the kinetic and potential terms occurs as you expect. To do this, disconnect the controller and plot the energy estimate when the pendulum is oscillating freely. The total energy of the system should be roughly constant (it will be decreasing because of friction, which is not modeled here). In particular if the total energy oscillates, this means the model is slightly off, and you need to adjust one of the constants in the kinetic or potential term (J or L p ). Now, test the switched controller. If the controller fails to swing up the pendulum or to stabilize around the θ = 0 position, you can tweak the parameters of the system (switching threshold, gains, etc.) until you obtain a satisfactory performance. October 25, 2017 7 of 8

4.3 Lab Report When you submit your report, provide a link to a video with your controller in action and include the following plots: position x and angle θ. Show at which point the switch occurs (by plotting the angle threshold) control input u observer state estimates x (include velocity and angular velocity) energy E Also, write a short description of the process for designing the swing up controller and what each part is doing, along with the block diagrams. October 25, 2017 8 of 8