Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Parameter Refinement of a Ballbot and Predictive

Control for Reference Tracking with Linear


Parameter-Varying Embedding
1st Dimitrios S. Karachalios 2nd Hossam S. Abbas
Institute for Electrical Engineering in Medicine Institute for Electrical Engineering in Medicine
University of Luebeck University of Luebeck
Lübeck, Germany Lübeck, Germany
arXiv:2402.12092v1 [math.OC] 19 Feb 2024

email: dimitrios.karachalios@uni-luebeck.de email: h.abbas@uni-luebeck.de

Abstract—In this study, we implement a control method for The dynamic model structure is well-known for robotic
stabilizing a ballbot that simultaneously follows a reference. A systems based on physical laws. The identification of the
ballbot is a robot balancing on a spherical wheel where the parameters can be obtained through classical mechanics [5]
single point of contact with the ground makes it omnidirectional
and highly maneuverable but with inherent instability. After and enhanced white modeling, but parameters that describe
introducing the scheduling parameters, we start the analysis friction can be determined only experimentally. This study will
by embedding the nonlinear dynamic model derived from first provide a method that refines the parameters that define the
principles to a linear parameter-varying (LPV) formulation. nonlinear ballbot model from the measurements derived in [1].
Continuously, and as an extension of a past study, we refine For controlling the ballbot, often, PID controllers considered
the parameters of the nonlinear model that enhance significantly
its accuracy. The crucial advantages of the LPV formulation [1], [6] or with double-loop approaches [3]. One of the
are that it consists of a nonlinear predictor that can be used limitations of the aforementioned methods is the consideration
in model predictive control (MPC) by retaining the convexity of input/state constraints.
of the quadratic optimization problem with linear constraints Model predictive control (MPC) has been widely applied
and further evades computational burdens that appear in other
for reference tracking with constraints [4]. It can generate
nonlinear MPC methods with only a slight loss in performance.
The LPVMPC control method can be solved efficiently as a optimal trajectories that steer the robot in a constrained space.
quadratic program (QP) that provides timing that supports real- Since autonomously moving robots are safety-critical systems,
time implementation. Finally, to illustrate the method, we test nonlinear MPC (NMPC) is gaining popularity due to its
the control designs on a two-set point 1D non-smooth reference ability to utilize high-fidelity nonlinear models, enabling more
with sudden changes, to a 2D nonstationary smooth reference
accurate and precise control actions. Another advantage of
known as Lissajous curves, and to a single-set point 1D non-
smooth reference where for this case theoretical guarantees such MPC is that it can be leveraged with planning algorithms,
as stability and recursive feasibility are provided. which is crucial for such autonomously moving objects. The
Index Terms—Identification, Control, Ballbot, Model Predic- drawback of NMPC is the computational complexity that
tive Control, Linear Parameter-Varying, Quadratic Program makes online minimization of the underlying objective func-
tion over a nonconvex manifold cumbersome. Therefore, a
I. I NTRODUCTION good alternative is to utilize the LPV formulation that can
embed the nonlinear model equivalently and introduce the
A ballbot Fig. 1 is an omnidirectional mobile robot that
LPVMPC framework that can be solved efficiently as QP,
balances on a single spherical wheel [1]–[3]. The single point
with nearly the same computational burden as in linear MPC,
of contact with the ground makes this under-actuated system
enabling real-time implementation.
agile but challenging to control. The use cases of a ballbot
include healthcare, virtual assistants, etc., as service robots, θy
where maneuverability in busy environments while maintain- z rw Virtual
ing stability is important. A ballbot system’s stability implies ϕy
balancing and trajectory tracking through a predetermined Wheel

path. Linear control of a ballbot [1] is proven insufficient, and


rb x
the LPV model, being much closer to the nonlinear model,
has shown great potential in several applications, such as
autonomous vehicles [4]. Side View
Fig. 1: The Ballbot constructed at the Institute for Electrical
This work was funded by the German Research Foundation (DFG), project
number 419290163. Engineering in Medicine (IME) and side view on the xz-plane.
Contents: Sec. II contains preliminaries and definitions. In The nonlinear state-space representation of the planar ballbot
Sec. II-A, the nonlinear ballbot model is presented. Continu- model is given next in (3).
ously, in Sec II-B, the linear parameter-varying (LPV) model     
0

q̇ q̇
is presented with technical aspects. In Sec. II-C, we refer to

=
M −1 (−C − D − G − ϵ)
+
M −1 Be τy , (3)
other stabilization methods that will help tune our terminal |{z} | {z }
cost, and in Sec. II-D, the LPVMPC complete framework ẋ f (x,u)
is introduced with all the details along with algorithms for
where, x = [ϕy , θy , ϕ̇y , θ̇y ]⊤ is the state vector of the system
ease of implementation. Sec. III contains results; in particular,
with ϕy the angular displacement, θy the tilt angle, ϕ̇y the
in Sec.III-A, the nonlinear model is identified. In Sec. III-B,
angular speed of the ballbot and θ̇y the angular speed of the tilt
three representative scenarios on reference tracking illustrate
angle. The input to each plane, e.g., τy , is the virtual wheel’s
the developed method together with results that can ensure
torque Fig. 1. The virtual torques (τx , τy , τz ) can be converted
theoretical guarantees. Finally, a discussion followed by ac-
to real torques of the three motors (τ1 , τ2 , τ3 ) as in [1] by using
knowledgment concludes the study.
(4), where for the design in Fig. 1 it holds that the Zenith angle
Notations: In is the identity matrix of dimension n. The
is α = π/4 = 45◦ .
notation Q ⪰ 0 represents the positive semi-definiteness of a   
2 1
matrix Q. The weighted norm ∥x∥Q is defined as ∥x∥2Q = 0
 
