You are on page 1of 47

Electronic Theses and Dissertations

UC San Diego

Peer Reviewed

Title:
Dynamic Maneuvers with a Mobile Inverted Pendulum /

Author:
Pogue, Edward

Acceptance Date:
2014

Series:
UC San Diego Electronic Theses and Dissertations

Degree:
, Engineering sciences (Aerospace Engineering)UC San Diego

Permalink:
http://escholarship.org/uc/item/12043152

Local Identifier(s):

Abstract:
A mobile inverted pendulum (MIP) type robot was constructed to test the feasibility of performing
high speed, dynamic maneuvers. Techniques were developed for line following and to achieve
high speed motion with a MIP. The results indicate that the speeds necessary for the maneuver
can be achieved, and the groundwork is laid for further experimentation

Copyright Information:
All rights reserved unless otherwise indicated. Contact the author or original publisher for any
necessary permissions. eScholarship is not the copyright owner for deposited works. Learn more
at http://www.escholarship.org/help_copyright.html#reuse

eScholarship provides open access, scholarly publishing


services to the University of California and delivers a dynamic
research platform to scholars worldwide.
UNIVERSITY OF CALIFORNIA, SAN DIEGO

Dynamic Maneuvers with a Mobile Inverted Pendulum

A thesis submitted in partial satisfaction of the


requirements for the degree
Master of Science

in

Engineering Sciences (Aerospace Engineering)

by

Edward Pogue

Committee in charge:

Professor Thomas Bewley, Chair


Professor Robert Bitmead
Professor Mauricio de Oliveira

2014
Copyright
Edward Pogue, 2014
All rights reserved.
The thesis of Edward Pogue is approved, and it is ac-
ceptable in quality and form for publication on microfilm
and electronically:

Chair

University of California, San Diego

2014

iii
DEDICATION

To my parents, for all the reasons you probably expect.

iv
TABLE OF CONTENTS

Signature Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

Dedication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv

Table of Contents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii

List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix

Vita and Publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x

Abstract of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi

Chapter 1 Objectives and Theory . . . . . . . . . . . . . . . . . . . . . . 1


1.1 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

Chapter 2 Simulations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 Physics Simulation . . . . . . . . . . . . . . . . . . . . . 6
2.2 Controls Simulation . . . . . . . . . . . . . . . . . . . . . 8

Chapter 3 Construction . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.1 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.2 Wheels . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.3 Line Following . . . . . . . . . . . . . . . . . . . . . . . . 14

Chapter 4 High Speed Motion . . . . . . . . . . . . . . . . . . . . . . . . 18


4.1 Initial Testing . . . . . . . . . . . . . . . . . . . . . . . . 18
4.2 Results After Gain Tuning . . . . . . . . . . . . . . . . . 20
4.3 Gain Scheduling . . . . . . . . . . . . . . . . . . . . . . . 20

Chapter 5 Assault MIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22


5.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2 Firing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.3 Loading . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.4 Fabrication . . . . . . . . . . . . . . . . . . . . . . . . . 27

v
Chapter 6 Results and Future Work . . . . . . . . . . . . . . . . . . . . . 30
6.1 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.2 Future Work . . . . . . . . . . . . . . . . . . . . . . . . . 30
6.2.1 The Loop . . . . . . . . . . . . . . . . . . . . . . 30
6.2.2 Improving Line Following . . . . . . . . . . . . . . 31

Chapter 7 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7.1 Line Following . . . . . . . . . . . . . . . . . . . . . . . . 33
7.2 High Speed Motion . . . . . . . . . . . . . . . . . . . . . 33
7.3 LDL Maneuver . . . . . . . . . . . . . . . . . . . . . . . 34

Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

vi
LIST OF FIGURES

Figure 1.1: Diagram of Mobile Inverted Pendulum on Inclined Plane . . . . 2

Figure 2.1: Simulated Loop Geometry . . . . . . . . . . . . . . . . . . . . . 7


Figure 2.2: Physics Simulation Results . . . . . . . . . . . . . . . . . . . . 8
Figure 2.3: Controls Speed Test Simulation Results . . . . . . . . . . . . . 9

Figure 3.1: Board with mounted electronics . . . . . . . . . . . . . . . . . . 11


Figure 3.2: Primary StuntMIP Prototype with Down Facing Sensors . . . . 12
Figure 3.3: Final Wheel Design with Clamping Nut and Bolt Configuration 13
Figure 3.4: Reflectance Vs. Angle . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 3.5: Centroid Vs. Angle for both algorithms . . . . . . . . . . . . . 16

Figure 4.1: φ̇ Offset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19


Figure 4.2: Oscillatory Failure with φ and φ̇ . . . . . . . . . . . . . . . . . 19
Figure 4.3: Successful Run with KR=4000 Gains . . . . . . . . . . . . . . . . 20
Figure 4.4: Successful Run With Speed-Based Gain Scheduling . . . . . . . 21

Figure 5.1: Firing Prototype CAD . . . . . . . . . . . . . . . . . . . . . . . 23


