Bicycle
Bicycle
Yixiao Wang
Yixiao Wang
ii
List of Publications
This thesis is based on the following publications:
[A] Yixiao Wang, Fredrik Bruzelius, Jonas Sjöberg, “Closed loop gray box
identification of a self-balancing bicycle and its application on a gain-scheduling
controller”. Accepted by 16th International Symposium on Advanced Vehicle
Control AVEC’24 .
[C] Yixiao Wang, Fredrik Bruzelius, Jonas Sjöberg, “Iterative learning tra-
jectory tracking control of an autonomous bicycle”. Accepted by 16th Inter-
national Symposium on Advanced Vehicle Control AVEC’24 .
iii
iv
Acronyms
MIMO: Multiple-Input-Multiple-Output
SIDO: Single-Input-Single-Output
v
Contents
Abstract i
Acronyms v
I Overview 1
1 Introduction 3
1.1 Topics not covered by the thesis . . . . . . . . . . . . . . . . . . 5
1.2 Contributions: . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Thesis Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Bicycle Dynamics 9
2.1 Steering-uncontrolled model . . . . . . . . . . . . . . . . . . . . 10
Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Applications of the Meijaard Model . . . . . . . . . . . . . . . . 11
2.2 Steering-controlled model . . . . . . . . . . . . . . . . . . . . . 12
Additional Assumptions . . . . . . . . . . . . . . . . . . . . . . 14
Application of the point-mass model . . . . . . . . . . . . . . . 14
vii
3 Bicycle robot 15
3.1 Actuators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Steering Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Drive Motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2 Sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Steering angle encoder . . . . . . . . . . . . . . . . . . . . . . . 17
Inertial Measurement Unit (IMU) . . . . . . . . . . . . . . . . . 18
GPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Wheel speed sensor . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.4 Control algorithms . . . . . . . . . . . . . . . . . . . . . . . . . 22
Motion control loops . . . . . . . . . . . . . . . . . . . . . . . . 23
State Observer . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
References 35
II Papers 41
viii
4.2 Lower speed performance . . . . . . . . . . . . . . . . . A18
5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A18
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A19
ix
Part I
Overview
1
CHAPTER 1
Introduction
As an emerging technology for the future, autonomous driving has seen rapid
advancement in recent years. A critical component of this field is Advanced
Driver Assistance Systems (ADAS), where ensuring safety is paramount. Given
the complex interplay of multiple sensors and algorithms in ADAS, compre-
hensive active safety testing is vital for validating system functionality and
performance [1].
In the European New Car Assessment Program (Euro NCAP), various ac-
tive safety modules are tested. These modules include Autonomous Emer-
gency Braking (AEB), Forward Collision Warning (FCW), Emergency Steer-
ing Support (ESS), and Emergency Lane Keeping (ELK). The tests are di-
vided into several scenarios to evaluate the vehicle’s response in different situ-
ations involving cyclists, including nearside, farside, longitudinal, and turning
collisions. Each scenario assesses the vehicle’s ability to detect and react to
cyclists, aiming to reduce or avoid collisions through braking or steering in-
terventions [2].
Although engineers and scientists have developed standard test scenarios
to accurately emulate real-world conditions, achieving repeatability in these
tests remains challenging due to their complexities [3]. Established commer-
3
Chapter 1 Introduction
4
1.1 Topics not covered by the thesis
1.2 Contributions:
Our work primarily contributes to state estimation and motion control within
the autonomous bicycle domain. We designed state estimator, effectively
tracking eight different states by accounting for sensor properties. This en-
ables precise control and state monitoring. Additionally, we develop a gain-
scheduled balancing controller by employing system identification techniques,
allowing for dynamic modeling that accounts for variations in longitudinal
speed. The practicality and accuracy of our model are demonstrated through
its application in controller design and other control-related tasks. Lastly, we
designed a trajectory tracking to improve the tracking performance through
experimental repetition.
5
Chapter 1 Introduction
Control Box
(MyRIO,
Steering Motor Driver, Emergency
GPS) Stop GPS Antenna
Steering Motor
and Encoder
Drive Motor
IMU
Drive Motor Driver
Battery Speed Sensor
1.4 Notation
The following table compiles the key notations used in this thesis, aiding in
understanding the technical content. Most of the variables listed in the table
have been visualized in Fig. 1.2, 1.3, 1.4.
6
1.4 Notation
7
Chapter 1 Introduction
8
CHAPTER 2
Bicycle Dynamics
9
Chapter 2 Bicycle Dynamics
where q = [φ, δ]T is the vector containing the roll and steering angle, while
f = [Tφ , Tδ ]T represents external torques in consistent dimensions. v denotes
10
2.1 Steering-uncontrolled model
Assumptions
Despite its higher complexity compared to point-mass models to be introduced
later, the Meijaard Model makes several critical assumptions:
• Ideal hinge connections between the bicycle’s parts with negligible fric-
tion.
• Lateral symmetry in bicycle design and circular symmetry in wheels.
• The motion of the rider is assumed to be negligible in relation to the bike
body. Additionally, the model does not consider the rider’s flexibility or
control reflexes.
• All bicycle parts are treated as rigid, with no allowance for structural
compliance or the presence of dampers.
• No tire model with compliance and slip, nor tire deformation.
• Knife-edge rolling wheels with point contact, in contrary to the contact
with toroidal wheels for motorcycles.
• External forces limited to conservative gravity forces and torques f =
[Tφ , Tδ ]T , making the entire system conservative and without dissipative
forces.
11
Chapter 2 Bicycle Dynamics
design: In [24], the wobble mode of the bicycle with cyclist is studied based on
the model. In [25], a simulator is developed with lateral dynamics computed
according to the model. [26] analyses the impacts of different electric bicycle
design on the self-stability property and suggested the bicycle configurations
for cycling comfort enhancement. In [27], a MIMO LQR controller is designed
for tracking yaw and longitudinal speed. In [28], an LQR controller with in-
tegral actions and a Linear Matrix Inequality (LMI)-based observer for roll
tracking is developed, using the longitudinal speed as a scheduling parameter.
In [29], a fuzzy-logic controller for path-tracking is designed with the help of
a nonlinear system identification technique with the numerical Gauss-Newton
method. In [30], a sliding-mode controller is designed with an identified model,
achieving greater robustness than PID controllers. [31] presents a multi-loop
controller for tracking path references. In [32], a fuzzy controller is designed
based on the Lyapunov stability criterion. [33] develops a robust controller
for a motorcycle using quantitative feedback theory.
dLx d2 φ Dv dδ Dδ
=J 2 − − v̇, (2.3)
dt dt b dt b
12
2.2 Steering-controlled model
where v̇ = dvdt is the longitudinal linear acceleration. The latter two terms
describe describes the effect of variations in ω, due to either the changes in
steering angle δ or the speed v.
According to Newton’s second law, the time-derivative of angular momen-
tum dL dt in longitudinal direction should equal the sum of the torques, i.e.,
x
Hence
d2 φ Dv dδ mv 2 h Dδ
J 2
− − tan (δ) = mghCM sin (φ) + v̇. (2.5)
dt b dt b b
With small angle assumptions on φ and δ:
d2 φ Dv dδ mv 2 h Dδ
J 2
− − δ = mghCM φ + v̇. (2.6)
dt b dt b b
The resulting model exhibits instability, regardless of the speed v, which
contradicts the self-balancing property extensively discussed in the context of
the Meijaard Model. By including the rotation of the center of mass of the
front wheel due to steering, the self-stabilization property can be retained, as
demonstrated in equation (14) in [20]:
13
Chapter 2 Bicycle Dynamics
Additional Assumptions
In addition to the assumptions applicable to the Meijaard Model, several more
have been made to simplify the model further:
• The steering angular rate is the system input, thus eliminating other
steering dynamics and rendering the front assembly inertia-less.
14
CHAPTER 3
Bicycle robot
3.1 Actuators
The modified bicycle is equipped with two actuators. These actuators align
with the degrees of freedom defined in the bicycle models of [13] and [20]. One
15
Chapter 3 Bicycle robot
motor manages the steering, while the other regulates longitudinal speeds.
This setup mirrors the approach human cyclists use for balancing, if we dis-
regard the lateral motions made by their upper bodies.
Steering Motor
We selected a graphite brushed motor, Maxon® DCX32L GB KL 24V, paired
with a gearbox GPX32HP at a 111:1 gear ratio. A timing belt transfers the
rotation to the handlebar, as depicted below. For control, a Maxon® ESCON
50/5 servo motor controller is utilized. During experiments, the steering angu-
lar rate is capped at 1 rad/s for safety, and the motor controller’s maximum
current is set to 5 A. Despite the high resolution of the motor-gearbox as-
sembly (approximately 1110.9
≈ 8.1 × 10−3◦ ), as per the datasheet, the timing
belt under load exhibits a substantial backlash of about 5◦ . This backlash
introduces uncertainty in encoder readings and challenges in controlling the
bicycle, particularly during steering direction changes.1
Assumption
The ESCON® 50/5 controller operates at a sampling rate of 53.6 kHz, well
above the balancing controller’s 100 Hz rate. Thus, we assume that the steer-
ing motor control is sufficiently rapid to meet the requirements of the point-
mass model. This model presupposes ideal steering angular rate control with
negligible steering dynamics.2 However, this assumption might not hold at
low speeds, where higher torque and larger steering actions are needed, due
to the motor’s current (torque) and speed limitations.
Drive Motor
We selected a brushless DC motor, Crystalyte® HS 2440, for longitudinal
propulsion. To regulate speed consistently, the VESC® 6 MkVI motor con-
troller was chosen. This motor operates without sensors, relying on back EMF
signals processed by the VESC® for rotor state estimation.
16
3.2 Sensors
Different Mountings
The drive motor’s mounting varies based on the motor type, with options
including the front wheel, mid-pedal area, or rear wheel. Fig. 3.3 illustrates
both front and rear mounting configurations. For applications requiring high
torque, we recommend the rear wheel mounting due to its superior structural
strength. The longitudinal speeds at these various points can be converted
according to equations (B.6) and (B.4).
Assumption
Given the relatively slow dynamics of the bicycle, we assume the rear wheel
speed, vr , remains constant during experiments. However, this assumption
might be less valid at lower speeds. Moreover, when the drive motor is
mounted on the front wheel, a large steering angle, δ, can affect the rear
wheel speed.
Challenge
A notable challenge is the diminished and infrequent back EMF signal at low
motor speeds, inherent in sensorless control strategy. This issue compromises
control accuracy, particularly in low-speed or high-torque conditions, prompt-
ing consideration of sensored BLDC motors for improved performance in these
scenarios.
3.2 Sensors
This section describes the sensors implemented on the bicycle. Throughout
our experiments, these sensors capture measurements of steering angle, roll
angle (and rate), bike position, longitudinal speed, and heading. A Kalman
filter, designed by us, integrates these measurements to refine state estima-
tions.
17
Chapter 3 Bicycle robot
Challenge
Challenge
The primary challenges with the IMU are the signal-to-noise ratio (SNR)
of the accelerometer and gyroscope data, and electromagnetic interference
(EMI) from the motors. The accelerometer data, particularly susceptible to
noise when the bicycle encounters bumps, contrasts with the relatively stable
gyroscope readings. These imperfections underscore the need for a sensor
fusion approach in estimation, as briefly discussed in section 3.2.
Another issue is the calibration of the IMU’s mounting. Economical IMUs
often suffer from misalignment between their measurement axes and the ge-
ometric axes, as well as biases in accelerometer and gyroscope outputs. To
address accelerometer biases, we devised a simple calibration method under
specific assumptions. The bicycle is positioned upright, aligning actual accel-
erations to [ax , ay , az ] = [0, 0, g]. Misalignment and biases are then compen-
sated for by calculating roll (X-axis) and pitch (Y-axis) rotations. The steps
below detail the process of transforming IMU measurements (am m m
x , ay , az ) into
18
3.2 Sensors
the bicycle’s local frame accelerations (ax , ay , az ), along with the calculation
of misalignment angles φ0 and θ0 :
• We assume the IMU’s three axes are orthogonal to each other and that
the IMU is mounted at the geometric center of the bicycle, aligning
the IMU’s x-axis with the bike’s longitudinal plane. This necessitates
placing the IMU at the bicycle’s lateral center, with its X-axis pointing
forward. Consequently, the remaining misalignment between the bicy-
cle’s body axis and the IMU can be described as a combination of roll
(X-axis) and pitch (Y-axis) rotations.
• The misalignment in pitch (Y-axis) rotation from the IMU axis to the
bicycle body axis is denoted as θ0 .
• The misalignment in roll (X-axis) rotation from the IMU axis to the
bicycle body axis is denoted as φ0 .
Rx (φ0 ) and Ry (θ0 ) are the rotation matrices in x-axis and y-axis, re-
19
Chapter 3 Bicycle robot
aˆm
y
φ0 = arctan q (3.8)
2
aˆm ˆm 2
x + az
aˆm
x
θ0 = arctan q (3.9)
2
aˆm ˆm 2
y + az
(3.10)
20
3.2 Sensors
GPS
We selected the Ublox® ZED-F9p GPS module to determine the bicycle’s
position. It provides longitude, latitude, speed, and course data to the mi-
crocontroller, as modeled in (B.21). With L2 signals, this GPS unit samples
data at 10 Hz.
Challenge
While the nominal GPS sampling rate is 10 Hz, the measurements can some-
times be delayed or dropped. These errors are identifiable by comparing lon-
gitude, latitude, and GPS NMEA timestamps against predicted values. We
apply a filtering technique during data acquisition in the Kalman filter process,
ensuring the reliability of the measurements.
Challenge
A significant challenge with this speed estimation method is the occurrence
of random multi-pulses triggered by certain magnets, possibly due to their
breakage or unevenness. To address this, we adjust the sensor’s bounce time
21
Chapter 3 Bicycle robot
3.3 Microcontroller
For our system, we selected the NI MyRio® -1900 microcontroller to interface
with the previously mentioned sensors and actuators. Operating on a real-time
Linux system, it comprises two processing layers: FPGA and CPU. We utilize
LabVIEW to achieve a 100 Hz sampling frequency. The FPGA primarily
handles communication tasks to ensure rapid input and output speeds, while
the CPU is responsible for executing control and state-estimation algorithms.
Table 3.1 provides an overview of the communication protocols employed for
each hardware component and the respective processors involved.
22
3.4 Control algorithms
Path-tracking loop
The roll tracking controller generates a roll angle reference φref for following a
predefined path. Intuitively, a left (negative) roll reference steers the bicycle to
the left, and vice versa. Several algorithms are suitable for this control strat-
egy. The difference between the reference and current positions is projected
into lateral and longitudinal errors, which are then mitigated by the steering
and drive motor propulsion, respectively. The Line-of-Sight technique, com-
monly used in missile guidance, and other approaches like [11], are referenced
here. The Line-of-Sight algorithm tracks the reference by vectoring the track-
ing error and using this vector as the reference heading angle ψref . A simple
proportional (P) controller tracks this reference heading angle with the roll
reference signal φref . Conversely, [11] decomposes the error into lateral and
longitudinal components, tracking the position reference via a combination of
lateral and longitudinal position controllers. Due to the bicycle’s underactu-
ated nature, a look-ahead set-point is essential in both methodologies.
An example of the Line-of-Sight path tracking algorithm is as follows: Let
(X G , Y G ) represent the bike position (X, Y ) in the global coordinate system,
with the subscript ref indicating the reference state. At timestep T , the error
vector between the looked-ahead time ∆T reference position and the current
position is calculated as:
{G}
∆X {G} (T ) = Xref (T + ∆T ) − X {G} (T )
{G}
∆Y {G} (T ) = Yref (T + ∆T ) − Y {G} (T )
23
Chapter 3 Bicycle robot
∆Y {G} (T )
ψref (T ) = arctan (3.11)
∆X {G} (T )
To track the heading reference, with KP as the control gain, the roll reference
is determined by:
Balancing Loop
The balancing loop receives the roll rate reference φ̇ref and outputs steering
rate reference δ̇ref to keep the bicycle balanced. It is designed together with
the roll tracking loop and the both of them are Proportional controller in our
application. Bandwidths are the crucial design factors, as too high bandwidth
may excite unexpected dynamics in the control loop and consequently, induce
oscillations. In practice, the author has observed an oscillation of 2.7 Hz on
the real bicycle, when the balancing control gain is too high, i.e., <> 7. The
oscillation at this frequency may relate to the weave mode of the bicycle [47],
and it was likely excited by the IMU gyroscope sensor noises. This arises
a practical limit for balancing control, especially at lower speeds where high
control gains are often required.
Let KP φ̇ be the gain in the balancing loop:
24
3.4 Control algorithms
Steering tracking
The innermost loop in Fig. 3.6, steering control, is incorporated into the
steering motor driver ESCON® 50/5, operating a Proportion-Integral (PI)
controller at 53.6 kHz. With a PI structure hard-coded in the motor driver,
this controller tracks the steering angular speed reference δ̇ref according to the
measurement from Maxon® HED 5540 incremental encoder. Given its high
sampling frequency (53.6 kHz) relative to other loops (100 Hz), we assume
ideal tracking from the steering control loop in our experiments. To prevent
accidents, the maximum permissible steering angle is limited to 45◦ , and the
steering angular speed is limited to 1 rad/s.
State Observer
An observer processes sensor data, providing estimated states to the con-
trollers in various loops. For our path-tracking application, the primary states
are position X, Y , and roll angle φ. Additionally, speed v, roll angular rate φ̇,
heading Ψ, steering angle δ, and encoder bias δ0 are estimated to facilitate fu-
ture state predictions. Detailed information about the observer can be found
in the paper referenced in B.
25
Chapter 3 Bicycle robot
Microcontroller
IMU
Steering
Motor
RPS
Observer
GPS (Kalman Controller
Filter)
Steering
Encoder
Longitudinal
Motor
Longitudinal Motor
Driver (VESC)
26
3.4 Control algorithms
Steering Axle
Timing Belt
Encoder
Rear mounting
Front mounting
Figure 3.3: Drive motor mounted at the front or the rear wheel
27
Chapter 3 Bicycle robot
Magnet × 9 Reed
Proximity
Sensor
Figure 3.4: Mounting of magnets and RPS on the wheels
Path-tracking Roll-tracking
controller Cascade loop
Kalman Filter
disturbances
vref ev v
Kv L′bike v
−
v̂
Figure 3.6: Schematic of the cascade control loops in roll tracking controller
28
CHAPTER 4
4.1 Paper A
Yixiao Wang, Fredrik Bruzelius, Jonas Sjöberg
Closed loop gray box identification of a self-balancing bicycle and its
application on a gain-scheduling controller
Accepted by 16th International Symposium on Advanced Vehicle Control
AVEC’24 .
This paper addresses the balancing control problem of the bicycle robot at
different speeds. Although high control gains will in general work for balanc-
ing, there are physical limits from actuators and system dynamics. Therefore
a model-based design approach will be beneficial, as it suggests lower but ap-
propriate gains. Then another problem is how to obtain a numerical model
of the bicycle robot to aid the design. We chose a data-driven approach by
applying system identification technique. Combining these strategies, this pa-
per applies a Gray-box identification technique to the robot bicycle, aiming to
29
Chapter 4 Summary of included papers
4.2 Paper B
Yixiao Wang, Fredrik Bruzelius, Jonas Sjöberg
A Kalman filter-based leaning, heading and position estimation for a
bicycle robot
In preparation for submission .
To accomplish balancing and trajectory tracking tasks, the crucial states, in-
cluding roll angle, position, heading angle and speed are requested by the con-
troller. Four different sensors measure them at different frequencies. Hence,
sensor fusion is needed to combine the information from both the sensor mea-
surements and the known numerical models. The steering encoder bias, as a
hidden state, is also identified and included in our state estimation, which is
induced by the gearbox backlashes of the steering transmission. As a result, a
total of 8 states are estimated in this sensor fusion problem. Meanwhile, the
multi-rate sensor properties and real-time performance requirements should
be considered. By exploiting the dynamical connection between roll and posi-
tion, this paper provides a multi-rate state estimation approach in a Kalman
scheme. Thanks to this connection, the backlashes in steering transmission
is estimated and adapted to by the estimator, resulting in a more accurate
estimation and dead-reckoning performance. Since the estimator is in a sta-
tionary Kalman filter scheme, the computation complexity is much lower than
Extended Kalman filters or Particle filters, making it possible to deploy on
our microcontroller.
30
4.3 Paper C
4.3 Paper C
Yixiao Wang, Fredrik Bruzelius, Jonas Sjöberg
Iterative learning trajectory tracking control of an autonomous bicycle
Accepted by 16th International Symposium on Advanced Vehicle Control
AVEC’24 .
For effective interaction with other test objects, precise bicycle trajectory
tracking control is essential. Such control should ensure that both the progress
and the path are well managed. As feedback control is driven by the errors, its
performance is limited by the unmodelled dynamics and control constraints.
The tracking errors will consequently not be eliminated and will behave same
during the repetitive experiments. To further reduce the errors in feedback
control, feedforward is often introduced as an external reference to the con-
trol loop. In the case of repetitive control tasks, Iterative Learning Control
(ILC) further provides an approach to learn an adaptive feedforward. This
approach can exploit the repetitive feature of our control application and fur-
ther reduce the tracking errors as we repeat the experiments. In this paper,
we present a design of an ILC controller tailored for the trajectory tracking
problem of an autonomous bicycle. We have decomposed the ILC trajectory
tracking problem into a longitudinal and a lateral motion ILC tracking prob-
lems. This decomposition is based on several underlying assumptions related
to lower level controllers and no tyre side-slip. The resulting lateral controller
depends only on position, while the longitudinal ILC controller depends only
on time. To illustrate the performance of the controller, simulations have been
conducted. The positive result shows the proposed ILC controller is ready for
deployment on the real bicycle, which will be implemented in the future.
31
CHAPTER 5
33
Chapter 5 Concluding Remarks and Future Work
34
References
35
References
36
References
37
References
38
References
39