τ1 cos α √ sin α τx
x⊤ Qx and similarly ∥x∥2P = x⊤ P x, ∥u∥2R = u⊤ Ru. The τ2  = 1  1 3 1  
3

 cos α cos√α sin α  τy . (4)
function diag(x) constructs a diagonal square matrix from τ3 1 3
− cos α − cos α sin α 1 τz
a vector x. The set of positive integers, including zero, is
denoted by Z+ ∪ {0}; i|k denotes at time k the ith prediction. Now that we have a well-defined nonlinear model, we can in-
troduce an equivalent representation with an LPV embedding.
II. P RELIMINARIES AND D EFINITIONS B. The Linear Parameter-Varying (LPV) Embedding
A. Nonlinear Model of a Ballbot The linear parameter-varying (LPV) embedding [7]–[10]
can be seen as a structured linearization over an adaptive oper-
The ballbot model is thoroughly discussed regarding the
ational point that depends on the scheduling parameters. The
Euler-Lagrange method of formulating the dynamics in [1],
nonlinear system in (3), can be embedded in the continuous-
[2]. A first attempt towards model discovery was performed in
time LPV representation by denoting with the subscript ”c” the
[1], where a linearized model was used to balance the ballbot.
continuous operators that depend on the variable ρ as Ac (ρ),
The ballbot is a 5-DoF system, where three are the body’s
Bc (ρ) and define the continuous-time LPV model as
rotational motion, and the two are the translation in the xy-
plane. We will see that the body’s angular position θ is used (
mainly for balancing, and the angular position of the ball ϕ is ẋ(t) = Ac (ρ(t))x(t) + Bc (ρ(t))u(t) ≡ f (x(t), u(t)),
(5)
used mainly for tracking see Fig. 1. ρ(t) = σ(x(t)), x0 = x(0), t ≥ 0,
The symmetry of the ballbot control problem helps us
where ρ is the so-called scheduling parameter that belongs
focus independently on just the xz-plane [1] to simulate and
to the scheduling set P ⊂ Rnρ that defines the range of the
understand its stability and controllability. The ballbot state
scheduling parameter, and it should be compact. Further, ρ
space model in (1) gives us the two observable and controllable
depends on the states through the mapping σ : Rnx → Rnρ .
states as q = [ϕy , θy ]T , together with τy , being the control
For the nonlinear system under consideration (on one plane
input torque of the virtual wheel actuator of the ballbot in the
of the ballbot), the state dimension is nx = 4. We consider
xz-plane as in Fig. 1 (right).
two scheduling parameters of the LPV model as θy (t) and
The ballbot model consists of the following matrices
θ̇y (t), thus nρ = 2 and ρ(t) = (θy (t), θ̇y (t)). Therefore, in
M, C, D, G, that denote the mass, Coriolis force (centrifugal
this case, the functionality σ 1 can be seen as a linear function
forces), frictional torque, and gravitational forces, respectively,
that chooses from the state vector only some states. Finally,
together with the input vector B. e The nonlinear mechanical
the input dimension is nu = 1 with u(t) = τy (t) representing
model is
the virtual torque of the virtual wheel Fig. 1.
M (q)q̈ + C(q, q̇) + D(q̇) + G(q) = Bτ
e y, (1) The considered LPV system’s matrices of the continuous-
time state-space model are given by (6), and the elements of
where the matrices are defined as: the matrices Ac and Bc are given in Table I.
 
b1 −b2 + ℓrb cos θy
M= ,
   
0 0 1 0 0
−b2 + ℓrb cos θy b3
Ac (ρ) = 0 0 0 1   0 ,
    0 A32 A33 A34 , Bc (ρ) = B31 (6)
−ℓrb sin(θy )θ̇y2 b ϕ̇
C= , D= 4 y , (2) 0 A42 A43 A44 B41
0 0
   rb  A discretization of the nonlinear continuous model is manda-
0 e = rwr .
G= , B  ⊤
−ℓg sin(θy ) − rwb 1 Functionality: σ(x) = x⊤
0 1 0 0
=

θy θ̇y

= ρ.
0 0 0 1
TABLE I: Elements of the operators Ac (ρ) and Bc (ρ), with given, the LPV operator remains linear w.r.t. the state x and
their respective scheduling parameters given within the paren- input u. In such cases, the LPV continuous operator will be
theses Aij (ρ) and Bij (ρ), and their scheduling signals are denoted as:
given by ρ = (θy , θ̇y ) as shown in the table.
(ρ)
fLPV (ρ, x(t), u(t)) := Ac (ρ)x(t) + Bc (ρ)u(t). (8)
d(θy ) b1 b3 − (−b2 + ℓrb cos(θy ))2
Consequently, when the scheduling parameter can be con-
 ℓg sinc(θy )(b2 −ℓrb cos(θy ))
A32 θy , θ̇y d(θy ) sidered known, we will denote the LPV operator with a
(ρ)
 b3 b4 superscript ρ as fLPV that will indicate that ρ is independent
A33 θy , θ̇y − d(θ )
y of the state/input allowing linear actions on both. In particular,
A34 θy , θ̇y
 b3 ℓrb sin(θy )θ̇y Remark 1 allows the LPV predictor to be inserted in a linear
d(θy )
MPC framework and retain all the characteristics of the opti-
b1 ℓg sinc(θy )
mization problem that stay invariant under linear operations.

A42 θy , θ̇y d(θy )
For instance, the convexity of the optimization problem and the
 b4 (b2 −ℓrb cos (θy ))
A43 θy , θ̇y − d(θy ) linear constraints can be retained. At the same time, efficient
 ℓrb sin (θy )θ̇y (b2 −ℓrb cos (θy ))
algorithms of QP can solve the underlying control problem
A44 θy , θ̇y d(θy ) efficiently.
 rb (b3 −(b2 −ℓrb cos (θy ))
B31 θy , θ̇y rw d(θy ) C. Stabilization and closed-loop parameters identification
 rb ((b2 −ℓrb cos (θy ))−b1 )
B41 θy , θ̇y rw d(θy ) To identify the parameters of the ballbot as a real physical
system, it was stabilized in [1] through a proportional integral
tory before setting the framework that combines the LPV with derivative (PID) controller. During stabilization in [1], a multi-
Model Predictive Control (MPC). Therefore, to discretize (5), harmonic excitation signal provided enough measurements to
many methods exist that differ in accuracy and numerical identify a linear model that is defined with the p-parameters
properties (s.a., numerical stability). For instance, the Forward provided in Table II and in the study [1]. The identified linear
Euler method is commonly used due to its ease of implemen- model could stabilize the ballbot with an optimal feedback
tation, but it usually endures low-level accuracy and, most gain K utilizing the solution of the linear quadratic regulator
importantly, inherits numerical instability. Therefore, we evade (LQR) approach. In this study, we will use the identified linear
such numerical pitfalls by utilizing the Runge–Kutta 4th order
with a single-time step (RK4). Consider the sampling time ts TABLE II: Physical parameters of the ballbot model (2), with
that spans the continuous time as t = ts k, k ∈ Z+ ∪ {0}, p being the linearized model parameters from [1].
and, it is denoted as x(tk ) = x(kts ) = xk . We denote the p1 p2 p3 p4 p5
angular velocity of the tilt angle θy as θ̇y (t) := ωy (t) and the -342.6038 -52.8301 -1425.9 -36.0734 -9.1477
corresponding discrete value is ωk . Similarly, we denote the p6 ℓ[m] rb [m] rw [m] g[m/s2 ]
angular velocity ϕ̇y (t) := φy (t), thus, the complete discrete 251.8476 0.2978 0.12 0.05 9.81
 ⊤
state vector remains xk = ϕk θk φk ωk .
By denoting the continuous in-time LPV operator fLPV (i.e., model from [1] for discovering the b parameters that define
fLPV is equivalent with the nonlinear operator f ) of the ballbot the refined values in (1) after solving (offline) a nonlinear
system, we can rewrite (5) as ẋ(t) = fLPV (x(t), u(t)) := optimization problem as will be explained in Sec. III-A.
Ac (σ(x(t)))x(t) + Bc (σ(x(t)))u(t) with the input u(t) = Consequently, the LPV embedding of the identified nonlinear
τy (t). The Runge-Kutta discretization method of order 4th model will allow the LPV integration within the proposed
(RK4) with a single time step ts when zero-order hold (ZOH) MPC scheme as shown in Sec. III-B that will handle the
is considered remains: stabilization and reference tracking of the ballbot simultane-
 ously without cascading complex control designs based on the

 κ1 = fLPV (xk , uk ) linearized model.

 κ2 = fLPV (xk + (ts /2)κ1 , uk )



RK4 κ3 = fLPV (xk + (ts /2)κ2 , uk ) (7) D. Model Predictive Control with LPV Embeddings



 κ4 = fLPV (xk + ts κ3 , uk ) Model predictive control with linear parameter-varying em-



xk+1 = xk + (ts /6)(κ1 + 2κ2 + 2κ3 + κ4 ). beddings implies that the MPC optimally controls an under-
lying time-varying model based on the scheduling parameters
Thus, we introduce the following remark to proceed with linear shown in the LPV formulation (5). The standard MPC form
operations with the LPV formulation, which will be essential begins with the cost function defined as Jk (u) as seen in (9),
for deriving a predictor that retains the characteristics of the where xi|k denotes the discretized state vector at time k and
underlying optimization problem. prediction i. The i varies in length i = 0, . . . , N − 1 with
Remark 1 (The operator fLPV with a given scheduling N the prediction horizon length. The reference state vector is
variable ρ is linear): When the scheduling parameter ρ is given as xref
i|k .
among other methods, that can handle constraints. MPC can be
N −1
X extended easily to include trajectory planning of the ballbot
Jk (u) = (∥xi|k − xref 2 2
i|k ∥Q + ∥ui|k ∥R )+ when it moves in a structured environment with obstacles.
i=0
(9) Tangent planes can play a significant role in keeping the
+ (∥xN |k − xref 2
N |k ∥P , optimization problem as QP, like the work in [4].
| {z }
terminal cost The QP optimization problem is formulated together with
the LPV predictor at the ”present” time k as the function
where Q ⪰ 0, R ≻ 0, P ≻ 0 are weighting symmet-
QP(ρi|k , xk , xref
i+k ) with the input arguments; 1) the given
ric matrices. Theoretically, to provide closed-loop stabiliza-
(from previous time) scheduling signal ρi|k ; 2) the initial
tion of the LPV model, for some feedback gain K(ρ) the
conditions xk ; 3) the reference xref
i+k . The Quadratic Program’s
A(ρ)−B(ρ)K(ρ) should be Hurwitz for all possible parameter
(QP) functionality is defined next in Algorithm 1.
variation of ρ. In this study, with the suitable tuning of
the LQR on the linearized model, we could provide a non- Algorithm 1 The quadratic program (QP) based-LPVRK4
parametric state feedback gain K that satisfies the Hurwitz
condition for the LPV over a dense grid that covers the Input: The time step k ∈ Z+ , the weighted costs Q, R, P ,
scheduling space P. In addition, the algebraic Riccati solution the triplet (ρi|k , xk , xref
k+i ), for i = 0, . . . , N − 1, the
P will be used to penalize the terminal cost of the MPC. horizon length N ∈ Z+ and the sampling time ts ∈ R+ .
In (9) and on the one hand, the explicit decision variables are Output: Optimal numerically design ui|k , i = 0, . . . , N − 1.
the input entries ui|k , i = 0, . . . , N − 1. Thus, the optimizer Minimization of the quadratic cost function:
should provide a solution in u that minimizes the energy PN −1  
ref 2
min i=0 ∥x̂i|k − xref k+i Q∥ 2
+ ∥u 2
i|k R + ∥x̂N − xk+N ∥P