Figure 5.2: Paddle Ball Loading Mechanism . . . . . . . . . . . . . . . . . 25
Figure 5.3: Second Prototype Ball Loading Mechanism with Wheel Mounted
Bumpers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 5.4: Second Generation Assault MIP Components . . . . . . . . . . 29

Figure 6.1: Future Loop Design . . . . . . . . . . . . . . . . . . . . . . . . 31


Figure 6.2: Gradient for Line Following . . . . . . . . . . . . . . . . . . . . 31

vii
LIST OF TABLES

Table 3.1: StuntMIP Prototypes . . . . . . . . . . . . . . . . . . . . . . . . 12

viii
ACKNOWLEDGEMENTS

Thanks to all my labmates at the Coordinated Robotics Lab: Nick Moro-


zovsky, Saam Ostovari, James Strawson, Eric Nauli-Sihite, Jeff Friesen and Daniel
Yang. I couldn’t have done it without you guys.

ix
VITA

2007 B. S. in Aerospace Engineering, University of California, San


Diego

2013 Graduate Teaching Assistant, University of California, San


Diego

2014 M. S. in Aerospace Engineering, University of California, San


Diego

PUBLICATIONS

B. Lavraud, J.E. Borovsky, A.J. Ridley, E.W. Pogue, “Strong bulk plasma ac-
celeration in Earth’s magnetosheath: A magnetic slingshot effect?”, American
Geophysical Union Journal, 18 July 2007.

x
ABSTRACT OF THE THESIS

Dynamic Maneuvers with a Mobile Inverted Pendulum

by

Edward Pogue

Master of Science in Engineering Sciences (Aerospace Engineering)

University of California, San Diego, 2014

Professor Thomas Bewley, Chair

A mobile inverted pendulum (MIP) type robot was constructed to test


the feasibility of performing high speed, dynamic maneuvers. Techniques were
developed for line following and to achieve high speed motion with a MIP. The
results indicate that the speeds necessary for the maneuver can be reliably achieved,
and the groundwork is laid for further experimentation.

xi
Chapter 1

Objectives and Theory

1.1 Objectives
The dynamics of mobile inverted pendulums on two wheels are well un-
derstood. However, there are ranges of dynamic maneuvers which have not been
explored in the literature. In the execution of such a dynamic maneuver (involving
high speed movement and inversion in the inertial reference frame) the direction
and magnitude of gravity relative to the robot will vary widely. In the simulations
and experiments described in the body of this paper we will explore the feasibility
and challenges of two wheeled segway-like movement up to and through a dynamic
maneuver such as a classic ’loop de loop’.

1.2 Theory
The physics of the dynamic loop de loop (hereafter abbreviated ’LDL’)
maneuver are well understood. Entering into a curved loop at a high rate of speed,
a vehicle can use its centripetal acceleration to maintain contact with the surface
of the track through the course of the loop. With sufficiently high speed, a wheeled
vehicle can even continue to accelerate while at the top of the loop without a loss
of traction.
The dynamics of an inverted pendulum are well known[2]. However, that
derivation assumes that robot operates on a flat surface. For our purposes, we

1
2

Figure 1.1: Diagram of Mobile Inverted Pendulum on Inclined Plane

derived the equations of motion assuming that the ground is at a given angle β.
One commonly used interpretation of the inverted pendulum is to visualize a wheel
with a rod attached at its center. In this derivation, the angle of the rod of the
pendulum is represented by θ, and the rotation of the wheel is represented by φ.
Taking the Lagrangian derivation of the equations of motion, we start with the
kinetic energies of the rod and the wheel.

1 1
Tw = mw ẋ2 + Iw φ̇2 (1.1)
2 2

1 1 1
Tr = mr (ẋ − Lθ̇cosθ)2 + mr (Lθ̇sinθ)2 + Ir θ̇2 (1.2)
2 2 2
Then we move onto the potential energy of the rod. Since we are measuring
the potential energy relative to the track, the wheel’s potential energy remains
constant.

Vr = mr gLcos(θ − β) (1.3)

Using these definitions of the kinetic and potential energy of the system,
we construct the lagrangian.
3

L = Tw + Tr − V (1.4)

Then this is put into the Euler-Lagrange equation:


 
d ∂L ∂L
− (1.5)
dt ∂ q˙i ∂q
Where q is defined as:
 
x
 
q=
 φ 
 (1.6)
θ
Note that β is not included in the q coordinate, as it does not change in
time. Going through each derivative term separately.
 
d ∂L ∂L d
− = (mw ẋ + mr (ẋ − Lθ̇cosθ)) + 0 (1.7)
dt ∂ ẋ ∂x dt

= mw ẍ + mr ẍ − mr Lθ̈cosθ + mr Lθ̇2 sinθ (1.8)

 
d ∂L ∂L d
− = (Iw φ̇) + 0
dt ∂ φ̇ ∂φ dt (1.9)
= Iw φ̈

 
d ∂L d
= (−mr Lẋcosθ + mr L2 θ̇ + Ir θ̇)
dt ∂ θ̇ dt (1.10)
2
= −mr L(ẍcosθ − ẋθ̇sinθ) + mr L θ̈ + Ir θ̈

