Documente Academic
Documente Profesional
Documente Cultură
Abstract—This paper describes the design, programming, and This paper reports the replacement of the TI Delfino®
construction of a battery operated autonomous Segbot. The Segbot, a with the National Instruments myRIO. This replacement
two wheeled robot, has some similarities to the inverted pendulum cart allows students to incorporate the interfacing and
system in that it is underactuated, exhibits non-minimum phase
behavior, and requires a stabilizing controller to stand upright. The programming advantages of LabView. The substitution
Segbot differs from the inverted pendulum cart system in that the includes real-time gain tuning, turning on/off the Segbot at a
dynamics are nonholonomic. The National Instruments® myRIO button click, the ability to work within a GUI oriented
microcontroller is used for control implementation. The myRIO allows programming language, the ability to include script-files or C
WiFi communication between the Segbot and a host computer for
supervisory control. The LabView® VI used for real-time data code, and the ability to save on a host computer real-time
acquisition and control consists of two main loops. The first loop measurements transmitted wirelessly. Besides stabilization,
collects state measurements from an accelerometer, rate gyros, and this paper provides a simple control scheme for tracking a
wheel position encoders. These measurements are passed to the second desired planar trajectory.
loop which calculates the desired control law. Included is a summary
of the system identification procedure used to determine parameters
Examination of well-known literature databases shows a
that cannot be directly measured and the use of a CAD program to wealth of information on the control of two wheeled mobile
estimate inertial values and mass center location. An example of the robots. The purpose of this paper is to illustrate the
Segbot tracking a figure-8 path with a novel navigation controller, application of the myRIO to the navigation and control of the
derived herein, is presented. Finally, a URL link is included for CAD device so that it can be used in a teaching environment. The
device drawings, a parts list, control programs, wiring diagrams, and a Segbot does present an opportunity for many nonlinear
video demonstration of the Segbot.
control applications, however the thrust of this paper is to
I. INTRODUCTION present the Segbot as a second control theory class teaching
tool. A linear control design will be presented. We have
The Segbot and other two wheeled balancing robots have developed nonlinear control applications for the Segbot and
been used in both research and academic settings [1, 2]. those applications will be presented elsewhere. At the time of
Much like the inverted pendulum cart, the basis of the device the writing of this paper, the myRIO has been commercially
is to maintain an underactuated dynamic system in the available for less than a year. From an examination of the
vertical position. Unlike the inverted pendulum cart system, literature at this time, no other myRIO applications to the
the Segbot exhibits a reaction torque on the pendulum body. Segbot have appeared.
The system is nonlinear, underactuated, nonholonomic, non-
minimum phase, and it serves as a physical example of II. SEGBOT DYNAMICS AND MODELING
several different systems.
One of the first Segbot designs [3] was produced at the A. Basic Geometry
University of Illinois. This early Segbot used a TI Fig. 1 shows a representation of the Segbot. In Fig. 1, the
C2000F28335 Delfino® floating-point microcontroller X-Y plane models the laboratory floor and trajectories in this
coupled with rate gyros, accelerometers, and other systems plane will be referred to as XY trajectories consisting of
that made it possible to stabilize the robot in an upright coordinate histories measured in this frame. The given XY
position. The Univ. of IL Segbot is also capable of robust, trajectory is the desired path the Segbot axle center will
high speed wall following, and a remote control mode that follow. The origin of the body-attached coordinate system,
uses TI eZ430-Chronos Wireless Watch Development Tool. given by xyz, is located at the Segbot axle center. The x axis
is aligned with the Segbot heading direction, while the z axis
M. Migchelbrink is with the Mechanical and Nuclear Engineering is vertical. The x-axis is found by a right hand rotation of
Department at Kansas State University, Manhattan, KS 66506 USA (e- measured from the global X-axis about the global Z-axis.
mail: mmigchelb@gmail.com). Because the pendulum body can lean and rotate, the
W.N. White is with the Mechanical and Nuclear Engineering
Department at Kansas State University, Manhattan, KS 66506 USA (phone:
coordinate set (x’,y’,z’) is the body-fixed system and its
785-532-2615; fax: 785-532-7057; e-mail: wnw@ksu.edu). origin is located at the Segbot mass center. The angle is the
L. Gorentz is with the Mechanical and Nuclear Engineering Department angle the Segbot body is leaning from the vertical and is
at Kansas State University, Manhattan, KS 66506 USA (e-mail: measured in the right hand sense about the y-axis. The
lgorentz@ksu.edu).
J. Wagner is with the Mechanical Engineering Department at the
Segbot was assembled so that the center of mass is located
University of Illinois, Champaign, IL 61820 USA (e-mail: an equal distance from the center of the left and right wheels,
wjwagne2@illinois.edu). i.e. somewhere in the x-z plane. The Segbot is also
B. Blankenau is with the Mechanical Engineering Department at the assembled so that the center of mass is directly above the
University of Illinois, Champaign, IL 61820 USA (e-mail:
bjblank2@illinois.edu).
axle center when is zero. The angles r and l measure the
right and left wheel rotations, respectively. The wheel
2784
where the bi replace the ratios in the numerator and that are not part of the standard package. The IMU is one
denominator. Providing a voltage step and inverting the such device and more will be described later in this section.
resulting Laplace transform yields There are two main loops used in the LabView Virtual
b2 b2 b2 Instrument (VI). These loops are shown in Fig. 2. The first is
t V t e
b1t
(5)
2 2 a feedback acquisition loop. This loop runs on available
b1 b1 b1 processor time. The main objective of this loop is to obtain
where t is the time in seconds, V is the magnitude of the and parse state measurements. The first loop runs faster than
voltage step input, is the base of the natural logarithms, the second loop. The purpose of the second loop is to realize
C d R a K t K m , and Kt the real-time control where feedback information is used to
b1 b2 . (6)
Ra J Ra J evaluate the control law and issue the necessary voltages
Again the least squares method is used to determine the through the D/A converters. The second loop also allows for
unknown constants b1 and b2. By knowing these two supervisory control where commands can be issued from the
constants, (6) provides an estimate for J. The estimate of the host computer to turn the controller on or off, change the
wheel position to a voltage step input is given by Equations nature of the control (tracking, stabilization, etc.), and
(5) and (6). Comparing (5) to the measured result is the least change control gains. The second loop executes at 100 Hz.
squares basis. The value of J is listed in Table 1. Software Organization
Untimed loop – executes as fast as possible as the idle process
D. Linearized Dynamics
The dynamics of the Segbot were linearized about the • Initialize the IMU on start-up
point where the lean angle and lean rate are both zero, and • Read gyros and accelerometers
the rate of change of both wheels is equal. Let the state • Read motor encoders
• Communicate feedback to timed loop using
vector be specified as X r l r l T . The linearized
shared variables
state equations are
X r l r l A X Bu
T
2785
G. Timed Loop In implementation, the state feedback gains from (10)
The second loop is a timed loop. The main purpose of could stabilize the Segbot. However, the values were altered
this loop is to allow the user the freedom to choose an slightly to yield a more desirable response. This process was
operating mode and conditions, calculate desired trajectories performed by varying the feedback gain values as the Segbot
if need be, and calculate the control law. Many individual operated by using the supervisory control functions on the
parameters are passed to the myRIO timed loop from the host computer. The final linear gains used to stabilize the
host computer using LabVIEW utilities. Also passed are the Segbot are
state measurements determined by the state acquisition loop. 0 0 . 12 10 . 27 0 . 026 0 . 14 0 . 19
The control loop also has a discrete observer to estimate of K . (11)
the angular wheel velocities using the angular displacement 0 . 12 0 10 . 27 0 . 14 0 . 026 0 . 19
information passed via shared variables from the B. Trajectory Tracking
measurement loop to the timed loop. Currently, the IR and Once the Segbot was stabilized, the main control design
sonar sensors are read in the timed loop. task is the trajectory tracking control of the axle center.
The control law evaluation is performed in the second loop The nonholonomic relationships between the wheel
by a math script node which consists of a MATLAB® script angular velocities and the global velocity, shown in Fig. 1,
file. This provides convenience because the script file is are
easy to create and debug. This is the main function used in
R r l R r l
the timed control loop. A simple series of programming X cos and Y sin . (12)
statements can be used to affect the control output of the 2 2
timed loop, the simplest of which is the case of stabilizing The Segbot is a nonholonomic dynamic system and as a
the Segbot. The MATLAB script is also used to implement result cannot move sideways without violating the
the tracking controller. Following the math script node, the nonholonomic constraint. In order to reduce the influence of
required pulse width modulated (PWM) signals are created disturbances on the tracking error, a navigational control
for the motor driver. must be added to the Segbot trajectory so the robot can
This control code started with a published NI example of eventually join the correct path. The navigational control
the myRIO being used with the Sparkfun MPU-6050 IMU. receives the current axle center position, heading direction,
The published code, documentation, and hardware details are and the desired trajectory. The navigational control then
found at: https://decibel.ni.com/content/docs/DOC-30443 produces a compensating angular velocity for each wheel so
that the path is regained. For the case of stabilization, the
desired velocities in the control loop are set to zero.
III. CONTROL ISSUES The derivation for the navigational control is rather
straight forward as outlined in [7]. A variation of the
A. Stabilization derivation is presented here that produces better tracking.
Bryson’s rule [6] was used to determine an initial set of The development of the navigational control begins with an
linear state feedback gains to stabilize the dynamic system. object that is subject to the nonholonomic constraints of
The weighting matrices were defined as
x cos 0
v
1
y sin 0
2 0 0 0 0 0
(13)
max
1
0 0 0 0 0
max
2
0 1
1
0 0
max
2
0 0 0
where v is the translational speed, is the heading direction,
Q
0 0 0
1
0 0
and is the rate of change in heading. Fig. 3 shows the
max
2
0 1
actual position of the object as a triangle.
0 0 0 0
max
2
0 0 0 0 0
1
(xd, yd)
max
Y
2
and
1 0 1 (9)
R 2
0 1 b2
where max = 10, max = 0.05, max = 10, max = 5, b2 is from
(6), and Vmax = 10 were used along with the MATLAB
command K=-lqr(A,B,Q,R) to determine the linear quadratic
regulator feedback gains of (x,y)
0 0 . 047 8 . 848 0 . 035 0 . 070 0 . 290
K . (10)
0 . 047 0 8 . 848 0 . 070 0 . 035 0 . 290 X
Figure 3: Navigational Control Posture Error
2786
The actual position of the object is (x, y, ) while the The trajectory tracking control has the same linear
desired position of the object is given by (xd, yd, d). feedback gains as the stabilizing control in (11). However,
The technique of [7] suggests defining the posture error rd = r and rd = r, while rd and ld are determined
as the error between the current coordinates and the desired
by the navigational control. For stabilization all of the
coordinates in the local body fixed coordinate system of the
desired states in the navigational control are set to zero.
object being controlled shown in Fig. 3 as
The last step is to choose gains for the ki that are used in
e d cos sin 0 x d x the navigational control. In [4, 7] the gain k3 is set as
P e l sin cos 0 y d y . (14) k 3 2 k 2 . Then appropriate gains must be found for the
other ki. The Segbot was given the figure-8 trajectory of
e 0 0 1 d
cos t cos t sin t
With some trigonometric simplifications the time Xd r and Y d r (20)
1 sin t 1 sin t
2 2
derivative of the vector in (14) can be written as
as the desired trajectory where is the angular frequency of
e d e l v v d sin e the figure-8 and 2r is the width across the figure-8. The
P el e d v d sin e (15) result in (20) can be differentiated to determine desired
trajectory time derivatives and the desired heading direction
e d
can be found by rearranging the nonholonomic constraint as
where is the position error measured along the local drive
1 Y
direction, is the position error measured in the local lateral tan . (21)
direction, e is the error in the heading direction, is the X
compensational translational speed found by the navigational
control, is the actual translational speed, and the subscript e IV. APPLICATIONS
stands for the desired coordinate minus the actual coordinate.
After the Segbot completes a few figure-8 revolutions to
The navigational control law is developed through a
overcome initial conditions, the trajectory converged to a
Lyapunov argument. The candidate Lyapunov function is
steady-state path. The effects of changing and are
chosen as
shown in Figures 4 and 5. The intent of Figures 4 and 5 are
1 2 1 cos e to illustrate the influence of the control constants.
V e d e l2 (16)
2 k2
k1=variable,k2=5,k3=2*sqrt(k2),k4=0,k5=0
1.5
This can be observed to be non-negative in the errors and V
describes a positive definite system. The time derivative of 1
(16) while observing the results of (15) can be shown to be
sin e e
V e d e d e l el 0.5
2k2
Y Position (m)
e d e l v v d cos e e l e d v d sin e (17) 0
sin e d . -0.5
Desired Path
2k2 k1=0.1
k1=1.0
-1
The development in [4] proposes the control law of k1=0.3
v v d cos e k1e d k 4 e d el
2 -1.5 -1 -0.5 0 0.5 1 1.5
X Position (m)
and
Figure 4: Effects of Modifying k1
d v d k 2 el k 3 sin e k 5 sin e el
2
(18)
The Segbot tracking can be improved by the proper gain
where the ki are all positive constants used as control choices as shown in Figure 6 which demonstrates that the
parameters. In [7] there are only three control parameters. new tracking control technique produces a better result.
Substituting the proposed control laws into the Lyapunov
time derivative shows V. SEGBOT CONSTRUCTION
k sin e el
2 2
k
V k1e d k 4 e d el 3 v d sin e 5 In building the Segbot, the aim was to replace the
2
2 2 2
(19)
k2 k2 microcontroller. Use was made of the existing framework
which shows that V is positive definite and V is negative and peripheral parts described in [3]. Although we started
definite. In [7], V was only negative semi-definite. with the Segbot shell, many design changes were introduced
as the construction progressed. Fig. 7 shows the completed
device. Information, such as CAD drawings of the Segbot,
2787
pdf of the CAD drawings, a parts list, the LabVIEW behave similarly to the inverted pendulum cart which may be
controller, pictures, a wiring diagram, and video showing the better suited for an introductory controls class.
Segbot operation, is available at [8]. The LabVIEW environment allows a simplification of
programming and sensor interfacing details, an important
k1=0.3,k2=variable,k3=2*sqrt(k2),k4=0,k5=0
1.5 consideration for students to complete their projects in a
timely fashion. This simplification provides the opportunity
1 to concentrate on control issues. The material presented here
is better suited for a controls class as opposed to a
mechatronics class because of the fewer interface details.
0.5
Y Position (m)
-0.5
Desired Path
k2=1.0
-1 k2=15.0
k2=5.0
k1=1.1,k2=50,k3=2*sqrt(k2),k4=500,k5=100
1
Figure 7: Completed Segbot
0.5
VII. ACKNOWLEDGEMENTS
Y Position (m)
2788