EE5101/ME5401 Linear Systems Mini-project 2022
Control of a Stationary Self-Balancing Two-wheeled Vehicle r>Important note: The due date is 15/11/2022. Late submission is absolutely not allowed as the
grades have to be submitted to the department very soon after the final exam. You may work together
with your classmates. But do write your report independently. And the results are supposed to be
different from each other as the parameters are based upon your matriculation numbers.
1 Background
We all had a tough time when learning to ride a bicycle when we are a teenager. It usually takes
months to master that skill after crashing into walls for hundreds of times. Needless to say even after
that, it is still difficult for us to ride on uneven surface or turn when riding in a high speed. Would
that be excited if such two-wheeled vehicle comes to the market that it can self-balance itself to
improve its stability and driving safety?
Self-sustaining two-wheeled vehicle not only is a proof of how control theory has been
developed during the past decades, but also has a huge market potential. Therefore, a lot of
researchers from universities and companies are working on related topics. Although most of the
study are still in experimental stage, there are research groups and startups that have already published
demonstration video online, such as the C-1 motorcycle from Lit Motors [1].
Figure 1 is a screenshot from a demonstration video on YouTube. As we can see, the vehicle
looks like a motorcycle from outside, but inside the vehicle the driver drives as if it is a car. The
vehicle self-balances itself when running on the road or even when it is still. This two-wheeled self-
balancing vehicle is said to combine the virtues of both the car and the motor: safety and low cost.
Figure 1 Two-wheeled self-balancing electric car/motor [1]
Since there are many more dynamics involved when the vehicle is running, in this mini-project
we only consider the self-balance of the two-wheeled vehicle when it is stationary. We will try to
balance this vehicle using the control methods we have learned in Linear Systems.
2 Modelling
For model-based control, the first step is to build an effective dynamic model for our target plant,
i.e., the two-wheeled vehicle in this project. The detailed procedures to model this vehicle can be
found in [2] and [3]. Here we only give a short introduction and the resulted state space model.
An experimental system for the two-wheeled vehicle prototype is shown in Figure 2. The two-
wheeled vehicle consists of three parts. There is a cart system that corresponds to the rider’s center-
of-gravity movement, a steering system (a front part) for steering, and a body (a rear part). The front
EE5101/ME5401 Linear Systems Mini-project 2022
part and the rear part are structures that are movable through a steering axis. A cart system and a
steering system are driven by DC servo motor, and DC motors are controlled by servo amplifier
which contains the velocity control system. Handle angle and cart position are measured by encoders.
Attitude angles of the two-wheeled vehicle (roll angle and yaw angle) are measured by gyroscopes.
Figure 2 Composition of experimental system
Figure 3 Two-wheeled vehicle structure model
The mechanical structure for the two-wheeled vehicle is given in Figure 3. The two-wheeled
vehicle is stabilized by moving the cart position ( )d t and adjusting the handle angle ( )tψ . The
control inputs are the voltages ( )cu t and ( )hu t to two DC servo motors, which drives the cart
system and the steering system correspondingly.
EE5101/ME5401 Linear Systems Mini-project 2022
For the dynamic model, the relevant symbols are defined in Table 1. Table 1 Definition of Symbols
, , Mass of each part
, , Vertical length from a floor to a center-of-gravity of each part
, Horizontal length from a front wheel rotation axis to a center-of-gravity of part of front wheel and steering axis.
, Horizontal length from a rear wheel rotation axis to a center-of-gravity of part of rear wheel and steering axis.
Horizontal length from a rear wheel rotation axis to a center-of-gravity of
the cart system
Moment of inertia around center-of-gravity x axially
Moment of inertia for part of front wheel z axially.
Moment of inertia for part of rear wheel that contains cart system z axially.
Viscous coefficient around x axis.
Viscous coefficient for part of front wheel around z axis.
Viscous coefficient for part of rear wheel that contains cart system around
z axis.
A viscosity coefficient of a movement direction of the cart system
Subscript f, r, c Part of front wheel, rear wheel, and cart system respectively
(), (), () Cart position, handle angle and bike angle
In [2], the state space linear model for the two-wheeled vehicle is derived to be
(1)
where the state variable is
and the matrices and the input vector are1
1 Some additional coupling terms are fabricated to facilitate our design.
EE5101/ME5401 Linear Systems Mini-project 2022
where g is the gravitational acceleration, 29.8 /g m s≈ .
The physical parameters in (5) can be measured directly or identified by experiments. The value
of all these physical parameters is summarized in Table 2. Table 2 Physical parameters of the two-wheeled vehicle
Parameter Value Parameter Value
[kg] 2.14 + /20 [m] 0.18
[kg] 5.91 ? /10 [m] 0.161
[kg] 1.74 [m] 0.098
[m] 0.05 [m] 0.133
[m] 0.128 [m] 0.308 + ( ? )/100
[m] 0.259
[kgm2] 0.5+( ? )/100 [kgm2/s] 3.33 ? /20 + /60
15.5 ? /3 + /2 27.5 ? /2
11.5 + ( ? )/( + + 3) 60 + ( ? )/10
where in Table 2 a, b, c, d represent the last four digits in your matriculation number. For
example, if your matriculation number is A0162903M, then = 2, = 9, = 0, = 3 and one
of the parameters can be computed as μx = 3.33 ? 9/20 + 2 ? 0/60 = 2.88.
EE5101/ME5401 Linear Systems Mini-project 2022
5 / 8
3 Control System Design
After all, we get a linear state space model (1) for the stationary two-wheeled vehicle. In the
following, different control strategies will be explored to stabilize this vehicle to achieve its self-
balance. We will target both the regulation and set point tracking problems. The initial condition for
the two-wheeled vehicle system (1) is assumed to be [ ]0 0.2, 0.1, 0.15, 1, 0.8, 0
Tx = ? ? .
3.1 Design specifications
The transient response performance specifications for all the outputs y in state space model (1)
are as follows:
1) The overshoot is less than 10%.
2) The 2% settling time is less than 5 seconds.
Note: (a) This transient response is checked by giving a step reference signal for each input
channel, i.e., [1, 0] and [0, 1], with zero initial conditions; (b) For all the following task 1) to 5), your
control system should satisfy this performance specification and you are supposed to finish the
required investigation for each task as well.
3.2 Tasks
Your study should include, but not limited to
1) Assume that you can measure all the six state variables, design a state feedback controller using
the pole place method, simulate the designed system and show all the six state responses to non-
zero initial state with zero external inputs. Discuss effects of the positions of the poles on system
performance, and also monitor control signal size. In this step, both the disturbance and set point
can be assumed to be zero. (10 points)
2) Assume that you can measure all the six state variables, design a state feedback controller using
the LQR method, simulate the designed system and show all the state responses to non-zero
initial state with zero external inputs. Discuss effects of weightings Q and R on system
performance, and also monitor control signal size. In this step, both the disturbance and set point
can be assumed to be zero. (10 points)
3) Assume you can only measure the three outputs. Design a state observer, simulate the resultant
observer-based LQR control system, monitor the state estimation error, investigate effects of
observer poles on state estimation error and closed-loop control performance. In this step, both
the disturbance and set point can be assumed to be zero. (10 points)
4) Suppose we are only interested in the two outputs ( )d t and ( )tψ , i.e., a new output matrix is
then we get a 2-input-2-output system. Design a decoupling controller with closed-loop stability
and simulate the step set point response of the resultant control system to verify decoupling
EE5101/ME5401 Linear Systems Mini-project 2022
6 / 8
performance with stability. In this step, the disturbance can be assumed to be zero. Is the decoupled
system internally stable? Please provide both the step (transient) response with zero initial states and
the initial response with respect to 0 of the decoupled system to support your conclusion. (10 points)
5) Assume that the operating set point for the three outputs is
1 0.5 ( ) / 201
0.1 ( ) / ( 10)10sp
a b
y CA B
b c a d
where a, b, c, d are still the last four digits in your matriculation number, as defined above.
Therefore, the objective of the controller is to maintain the output vector around this operating set
point as close as possible.
Assume that you only have three cheap sensors to measure the output. Design a controller such
that the plant (vehicle) can operate around the set point as close as possible at steady state even
when step disturbances are present at the plant input. Plot out both the control and output signals.
In your simulation, you may assume the step disturbance for the two inputs, = [?1, 1]
takes effect from time = 10 afterwards. (10 points)
6) We have learned about the multivariable integral control using state space model in Chapter 9. It
is a classical way to solve the set point tracking problem even when a constant disturbance is
involved. Now for the two-wheeled vehicle, can we maintain the three outputs at an arbitrary
constant set point with zero steady-state error? You can try the integral control method or any
other method you figure out. You can use simulations to test various set points and see the results.
Please give a formal mathematical analysis/proof for your conclusion. (10 points)
Note that there are no unique answers to all the above design questions. For the tasks in our
project, you can assume that the control input is unlimited. However, in practice all the physical
actuators can only provide a limited drive capacity. You need to make your own judgement assuming
you are the engineer responsible for the control system design in the real world. There are three major
factors you should consider when you design and justify your controller:
Speed --- Transient response
Accuracy --- Steady state error
Cost ---- Size of the control signals
EE5101/ME5401 Linear Systems Mini-project 2022
4 Reference
[1] 2014 Lit Motors C-1 - YouTube More videos can be found on YouTube such as https:/
/www.youtube.com/watch?v=zb51CvptTt4.
[2] Satoh, H. and Namerikawa, T., 2006. Modeling and robust attitude control of stationary
self-sustaining two-wheeled vehicle. Nippon Kikai Gakkai Ronbunshu C Hen (Transactions o
f the Japan Society of Mechanical Engineers Part C)(Japan), 18(7), pp.2130-2136.
[3] Satoh, H. and Namerikawa, T., 2007, October. Robust stabilization of running self-sustai
ning two-wheeled vehicle. In 2007 IEEE International Conference on Control Applications
(pp. 539-544). IEEE.
5 Format of Reports
Your report should mainly contain the plant description, control and observer design method
description, your design details, simulation results, possible comparison, comments and discussion,
modification and refinements.
The report should include the following and be organized in the following sequence:
A cover paper to indicate “Assignment for EE5101/ME5401 (or your specialization
code if else) Linear Systems”, a title of your report at your choice, your full name, your
Matriculation number, email address and date;
An abstract of 50-100 words on a separate page;
A contents table on a separate page;
Section 1 Introduction
The major materials of your report organized nicely in a few sections each with specific
focus. Label your equations, tables, and figures with number and caption for reference
in the text. Your figure size and figure quality should be high enough to facilitate the
verification of your results.
The last section on conclusions.
A list of reference books/papers if any;
Appendices if any each on a separate page. Your MATLAB code should be in this
appendix. If you use Simulink, a screenshot of your Simulink model should be inserted
at proper position in the above major materials part as figures.
Pay attention to your presentation (English writing, organization, and layout et al). Make the
report formal, complete and readable. It is also advisable to write your report with a word-processing
software such as Word or LaTeX.
The final point to note about your report: it is the content that matters not the length. Keep in
mind that there are only TWENTY SEVEN pages in John Nash’s PhD thesis, which leaded to his
Nobel Prize. Therefore, you will be penalized if you put too much “copy and paste” material in your
EE5101/ME5401 Linear Systems Mini-project 2022
8 / 8
report.
6 A Note on Access and Use of MATLAB
To complete the project, you are supposed to use SIMULINK and MATLAB. The easy way is
to learn how to build various block diagrams in SIMULINK first, and then try to solve the control
systems design for the mini-project. An excellent Control Tutorial for MATLAB and Simulink can be
found at http://ctms.engin.umich.edu/CTMS/index.php?aux=Home. Besides, a Matlab manual is
provided in IVLE for the first timers.
If you don’t have MATLAB on your PC currently, you can access MATLAB in either of the
following two ways:
1) Go to PC clusters located at the third floor of E2: http://www.eng.nus.edu.sg/eitu/pc.html.
2) Download MATLAB from NUS information technology center: every NUS student can
have a license. https://nusit.nus.edu.sg/services/software_and_os/software/software-
student/#install-matlab.
Hint on MATLAB/SIMULINK:
A. You can use functions such as step, initial and lsim to simulate the system’s
corresponding response. Also, all these simulations can be done with SIMULINK.
B. In some cases, it may be easier to use SIMULINK for the simulation, for example,