function (9). On the other hand, the xi|k , i = 0, . . . , N ui|k | {z }
terminal cost
consists of the set with the implicit decision variables inserted Subject to:
through a predictor. Suppose the prediction xi|k depends 1: x̂0|k = x0|k = xk ,
nonlinearly on previous states. In that case, the energy function 2: for i=0,. . . ,N-1 do
will not remain quadratic or convex, inevitably leading to 3:
(ρ ) 
κ1 = fLPVi|k ρi|k , x̂i|k , ui|k ,
nonconvex optimization formulation where the cost of solving (ρ ) 
such problems inherits high complexity. 4: κ2 = fLPVi|k ρi|k , x̂i|k + (ts /2)κ1 , ui|k ,
(ρ ) 
To evade such a computational burden, by utilizing the 5: κ3 = fLPVi|k ρi|k , x̂i|k + (ts /2)κ2 , ui|k ,
(ρ ) 
LPV formulation together with the property in Remark 1, 6: κ4 = fLPVi|k ρi|k , x̂i|k + ts κ3 , ui|k ,
when the scheduling variable is given, the implicit decision 7: Update: x̂i+1|k = x̂i|k + (ts /6)(κ1 + 2κ2 + 2κ3 + κ4 ),
variables xi|k are introduced linearly in the energy function 8: end for
and retain the quadratic manifold where the minimization is 9: Satisfy: x̂i|k ∈ X , ∀i = 1, . . . , N ,
quite efficient through the quadratic program (QP) that will 10: Satisfy: ui|k ∈ U, ∀i = 0, 1, . . . , N − 1.
introduce next.
Importantly, good scheduling estimation will make the adap- Next, we discuss Algorithm (1) step by step when it is called
tive nature of the LPV over a potentially nonlinear manifold at the simulation time instance k ∈ Z+ :
quite accurate. Good predictions for the scheduling variable lie
• At time k, the input to the QP consists of the matrices
at the heart of the LPV method, and methods that introduce
Q, R, P , the initial condition xk , the reference xref k+i ,
ways, e.g., scheduling tube control [10], can provide further
and the scheduling variable that is either available from
guarantees, such as recursive feasibility and stability.
previous time k − 1 or initialized from initial conditions
Back to our aim, we want to minimize the quadratic cost
xk . In particular, when the simulation starts at time k =
function J in (9) under the linear equality constraints that
0, and there is no available scheduling prediction from
satisfy the LPV (given scheduling) predictor model together
the past, the scheduling variable is initialized as ρi|0 =
with the following linear inequalities given in (10).
σ(x0 ), i = 0, . . . , N − 1.
X = {xk ∈ Rnx | Gx xk ≤ hx }, • The optimization problem consists of the quadratic cost
(10) function (9) that is updated with the implicit decision
U = {uk ∈ Rnu | Gu uk ≤ hu },
variables x̂i|k as a function of the explicit decision
where, the state/input inequality constraints emerge as variables ui|k with the LPV predictor. This can be

