Вы находитесь на странице: 1из 9

Feedback Control of a Rotary Driven

Inverted Pendulum (a.k.a. Pendubot)


ECE 572 Term Project

Abdullah Al-Refai
Kevin Bowman
John Eisenbraun

April 2011

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

Abstract
The inverted pendulum represents an entire class of control problems known as balance systems. The
properties of balance systems and all manner of solutions to controlling such systems (i.e. balancing a
pendulum in the upright position) are fundamental concepts covered in numerous control systems and
control theory textbooks. The inverted pendulum problem is often presented as a cart pendulum
problem, in which a pendulum is attached to a moving cart by means of a frictionless pivot. Other
mechanisms, such as the rotary control we investigate here, are less common. A closely related problem
is the controlled movement, or anti-sway, of a hanging pendulum (e.g. cranes lifting and moving heavy
objects).
In this report, we present our implementation of a system to balance an inverted pendulum by means of
a rotary actuator (i.e. a motor). This system is often called a Pendubot. Of primary interest are:
a) the derivation of a mathematical model that encompasses the entire system (motor and
pendulum arms),
b) the computer modeling and simulation we constructed for experimentation prior to the
availability of a physical system, and
c) the challenges we faced in making the transition to the real world physical system.
Much has been written about deriving equations of motion for a forced dual pendulum but our survey
of the literature regarding Pendubots and other motor-based balancing systems failed to produce a
single description or example that includes the actuator (motor) in the analysis of the system. This is
perplexing because the universally accepted method of derivation results in equations of motion that
declare torque to be the controlling force; yet, motors are typically controlled by an applied voltage,
which has a non-linear relationship to torque. In this report, we explain how we extend the
mathematical model to include the motor in the system dynamics.
Accurately modeling even the simplest of non-linear dynamic systems is difficult. If the model does not
closely represent conditions and relationships found in the real world, it is of little practical use. Yet, the
use of computer models in designing control systems has advantages not the least of which is the
ability to experiment with various aspects of the system when no physical system is immediately
available. In this report, we show the incremental and iterative development of a simulation model that
aided us in the design of the Pendubot control.
Finally, we discuss some of the practical matters we encountered while making the transition from an
ideal simulation environment to a physical electro-mechanical prototype. In particular, we discuss issues
with the mechanical design, fabrication, and construction of the pendulum arms and the limitations and
constraints imposed by a high level model-based and inherently non-real-time computing platform.

Page 2 of 68

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

Table of Contents
Acknowledgments......................................................................................................................................... 5
Introduction .................................................................................................................................................. 6
Objectives ..................................................................................................................................................... 7
Summary of Results ...................................................................................................................................... 8
Significant Milestones ............................................................................................................................... 8
Conclusions ................................................................................................................................................. 12
Recommendations ...................................................................................................................................... 13
Discussions .................................................................................................................................................. 14
Dual pendulum visualization ................................................................................................................... 14
Modeling and simulation of the (non-linear) unforced pendulum system ............................................ 15
The Math Model ................................................................................................................................. 15
Simulink model of the dual pendulum system ................................................................................... 16
Linearization about balance points ..................................................................................................... 16
Modeling a DC motor in Simulink ........................................................................................................... 17
Modeling and simulation of the pendulum system under direct torque control................................... 19
Modeling and simulation of the entire plant (pendulums plus motor) .................................................. 19
Design of the feedback control ............................................................................................................... 19
Simulating the system under control...................................................................................................... 21
Implement the physical system .............................................................................................................. 23
Interfacing the motor and encoders with MATLAB ................................................................................ 24
The physical system under control ......................................................................................................... 25
References .................................................................................................................................................. 26
Bibliography ................................................................................................................................................ 26
Appendix A Derivation of non-linear equations of motion...................................................................... 27
Appendix B Derivation of the seventh order state space model ............................................................. 34
Appendix C Program Listings.................................................................................................................... 39
Appendix D Data Sheets ........................................................................................................................... 48

List of Figures
Figure 1 - System schematic ......................................................................................................................... 7

Page 3 of 68

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

Figure 2 Visualization window in a MATLAB GUI ....................................................................................... 9


Figure 3 - Simulink model of non-linear dual pendulum dynamics .............................................................. 9
Figure 4 - Simulink model of a DC motor .................................................................................................... 10
Figure 5 - Simulink model for simulation .................................................................................................... 10
Figure 6 - Response plots from LQR control design .................................................................................... 11
Figure 7 - Physical prototype ...................................................................................................................... 11
Figure 8 - MATLAB m-file DispArms.m function to display the pendulum arms ..................................... 14
Figure 9 - MATLAB m-file ArmCoords.m helper function ........................................................................ 14
Figure 10 - Visualization of the dual pendulum system .............................................................................. 15
Figure 11 - Free body diagram of the pendulum arms ............................................................................... 15
Figure 12 - Simulink subsystem for pendulum dynamics ........................................................................... 16
Figure 13 - Simulink motor subsystem........................................................................................................ 18
Figure 14 - Motor model with friction and gearbox efficiency ................................................................... 19
Figure 15 m-file to compute LQR control gain factors ............................................................................. 20
Figure 16 - Swing up and balance control blocks........................................................................................ 22
Figure 17 - LQR control ............................................................................................................................... 22
Figure 18 - Partial linearization control ...................................................................................................... 23
Figure 19 function to set the motor command voltage and direction .................................................... 24

List of Tables
Table 1 Project Goals ................................................................................................................................. 8

Page 4 of 68

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