∂L
= mr Lθ̇sinθ(ẋ − Lθ̇cosθ) + mr L2 θ̇2 cosθsinθ + mr gLsin(θ + β) (1.11)
∂θ
Gathering the second derivative terms, the Lagrangian equations come out
to:
Qx = (mw + mr )ẍ − (mr Lcosθ)θ̈ + mr Lθ̇2 sinθ (1.12)
4

Qφ = Iw φ̈ (1.13)

Qθ = (−mr Lcosθ)ẍ + (Iw + mr L2 )θ̈ − mr gLsin(θ + β) (1.14)

This allows us to describe the system by the equation M q̈ + F = Bu.


The mass matrix M relates the masses of the robot to the different second
derivative terms.
 
(mw + mr ) 0 −(mr Lcosθ)
 
M =
 0 Iw 0 
 (1.15)
−(mr Lcosθ) 0 (Ir + mr L2 )

The force vector F contains all the terms that are not second derivative
terms or the motor input.
 
mr Lθ̇sinθ
 
F =
 0 
 (1.16)
−mr gLsin(θ + β)

The control input vector B relates the input torque of the motor to the rest
of the equation.  
0
 
B=
 1 
 (1.17)
−1
To simplify this, we apply the no slip condition at the interface of the
wheel and the track, simply x = Rφ. This changes the above overall equation to
S T M S ν̇ + S T F = S T Bu where S is:
 
−R 0
 
S=
 1 0 
 (1.18)
0 1
And ν̇ is: " #
φ̈
ν̇ = (1.19)
θ̈
5

After multiplying it out, the total equation comes out to:


" #" # " # " #
(mw + mr )R2 + Iw mr RLcosθ φ̈ −mr RLθ̇2 sinθ τ
+ =
mr RLcosθ (Ir + mr L2 ) θ̈ −mr gLsin(θ + β) −τ
(1.20)
From this point, the motor dynamics come into play [1]. Setting the torque
term:

τ = s̄u − b(φ̇ − θ̇) (1.21)

ηkγV
s̄ = (1.22)

η(kγ)2
b= (1.23)

Where the terms there are defined as:
η = motor efficiency (mechanical power out / electrical power in)
k = motor constant (torque applied per ampere)
γ = gear reduction
V = voltage (volts)
Ω = resistance (ohms)

Rewriting the overall equations of motion to include the motor dynamics


results results in:

S T M S ν̇ + S T (F + BD) = 2S T Bs̄u (1.24)

Where D is defined as:

D = 2b(φ̇ − θ̇) (1.25)

Linearizing by taking the Jacobian we get the equation into the form Ax +
B = u. This is then input to the standard LQR derivation to come up with an
appropriate set of control gains for the robot at a given incline β.
Chapter 2

Simulations

2.1 Physics Simulation


Utilizing MATLAB’s Simulink tool, a time stepped simulation of an object
proceeding through an LDL was constructed. The initial simulation was of a
flat track leading into a perfectly circular loop, which presented some difficulties.
Upon entering the loop, the normal force exerted on the robot would jump by a
factor of four. This increased centripetal force would act as an increase in the
force of gravity. This overall vector, combining both gravity and the centripetal
acceleration will be referred to as ’perceived gravity’. While the control simulations
show that the same set of control gains could stabilize the robot in a wide range
of perceived gravities, forcing it to transition abruptly between perceived gravities
was thought to be unfeasible, so a second simulation was constructed, this time
with a more gradual transition from a ramped track to a teardrop shaped loop.
This was generated by continuously varying the radius of curvature of the track
from an initial 10 meters to the 0.25 meters we desired for the loop. This resulted
in a transition of perceived gravity that covered the same range, but in a smooth,
continuous manner.
Using this simulation, with the estimated mass of the robot and the precise
characteristics of its motors, the feasibility of the robot’s successful completion of
the maneuver was established. It was assumed that the robot would enter the loop
at a fixed speed, that the loop would have minimal flex, and that the only forces

6
7

Figure 2.1: Simulated Loop Geometry

slowing the robot would be the force of gravity against its motion and the rolling
friction of the wheel.
FGN = mrobot gcosβ (2.1)

Fcentripetal = mrobot v 2 /Rcurvature (2.2)

Fnormal = Fcentripetal + FGN (2.3)

FRR = Fnormal CRR (2.4)

FGaM = mrobot gsinβ (2.5)

The force normal to the track was used to determine the rolling resistance,
and also the failure condition of the simulation. If at any point it dropped be-
low zero, the simulation terminated. For a small segway-type robot to make it
through an LDL with a minimum radius of 0.25 meters, it must maintain a speed
of 1.56 meters per second to maintain a positive contact with the loop all the way
through. According to the simulations, this is achievable using motors available
to the project with a wide safety margin. According to the simulation, a speed of
2.5 meters per second is achievable through the loop.
8

Figure 2.2: Physics Simulation Results

2.2 Controls Simulation