+Inx
 
+xmax
 done with linear operations since the scheduling variable
x (2nx )×nx x
G = ∈R , h = ∈ R2nx , ρi|k , i = 0, . . . , N −1 is considered known, and the linear
−Inx −xmin
    property explained in Remark 1. The RK4 in lines (2-7)
u +Inu (2nu )×nu u +umax
G = ∈R , h = ∈ R2nu . is the discretization scheme that predicts the evolution.
−Inu −umin
• The QP can be solved together with the constraints
The superiority of the MPC control strategy comes exactly in lines (9-10), efficiently from [11] and provide the
at the point where constraints can be introduced. MPC casts optimized input design at each time k numerically as
the control problem into optimization with the major feature, ui|k , i = 0, . . . , N − 1.
Algorithm 2 The Ballbot QP-based LPVMPC algorithm be revealed in Step 4. The hat notation is omitted as
Input: Initial conditions x0 , with reference xref these computations result in the system’s true response,
k ,k
∈ Z+ ∪{0}
Output: The control input uk , k = 0, 1, . . ., that drives the assuming that no other disturbance or measurement noise
nonlinear system to the reference by satisfying constraints. will affect the system.
Algorithm steps • In Step 6, the one-step implementation of the input to
1: Initialize the scheduling parameter for k = 0 as next: the nonlinear system (5) is done by simulating with
ode45 (Runge Kutta 45 with adaptive time step) where
ρi|0 = (θ0 , ω0 ), i = 0, . . . , N between two consequent time instances that differ only
2: while k = 0, 1, . . . do one sampling time ts , zero-order hold (ZOH) (constant
3: Solve the QP in Algorithm 1 input of the sampling time) is considered. This high-
fidelity simulation ensures good agreement with the true
ui|k ← QP(ρi|k , xk , xref
i+k ), i = 0, . . . , N − 1 response of the physical plant.
• In Step 7, we slide the prediction horizon by one (sliding
4: Update the scheduling parameters from the designed the prediction window with length N by one sampling
input ui|k , i = 0, . . . , N − 1 with (7) as time ts )

