used to verify that the system is controllable under
the motor torque τ
m
. Therefore, τ
m
can be used to not
only stabilize/balance the vehicle but also act as an al-
ternative source of propulsion to the rider’s pedaling
torque.
The motor torque, which is generated by a BLDC
hub motor, is regulated by controlling the motor cur-
rent via a motor driver. Since both positive torque or
negative torque for a wide range of rotational speed
is needed for balancing, accelerating or decelerating
the vehicle, the motor driver devised for this research
can automatically switch between the motoring mode
and the regeneration mode for the sake of energy ef-
ﬁciency. The motor driver also provides a simple,
consistent motor dynamics regardless of the mode
switching.
The switching module in the motor driver as pro-
posed in (Wu and Yeh, 2013) is adopted here. This
module determines which mode the motor should be
switched to for proper operation. Furthermore, to fa-
cilitate the subsequent control design, it also performs
an input transformation so that a single 1st order dif-
ferential equation in the form of
L
di
dt
+ Ri = u (3)
can describe the current dynamics for all the four
modes. According to (3), the input to the differen-
tial equation, consequently the switching module is u.
How the mode of operation is selected and how the
duty ratios for PWM switching are computed from
the input u, the measured coil current (i), and the ro-
tational speed (ω) are given in (Wu and Yeh, 2013).
3 BALANCING CONTROL
In Legway, the COG of the vehicle body is dictated by
the rider’s posture and is uncertain to the control sys-
tem. The successful operation of Legway requires the
control system to adaptively estimate the uncertain
COG, slew it to a balanced position and then main-
tain the motor torque at a commanded value. When
the torque command is zero, the COG is slewed to
the top of the wheel axle so that the rider feels mini-
mum interference from the motor as he/she pedals the
vehicle. The rider also does not have to worry about
the uncontrollable acceleration of the vehicle even if
he/she has yet learned to properly place his/her COG
when he ﬁrst rides the vehicle. In the case that the
commanded torque is nonzero, the motor produces an
assistive torque for climbing hills, or stopping the ve-
hicle via regenerative braking.
3.1 Controller Design
The state equation and the output equation for the
controller design are in the form of
˙x = Ax+ Bu+ B
τ
τ
p
(4)
y = x+ Cϕ (5)
where x,u,y are respectively the state, the input, and
the output vectors, ϕ represents the output distur-
bance, and A, B, C are system matrices. The state
equation, which uses x =
θ
g
˙
θ
g
i
T
as the state
vector and u =u, is obtained by concatenating the dy-
namics of θ
g
and
˙
θ
g
in (2) with the current dynamics
in (3) via τ
m
= k
m
i, so A=
0 1 0
αλ
η
0
α+γ
η
k
m
0 0 −
R
L
,B =
0
0
1
L
,B
τ
=
0
α+γ
η
0
. Notice that because it is up
to the rider to apply the pedaling torque or the current
command to control the wheel speed, in the controller
design
˙
θ
w
is not considered as a state variable. As for
the the output y, it consists of the measured pitch an-
gle (θ
b
) and the pitch rate (
˙
θ
b
) from the inclinometer
and the rate gyro installed on the vehicle frame
1
, and
the motor current (i) from the hall sensors in the mo-
tor. It is assume that the the rider’s posture remains
relatively ﬁxed to the vehicle frame, so φ = θ
b
− θ
g
is
constant and
˙
φ =
˙
θ
b
−
˙
θ
g
= 0. This gives ϕ =φ,and
C =
1 0 0
T
.
The control objective is to use the feedback from
y to devise a control law for u to make x asymptot-
ically converge to a reference state x
d
. The major
challenge here is that the output is contaminated by
unknown output disturbance ϕ, so an adaptive scheme
is required for the control system to on-line estimate
and then cancel ϕ. In the following investigation,
we will temporarily ignore τ
p
, and pose the control
problem in a more general setting for x ∈ R
n
, u ∈ R
p
,
and ϕ ∈ R
q
which correspond to A ∈ R
n×n
, B ∈ R
n×p
,
and C ∈ R
n×q
. The controller design for the general
problem is given in the following theorem.
Theorem 1: Given the system in (4)(5) with τ
p
=
0, and ϕ being an unknown, constant output distur-
bance, assume that A is invertible, (A,B) control-
lable, and C has full rank. The control system con-
taining
u = −K(ˆx− x
d
) + u
d
(6)
1
˙
θ
b
is measured directly from the rate gyro. However,
to increase the sensing bandwidth, the measurement for θ
b
is obtained by merging the outputs of the rate gyro and
the inclinometer using a complementary ﬁlter(T.-J. Yeh and
Wang, 2005).
ICINCO2014-11thInternationalConferenceonInformaticsinControl,AutomationandRobotics
122