Several different controls simulations were performed prior to the construc-
tion of the robot. The first was a basic response to a disturbance, at an incline. For
this, the equations of motion for segway-type motion on an incline were linearized
and the mass and motor characteristics of the robot were applied to them. This
in turn was used to find a set of Linear Quadratic Regulator (LQR) gains at the
given angle. This being done, the simulation of a segway-type robot on an incline
was constructed, being controlled by the given set of LQR gains. It was found that
the robot could in fact operate on said incline in simulation with controls gains
derived for both flat and inclined surfaces. The difference in rise time was very
minor (0.7346 vs. 0.7251 seconds, flat-derived controls gains vs. incline-derived
control gains on a 15◦ incline). There was no steady state error between the two,
as both sets of gains could stabilize the robot at the same point.
Going forward utilizing the flat-derived LQR gains, the previous simulation
was expanded from a disturbance test to a full fledged speed test. By introducing
a reference trajectory to the θ, φ and φ̇ readings going into the control gains,
9

a forward acceleration was developed. To test the high speed movement over a
longer distance, the φ and φ̇ set points were input to a simulation to assess how
quickly the robot would be able to get up to the desired speed of 2.5 meters per
second. Integrating the φ̇ term to get the φ set point, the φ̇ was incremented
by a small amount each time step, linearly for the first three seconds, and then
falling off quadratically afterwards to ensure that the set point wouldn’t exceed
the maximum desired speed. The simulation results came out positively. Later

Figure 2.3: Controls Speed Test Simulation Results

simulations introduced a time delay between the signal of the motor duty and the
application of torque, which replicated oscillatory results that had been seen in
the robot itself. In future, the author would note the importance of including at
least a small delay on the order of the motor’s mechanical time constant into a
simulation to help keep the simulation grounded in reality. The data found from
these simulations formed the baseline for further practical testing.
Chapter 3

Construction

3.1 Challenges
The StuntMIP bears a resemblance to previous MIP-type vehicles developed
in the lab previously, specifically Mini-MIP and myMIP. The primary difference
between this robot and its forebears is the high performance it must achieve. The
top speed of the previous robots topped out at approximately 1 meter per second,
while for this robot to achieve its objective of completing the LDL, it must achieve
a velocity of approximately 2.8 meters per second and not drop below 2.5 meters
per second during the execution of the maneuver. This requires substantially more
motor power, while keeping any increase in mass to a minimum. The same motors
were used as in a previous design, the Mini-MIP, given their high performance
and compact form factor. To achieve the higher performance required, the voltage
available was increased from 12 volts to 22 by putting two 11 volt lithium polymer
batteries in series. The higher power density of these batteries allow for a small
form factor and a relatively modest increase in weight while providing the necessary
power.
It became apparent that the complexity of the wiring the electronics of
StuntMIP would prove excessively complicated and difficult to test, so the elec-
tronics were mounted onto a single printed circuit board. Mounting the motor
driver, accelerometer, gyroscope, bluetooth, light sensors, two voltage regulators
and the Arduino microprocessor on the board via female header pins allowed for

10
11

easy access, testing and replacement of all the components.

Figure 3.1: Board with mounted electronics

The main body of the robot is relatively simple, essentially a box to hold
the electronics and a shaft to mount the motors into. The line following sensors
require a low ground clearance, approximately, and are positioned along the bottom
of the robot. The batteries are mounted higher in individual pods on either side
to bring up the center of mass of the robot while maintaining symmetry, and to
shorten the distance of the main power lines to the board. The main driving design
concerns was fitting the board and the motors inside the robot. The entire robot
was designed in CAD and then 3D printed using a Makerbot Replicator out of PLA
plastic. This allowed for a rapid prototyping, as the design matured to include the
printed board instead of the free components and a ’rats nest’ of wires. A previous
design had already been printed and was then superseded by the second after the
decision was made to mount electronics on a board. That design was itself replaced
by one included space for larger batteries, which was the primary robot used in
12

Table 3.1: StuntMIP Prototypes


Prototype 1 ’Rat’s Nest’ Wiring
Prototype 2 Smaller battery pods, mounted electronics board
Prototype 3 Larger battery pods
Prototype 4 Forward facing sensors

testing. A fourth version was printed to angle the light sensors forward so that
they were seeing the line ahead rather than behind. It also incorporated mounting
points for two arms to catch the robot when falling or colliding with something
during testing.

Figure 3.2: Primary StuntMIP Prototype with Down Facing Sensors

3.2 Wheels
Using the lab’s 3D printer to produce wheels resulted in several interesting
failures and workarounds which are worth exploring briefly. The original design
called for press fitting the driveshafts into the wheels. While this works if the
wheels are never removed, once that becomes necessary, the second time one press
fits a metal shaft into plastic, it further deforms the plastic resulting in an un-
satisfactory fit. The second option explored was using a set screw to hold it in
place. Rather than threading the screw into the plastic, which would have had a
similar effect to the press fit, a small space was included for a nut that could act
13

as the threading to hold the set screw in place. This worked satisfactorily at first,
creating a tight fit that could be removed and replaced as needed. However, an
unforeseen consequence of this particular design was the crushing of the plastic
making up the channel for the drive shaft. As the set screw was tightened, it
pressed the shaft into the plastic, deforming it. While the wheel was still firmly
attached to the shaft, it was no longer aligned with the direction of the motor shaft
and a noticeable wobble developed in the wheels.
A third design was developed to act as a clamp around the motor shaft.
Utilizing a similar nut and bolt arrangement, a space was left in the wheel hub
that it might flex open to admit the motor shaft. The bolt was then tightened,
closing the gap and firmly clamping the motor shaft into place. This solution has
proven satisfactory, and resolved several issues previously thought unrelated, but
then turned out to be the result of several degrees of play between the motor shaft
and the wheel.