ϕi+1|k
 
ϕi|k
  • In Step 8, we measure the new initial conditions xk .
 θi+1|k  (7) • Finally, in Step 9, we update the new scheduling variable
 = fLPV  θi|k  , ui|k 
  
xi+1|k =   φi+1|k  RK4  φi|k   at time k from the previous simulation time k−1, and the
ωi+1|k ωi|k while loop in Steps 2-10 runs to provide the next control
inputs uk for arbitrary k.

5: Update ρi|k = θi|k , ωi|k , i = 0, . . . , N III. R ESULTS AND D ISCUSSION
6: Apply uk = u0|k to the continuous system (5)
A. Refinement of the ballbot physical parameters
7: k ←k+1
8: Measure xk A linearized continuous model at xe = [0, 0, 0, 0]T can be
9: Update ρi|k ← ρi+1|k−1 , i = 0, . . . , N − 1 derived through the LPV evaluated at xe as in (11).
10: end while 0 0 1 0
 
0 0 0 1 
As we have introduced in detail the QP minimization problem 0 A32 (0, 0) A33 (0, 0) A34 (0, 0)
 
that is tailored with the LPV formulation in Algorithm 1, we Ac (0, 0) = 
 | {z } | {z } | {z } ,
p1 p2 0

are ready to proceed by stating the method in Algorithm 2 that 
0 A42 (0, 0) A43 (0, 0) A44 (0, 0)

is connected with our application on stabilizing and tracking a | {z } | {z } | {z }
given reference for the ballbot. Next, every step in the resulting p4 p5 0
(11)
Algorithm 2 is explained. 0
 
• The input to Algorithm 2 consists of the initial conditions  0 
x0 and the full state reference xref . For the ballbot system, B3 (0, 0)
 
Bc (0, 0) = 
  , d(0) = b1 b3 − (−b2 + ℓrb )2 .
the state reference contains the angular displacement of
| {z }
 p3 

the ball ϕk . In particular, θk is the tilt angle, and its B4 (0, 0)
reference target is zero, thus enforcing stabilization in | {z }
p6
that operating (unstable equilibrium) point. Finally, for
the rest of the states in xref that concern the angular By introducing the functions hi (b) : R4 → R, i = 1, . . . , 6
velocities, again, we enforce them to zero as the aim is with suport the parameterized vector b = (b1 , b2 , b3 , b4 ), we
to reach the reference ϕref and then the ballbot to remain can define:
there with θ = θ̇ = ϕ̇ = 0 (steady state) and ϕ at the gl (b2 − lrb )
A32 (0, 0) := h1 (b) = ,
target point. d(0)
• In Step 1, initialization at any instant k of the scheduling b3 b4
parameters can be done either from the previous time as A33 (0, 0) := h2 (b) = − ,
d(0)
ρi|k = σ(xi+1|k−1 ), i = 0, . . . , N − 1 or from the initial b1 g l
conditions as explained in Algorithm 1. A42 (0, 0) := h4 (b) = ,
d(0)
• In Steps 2-3, we can call the QP Algorithm 1 to provide
b4 (b2 − l rb ) (12)
the optimally designed input ui|k , i = 0, . . . , N −1. Note A43 (0, 0) := h5 (b) = − ,
that by having N inputs, we can compute N + 1 state d(0)
estimation through the LPV predictor. A34 (0, 0) := 0, A44 (0, 0) := 0,
• In Step 4, given xk and ui|k , we can compute the b3 rb − rb (b2 − l rb )
B3 (0, 0) := h3 (b) = ,
true evolution response from the nonlinear system after rw d(0)
using the exact/embedded nonlinear discrete predictor (7). rb (b2 − l rb ) − b1 rb
The scheduling parameters to be used in Step 5 can B4 (0, 0) := h6 (b) = .
rw d(0)
To infer the nonlinear b-parameters, given the p-parameters 14000
values, we must solve the nonlinear system of equations
12000
described in the set of equations (12) for the unknown vector
b = (b1 , b2 , b3 , b4 ) and with the functionality hi (b) : R4 → 10000