Acknowledgments
The beam-balancing concept that is the main focus of this project was chosen from a list of suggestions
provided by Dr. Cheok. In place of the machine vision method for determining beam angles, we chose to
use rotary encoders. Other components of the system were employed as suggested.
Dr. Cheok and Sami Oweis selected and ordered the motor (with integrated encoder), H-bridge, and
DAQ hardware. Pete Wilson, the engineering department machinist, fabricated the pendulum arms.
John Eisenbraun assembled and tested the H-Bridge kit.
We would like to thank Dr. Cheok for his many suggestions and for his help in formulating a
comprehensive state space model. We also recognize Sami Oweis, who spent many hours in the lab with
us and other groups.
Magna Electronics generously loaned us the TMS320 Piccolo development kit.
MATLAB and Simulink are registered trademarks of The Mathworks, Inc.

Page 5 of 68

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

Introduction
Examples of inverted pendulums exist everywhere. The last decade has seen the introduction of several
self-balancing personal vehicles like the Segway Personal Transporter. Using technology developed for
the ASIMO robot, Honda has created a self-balancing unicycle[1] . Every human being is himself an
example of an inverted pendulum, balancing the torso on two legs consisting of several joints having
several degrees of freedom.
The inverted pendulum is inherently unstable; to keep the pendulum upright the forces at the bottom of
the pendulum must be constantly adjusted. The failure of a Trident 2 missile launched from a submarine
during a test in 1989 is a testament to the susceptibility of such systems to external disturbances. The
missile had been successful in several land-based launches but spiraled out of control after breaking
through the surface of the water from an underwater launch[2]. This really is rocket science!
Complex systems are naturally non-linear. The academic study of inverted pendulums and solutions for
their controlled balancing leads to an understanding of concepts common to non-linear systems in
general. These concepts include linearization about equilibrium points; control strategies, including
strategies for guiding a system between discontinuous equilibrium points; and systems involving
multiple disciplines (e.g. mechanical, electrical, software), to name a few. In this project, we investigate
modeling a complete system consisting of a double pendulum and a motor, the design of a control
system to balance the pendulum in different configurations (including anti-sway), and a swing-up
strategy for moving the pendulum from rest to a balanced position.

Page 6 of 68

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

Objectives
The overall objective of this project is to apply control systems theory and the microcomputer-based
tools presented in class to demonstrate the controlled balancing of a beam. We place heavy emphasis
on the use of modeling and simulation and the challenge of real-time control in an inherently non-realtime development environment.
24 V DC

Motor power cable

H-Bridge Amplifier
Motor Direction
to H-Bridge

Encoder 1 (on motor)


Motor

Motor Voltage
to H-Bridge
Motor Current
from H-Bridge

Encoder Inputs
Digital Inputs/Outputs

Analog Input/Output

USB

National
Instruments DAQ
Encoder 2

Slack in encoder cable to


allow for 360 rotation of
arm from down position
Computer running
control software

Figure 1 - System schematic

The following table lists the goals we wished to achieve and the criteria for their success:
#
1

Goal
Dual pendulum visualization

Modeling and simulation of the (nonlinear) unforced pendulum system

Modeling a DC Motor in Simulink

Modeling and simulation of the


pendulum system under direct torque
control
Modeling and simulation of the entire
plant (pendulums plus motor)

Success Criteria
Demonstrate the visualization in all possible angle
combinations using a test clock pattern.
Observe that the movement of the pendulum arms
released from various non-static positions behaves
in a reasonable manner (does it look right?).
Motor responds to voltage and load torque inputs,
produces torque and speed outputs.
Visualized pendulum responds to applied torque.

With the motor in the loop, the visualized pendulum


responds to voltage commands.

Page 7 of 68

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

#
6

Goal
Design of the feedback control

Ultimately, we could not reconcile the


compliance factor (we didnt have a value
for it and had no way to determine the
value experimentally), so we looked for
other methods of integrating the motor
into the system.
Simulating the system under control
Implement the physical system

8
9
10

Interfacing the motor and encoders with


MATLAB
The physical system under control

Success Criteria
Analysis of the systems reaction to initial conditions
and pulse inputs shows convergence within reasonable
response times.
Visualize the simulated anti-sway control and
balancing of the inverted pendulum

All the mechanical parts work as designed. The motor


and H-bridge respond to test signals.
Pendulum arm angles and rates of rotation display
properly in real time within a running Simulink model.
Demonstrate anti-sway and beam balancing.

Table 1 Project Goals

Summary of Results
We were successful in applying control theory to design a beam-balancing control system. Simulated
models were built in Simulink. Simulations of an LQR full state feedback control system showed that it
was effective at balancing an inverted pendulum. Practicalities and limitations of the physical prototype
prevented us from achieving the balance of a real inverted pendulum. We were, however, able to
demonstrate the use of the control in an anti-sway application.

Significant Milestones
Pendulum Visualization
The ability to see the pendulums in action was indispensible during simulation. While scope plots and
other collected data provided more detail for close analysis, visualization is a quick and intuitive
indication of the systems behavior.

Page 8 of 68

ECE 572 Term Project

Al-Refai, Bowman, Eisenbraun

Figure 2 Visualization window in a MATLAB GUI

Non-linear system dynamics model


We implemented the pendulums non-linear equations of motion in a Simulink block. It was tested by
applying various input signals (torque) and observing the output (the pendulum angles) in the
visualization window.

Figure 3 - Simulink model of non-linear dual pendulum dynamics

Motor Model
We developed a Simulink model of a DC motor and assigned the various parameters according to the
physical motors datasheet. The output variable for our system in torque (speed or angle are more
common outputs).

Page 9 of 68

Вам также может понравиться