Figure 3.3: Final Wheel Design with Clamping Nut and Bolt Configuration
14

3.3 Line Following


During the simulation phase, it became apparent that the robot was going
to be moving at a high rate of speed through a relatively small course with little
room for error. Manual remote control of the robot via bluetooth was not a feasible
option for steering through the maneuver, so an alternate control method had to be
found. After some discussion, line-following was explored as the most likely option.
Line following robots are nothing new, being a staple of high school and college
robotics competitions. However, this line-following algorithm has to operate in a
whole range of heights from the track, and at a higher rate of speed than most.
Employing four light reflectance sensors spaced evenly along the bottom
of the robot facing forward at 22o , a histogram weighted-centroid algorithm was
employed to steer. The algorithm operates by reading the calibrated analog output
of all four sensors, and multiplying that output by its distance from the ’pivot’
sensor. For simplicity, the left-most sensor was assigned as the pivot. Each product
was then summed, and that total divided by the summed output of the sensors to
give a centroid of the sensor readings. T is the summed total of sensor readings,
W is the weighted sensor readings, and c is the actual centroid.

3
X
ri = T (3.1)
i=0

3
X
iri = W (3.2)
i=0

W
c= (3.3)
T
For four sensors, with the pivot serving as a zero point, the line should
be found at a centroid of 1.5. This algorithm allows for precise control, and also
alleviates the concern over varying sensor output as the robot accelerates and the
sensors move vertically relative to the track. Early testing with this algorithm
resulted in a general failure to follow a line.
Examining the telemetry from the MIP established that when at rest and
standing upright, the analog reflectance sensors read very low off the line and very
15

Figure 3.4: Reflectance Vs. Angle

high on the line. The analog sensor readings were remapped from 0 to 5 volts to
0 to 1024. The on-line readings were approximately 900 to 30-70 off of it. As the
angle increased, the on-line sensors maintained their high readings, while the off-
line sensors had increasingly high readings. As a result, the centroid calculations
would steadily move towards the center reading regardless of location along the
line, since all the sensor readings were trending towards the maximum possible
reading. We modified the algorithm to select the smallest reflectance reading and
subtract that from the rest of the readings.
3
X
(ri − rmin ) = tadjusted (3.4)
i=0

3
X
i(ri − rmin ) = wadjusted (3.5)
i=0

This allowed the algorithm to function between a zero point and some larger point,
which resulted in much better tracking of position along the line.
Implementing the new algorithm, straight line following was achieved at
a variety of speeds. A controller was developed by iterative testing. Since the
16

Figure 3.5: Centroid Vs. Angle for both algorithms

dynamics of the system act as an integrator (the further along the line the robot
goes in a given direction that’s not directly along the line, the further off the line it
gets) we opted to use a proportional-derivative controller. Looking at the problem
further, it became clear that high proportional gain wouldn’t serve particularly
well, as this robot’s main function is to go in a straight line. Higher proportional
gain would cause it to overreact and pass straight off the line. Correspondingly, a
high derivative gain was chosen to ensure that the errors in line position damped
out over time. With some trial and error along a small straight-line course, a set
of control gains were found that were very effective.
While the straight line following was effectively implemented, attempts at
line following over a more complicated course were unsuccessful. This is largely due
to the physical design of an early prototype robot, more specifically the location
and orientation of the reflectance sensors. Their position at the bottom of the robot
facing straight down prevented them from reading the line in front. As the robot
leans forward to accelerate forward, the sensors were constantly looking back. As
a result, it could only react to the path of the line behind it, which, along a varied
course, results in the robot eventually reacting to a turn in the line too late, and
17

going off course. A later version of this robot had forward facing sensors installed
along the base, which improved straight line following, but no testing has yet been
done with more complicated course following.
Chapter 4

High Speed Motion

4.1 Initial Testing


Having implemented line following, the next step to performing the LDL
maneuver was achieving and maintaining a speed of approximately 2.5 meters per
second. During the low speed testing, a simple offset term was fed into the φ
control term to keep it moving. For the high speed testing, more sophisticated
offsets were required. Rather than just using the single φ offset, several offset
terms were fed into the control to create a reference trajectory. The θ offset was
set to linearly increase to a relatively high value of 0.2 since an accelerating MIP
cannot remain at a θ of zero, and any control effort to restore it to zero would be
counterproductive to the goal of achieving a higher speed. The φ offset was created
by integrating the φ̇ term. The forward motion was accomplished through the φ̇
offset term. This φ̇ offset was set to linearly increase from launch for 2-3 seconds
and then continue increasing at a slower rate for the rest of the run. Early testing
was successful up to a point. The robot was able to achieve speeds of 1.4 meters
per second before the control effort began to oscillate significantly, resulting in
failure upon the robot’s contact with the ground. During the oscillations, it would
achieve high peak speeds, but not in a controlled way. Many different attempts
were made to get around this problem, including various acceleration profiles and
low pass sensor filters for φ̇ and θ̇. It was thought that LQR control’s tendency
to drive control output to zero might have been a factor, as the motors would