R, i = 1, . . . , 6. The problem remains to find b∗ that satisfies 8000

pi − hi (b∗ ) ≈ 0 for all i = 1, . . . , 6. Thus, we define the 6000


operator F (b) : R4 → R6 along with the Jacobian next:
4000
 ∂F
· · · ∂F

p1 − h1 (b) 1 1
 
∂b1 ∂b4 2000
 ∂F2
 p − h (b)   ∂b1 · · · ∂F 2

 2 2  ∂b4 
 0
0 2 4 6 8 10 12 14 16 18 20
F (b) :=   , ∇F (b) =  . .

 ..   ..
 .  

 Fig. 2: Convergence of the Newton scheme with residual error
p6 − h6 (b) ∂F6
∂b1 · · · ∂F6
∂b4
∥F (b∗ )∥ = 0.4330. The optimal parameter vector b∗ is shown
in Tab. III.
The Newton scheme for updating the parameters b with
initialization b0 and for k ∈ Z+ ∪ {0} is Nonlinear-ode45 Linearized LPV-RK4 LPV-ode45
30 0.5
−1
bk+1 = bk − [∇F (bk )] F (bk ), k = 0, . . . (13) 20
0

Upon convergence of (13), the optimal solution vector b can 10

be obtained to satisfy F (b∗ ) ≈ 0 (with the smallest possible 0 -0.5


0 1 2 3 4 5 0 1 2 3 4 5
residual). In such problems, where the nonlinear parameterized
40
manifold is nonconvex, the iterative scheme in (13) remains 2

1
divergent when random initialization is considered, or a so- 20

0
lution can be algebraically correct without explaining the 0
-1
physical law. To tackle such a problem, initialization of the -20
-2
b-parameters should be done by respecting the engineering 0 1 2 3 4 5 0 1 2 3 4 5

regularity of the problem. Thus, some parameters bi can Fig. 3: Models simulations; the linearized model given in
be initialized with physical meaning, e.g., b1 , b2 , b3 being dashed blue line; non-linear model simulation given in black;
positive to explain the high-fidelity knowledge of the physical LPV in dashed red lines; all done using ode45 on MATLAB.
plant [1] where b4 as concerns friction can remain arbitrary Finally, with green is the RK4 method utilizing (7). The input
but also with a reasonable small value. τy is a multiharmonic signal.
In Fig. 2, the iterative scheme (13) converged after five
steps and gave the optimal solution with a residual error that B. LPVMPC for Reference Tracking
stagnated to the value 0.4330. This error cannot be improved Reference tracking for a ballbot refers to the stabilized
further as the analysis relies on the identified parameters p motion by the LPVMPC method that can maneuver over
from the study [1], where the dynamics are corrupted with any given state reference xref . We will consider three study
noise and/or slight nonlinear behavior from the physical plant. scenarios. The 1st scenario will be a 1D reference tracking of
Continuously, in Fig. 3, the simulation indicates the ex- a nonsmooth discontinuous trajectory that will ”shock” the
pected performance after substituting the obtained parameters optimization problem due to the sudden changes. The 2nd
b in Table III and applying a multi-harmonic input to the scenario will be a 2D smooth reference as Lissajous curves,
stabilized plant. In particular, in Fig. 3, the nonlinear model assuming the ballbot can be driven independently in the xz and
compared to the linearized model stays close to the dynamical yz planes. Finally, a 3rd scenario will illustrate the reference
evolution for all states when the dynamics are close to the lin- tracking of a single set point with a scheme of the LPVMPC
earization operation point xe = 0 as expected. The discrepancy that can guarantee the stability of the closed-loop system and
increases for larger deviations in ϕ from the origin where the the recursive feasibility of its optimization problem. These
linearized cannot be trusted. Finally, in Fig. 3, the comparison properties are explained below. Tuning of the prediction hori-
between the LPV and the nonlinear model certifies that the zon depends on the physical system’s operational bandwidth
LPV is an equivalent embedding of the nonlinear system where and can vary significantly across applications. The ballbot is
differences are buried in machine precision error. Finally, the a robotic system that operates around 1(Hz); thus, a horizon
discrete-time implementation with the RK4 in (7) with a ZOH of about 1 (s) is reasonable.
also certifies a good accuracy compared to the ode45. 1) 1st Scenario: Nonsmooth 1D reference: In Fig. 4, we
consider the following 2-set point nonsmooth reference. The
TABLE III: The refined b parameters of the nonlinear model. ballbot should start from the origin and at t = 1 s should
b∗ b1 b2 b3 b4
roll for one circle 2π rad, then stay there for 2 s and for the
Optimal 0.002483 0.059325 0.143093 -0.07436
remaining 1 s to return to the origin; thus, it will roll a total
distance of approximately (2 · 2π · rb ≈ 1.5 m) within 4 s.
At the beginning and near the origin, positive virtual torque
applies on the ballbot to decrease the tilt angle θ that instantly
will move the ballbot to the negative ϕ, where immediately
switching direction (normal behavior of such non-minimal
phase system, similar to a bike where to turn, first a small
maneuver to the opposite direction is needed). Continuously
the ballbot increases speed in the ϕ positive direction while
approaching the target 2π with satisfying accuracy and faster
than the linear one after ≈ 1.3 s, then stays there and at
around 2+ s where the prediction horizon of time length
N · ts = 20 · 0.05 = 1 s receives the information of the sudden
change in reference from 2π to 0 rad, the ballbot slightly Fig. 4: Ballbot reference tracking with the angular displace-
overshoots in ϕ so to change the tilt angle again and starts to ment ϕ traveling from the origin to 2π rad and back. A
accelerate in the opposite direction. After less than a second, comparison between the linear and LPV MPC frameworks is
the ballbot has reached its origin without overshooting, which illustrated. θ measuring balancing of ballbot, ϕ̇, θ̇ measuring
outlines the good performance seen mainly in nonlinear MPC the angular velocities, τy is the virtual torque, J is the energy
frameworks. cost function.
In Fig. 4, we compare the MPC performances between the to global coordinates as: X ref = ϕx rb = 0.12 · 2π sin(0.3t)
LPV and the linearized model. As expected, the LPVMPC is and Y ref = ϕy rb = 0.12 · 2π sin(0.4t), under the constraints
generally faster at reaching the reference with almost similar in Table IV. In that case, the reference is smoother without
computational complexity as the linear MPC and the potential sudden changes. Therefore, we can increase the weight for
to handle better strong maneuvering as the adaptive scheduling matching the ϕ without inheriting infeasibility problems; thus,
variable ρi|k provides linearizations over a trajectory of the the quadratic cost for the 2D reference tracking in each
nonlinear ballbot model instead of a single fixed point for direction can be set as Q = diag([1000, 1, 0.1, 0.1]). All
the linearized model. The quadratic costs for the 1st scenario the other quadratic weights and parameter specifications are
are defined as Q = diag([200, 1, 0.1, 0.1]), R = 1000, and considered the same as in the 1st scenario. In Fig. 5, the
the terminal cost P is the Riccati solution from the LQR LPVMPC control strategy accurately drives the ballbot to the
on the linearized model from [1] with the same tuning of reference within an area of around 2 m2 and for 70 s.
Q and R that will penalize the ”tail” of the horizon. The
sampling time is ts = 0.05 (s), with horizon length N = 20, 0.8
and the MPC solution is obtained under the input/state hard
0.6
constraints introduced in Table IV and highlighted with the
0.4
gray background in Fig. 4. In the 1D reference tracking, as
0.2