18
19

Figure 4.1: φ̇ Offset

still require significant input to maintain a high speed. From the earlier equation
τ = s̄u − bω, for a torque τ of zero and a speed ω of 70 radians per seconds, the
required motor output u∗ is approximately 0.8 out of a possible 1, translating to
a pulse width modulation output of 204, where 255 is the maximum output. An
additional control term to account for this motor damping was implemented in the
code.
u∗ = 0.1212φ̇ (4.1)

This didn’t have the desired effect of stabilizing performance, but rather resulted
in an immediate failure in which the robot accelerated into the ground.

Figure 4.2: Oscillatory Failure with φ and φ̇


20

4.2 Results After Gain Tuning


After deriving new control gains for higher speeds, both by linearizing the
equations of motion around a higher speed and by reweighting the state penalty
matrix Q several times, the control penalty matrix R was increased from its original
setting of approximately 500 to 8,000. Each step between these two sets of gains
resulted in better performance. At R = 8, 000, the performance peaked out at
2.16 meters per second. Any gains derived with a control penalty matrix past
10,000 failed to improve performance. In fact, the performance of the KR=8000
gains when stationary was significantly degraded from the gains at KR=500 . This
performance degradation made testing difficult, as it was unable to consistently
remain stationary long enough to stay on the line.

Figure 4.3: Successful Run with KR=4000 Gains

4.3 Gain Scheduling


To achieve better performance during the whole run, we employed gain
scheduling, interpolating between the KR=3000 gains and the KR=8000 gains accord-
ing to the φ̇ term. This resulted in a more reliable performance from start to
finish, but not in a higher sustained speed. The next gain scheduled controller
interpolated between gains from time of launch, going from KR=3000 to KR=8000
over the course of 1 - 2 seconds. The time based gain scheduling did not have any
21

positive results, instead reverting back to the oscillatory failures previously seen.

Figure 4.4: Successful Run With Speed-Based Gain Scheduling


Chapter 5

Assault MIP

5.1 History
The Assault Mobile Inverted Pendulum (or MIP) is a direct offshoot of
one of our lab’s previous robots, the iFling. The iFling was a remote controlled
segway-type robot designed to collect ping-pong balls and then launch them one
at a time using a jai alai type arm. It was hoped to develop something that could
shoot faster and more reliably than the previous model. This idea became Assault
MIP. Using the iFling’s lower geometry to run over balls and collect them into
the wheel wells and moving them into a loading position, a new loading and firing
mechanism was designed, driven by a single additional motor. Several teams have
worked on several iterations of this design, which is rapidly maturing. The author
was team lead for the second and third prototypes, oversaw the design and building
of both, and focused especially on the ball-loading problem.

5.2 Firing
The firing mechanism for the first version of Assault MIP was driven by a
single motor acting on a spring loaded firing hammer. A curved attachment at the
end of the motor arm pressed the hammer back, tensioning the torsional spring
until, at its maximum point, the hammer slipped off the curved attachment and
the tensioned spring spun it forward into a waiting ping-pong ball, shooting it 6-8

22
23

feet, with the hammer coming to rest on the back end of the firing chamber. We
had an issue with the initial design, namely that the interface between the hammer
and the motor took place at the end of a rod attached to the hammer, which served
as a moment arm that would jam the firing mechanism. A second iteration of the
design shortened this moment arm, putting the motor almost directly onto the
hammer. This design resulted in a reliably high rate of fire in several test set ups
which precisely replicated the internal geometry of the future robot.

Figure 5.1: Firing Prototype CAD

While this design had the desired firing rate, range and reliability, the
internal geometry it required proved incompatible with the third generation robot’s
loading mechanism, requiring a change. In the first two iterations, the hammer
24

rested in the firing chamber, lifting up and back to cock and fire. This in turn lifted
the ball stack slightly, then when the hammer cleared the chamber, a ball would
fall into firing position, and the hammer would then slip off the firing motor’s
curved attachment, spinning forward into the waiting ball. There were several
issues with this, one being that the hammer had to lift the entire stack of balls
with each firing. While this had not yet posed any problems, it was an inefficiency
that could potentially present a problem further down the line. Another issue was
that this design required that any new balls being loaded in do so on top of a
ball resting on top of the hammer. This presented some issues with maintaining a
sufficiently vertical loading stack, as balls could very easily get off-center, making
loading subsequent balls impossible.
The current design is also a high fire-rate design utilizing a spring-loaded
hammer, but rather than being driven by a torsional spring, it’s attached to a
linear spring and completes a full revolution with each firing, rather than the
reciprocating action of previous designs. To save space on the smaller robot, the
motor in this design drives a worm and worm gear to cock the hammer. This
hammer rests just below the firing chamber. It’s mounted to a slip clutch on a
shaft, allowing it to only turn on way, into the firing chamber. As the worm gear
turns, the hammer comes around, tensioning the spring until the hammer has gone
approximately 180 degrees, at which point the spring pulls the hammer forward
into the waiting ball. In testing this has resulted in a satisfactory rate of fire and
range.

5.3 Loading
The loading problem proved to be the thorniest issue in the design and
construction of the robot. In short, after gathering the ball using the wheel-body
geometry, it then needed to be loaded into a hopper that fed directly into the firing
mechanism, without using another actuator. On the iFling, this was accomplished
by storing the balls in the main body, and then releasing them out onto the arm
to fire. In the case of the Assault MIP, since the firing mechanism is in the main
25

body, the balls must now be stored above it, and in greater quantity, since it is
meant to fire them rapidly. This requires a precisely tuned internal geometry to
ensure that the loading process is both smooth and has a high success rate.
One concept explored was using paddles geared to the movement of the
wheels. A fixed wheel with a variable radius at one level and a gear the level
above is fixed at a set distance from one of the drive wheels. The geared level
is meshed with another gear, this one attached to a paddle further below. The

Figure 5.2: Paddle Ball Loading Mechanism

variable radius of the first wheel creates a ’dead space’ in its interface with the
drive wheel, to prevent the paddle from turning constantly. When a ball is rolled
up into loading position, it impinges on the paddle, pushing the variable radius
wheel out of its dead space, engaging the drive wheel, which then completes a
full revolution, driving the paddle which in turn pushes the ball into the loading
stack. This strategy was implemented with some success in the first generation
of Assault MIP, and worked in a simulation performed using Solidworks, however
its requirement for fine-tuned meshing between the drive wheel and the first gear
resulted in an unacceptably low success rate for loading, and the concept was
abandoned.
The subsequent loading strategy again involved using the drive wheel, but
26

this time bumpers were mounted to the inside of the wheel. These bumpers would
be angled on one side, creating a ’wedge’ effect between the ball and the front wall of
the robot, forcing it up and into the loading stack. This concept was implemented
on both the second and third generation Assault MIPs. In the second generation,
it was found that the robot was in fact too wide to effectively use the bumpers to
load into the stack. It was capable of loading, but only if there was a second ball
transmitting the force from the bumper to load the first ball into the stack.

Figure 5.3: Second Prototype Ball Loading Mechanism with Wheel Mounted
Bumpers

The third generation robot incorporated extended bumpers which would


be better characterized as arms. Angled so as to form a wedge with the front
of the robot, the front part of the robot had a cutout to allow free passage of
the arms while preventing any ball from popping out. This iteration of the robot
was significantly less wide, specifically to achieve loading with this system, and it
proved to be a success. This method allowed for the successful loading of balls
27

with a high rate of repeatability.


For the third iteration of the robot, the balls load into the initial firing
position, unlike the previous designs, which had the balls load atop the hammer
which was itself above the firing position. This helped reduce the overall robot
to a more manageable size. It created an added complication, however, in that
the robot required an extra mechanism to prevent the balls from falling out of the
’barrel’ when balls were being stored. An additional door was added to block off
the ’barrel’. The mechanism held the door on a long rod, which hinged halfway
down its length, just below the firing position. A portion of the hammer acts as a
cam, holding the door up and in position while at rest and for much of its rotation,
until it comes around to fire, at which point it releases the door to fall out of the
path of the fired ball. A linear spring was attached to the front end of the rod to
pull the door down faster, as gravity proved insufficient to pull the door down fast
enough. This system proved eminently capable of holding the balls in place for
loading.
On the path to the loading stack on either side is a spring loaded door that
only opens inward. When a ball is loaded in, it pushes past the door which then
springs back into place, securing the ball inside the loading stack, ensuring that it
will not pass out the other side but rather up the hopper as more balls are loaded
in. The shape and location of these spring-loaded doors has changed, from the top
of the path to the loading stack to the sides, but while various parts of the loading
mechanism changed with each iteration, this concept remained as a constant. It
originated in the iFling design, keeping the balls from potentially exiting before
firing, but in Assault MIP it has the added requirement of having to maintain a
vertical stack of balls such that more can be loaded.

5.4 Fabrication
The first generation of Assault MIP was built using an industrial 3D printer
available in the UCSD design studio. The large scale of the printer, in addition to
its ability to use soluble support material allowed us to print the robot in several
28

large pieces. The second and third versions were printed on the Coordinated
Robotics Lab’s own 3D printer, a Makerbot Replicator. The second version, with
similar sizing and geometry to the first, couldn’t be printed in whole parts on the
smaller printer. Instead, the design was modified to split the entire robot into
printable components. While this proved feasible for most of the robot, it was less
than optimal for the wheels on the second iteration of the robot, as they had to be
printed in halves and then epoxied together. This resulted in some issues with the
wheels being ’true’. The third generation robot had a much smaller wheel radius,
which resulted in a simpler print.
The ability to 3D print our parts resulted in low-weight, high fidelity parts
for very low cost. This in turn allowed us to iterate through the design much faster
than we wound have otherwise. The design of the paddles for the loading system,
the hammer for the firing mechanism, the spring-loaded doors for maintaining the
loading stack, in fact every element of the robot required multiple versions to get it
into working order. The in-house 3D printer is now capable of making parts with
the same fidelity as the industrial level printer we used previously, after several
software upgrades which use the solid plastic which is used to make up the rest of
the printed parts to create an easily removable support structure for overarching
shapes that previously would have been unprintable.
The first generation Assault MIP had its electronics wired together manu-
ally, with various chips held in place with hot glue and wires soldered directly to
boards. This proved difficult to assemble, troubleshoot, and also created an un-
sightly ’rats nest’ of wires. For the second generation design a printed circuit board
was attached to the back of the robot, and all the electronics were mounted in with
header pins. This cleaned up the design significantly, and made troubleshooting
significantly easier. In addition, when the third iteration of Assault MIP was built,
the board from the second generation was mounted directly onto its hopper, which
allowed us to get it up and running in a fraction of the time previous designs had.
The second generation robot had to be assembled by hand from eight sepa-
rate parts held together with bolts and nuts. Not all of these were ideally positioned
for access by hand or by tool. For the third generation the team settled on using
29