TABLE IV: MPC Constraints 0

Variable Lower bound Upper bound Units -0.2


Start at O(0,0)
ϕk −∞ +∞ [rad]
θk −π/3 +π/3 [rad] -0.4

ϕ̇k −10π +10π [ rad


s
] -0.6

θ̇k −2π +2π [ rad


s
] -0.8
-0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8
u −1.5 +1.5 [Nm]
Fig. 5: Stabilization and Lissajous curve trajectory tracking of
shown in Fig. 4, traveling in y direction, the ballbot system the ballbot in 2D using the LPVMPC algorithm solved in both
also balances itself simultaneously, as shown with θ being xz and yz planes.
between ranges of 0 rad to 0.5 rad while traveling a distance
of ϕ, which is referenced for 2π rad, and angular velocities of 3) 3rd Scenario: Single set point reference and LPVMPC
both are shown in θ̇, and ϕ̇ respectively. They show the agile with guarantees: In our last scenario, regulated as in the 1st
and robust movements of the ballbot. Also, in correspondence (e.g., quadratic costs, etc.), we want to illustrate the crucial
to the reference and torque, τy is applied to the virtual wheel advantage of considering LPV models for MPC tasks, as it
actuator. The virtual torque is shown as discrete steps, i.e., can provide theoretical guarantees. On the one hand, when a
ZOH, and the energy function J to be minimized to get the linearized model is considered instead of the underlying non-
optimal control input τy . linear, achieving theoretical guarantees within MPC could be a
2) 2nd Scenario: Lissajous 2D smooth curves: Solving the straightforward task. Still, it will remain quite conservative and
LPVMPC reference tracking problem in parallel for the yz- thus not practically useful. On the other hand, in the case of
plane and xz-plane, we can drive the ballbot over the xy plane NMPC, guarantees can also be provided at the expense of com-
with reference as Lissajous curves in Fig. 5. The ballbot starts putational complexity. Consequently, an excellent alternative
from (x, y) = (ϕx rb , ϕy rb ) = (0, 0), and following the path for providing theoretical guarantees is the LPV formulation
within MPC, which can be considered an excellent trade-off method based on the well-known Runge-Kutta 4th order in-
between the complexity and conservativeness of the previous troduced in the LPVMPC framework potentially improves the
two general approaches. accuracy issue that can arise in the forward Euler method.
To prove theoretical guarantees, in Algorithm 1, we have to The results indicated that applying the LPVMPC-based control
introduce additionally the terminal equality constrain as method for simultaneously balancing and reference tracking
can achieve real-time implementation as the average timing
Xt = {x̂N |k ∈ Rnx | x̂N |k = xref
N +k }. (14) of solving the QP problem is usually (10)-times less than the
Thus, the state constraints X in Algorithm 1 are enhanced sampling time under consideration.
with x̂N |k ∈ Xt . Note that in the presence of the terminal Utilizing such a control design that preserves the nonlinear
constraint Xt , the terminal cost remains zero; thus, in that case, behavior of the model is advantageous and practical, unlike
no use of the weight P is needed. In Fig. 6, the dynamics are methods that work with linearized models or try to solve
illustrated when considering the terminal constraint (cyan line) very complex optimization problems tailored directly to the
in (14), where we lose some performance compared with no nonlinear, which might be impossible online. The method is
guarantees (red line). Thus, with active (14) and making use of illustrated with practical reference tracking scenarios where
the Theorem 1 in [12] (page: 6), all the conditions are satisfied theoretical guarantees can be provided in the single-set point
in our 3rd scenario, which leads to the following conclusions; case. Proving stability and recursive feasibility in the case of
i) the LPVMPC optimization problem is recursively feasible; multiple reference points is left to future investigation. Finally,
ii) the closed-loop system satisfies the constraints ui|k ∈ U, as the theoretical establishment of such a robotic system has
x̂i|k ∈ X , and x̂N |k ∈ Xt ; iii) (uref , xref ) = (0, π) is matured, implementing this method in the physical ballbot in
an exponentially stable (forced) equilibrium of the closed- a real environment is left for our immediate future endeavors.
loop system. The proof of these properties follows the same ACKNOWLEDGEMENT
reasoning as the proof of Theorem 1 in [12].
We thank Mr. Ing.-Ievgen Zhavzharov, who constructed the
ballbot in Fig. 1.
5