Figure 5.4: Second Generation Assault MIP Components

4-40 sized bolts and captive nuts to hold the robot together, and the design was
done with a special eye towards ease of assembly.
This contributed greatly towards the speed of iteration that’s taken place on
the third generation design. Being able to take the entire robot apart to replace a
single component and then reassemble and test with a minimum of trouble helped
the team zero in on optimal solutions in reasonably short periods of time.
Chapter 6

Results and Future Work

6.1 Results
While it wasn’t possible to construct and test a full LDL for the robot,
much of the groundwork has been laid. Achieving high speed motion with a small
MIP proved non-trivial and counter-intuitive, however it is eminently achievable.
Having established the top speed of the robot as 2.1 meters per second we can
begin looking to the construction of the loop. While previous simulations required
a speed of 2.5-2.8 meters per second, in future the loop will be redesigned to acco-
modate the lower speed. Furthermore, while line following has been accomplished
with inverted-pendulum type robots before, previous attempts have been at very
low speeds. Utilizing the centroid algorithm with the appropriate conditioning of
the sensor data, we can achieve line following at much higher speeds.

6.2 Future Work

6.2.1 The Loop


The construction of the loop has been a thought experiment for most of this
project. Planning recently began on its construction, with an initial drop to aid in
accelerating the robot up to full speed. The variable incline control gains derived
in the first section combined with gain scheduling should be helpful in achieving

30
31

this particular goal.

Figure 6.1: Future Loop Design

6.2.2 Improving Line Following


A feature that had originally been planned for the initial testing phase
was to have the robot follow a gradient rather than a line. From the darkest in
the middle, fading to white on either side, this gradient would allow for all four
sensors along the bottom to contribute to the centroid reading in the line following
algorithm, rather than the one or two sensors immediately over the line. The hope
is that this will contribute to a more refined control of the robot’s position over
the line.

Figure 6.2: Gradient for Line Following

In the instance of the robot completely losing the line, some preliminary
32

work has been put into writing an algorithm to recognize when the robot has lost
the line and to turn in the direction that the line was last seen in. This is achievable
on the current hardware, but is left to the next team to implement.
With the forward facing sensors, there’s work to be done exploring how
well it can follow a path with twists and turns. This could help shorten the course
necessary for the start of the LDL run, but also serves as an interesting problem
unto itself.
Chapter 7

Conclusions

7.1 Line Following


Line following using a mobile inverted pendulum poses several unique chal-
lenges. While most robots that employ line following have their sensors a fixed
distance from the ground, the nature of a MIP requires that these sensors move
relative to the line they’re reading. The weighted centroid algorithm is a proven
solution to the line following problem, and with the addition of the sensor condi-
tioning described in chapter three, can be used to achieve robust, high speed line
following with a MIP.

7.2 High Speed Motion


Achieving high speed movement with StuntMIP proved to be a greater
challenge than had been anticipated. Attempts were made by working through
reference trajectories of various shapes and magnitudes, compensating for sig-
nificant motor damping, reweighting the state penalty matrix for higher speeds
and more acceleration, and then finally reweighting the control penalty matrix
counter-intuitively higher. The initial assumption that the robot would need to
make liberal use of the entire range of its control output proved faulty, as it re-
peatedly overcompensated once it achieved a certain speed, resulting in oscillatory
failure. Increasing the control penalty matrix, and thus decreasing the actual gains

33
34

themselves, resulted in a smooth acceleration up to maximum speed. This par-


ticular approach is best when used with gain scheduling, to ensure satisfactory
performance at all speeds.

7.3 LDL Maneuver


The data to this point suggests that performing the loop de loop maneuver
is possible, given a loop specifically constructed for that purpose. A good deal of
simulation work remains to be done, as well as practical testing with the robot to
see how well it handles acceleration on an incline, and variable terrain.
Bibliography

[1] Morozovsky, Nick, Robert Moroto and Tom Bewley. RAPID: an inexpensive
open source dynamometer for robotics and applications. IEEE/ASME Trans-
actions on Mechatronics, Volume 18, Number 6, Pages 1855-1860 2013.

[2] Bewley, Tom (2012). Numerical Renaissance: simulation, optimizaion, and con-
trol, Renaissance Press

35

You might also like