4
R EFERENCES
[1] M. Studt, I. Zhavzharov, and H. S. Abbas, “Parameter identification and
3
LQR/MPC balancing control of a ballbot,” in 2022 European Control
2 Conference (ECC), 2022, pp. 1315–1321.
[2] P. Fankhauser and C. Gwerder, “Modeling and control of a ballbot,”
1 2010. [Online]. Available: https://api.semanticscholar.org/CorpusID:
58555644
0
[3] D. B. Pham, H. Kim, J. Kim, and S.-G. Lee, “Balancing and transferring
-1 control of a ball segway using a double-loop approach [applications of
control],” IEEE Control Systems Magazine, vol. 38, no. 2, pp. 15–37,
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2
2018.
[4] M. Nezami, D. S. Karachalios, G. Schildbach, and H. S. Abbas, “On
Fig. 6: Single-set point reference i.e., π, for the LPVMPC the design of nonlinear MPC and LPVMPC for obstacle avoidance in
autonomous driving*,” in 2023 9th International Conference on Control,
framework with and without theoretical guarantees. Decision and Information Technologies (CoDIT), 2023, pp. 1–6.
[5] B. Siciliano, L. Sciavicco, L. Villani, and G. Oriolo, Robotics: Mod-
elling, Planning and Control, 1st ed. Springer Publishing Company,
TABLE V: Comparison of computation times for a single QP Incorporated, 2008.
[6] S. Puychaison and B. S., “Mouse type ballbot identification and control
using YALMIP with LPVMPC. The simulations are performed using a convex-concave optimization,” in In Proceedings of the Inter-
on a Dell Latitude 5590 laptop with an Intel(R) Core(TM) national Automatic Control Conference (CACS 2019), National Taiwan
i7-8650U CPU and 16 GB of RAM. The scenarios are im- Ocean University, Keelung,Taiwan, Nov. 2019, pp. 1–6.
[7] P. S. G. Cisneros, S. Voss, and H. Werner, “Efficient nonlinear model
plemented in MATLAB, utilizing the YALMIP toolbox [11], predictive control via quasi-LPV representation,” in 2016 IEEE 55th
with an optimality tolerance of 10−8 . Conference on Decision and Control (CDC), 2016, pp. 3216–3221.
LPVMPC with ts = 0.05 s Mean Standard deviation [8] M. M. Morato, J. E. Normey-Rico, and O. Sename, “Model predictive
control design for linear parameter varying systems: A survey,” Annual
1st Scenario 0.0086 s 0.0104 s
Reviews in Control, vol. 49, pp. 64–80, 2020.
2nd Scenario 0.0087 s 0.0132 s
[9] H. S. Abbas, R. Tóth, N. Meskin, J. Mohammadpour, and J. Hanema,
3rd Scenario 0.0058 s 0.0025 s
“A robust MPC for input-output LPV models,” IEEE Transactions on
Automatic Control, vol. 61, no. 12, pp. 4183–4188, 2016.
[10] H. S. Abbas, “Linear parameter-varying model predictive control for
IV. C ONCLUSION nonlinear systems using general polytopic tubes,” Automatica, vol. 160,
p. 111432, 2024. [Online]. Available: https://www.sciencedirect.com/
In this study, we were concerned with the reference tracking science/article/pii/S000510982300599X
of a ballbot by utilizing the LPV embedding within the MPC [11] J. Löfberg, “YALMIP : A toolbox for modeling and optimization in
framework. An important step was the refinement of the matlab,” in In Proceedings of the CACSD Conference, Taipei, Taiwan,
2004.
parameters of the ballbot system from measurements of a past [12] C. Verhoek, J. Berberich, S. Haesaert, R. Tóth, and H. S. Abbas, “A
study. Thus, having the nonlinear model allowed the nonlinear linear parameter-varying approach to data predictive control,” 2023.
embedding of the LPV form. An improved discretization [Online]. Available: https://arxiv.org/abs/2311.07140

You might also like