0% found this document useful (0 votes)
5 views

2024 Time Optimal Trajectory Observer

This research article presents a motion planning and control scheme for a 3D ballbot system, focusing on time-optimal trajectory generation and safety constraints. It employs a hierarchical sliding mode control (HSMC) combined with an exponential control barrier function (ECBF) to manage the ballbot's movement and ensure stability under external disturbances. The study demonstrates the effectiveness of the proposed methods through simulations, highlighting improvements in performance and safety in various operational conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

2024 Time Optimal Trajectory Observer

This research article presents a motion planning and control scheme for a 3D ballbot system, focusing on time-optimal trajectory generation and safety constraints. It employs a hierarchical sliding mode control (HSMC) combined with an exponential control barrier function (ECBF) to manage the ballbot's movement and ensure stability under external disturbances. The study demonstrates the effectiveness of the proposed methods through simulations, highlighting improvements in performance and safety in various operational conditions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Received: 6 December 2023 Revised: 8 February 2024 Accepted: 27 March 2024

DOI: 10.1002/rnc.7358

RESEARCH ARTICLE

Time-optimal trajectory generation and observer-based


hierarchical sliding mode control for ballbots with
system constraints

Duc Cuong Vu1 Minh Duc Pham1 Thi Thuy Hang Nguyen1,2 Thi Van Anh Nguyen1
Tung Lam Nguyen1

1
Hanoi University of Science and
Technology, Hanoi, Vietnam Abstract
2
Thuy Loi University, Hanoi, Vietnam This paper introduces a comprehensive motion planning–tracking–safety con-
straint scheme for a 3D ballbot system. A nonlinear control for the 3D ballbot
Correspondence
system is designed based on three separate planes by utilizing extended state
Tung Lam Nguyen, Hanoi University of
Science and Technology, Hanoi, Vietnam. observer (ESO) to estimate coupling mechanisms. Three virtual control signals
Email: [email protected] are generated from these distinct planes and can be used for formulating actual
Funding information
control signals. To overcome the complexity of nonlinear motion equations,
Hanoi University of Science and flatness theory is used to construct the time-optimal trajectory through an opti-
Technology (HUST), Grant/Award mization problem, facilitating smooth movement of the ballbot, and obstacle
Number: T2023-TÐ-002
avoidance based on RRT* waypoints. Furthermore, our work manipulates the
hierarchical sliding mode controller (HSMC) as the nominal controller to ensure
that the ballbot tracks to the optimal trajectory, unifying with the exponential
control barrier function (ECBF) to address safety constraints in the body’s deflec-
tion angle. Through extensive simulations and comparative analysis, the system
demonstrates its effectiveness and safe operation in various working conditions.

KEYWORDS
ballbot, exponential control barrier function, flatness theory, hierarchical sliding mode control,
linear quadratic Gaussian, path planning

1 I N T RO DU CT ION

In the ever-evolving landscape of robotics and autonomous systems, a ballbot is an innovative approach towards the
development of sophisticated robotic systems capable of exhibiting adaptable locomotion in unpredictable environments.
Ballbots deviate from conventional robotic mobility paradigms by relying primarily on a solitary rolling sphere as their
principal mode of movement. This distinctive design characteristic affords them an exceptional degree of agility, enabling
them to gracefully navigate constrained spaces while dynamically adapting to their surroundings.
Despite their remarkable advantages, the control of the ballbot poses formidable challenges for researchers. The first
one is the underactuated nature of the system, wherein the number of control variables is fewer than the number of
output variables. Furthermore, the ballbot dynamics model exhibits pronounced nonlinearity, and susceptibility to exter-
nal perturbations, and necessitates meticulous precision in experiments. Various methodologies have been proposed to
devise controllers for ballbots, which can be broadly categorized into two general groups. The first group involves the

7580 © 2024 John Wiley & Sons Ltd. wileyonlinelibrary.com/journal/rnc Int J Robust Nonlinear Control. 2024;34:7580–7610.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7581

construction of controllers based on linearized models, such as 2-loop PI-LQR controller,1 two PD controllers,2 LQR com-
bined with feedforward,3 LQR for linear feedback controllers in References 4,5, LMI-based linear feedback controller,6,7
LQR/MPC.8 These methods have the advantage of well-responding in low-impact environments, simple models, and
fast calculations based on linearized fixed matrices. Nevertheless, their principal drawback is in their inability to ensure
accuracy when ballbots operate far from the linearization point.
To ameliorate this limitation, researchers have established nonlinear control methods for ballot such as fuzzy-based
control,9–11 model predictive control (MPC)12,13 or sliding mode control (SMC). In the majority of recent studies, authors
use SMC and advanced SMC methods to simultaneously bring both position and deflection angle to desired values.
Notable advantages of this methodology are the inherent capacity to uphold system stability and robustness, even in the
presence of external disturbances. Some illustrative studies in this category including LQR and SMC based on the quater-
nion model,14,12 fractional order hierarchical sliding mode control (FoHSMC) for the 2D ballbot15 or second-order SMC.16
Additionally, hierarchical sliding mode control (HSMC) has been proposed for 3D ballbots in References 17,18. However, a
noticeable drawback of this research pertains to the underlying model construction. The authors only consider the body’s
kinematics in two directions of rotation which are roll and pitch angles, completely ignoring the rotation around the
vertical axis (yaw angle). This oversight impacts the fidelity of the Euler-Lagrange equation and inter-component inter-
actions during robot motions. Therefore, in this research endeavor, an exhaustive 3D ballbot model is formulated, which
takes into account all relevant body tilt angles. In addition to traditional control methods, reinforcement learning (RL) is
applied for balancing control in Reference 19, but tracking control is not considered. Other learning-based control meth-
ods are also researched for nonlinear systems similar to ballbot such as actor-critic neutral network,20 Hamiltonian-driven
adaptive dynamic programming,21 iterative 𝜆-PI algorithm.22 However, the above algorithms require the training process
and are more suitable for cyclical systems or limited workspaces. Applying for complex systems such as ballots is still
questionable and needs more further research with this specific system.
In our control structure, the control signals are not directly built from the 3D ballbot model. Instead, we project
the system onto three distinct planar frames and design separate control signals for each plane. Thus we obtain three
virtual control signals in three directions along Ox, Oy, and Oz axes. These signals are subsequently transformed into
three actual control signals for three omnidirectional wheels via a torque conversion matrix. By implementing control
on individual planes, the number of state variables is reduced and the model’s complexity is simplified. However, the
dynamics of this planar ballbot are influenced by interactions with other planes which can be harmful to the system
stability if not properly handled. To address this issue, an extended state observer (ESO) is proposed to approximately
calculate disturbances and uncertainty components arising from the interstitial control effect on each plane. Furthermore,
in practical scenarios, certain state variables, such as the robot’s velocity and the body’s angular velocity, pose challenges
for direct measurement using sensors. The ESO is also designed to estimate these state variables by relying on the object
model, effectively resolving the sensorless measurement problem.
Alongside controlling the system, we also focus on safety constraints for body deflection angle. In practical opera-
tion, the robot is susceptible to environmental influences and unknown external forces, which may result in a shift of
its center of gravity away from the base and increase the risk of falling over. To mitigate these complexities, it becomes
imperative to establish maximum allowable tilt angle constraints. We advocate the utilization of a constraint method-
ology known as the exponential control barrier function (ECBF). This approach originally introduced by Ames et al.
in Reference 23, furnishes a framework for the specification of output constraints predicated on set invariance prin-
ciples and validates their adherence through the application of ECBFs. The author prescribes certain conditions for
determining the set encompassing all control values that uphold the forward invariance of the safe set. By amalgamat-
ing ECBF with quadratic programming (QP), this approach can be seamlessly integrated with diverse controller types.
A pivotal advantage conferred by the implementation of ECBF lies in its capacity to generate a control signal that not
only conforms to predefined output constraints but also preserves system stability and desired behavior. It is impera-
tive to underscore that ECBF is not intended to supplant the HSMC controller tasked with the overarching control and
stabilization of the underactuated system. Instead, it complements the existing controller by guaranteeing constraint sat-
isfaction. By formulating the problem as a QP optimization, the ECBF technique offers an efficient and effective means of
achieving this goal.
In the realm of mobile robot control, it is imperative to devise a coherent and kinematic-based trajectory for effec-
tive implementation. While traditional robots necessitate primarily considering the direction of motion and coordinates,
non-linear objects such as ballbots demand meticulous attention to the deflection angle of the robot’s body. Failure to
regulate the deflection angle renders control impractical. Various trajectory tracking methods have been proposed in
prior research endeavors14,12,24 to optimize system performance. Nonetheless, these methods predominantly address the
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7582 VU et al.

kinematic aspects of the ballbots and overlook the imperative criterion of achieving optimal traveling time. On the other
hand, Shomin’s studies25,26 introduce a flat trajectory generation approach tailored to an inverse mouse-ball drive ballbot
employing two drive motors. Consequently, this study presents a novel approach for devising a motion trajectory tailored
to three-omnidirectional wheels ballbot, harmonizing with both the system model and travel time optimization based on
the principles of flatness theory.27,28 The trajectory is constructed by solving the time optimization problem, drawing upon
the system model, and considering kinematic constraints, boundary conditions, and system output constraints. Owing to
the inherent flatness of the ballbot system, all states and inputs can be directly represented through the flat output and
a finite set of its derivatives. Therefore the generated trajectory aligns seamlessly with kinematic properties while simul-
taneously optimizing traveling time. This approach promotes smooth robot motion, diminishing excessive regulation in
the output response and minimizing the peak value of the control signal.
Motivated by generating the time-optimal trajectory based on flatness theory, in this research, we also introduce a
novel method for combining the flatness theory and a path-planning algorithm such as the rapidly exploring random
trees start algorithm (RRT*).29 RRT* is a further enhancement of RRT algorithm30 with the purpose to address the feasible
path planning for autonomous vehicles in high-dimensional configuration spaces. The advantages of random expansion
in all directions and quick trajectory findings based on the tree structure make RRT* particularly well-suited for complex
environments with obstacles. However, because the RRT* algorithm just creates waypoints by connecting all nodes, this
path is not a smooth line and hinders the mobility of the ballbot. By connecting each pair of points in this waypoints
via the flatness theory based on time-optimal trajectory and boundary constraints at each pair of points, we achieved a
smoother trajectory and optimal traveling time between each waypoint.
The main contribution of this research to improve the ballbot’s movement performance can be summarized as follows:

1. Build a complete kinematic model for the 3D ballbot based on the Euler-Lagrange equation. Subsequently, utilizing
approximation algorithms, this 3D model was projected onto three distinct planes, resulting in three separate 2D mod-
els with coupling mechanisms. In previous studies,5,3,13,24 the coupling mechanisms are ignored because the 2D ballbot
models are directly described on a specific inertial plane.
2. An extended state observer is introduced to estimate coupling effects between planes as disturbances, which are not
considered in all of the previous studies. Therefore, we can control planes independently using HSMC controllers
for the 2D model. The proposed observer also provides necessary state information for control purposes, which may
otherwise be challenging to obtain directly from sensors.
3. Propose hierarchical sliding mode control in combination with exponential control barrier function to solve the safety
constraints problem for ensuring that tilt angle does not exceed a maximum value even though subjected to unexpected
external forces or environmental disturbances. The advantages of this method concerning other methods,31–34 which
based on barrier Lyapunov function (BLF) will be analyzed.
4. Different from using flatness theory in other studies,25,26 in this study, flatness theory is used to generate a trajectory
that optimizes the traveling time, while avoiding obstacles. Then integrate a combination of the time-optimal trajectory
and the RRT* path-planning algorithm for the ballbot moving in an indoor environment with static obstacles.

This paper is structured in five sections. The first is the introduction. In the second section, we introduce the mathe-
matical model of the 3D-ballbot based on the Euler-Lagrange equation and approximate the 3D model to the 2D model.
The third section proposed the main results of this study, which includes a methodology for coupling mechanism con-
versing; an algorithm for safe control in roll-pitch angle by unifying HSMC and ECBF; LQR and Kalman filter for fixed
yaw angle; and the motion plan based on the time-optimal flatness theory. The numerical simulation results and com-
bining RRT* with flatness theory are shown and compared with PD-ESO and LQR controls in Section 4. And in the last
section is the conclusion.

2 MODELING OF THE BALLBOT

2.1 Coordinate definition

In this section, a mathematical model of the ballbot is introduced based on the Euler angle. This model can be simplified
by some assumptions as follows:
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7583

Assumption 1. Ball-ground and omniwheel-ball contact is point–point and no slip.


Assumption 2. The responses of actuators are immediate.
Assumption 3. The ball only moves on a flat operating surface.
The frames are defined in the following (Figure 1):

1. {I} is the inertial frame fixed to the ground.


2. {b′ } is the frame rigid fixed in the ball.
3. {b} is the frame translated by {I} to the center of mass (CoM) of the ball.
4. {a′ } is the frame fixed to the body.
5. {a} is the frame which is translated frame {a′ } to the ball’s CoM.

The parameters of the ballbot are shown in Table 1.


With the frame defined and the system parameters above, the following corollaries are achieved
[ ]⊤
Corollary 1. The position of the ball in the plane x y 0 is the position of frame {b} when looking from
frame {I} and described in frame {I}.
[ ]⊤
Corollary 2. The rotation of the ball 𝜃x 𝜃y 0 is the rotation of frame {b} when looking from frame {b′ }
and described in frame {b′ }, with

ẏ ẋ
𝜃̇ x = − ; 𝜃̇ y = (1)
rb rb
Corollary 3. The rotation of the body (𝜙x , 𝜙y , 𝜙z ) described by Euler angle35 is the rotation of frame {a} when
looking from frame {b}, described in frame {b}, and 𝜙x , 𝜙y , 𝜙z are the roll-pitch-yaw rotation of the body,
respectively.

FIGURE 1 Sketch of 3D ballbot structure.


10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7584 VU et al.

T A B L E 1 System parameters.
Parameters Descriptions Values Unit

ma Total mass of the body and the omni-wheels 4.59 kg


Jax Moment of inertial of the body-wheels around a′ x 0.2 kg m2
Jay Moment of inertial of the body-wheels around a′ y 0.2 kg m2
Jaz Moment of inertial of the body-wheels around a′ z 0.06 kg m2
mb Mass of the ball 0.62 kg
Jb Moment of inertial of the ball 0.006 kg m2
rb Radius of the ball 0.12 m
Jw Rotation moment of inertial of the omni-wheel 0.0002 kg m2
rw Radius of the omni-wheel 0.05 m
l Distance from the ball’s CoM to the body’s CoM 0.5 m
𝛼 Zenith angle of the omni-wheel 45 deg
𝛽 Angle between the motors viewed in the z-axis 120 deg
g Gravity acceleration 9.81 m/s2

Corollary 4. The rotation matrix from frames {a} to {b} is inferred by performing rotations about each axis
sequentially.

Ra→b = RZ (𝜙z )RY (𝜙y )RX (𝜙x ) (2)

where RX , RY , and RZ are the rotation matrices.

2.2 Motion equation of the 3D ballbot

The mathematical model of the ballbot can be formulated by using the Euler-Lagrange equation in some well-known
literature.3,4 In this research, the motion equation of the 3D ballbot is formulated again for approximation purposes. The
generalized coordinates are considered as follows
[ ]⊤
q = x y 𝜙x 𝜙y 𝜙z (3)

Thus, the model of the ballbot is the explanation of the Euler-Lagrange equation

d 𝜕 𝜕
− =0 (4)
dt 𝜕 q̇ 𝜕q

where  = a + b + w − a − b − w and a , a are the kinetic and potential energy of the body, respectively; b , b are
the kinetic and potential energy of the ball, respectively; w , w are the kinetic and potential energy of the omni-wheels,
respectively. By Assumptions 1 and 2, the kinetic energy and the potential energy of the ball is
1 1
b = mb ||vb ||2 + 𝝎⊤b J2b 𝝎b ; b = 0 (5)
2 2
[ ]⊤ [ ]⊤
where vb = ẋ ẏ 0 and 𝝎b = 𝜃̇ x 𝜃̇ y 0 are the tangential and angular velocities of the ball in the plane, respec-
tively. Jb = diag(Jb , Jb , Jb ) is defined as the moment of the initial of the ball. Similarly, the energy of the rigid system
body-wheels is

1 1
a = ma ||va ||2 + 𝝎⊤a|b,a Ja 𝝎a|b,a ; a = mgl cos 𝜙x cos 𝜙y (6)
2 2
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7585

where Ja = diag(Jax , Jay , Jaz ) is the moment of inertial of the body, va is the velocity of the body (reference frame {I}),
𝝎a|b,a is defined as the angular velocity of the body when looking from frame {b} and described in frame {a}, that is,
𝝎a|b,a = R−1 𝝎
a→b a|b,b
. Thus, the remaining energy of the omniwheels is the rotation kinetic around the omniwheel’s yaw
axis, that is,

1 ̇⊤ ̇
Tw = 𝝃 Jw 𝝃 (7)
2

where Jw = diag(Jw , Jw , Jw ) is the moment of the inertial of all omni-wheels around the omni-wheel’s yaw axis and
[ ]⊤
𝝃 = 𝜉1 𝜉2 𝜉3 is the rotation of the omniwheels. In addition, the rotation of the omni-wheels can be calculated by
considering the inverse kinetics from the system state variable. In addition, the input forces of the ballbot are provided
by the omni-wheels, it can be determined by calculating the Jacobian matrix of the inverse kinetic.

𝜕 𝝃̇ [ ̇ ]
𝜕𝝃 𝜕 𝝃̇ 𝜕 𝝃̇ 𝜕 𝝃̇ 𝜕 𝝃̇
J= = 𝜕ẋ 𝜕 𝜙̇ x 𝜕 𝜙̇ y 𝜕 𝜙̇ z
(8)
𝜕 q̇ 𝜕 ẏ

From Equations (4) to (8), the mathematical model of 3D ballbot can be written in the following

M(q)q̈ + N(q, q)
̇ = J𝝉 (9)

[ ]⊤
̇ ∈ R5×1 , and 𝝉 = 𝜏1 𝜏2 𝜏3 is the actual torque vector, 𝜏1 , 𝜏2 , and 𝜏3 are the torque of the
where M(q) ∈ R5×5 , N(q, q)
̇ are very long to display in this study.
omniwheel 1, 2, and 3 respectively. The detail of M(q) and N(q, q)

Remark 1. In other documents,3,14,12 the Equation (9) is written in the following form: M(q)q̈ + C(q, q) ̇ q̇ +
G(q) = J𝝉 where M(q) is the mass matrix, C(q, q)̇ is the Coriolis matrix and G(q) is the gravity matrix. In this
̇ by C(q, q)
work, we define the term N(q, q) ̇ q̇ + G(q).

2.3 3D model approximation

In the 3D ballbot model, omnidirectional wheels will be arranged around the body at 120◦ intervals. Control torques
are directed along the axis of the wheels and are called torques of actual wheels. However, in the control structure, the
control signals for each 2D plane are torques of the virtual wheels with corresponding directions along the Ox, Oy, and
Oz axes. Thus, we need a conversion to accurately obtain the signals for each real wheel from the controller’s output.
This relation can be derived using the torque conservation property between total virtual torque and total actual torque
acting on the ball:

Tx + Ty + Tz = T1 + T2 + T3 (10)

where Tx , Ty , and Tz are virtual torques acting on the ball by the forces Fx , Fy , and Fz in the direction of Ox, Oy, and
Oz respectively and T1 , T2 , and T3 are actual torques acting on the ball by the forces F1 , F2 , and F3 (Figure 2) and
calculated by

⎡ sin(i𝛽) ⎤ ⎡sin(𝛼) cos(i𝛽)⎤


𝜏i ⎢ ⎥ ⎢ ⎥
Ti = ⎢− cos(i𝛽)⎥ × rb ⎢ sin(𝛼) sin(i𝛽) ⎥ (11)
rw ⎢ ⎥ ⎢ ⎥
⎣ 0 ⎦ ⎣ cos(𝛼) ⎦

[ ]⊤ [ ]⊤
Therefore, the mapping from the virtual torque 𝝉 v = 𝜏x 𝜏y 𝜏z to the actual torque of ballbot 𝝉 = 𝜏1 𝜏2 𝜏3
is achieved in the following

𝝉 = 𝛀𝝉 v (12)
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7586 VU et al.

F I G U R E 2 Torque analysis of the planar ballbot. (A) Actual torque analysis of ballbot in top view and side view. (B) Virtual torque
analysis of ballbot in top view and side view.

where
√ √
⎡ 2 2 2⎤
⎢ 3√ √0 √3 ⎥
𝛀 = ⎢− 2 2 6 2⎥
(13)
⎢ √3 3√ √3 ⎥
⎢− 2 2 − 6 2⎥
⎣ 3 3 3 ⎦

Substituting Equations (12) to (9), the equation of motion (EoM) of the ballbot with the virtual wheel’s torques is
determined as follows

M(q)q̈ + N(q, q)
̇ = J𝛀𝝉 v (14)

The approximate model of the ballbot in the xz-plane can be found by assuming that the ballbot is balancing, that is,
̇ 𝜙̇ x = 𝛿 𝜙̇ x , 𝜙̇ z = 𝛿 𝜙̇ z , 𝜏x = 𝛿𝜏x , 𝜏z = 𝛿𝜏z , 𝛿 implies that it is very small. Then the EoM of
y = 𝛿y, 𝜙x = 𝛿𝜙x , 𝜙z = 𝛿𝜙z , ẏ = 𝛿 y,
the ballbot become
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7587

[ ]⊤ [ ]⊤
M ẍ 𝛿 ÿ 𝛿 𝜙̈x 𝜙̈y 𝛿 𝜙̈z + N = Jv 𝛿𝜏x 𝜏y 𝛿𝜏z (15)

where

⎡m11 + 𝛿m11 𝛿m12 𝛿m13 m14 + 𝛿m14 𝛿m15 ⎤


⎢ ⎥
⎢ 𝛿m21 m22 + 𝛿m22 m23 + 𝛿m23 𝛿m24 m25 + 𝛿m25 ⎥
⎢ ⎥
M = ⎢ 𝛿m31 m23 + 𝛿m23 m33 + 𝛿m33 𝛿m34 m35 + 𝛿m35 ⎥
⎢ ⎥
⎢m14 + 𝛿m14 𝛿m42 𝛿m43 m44 + 𝛿m44 𝛿m45 ⎥
⎢ 𝛿m m25 + 𝛿m25 m35 + 𝛿m35 𝛿m54 m55 + 𝛿m55 ⎥⎦
⎣ 51

⎡n1 + 𝛿n1 ⎤ ⎡ 𝛿j j12 + 𝛿j12 𝛿j12 ⎤


⎢ ⎥ ⎢ 11

⎢ 𝛿n2 ⎥ ⎢j21 + 𝛿j21 𝛿j22 j23 + 𝛿j23 ⎥
⎢ ⎥ ⎢ ⎥
N = ⎢ 𝛿n3 ⎥ Jv = ⎢j31 + 𝛿j31 𝛿j32 j33 + 𝛿j33 ⎥
⎢ ⎥ ⎢ ⎥
⎢n4 + 𝛿n4 ⎥ ⎢ 𝛿j41 j42 + 𝛿j42 𝛿j43 ⎥
⎢ 𝛿n ⎥ ⎢j + 𝛿j 𝛿j52 j53 + 𝛿j53 ⎥⎦
⎣ 5 ⎦ ⎣ 51 51

and, 𝛿mir , 𝛿ni , 𝛿jir are the infinitesimal values; i, r = 1, … , 5. Then, the EoM of the ballbot in xz-plane after simplifying
the Equation (15) by ignoring all products of small values
[ ][ ] [ ] [ ]
m11 + 𝛿m11 m14 + 𝛿m14 ẍ n1 + 𝛿n1 j12 + 𝛿j12
+ +d= 𝜏y (16)
m14 + 𝛿m14 m44 + 𝛿m44 𝜙̈y n4 + 𝛿n4 j42 + 𝛿j42

where d is the coupling mechanism between planes. The EoM of the ballbot can be rewritten in the following form with
uncertainty disturbance dxz as follows:

Mxz q̈ xz + Nxz + dxz = Jxz 𝜏y (17)

where
[ ] [ ] [ ] [ ]
x m11 m14 n1 j
qxz = ; Mxz = ; Nxz = ; Jxz = 12
𝜙y m14 m44 n4 j42
[ ][ ] [ ] [ ]
𝛿m11 𝛿m14 ẍ 𝛿n1 𝛿j12
dxz = + − 𝜏y + d
𝛿m14 𝛿m44 𝜙y ̈ 𝛿n4 𝛿j42
m11 = (4Jb rw2 + 3Jw rb2 + 4ma rb2 rw2 + 4mb rb2 rw2 )∕(4rb2 rw2 )
m14 = (4lma cos(𝜙y )rw2 − 3Jw rb )∕(4rw2 ); m44 = (4ma l2 rw2 + 3Jw rb2 + 4Jay rw2 )∕(4rw2 )
n1 = −𝜙̇ y lma sin(𝜙y ) n4 = −glma sin(𝜙y );
2
j12 = −1∕rw ; j42 = rb ∕rw

Similarly, the EoM of the ballbot in yz-plane can be formulated as:


[ ][ ] [ ] [ ]
m ̃ 22 m
̃ 22 + 𝛿 m ̃ 23 + 𝛿 m
̃ 23 ẍ ñ2 + 𝛿ñ2 ̃j21 + 𝛿̃j21
+ + d̃ = 𝜏x (18)
m̃ 23 + 𝛿 m
̃ 23 m ̃ 33 𝜙̈y
̃ 33 + 𝛿 m ñ3 + 𝛿ñ3 ̃j31 + 𝛿̃j31

Therefore, the EoM of the ballbot can be written in the following form with uncertainty disturbance, dyz

Myz q̈ yz + Nyz + dyz = Jyz 𝜏x (19)

where
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7588 VU et al.

[ ] [ ] [ ] [ ]
y m̃ 22 m
̃ 23 ñ2 ̃j
qyz = ; Myz = ; Nyz = ; Jyz = 21
𝜙x m̃ 23 m
̃ 33 ñ3 ̃j31
[ ][ ] [ ] [ ]
̃ 22 𝛿 m
𝛿m ̃ 23 ẍ 𝛿ñ2 𝛿̃j21
dyz = + − 𝜏x + d̃
̃ 33 𝜙̈y
̃ 23 𝛿 m
𝛿m 𝛿ñ3 𝛿̃j31
̃ 22 = (4Jb rw2 + 3Jw rb2 + 4ma rb2 rw2 + 4mb rb2 rw2 )∕(4rb2 rw2 )
m
̃ 23 = (−4lma cos(𝜙x )rw2 + 3Jw rb )∕(4rw2 );
m ̃ 33 = (4ma l2 rw2 + 3Jw rb2 + 4Jax rw2 )∕(4rw2 )
m
ñ2 = 𝜙̇ x lma sin(𝜙x );
2
ñ3 = −glma sin(𝜙x ); ̃j21 = 1∕rw ; ̃j31 = rb ∕rw

Finally, the model of the ballbot in xy-plane is a single input–single output with coupling term dxy . In particular, the
input is only the torque following z-axis and the outputs are the rotation around z-axis of the body, 𝜙z , and the corre-
sponding angular velocity, 𝜙̇ z . By approximating x = 𝛿x, y = 𝛿y, 𝜙x = 𝛿𝜙x , 𝜙y = 𝛿𝜙y , ż = 𝛿 z, ̇ 𝜙̇ x = 𝛿 𝜙̇ x , 𝜙̇ y = 𝛿 𝜙̇ y ,
̇ ẏ = 𝛿 y,
𝜏x = 𝛿𝜏x , 𝜏y = 𝛿𝜏y , the EoM of the ballbot in xy-plane is achieved as follows

3Jw rb2 + 2Jaz rw2 −r


𝜙̈z + dxy = b 𝜏z (20)
2rw2 rw
Remark 2. The EoMs of the ballbot in xz-plane and yz-plane are the same as if we reverse the position and
the velocity of the ball in the EoM xz-plane or yz-plane. This is easily recognized when we observe the EoMs.
Thus, the control design and observer design for both xz-plane and yz-plane are the same. So, in the next
sections, the controller and observer are only designed for one plane and apply to the remaining plane.

3 MAIN RESULTS

This section introduce the main results of this paper. An ESO is proposed in Subsection 3.1 for observation of the coupling
mechanism, the velocity, and the total disturbances of the ballbot by using output measurement. The HSMC is a nominal
controller (Subsection 3.2) for balancing and tracking problems. Subsequently, CBF-QP is introduced to ensure that the
ballbot is balancing in a safe range with maximum tilt angle (Subsection 3.3). Besides that, an optimization traveling time
algorithm based on flatness theory (Subsection 3.5) is given for generating a best-performing trajectory. In particular, the
controller for the 3D model of the ballbot is designed by combining the roll-pitch controllers and the yaw controller. The
roll-pitch controllers are designed as the HSMC-ESO with output constraint by CBF. The references for the roll-pitch
controllers are the references with minimum traveling time and avoiding obstacles in the map.

3.1 Coupling effect and disturbance observer

As introduced in Remark 2, the observer for balancing the ballbot can just be designed for only one plane and applied to
the remaining plane. Now we consider the system in xz-plane, that is, it is balancing in yz-plane

Mxz q̈ xz + Nxz + dxz = Jxz 𝜏y (21)

This can be written as a second-order system as

q̈ xz = −M−1
xz Nxz − Mxz dxz + Mxz Jxz 𝜏y
−1 −1
(22)

[ ]⊤
Let q1 = qxz , q2 = q̇ xz , u = 𝜏y , and q = q1 q2 we get

q̇ = Aq + B(f + gu) (23)

where f = −M−1 −1 −1
xz Nxz − Mxz dxz called total disturbance, g = Mxz Jxz , and
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7589

[ ] [ ]
0 I 0
A= ; B= (24)
0 0 I

Then, following Reference 36, the ESO structure can be written as

𝜀𝜹̇ = 𝜹 + 𝜀ḟ (25)

[ ]⊤
q̂ 1 −q1 q̂ 2 −q2
where 𝜀 is the positive number, 𝜹 = q̂ 3 − f is defined as the error of estimated states, q̂ 1 , q̂ 2 , q̂ 3 are the
𝜀2 𝜀
estimated values of q1 , q2 , f, respectively, and

⎡− 𝛾1 I I 0⎤ ⎡0⎤
⎢ ⎥ ⎢ ⎥
 = ⎢− 𝛾2 I 0 I ⎥;  = ⎢0⎥ (26)
⎢ ⎥ ⎢ ⎥
⎣− 𝛾3 I 0 0⎦ ⎣I⎦
[ ]⊤
Remark 3. In this case, we consider the ballbot in the xz-plane, the estimate value q̂1 = x̂ 𝜙̂ y and q̂2 =
[ ]⊤ [ ]⊤ [ ]⊤
x̂̇ 𝜙̂̇ y . And if we consider the ballbot in the yz-plane, the estimate value q̂1 = ŷ 𝜙̂ x and q̂2 = ŷ̇ 𝜙̂̇ x .
Theorem 1. Consider the planar ballbot system described in Equation (20), by assuming that the total distur-
bance ḟ bounded by ḟ max > 0 and existing the positive define symmetric matrices P and Q such that the Lyapunov
function

⊤ P + P + Q = 0 (27)

then the ESO described in Equation (25) satisfies that the error estimated value 𝜹 is bounded and convergence to
zero if 𝜀 → 0 and t → ∞.

Proof. Consider the dynamic model of ESO in Equation (25), the Lyapunov candidate function is chosen as

VESO = 𝜀𝜹⊤ P𝜹 (28)

therefore, the first derivative of VESO respect in time is


V̇ ESO = 𝜀𝜹̇ P𝜹 + 𝜀𝜹⊤ P𝜹̇
= (𝜹 + 𝜀f)̇ ⊤ P𝜹 + 𝜹⊤ P(𝜹 + 𝜀f)
̇
(29)
̇ ⊤ P𝜹 + 𝜹⊤ P𝜹 + 𝜹⊤ P𝜀ḟ
= 𝜹⊤ ⊤ P𝜹 + 𝜀(f)
= −𝜹⊤ Q𝜹 + 2𝜀𝜹⊤ Pḟ

By choosing the Lyapunov candidate as in (28), we get that

V̇ ESO ≤ −||𝜹||2 𝜆min (Q) + 2𝜀||𝜹||.||P||ḟ max



𝜆min (Q) VESO (30)
≤ −VESO + 2𝜀 ||P||ḟ max
𝜀𝜆min (P) 𝜀𝜆min (Q)

where 𝜆min (•) is defined as the minimum eigenvalue of (•), V̈ ESO become

d√ 1 1√ 𝜆min (Q) 𝜀
VESO = √ V̇ ESO ≤ − VESO +√ ||P||ḟ max (31)
dt 2 VESO 2 𝜀𝜆min (P) 𝜀𝜆min (P)

Define 𝜆1 = 𝜀𝜆min (P), and 𝜆2 = 𝜆min (Q), we get



d√ −𝜆2 √ 𝜆1
VESO ≤ VESO + 𝜀||P||ḟ max (32)
dt 2𝜆1 𝜆1
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7590 VU et al.

then,

√ √ t
VESO 𝜆1 VESO (𝜹(0)) −𝜆2 t 𝜀||P||ḟ max −𝜆2
(t−𝜒)
||𝜹|| ≤ ≤ e 2𝜆1 + e 2𝜆1 d𝜒 (33)
𝜆1 𝜆1 𝜆1 ∫
√ 0
𝜆1 VESO (𝜹(0)) −𝜆2 t 2𝜀||P||ḟ max −𝜆2 t 2𝜀||P||ḟ max
≤ e 2𝜆1 + e 2𝜆1 + = E(t) (34)
𝜆1 𝜆2 𝜆2

Thus, by selecting the positive number 𝜀 ≪ 1, the error of the estimated state is bounded and convergence to
zero, that is,

lim( lim E) = 0 (35)


𝜀→0 t→inf

The theorem is proven. ▪

3.2 ESO-based HSMC balancing control

The dynamic error of the ESO described in (25) can be written as

𝛾1
q̂̇ 1 = q̂ 2 + (q1 − q̂ 1 ) (36)
𝜀
𝛾
q̂̇ 2 = q̂ 3 + 2 (q1 − q̂ 1 ) + gu
2
(37)
𝜀
𝛾3
q̂̇ 3 = 3 (q1 − q̂ 1 ) (38)
𝜀

Then, vectors q̂ 1 and q̂ 2 can be decomposed to q̂ 11 , q̂ 12 , and q̂ 21 , q̂ 22 , respectively. Then, the errors of output are defined in
the following

e1 = q̂ 11 − xr ; and e2 = q̂ 12 − 𝜙yr (39)

where xr , and 𝜙yr are defined as the reference of x, and 𝜙y , respectively. The sliding surface of each output is given as
follows
𝛾1
s1 = ė 1 − k1 e1 = q̂̇ 11 − ẋ r + k1 (q̂ 11 − xr ) = q̂ 21 + (x − q̂ 11 ) − ẋ r + k1 (q̂ 11 − xr ) (40)
𝜀
𝛾1
s2 = ė 2 − k2 e2 = q̂̇ 12 − 𝜙̇ yr + k2 (q̂ 12 − 𝜙yr ) = q̂ 22 + (𝜙 − q̂ 12 ) − 𝜙̇ yr + k2 (q̂ 12 − 𝜙yr ) (41)
𝜀

and the total sliding surface with the positive numbers k𝛼 and k𝛽 is

s = k𝛼 s1 + k𝛽 s2 (42)
( 𝛾1 ) ( 𝛾1 )
= k𝛼 q̂ 21 + (x − q̂ 11 ) − ẋ r + k1 (q̂ 11 − xr ) + k𝛽 q̂ 22 + (𝜙 − q̂ 12 ) − 𝜙̇ yr + k2 (q̂ 12 − 𝜙yr ) (43)
𝜀 𝜀

then the derivative of the sliding surface is


( 𝛾1 ) ( 𝛾1 )
ṡ = k𝛼 q̂̇ 21 + (ẋ − q̂̇ 11 ) + k1 (q̂̇ 11 − ẋ r ) + k𝛽 q̂̇ 22 + (𝜙̇ − q̂̇ 12 ) + k2 (q̂̇ 12 − 𝜙̇ yr ) (44)
𝜀 𝜀
( 𝛾2 𝛾1 ( 𝛾1 ))
= k𝛼 q̂ 31 + 2 (x − q̂ 11 ) + g1 u + (ẋ − q̂̇ 11 ) + k1 q̂ 21 + (x − q̂ 11 ) − ẋ r (45)
𝜀 𝜀 𝜀
( 𝛾2 𝛾1 ̇ ( 𝛾1 ))
+ k𝛽 q̂ 32 + 2 (𝜙y − q̂ 12 ) + g2 u + (𝜙y − q̂̇ 12 ) + k2 q̂ 22 + (𝜙 − q̂ 12 ) − 𝜙̇ yr (46)
𝜀 𝜀 𝜀
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7591

[ ] [ ]
where g1 = 1 0 g, and g2 = 0 1 g, and q̂ 31 , q̂ 32 are the decomposed values of q̂ 3 . By choosing the suitable 𝜀 and 𝛾1 , 𝛾2 ,
𝛾3 , the sliding surface can be approximated to
( ) ( )
ṡ ≈ k𝛼 q̂ 31 + g1 u + k1 (q̂ 21 − ẋ r ) + k𝛽 q̂ 32 + g2 u + k2 (q̂ 22 − 𝜙̇ yr ) (47)

Thus, the control signal in the reaching phase ur is achieved


( ) ( )
(k𝛼 g1 + k𝛽 g2 )ur = −k𝛼 q̂ 31 + k1 (q̂ 21 − ẋ r ) − k𝛽 q̂ 32 + k2 (q̂ 22 − 𝜙̇ yr ) (48)

and the control signal in the switching phase us

(k𝛼 g1 + k𝛽 g2 )us = −ks − 𝜂sign(s) (49)

where k and 𝜂 are positive constants. Then, final the control signal can be synthesized by

u = ur + u s (50)
Theorem 2. Consider the ballbot system given in (17), the system states are observed by the ESO described in
(25), under the control signal u = ur + us given in (50) where k𝛼 , k𝛽 , k1 , k2 , k and 𝜂 are positive numbers, the
sliding surface is asymptotically convergence to zero.

Proof. Select the Lyapunov candidate as follows

1 2
V(s) = s (51)
2

then, the derivative of V(s) respect in time is

̇
V(s) = sṡ (52)
[ ( 𝛾2 𝛾1 ( 𝛾1 ))
= s k𝛼 q̂ 31 + 2 (x − q̂ 11 ) + g1 u + (ẋ − q̂̇ 11 ) + k1 q̂ 21 + (x − q̂ 11 ) − ẋ r (53)
𝜀 𝜀 𝜀
( 𝛾2 𝛾1 ̇ ( 𝛾 ))]
+ k𝛽 q̂ 32 + 2 (𝜙y − q̂ 12 ) + g2 u + (𝜙y − q̂̇ 12 ) + k2 q̂ 22 + (𝜙 − q̂ 12 ) − 𝜙̇ yr
1
(54)
𝜀 𝜀 𝜀

Substituting the control signal u = ur + us to the derivative of the Lyapunov candidate, we get
[ (𝛾 𝛾1 𝛾1 )
̇ = s k𝛼 2 (x − q̂ 11 ) + (ẋ − q̂̇ 11 ) + k1 (x − q̂ 11 )
2
V(s) (55)
𝜀 𝜀 𝜀
(𝛾 𝛾1 ̇ 𝛾 ) ]
+ k𝛽 2 (𝜙y − q̂ 12 ) + (𝜙y − q̂̇ 12 ) + k2 (𝜙 − q̂ 12 ) − ks − 𝜂sign(s)
2 1
(56)
𝜀 𝜀 𝜀

Therefore,

̇
lim lim[V(s)] = s(−ks − 𝜂sign(s)) = −ks2 − 𝜂|s| < 0 (57)
t→∞ 𝜀→0

Finally, following Barbalat’s lemma,37 the total sliding surface s convergence to zero, that is, limt→∞ s = 0 and
k𝛼 , k𝛽 are positive number, the theorem is proven. ▪

3.3 ESO-based ECBF safe control

At this design step, we introduce an idea to constrain the tilt angle of the ballbot. The purpose of safe control can be
understood as follows: due to the mechanical construction as well as the capacity of the actuator, the ballbot can not work
well at all tilt angles. A simple example is when the ballbot tilt angle is about 60◦ , the return to the upright position is as
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7592 VU et al.

close as impossible. In the implementation, the tilt angles for safe control are very small, and accurately determining the
maximum tilt angles of the ballbot is very difficult. So, in this study, we assume that the safe angle of the ballbot is bounded
by a conical boundary as shown in Figure 3, that is, the control objective is designing the control signal to guarantee that
|𝜃| ≤ 𝜃max , 𝜃 is defined as the angle of the body respect with the opposite gravity direction.
The problem of safe control has been mentioned in several previous studies, of which is the study of Tee et al.31,32
Specifically, they propose a barrier Lyapunov function (BLF) as the logarithm function respect with the constraint
𝜃2
Vblf (qxz ) = 12 log 𝜃2 −𝜃 2
. We can consider that, when 𝜙y → 𝜙max , Vblf (qxz ) → ∞. Therefore, the selected Lyapunov func-
max
tion will drive 𝜙y to the safe region. Following up on the study by Tee, an integral barrier Lyapunov function (iBLF),33
and a tangent barrier Lyapunov function (TanBLF)34 have been introduced to improve the performance of the BLF. How-
ever, the above method has some disadvantages: (i) the Lyapunov function Vblf (qxz ) is undefined if the output is out of the
safe region; (ii) when the system reaches the boundary, Vblf (qxz ) tends to infinity which causes the singularity calculation
problem; (iii) this method is very conservative and inflexible, which may result in the tedious calculation when applying
to the ballbot. Therefore, to overcome the above disadvantages, in this study, we propose another method to constrain the
tilt angle of the ballbot. Introduced by Ames et al. in References 38 and 39, CBF is an effective output constraint method,
by considering a superlevel set of continuously differentiable h ∶  → R ( ⊂ R4 is the set of q) as follows

 = {q ∈  ⊂ R4 ∶ h(q) ≥ 0} (58)

and 𝜕 = {q ∈  ⊂ R4 ∶ h(q) = 0}, Int() = {q ∈  ⊂ R4 ∶ h(q) > 0}. Following Reference 23, in order to satisfy that
the set  is forward invariant, the control signal act to the system can be found by solving the quadratic programming
(QP) as follows

minimize (u − un )2 (59)
u

s.t. L2F h(q) + LG LF h(q)u ≥ −K𝓁 𝜼h (q) (60)

where un is the control signal as the output of HSMC (also called the ‘nominal controller’), the constraint (60) implies
[ ]⊤
the constraint such that the safety is satisfied, F(t) = −M−1 xz Nxz − Mxz dxz , G(t) = Mxz Jxz , 𝜼h (q) = h(q)
−1 −1 ̇
h(q) and the
[ ]
Lie derivative is defined as LX h ∶= ∇h ⋅ X, where X can be replaced by F(t) or G(t). The matrix K𝓁 = 𝓁1 𝓁2 is selected
such as the roots of equation fs (s) = s2 + 𝓁2 s + 𝓁1 are negative.

F I G U R E 3 Description of safety control in ballbot: Ballbot in the safe region is shown on the left and ballbot in the unsafe region is
shown on the right.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7593

Remark 4. The exponential control barrier function (ECBF) can be written in the other form as the control
barrier function (CBF) (ECBF is motivated by CBF for the high-relative degree system). Because the ballbot
system is a high-relative degree system, the CBF constraint should be selected as the exponential CBF. If using
CBF for output constraint, the selected barrier certificate h must depend on the first derivative of the state
variable.40 However, the control designs generate abrupt changes in control signals.
In this paper, the coupling mechanism affects the behavior of the system, and the ESO observes and compensates for
the uncertainty disturbances. To achieve safety in the control ballbot, the ECBF h should be non-negative. Motivated by
Reference 23, we define a set of function with 𝜆3 = 𝜀𝜆max (P) as follow

𝜂0 (q) = h(q) (61)


( )
d
𝜂1 (q) = + 𝜆1 𝜂0 (q) (62)
dt
( )
d
𝜂2 (q) = + 𝜆3 𝜂1 (q) (63)
dt

Then, by assuming that 𝜂i are global Lipschitz, and exist the positive number Ki , we get

̂ − K ||q − q||
𝜂i (q) ≥ 𝜂i (q) ̂ (64)
i

̂ − K ||||E(t)
≥ 𝜂i (q) (65)
i

[ ]
where  = 𝜀2 𝜀 . We define Wi (t) with E(t) from Equation (34)

̂
Wi (t) = 𝜂i (q(t)) − Ki ||||E(t) (66)
[ ] [ ] [ ]
A A′ 0 B [𝛾 𝛾2 𝛾3 ] ⊤
and  = ; A = I ;  = 0 ; 𝚪 = 𝜀1 I

𝜀2
I 𝜀3
I , then the design of ESO-based ECBF can be given in the
0 0
theorem as follows.
Theorem 3. Consider the ballbot system described in (17), the ESO designed based on (25) and the superlevel
set  of h(q). If the initial values W0 (0) ≥ 0, W1 (0) ≥ 𝜆3 ||𝜹(0)||, and 𝜆2 > 𝓁2 𝜆3 , then h(q) ≥ 0 for all time with
the control signal u satisfy that
( )
1 1
u ∈  = {u ∈  ∶ L W1 + L W1 u − 1+ ||L(𝜀2 𝜞 ) W1 ||2
4 𝜆2 − 𝓁2 𝜆3 (67)
𝜀2 ḟ max ||P||2
2
− − E − ||L(𝜀2 𝜞 ) W1 ||E + 𝓁2 W1 ≥ 0}
2

Proof. The ECBF candidate is defined as

̂ = W − 𝜀𝜹⊤ P𝜹 ≥ 0
𝜂 1 (q) (68)
1

then, the derivative of 𝜂 1 (q̂1 ) can be derived as

𝜕W1 ⊤ 𝜕 q̂ 𝜕W1
𝜂̇ 1 (q̂1 ) = Ẇ 1 − 2𝜀𝜹⊤ P𝜹̇ = + − 2𝜀𝜹⊤ P𝜹̇
̂
𝜕 q 𝜕t 𝜕t
(69)
𝜕W1 ⊤ ̂ 𝜕W1
= (q + u + 𝚪(q1 − q̂ 1 )) + − 2𝜀𝜹⊤ P𝜹̇
𝜕q̂ 𝜕t

Furthermore, q1 − q̂ 1 is defined as 𝜀2 𝛿1 , then we have


10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7594 VU et al.

𝜕W1 ⊤ ̂ 𝜕W1 𝜕W1 ⊤ 2


𝜂̇ 1 = (q + u) + + 𝜀 𝚪𝛿1 − 2𝜀𝜹⊤ P𝜹
̂
𝜕q 𝜕t 𝜕q̂
(70)
𝜕W1 ⊤ ‖
𝜕W1 ‖ 1 𝜕W1 ⊤ 2 ‖2 1‖ ⊤ ‖2
̂ ‖ ‖ 𝜕W1 2 ‖
= (q + u) + +‖ 𝜀 𝚪 + 𝛿1 ‖ − ||𝛿1 ||2 − ‖ 𝜀 𝚪‖ − 2𝜀𝜹⊤ P𝜹
̂
𝜕q 𝜕t ‖ 2 ̂ ‖ 4‖ ̂ ‖
‖ 𝜕q ‖ ‖ 𝜕 q ‖

Following Equation (30), yields

⊤ ‖ 1 𝜕W ⊤ ‖2 1‖ ⊤ ‖2
̇𝜂 ≥ 𝜕W1 (q̂ + u) + 𝜕W1 + ‖ ‖
1 ‖
𝜀 𝚪 + 𝛿1 ‖ − ||𝛿1 ||2 −
2 ‖ 𝜕W1 2 ‖
‖ 𝜀 𝚪‖
1
𝜕 q̂ ‖ 2 𝜕 q̂ ‖ 4‖ ‖
𝜕t ‖ ‖ ‖ 𝜕 q̂ ‖ (71)
+ ||𝜹||2 𝜆min (Q) − 2𝜀||𝜹||.||P||ḟ max

and based on Cauchy’s inequality

𝜕W1 ⊤ ̂ 𝜕W1 ‖ ‖ 1 𝜕W1 2


⊤ ‖2
‖ 1‖ ⊤
‖ 𝜕W1 2 ‖
‖2
𝜂̇ 1 ≥ (q + u) + +‖ 𝜀 𝚪 + 𝛿1 ‖ − ||𝛿1 ||2 − ‖ 𝜀 𝚪‖
̂ ‖ ̂ ‖ 4‖ ‖
𝜕q 𝜕t 2
‖ 𝜕q ‖ ‖ 𝜕 q̂ ‖ (72)
+ ||𝜹|| (𝜆2 − 𝓁2 𝜆3 ) + ||𝜹|| 𝓁2 𝜆3 − ||𝜹|| − (𝜀||P||ḟ max )2
2 2 2

then u ∈ , we get
( )
̇𝜂 ≥ 1 1 + 1 𝜕W1
||L(𝜀2 𝜞 ) W1 ||2 + 𝜀2 ḟ max ||P||2 + E2 + ||L(𝜀2 𝜞 ) W1 ||E − 𝓁2 W1 +
2
1 − ||𝜹||2 (73)
4 𝜆2 − 𝓁2 𝜆3 𝜕t
‖ 1 𝜕W ⊤ ‖2 1‖ ⊤ ‖2
‖ ‖ ‖ 𝜕W1 2 ‖
+‖ 1
𝜀 𝚪 + 𝛿1 ‖ − ||𝛿1 || − ‖
2 2
𝜀 𝚪‖ + ||𝜹||2 (𝜆2 − 𝓁2 𝜆3 ) + ||𝜹||2 𝓁2 𝜆3 − ||𝜹||2 − (𝜀||P||ḟ max )2
‖ 2 𝜕 q̂ ‖ 4‖ ‖
‖ ‖ ‖ 𝜕 q̂ ‖
1 ||L(𝜀2 𝜞 ) W1 ||
2
𝜕W1 ‖ 1 𝜕W ⊤ ‖2 (74)
‖ 1 ‖
≥ + E2 + ||L(𝜀2 𝜞 ) W1 ||E − 𝓁2 W1 + − ||𝜹||2 − ||𝛿1 ||2 + ‖ 𝜀2 𝚪 + 𝛿1 ‖
4 𝜆2 − 𝓁2 𝜆3 𝜕t ‖ 2 𝜕 q̂ ‖
‖ ‖
+ ||𝜹|| (𝜆2 − 𝓁2 𝜆3 ) + ||𝜹|| 𝓁2 𝜆3
2 2

and apply Young’s inequality for ||𝜹||2 (𝜆2 − 𝓁2 𝜆3 ), (74) become

‖ 1 𝜕W ⊤ ‖2
̇𝜂 ≥ 1 ||L(𝜀2 𝜞 ) W1 || + E2 + ||L(𝜀2 𝜞 ) W1 ||E − 𝓁2 W1 + 𝜕W1 + ‖
2
1 ‖
‖ 𝜀 𝚪 + 𝛿1 ‖ − ||𝜹||2 − ||𝛿1 ||2
2
1
4 𝜆2 − 𝓁2 𝜆3 𝜕t ‖ 2 𝜕 q̂ ‖
‖ ‖
‖√ ‖2 (75)
||L(𝜀2 𝜞 ) W1 || 2 ‖ L(𝜀2 𝜞 ) W1 ‖
− + −L(𝜀2 𝜞 ) W1 ||𝜹|| + ‖
‖ (𝜆2 − 𝓁2 𝜆3 )||𝜹|| + √ ‖ + ||𝜹||2 𝓁2 𝜆3

4(𝜆2 − 𝓁2 𝜆3 ) ‖ 2 (𝜆2 − 𝓁2 𝜆3 ) ‖
‖ ‖
≥ E2 + ||L(𝜀2 𝜞 ) W1 ||E − 𝓁2 W1 − ||𝜹||2 − ||𝛿1 ||2 − L(𝜀2 𝜞 ) W1 ||𝜹|| + ||𝜹||2 𝓁2 𝜆3 (76)

̂ ≥ 0∀t, that implies W(q)


According to the defined of E in (34) and W in (66), we achieve that 𝜂(q) ̂ ≥ 0, and
̂ ≥ 0. Then, based on References 23,41,  is forward invariant with control signal u ∈ .
𝜂(q) ▪

As a result, to achieve the tilt angles constraint of the ballbot system through the ESO-based ECBF, the control signal
can be considered using the following QP:

minimize (u − un )2 (77)
u
( )
1 1
||L(𝜀2 𝜞 ) W1 ||2 − 𝜀2 ḟ max ||P||2 − E2 − ||L(𝜀2 𝜞 ) W1 ||E + 𝓁2 W1 ≥ 0
2
s.t. L W1 + L W1 u − 1+ (78)
4 𝜆2 − 𝓁2 𝜆3

In summary, the control signal act to the system u can be derived by solving the above optimization problem.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7595

3.4 Yaw control design

Consider the model of the ballbot in xy-plane as described in Equation (20), we introduce an LQG for yaw rotation control,
which includes the linear quadratic regulator (LQR) and a Kalman observer. Specifically, the LQR controller and Kalman
observer can be designed by calculating the gain controller/observer Klqr , LKalman such as the cost function in the below
minimize

1 ( ⊤ )
Jlqr = qxy Qlqr qxy + Rlqr 𝜏z2 dt → min (79)
2 ∫
0

( )
1 ⊤ 2
JKalman = qxy Nx qxy + Ny 𝜏 z dt → min (80)
2∫
0

where the chosen parameters Qlqr = Q⊤ > 0, Rlqr > 0, Nx = N⊤x > 0, Ny > 0, and qxy , 𝜏 z are the state and control input of
the dual system (20), and the error static can be destructed by the integral action for the reference at time t1 . That is the
reference for LQG controller w(t) can be determined as follows

t1

w(t) = k (𝜙z (t) − 𝜙zr (t))dt (81)



0

where k is a positive parameter.

3.5 Flatness-based time-optimal obstacle avoidance trajectory planning

In generating a trajectory for the optimization traveling time of the ballbot system, we try to consider the trajectory of the
planar model and synthesize the trajectory of the 3D ballbot model. It is similar to designing the optimization trajectory
in the planar model of ballbot respect in xz and yz-plane. Then we consider the ballbot model in xz-plane in Equation (19),
it can be written as follows
[ ][ ] [ ] [ ]
M11 M12 ẍ N1 J1
+ = 𝜏y (82)
M21 M22 𝜙y ̈ N2 J2

where M11 = m11 , M12 = m14 , M21 = m41 , M22 = m44 , N1 = n1 , N2 = n4 , J1 = j12 , J2 = j42 .
Rewriting the Equation (82), we get the multi equations as follows


⎪M11 ẍ + M12 𝜙̈y − 𝜙̇ y lma sin(𝜙y ) = − r 𝜏y
2 1

⎨ w (83)
⎪ 21
(M + r M
b 11 x
)̈ + (M 22 + r M )
b 12 y 𝜙̈ − (g + rb 𝜙̇ y )lma sin(𝜙y ) = 0
2

when balancing, the tilt angle of the ballbot is less than 0.1 rad and the angular velocity is small, that is, the trigonometric
functions are approximated, that is, cos(𝜙y ) ≈ 1, sin(𝜙y ) ≈ 𝜙y . The Equation (83) can be reform as:

S1 ẍ + S2 𝜙̈y = glma 𝜙y (84)

where

4Jb rw2 + 3Jw rb2 + 4ma rb2 rw2 + 4mb rb2 rw2 3Jw rb − 4lma rw2
S1 = − (85)
4rb rw2 4rw2
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7596 VU et al.

4ma l2 rw2 + 3Jw rb2 + 4Jay rw2 rb (3Jw rb − 4lma rw2 )


S2 = − (86)
4rw2 4rw2

Then, here, we selected that References 25,26

F = S1 x + S2 𝜙y (87)

then the derivative of flat output as

Ḟ = S1 ẋ + S2 𝜙̇ y (88)

F̈ = S1 ẍ + S2 𝜙̈y = glma 𝜙y (89)

So, the output state and control input can be represented by flat output and its derivative as follows

rb (Jay F̈ + l2 ma F̈ − glma F + lma rb F)


̈
x=− (90)
glma (Jb + ma rb2 + mb rb2 + lma rb )


𝜙y = (91)
glma
rw ( )
𝜏y = M21 ẍ + M22 𝜙̈y − glma sin(𝜙y ) = 𝛼𝜏y (F,
̇ F,
̈ F (3) , F (4) ) (92)
rb
Remark 5. By assuming that the ballbot operates in the vicinity of the equilibrium point, ballbot system is
considered a flat system,27,28 since:

1. With the flat output selected as (87), it can be represented by output state and control input.
2. The output state and control input also can be represented by flat output and the i-th derivative of it as in
(90), (91), (92).
3. And by selecting the flat output as the linear function of state output, the flat output is differentially
̇ F,
independent, that is, it did not satisfy the differential equation fd (F, ̈ … , F (i) ) = 0

We consider the flat dynamic as a linear system:

⎡Ḟ 1 ⎤ ⎡0 1 0 0⎤ ⎡0⎤
⎢ ⎥ ⎢ ⎥ ⎢ ⎥
⎢ Ḟ 2 ⎥ ⎢0 0 1 0⎥ ⎢0⎥
Ḟ = ⎢ ⎥ = ⎢ ⎥F + ⎢ ⎥
̇
⎢F 3 ⎥ ⎢0 0 0 1⎥ ⎢0⎥ (93)
⎢Ḟ ⎥ ⎢0 0 0 0⎥ ⎢F ⎥
⎣ 4⎦ ⎣ ⎦ ⎣ 5⎦
⏟⏞⏞⏞⏟⏞⏞⏞⏟ ⏟⏟⏟
AF u

where Fi = F (i−1) , i = 1, 2, 3, 4 are state variables, and F5 is the control input of flat dynamic system. A trajectory that
satisfies all constraints of the ballbot system, can be easily found. A trajectory with optimal travel time can be generated
by considering both the sampling time as well as the number of samples as follows:


N
minimize J = Δt
Δt, F (i)
i=1

subject to: F[k + 1] = F[k] + Δt(AF F[k] + u[k]) (Flat dynamic constraint)
F[N] = Fref ; F[1] = F(0) (Boundary constraints) (94)
𝜙min < 𝜙y < 𝜙max (Safe constraints)
xmin < x < xmax (Map constraints)
vmin < ẋ < vmax (Velocity constraints)
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7597

By adding the obstacle constraint to the optimization problem (94), the trajectory for time-optimal and obstacle
avoidance is achieved. Finally, the algorithm for generating the time-optimal trajectory is shown in Algorithm 1.

Algorithm 1. Generate time-optimal trajectory based flatness

Require: Δt0 ⊳ Sampling time


Require: obstacles position
1: N ← N0 ⊳ Initial number of step
2: add obstacles constraint to (94)
3: Δt, F (i) ← solve optimization problem (94)
4: while Δt>Δt0 do
5: increment N
6: Δt, F (i) ← solve optimization problem (94)
7: end while
8: reference ← calculate references by Equations∼(90, 91)
9: return reference

Consider the final control structure of this study in Figure 4, the ballbot is controlled by three main controllers includ-
ing two ESO-based HSMCs (25), (50) for balancing and tracking the time-optimal trajectory; and an LQG controller is
added for fixing the yaw rotation of ballbot to satisfy torque convert (12). In addition, the tilt angle can be constrained by
combining the exponential control barrier function (60) and the nominal controller HSMC via the optimization problem
(94). Then, it satisfies that the ballbot moves and balances with the optimal trajectory and satisfies the safe constraint in
tilt angle.

FIGURE 4 Control structure.


10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7598 VU et al.

4 NUMERICAL SIMULATIONS

In this section, we implement the numerical simulations in MATLAB/Simulink. The reference trajectories are con-
strained by 𝜙max = −𝜙min = 0.1 rad, and the maximum ballbot velocity vmax = −vmin = 0.3m/s. In the last simulation, we
combine the time-optimal trajectory with the RRT∗ algorithm to achieve the path-finding and time-optimal by imple-
menting the Algorithm 2. The optimization problem (94) is solved by CasAdi.42 The quality of the controller is evaluated
through simulation results and the video of visualization ballbot’s movement in https://youtu.be/H8lpT75bVSM.

Algorithm 2. Generate time-optimal trajectory based flatness and RRT∗

Require: Δt0 ⊳ Sampling time


Require: RRT∗ waypoints ⊳ Raw path
Require: N ⊳ Number of samples
1: xw , yw ← RRT∗ waypoints
2: Nw ← number of RRT* waypoints
3: for i from 1 to Nw − 1 do

4: l(i) ← (x(i + 1) − x(i))2 + (y(i + 1) − y(i))2 ⊳ Calculate the length of each sub-path
5: vxw (i) ← (xw (i + 1) − xw (i))∕(l(i)k) ⊳ Calculate maximum reference velocity
6: vyw (i) ← (yw (i + 1) − yw (i))∕(l(i)k) ⊳ Calculate maximum reference velocity
7: end for
8: for i from 1 to Nw − 1 do
9: N(i) ← N ∗ l(i)∕ max(l) ⊳ Number of sample for each sub-path
10: adds the constraints of vxw (i), vxw (i + 1), vxw (i), and vxw (i + 1) to (94)
11: Δt, F (i) ← solve optimization problem (94) with N(i) samples
12: while Δt>Δt0 do
13: increment N(i)
14: Δt, F (i) ← solve optimization problem (94) with N(i) samples
15: end while
16: ref (i) ← calculate references by equations
17: end for
18: return ref

The HSMC-ESO controller parameters are chosen as: for ESO parameters, 𝛼1 = 3, 𝛼2 = 3, 𝛼3 = 1, and 𝜀 = 0.01; for
HSMC parameters, k1 = 1, k2 = 5, k3 = 2, k4 = 3, k5 = −5, k6 = −1, and k7 = 1; for CBF constraint, the barrier function
[ ]⊤
is h = 𝜃max
2
− 𝜃 2 , Q = I6 , and K𝓁 = 10 10 .
The PD-ESO controller is designed based on the states observed by ESO for each plane. The control signal in each
plane is the sum of two PD controllers in position control and angle control

uPDxz = kp1 (̂x − xr ) + kd1 (x̂̇ − ẋ r ) + kp2 (𝜙̂ y − 𝜙yr ) + kd2 (𝜙̂̇ y − 𝜙̇ yr ) (95)

uPDyz = kp1 (̂y − yr ) + kd1 (ŷ̇ − ẏ r ) + kp2 (𝜙̂ x − 𝜙xr ) + kd2 (𝜙̂̇ x − 𝜙̇ xr ) (96)

where, the PD controller parameters are chosen as kp1 = 1, kd1 = 1.77, kp2 = 10.3, and kd2 = 2.6.
The LQR controller is designed by linearizing the 3D model of the ballbot. So, the ballbot system can be written in the
linear form as follows

[ ] [ ] ⎡𝜏1 ⎤
q̇ q ⎢ ⎥
= ALQR + BLQR ⎢𝜏2 ⎥ (97)
q̈ ̇q ⎢ ⎥
⎣𝜏3 ⎦
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7599

where ALQR ∈ R10 and BLQR ∈ R10×3 are the state matrices of the 3D linear model ballbot. By select the matrices QLQR =
diag(5, 5, 9, 9, 3, 5, 5, 9, 9, 3) and RLQR = diag(3, 3, 3), the controller can be found

⎡ 0 −1.05 10.69 0 −0.57 0 −1.87 2.79 0 −0.58⎤


⎢ ⎥
KLQR = ⎢ 0.91 0.52 −5.34 9.25 −0.57 1.62 0.93 −1.37 2.41 −0.58⎥ (98)
⎢ ⎥
⎣− 0.91 0.5270 −5.3461 −9.25 −0.57 −1.62 0.93 −1.39 −2.41 −0.58⎦

Finally, the yaw control is designed as the LQG controller with Q = diag(0.7, 0.7), R = 0.01, kp = 30, and Nx =
diag(4, 4), Ny = 0.007 are chosen parameters for the Kalman filter.
In the following, we present three simulation scenarios including:

1. First scenario: we move the ballbot balancing at 𝜃x (0) = 𝜃y (0) = 𝜃z (0) = 0 from the initial position (0, 0) to position (5,
5) and it satisfies the traveling time is minimum
2. Second scenario: The ballbot tries to avoid an obstacle, which is chosen as a rectangular with a length is 4 m and a
width is 1 m, and it is put at (2, 2.5) in the inertial frame
3. Third scenario: Combination RRT* algorithm and flatness-based time-optimal trajectory for drive ballbot in a complex
indoor environment.

The motion trajectory (Figures 5,11B, 15), output response graph (Figures 6,12,16), velocity response graph
(Figures 7,13,18), and control input graph (Figures 8,14,17) show the outcomes of the simulation. Furthermore, to
further illustrate the superiority of the proposed HSMC-ESO controller, a performance evaluation table of the con-
trollers is included in the third simulation scenario. Almost figures show that output responses and velocity responses of
HSMC-ESO exhibit less overshoot and settling time at start and finish times compared to the PD-ESO and LQR. Especially,
position x, y subfigures in the output response graph of three scenarios illustrate that the position errors of HSMC-ESO
controller relative to the optimal trajectories are significantly smaller than in PD-ESO and LQR cases. That shows the
effectiveness of HSMC controller and ESO observer in trajectory tracking tasks. The influence of CBF is clearly performed
in 𝜙x -subfigure of Figure 12, the tilt angle 𝜙x of HSMC-ESO does not exceed the 0.1 m boundary line while PD-ESO
and LQR responses touch and go outside the safe range in 27 s time. Furthermore, the control signal generated from
HSMC-ESO requires less power to navigate the ballbot than the other controllers, especially when the ballbot changes
the moving direction in the desired trajectory.

4.1 Rest-to-rest simulation scenario

In the first scenario, the ballbot moves from the initial position (x, y) = (0, 0) with initial velocity (vx , vy ) = (0, 0) to the end
position (5, 5) as shown in Figure 9, and keeps balancing in the whole trajectory. The time-optimal trajectory is generated
from optimization problem (94) with N = 500, 𝜃min = −0.1 rad, 𝜃max = 0.1 rad. We apply our proposed controller for
tracking this optimal trajectory in comparison with a straight trajectory connecting initial point and ending point. The
time-optimal trajectory ensures the effectiveness of traveling time and navigates ballbot to ending position in 16.5 s, which
is 1 s faster than the non-optimal trajectory in Figure 9. Because of designing based on the equation of motion, the optimal
trajectory is more consistent with the kinematic properties of ballbot and becomes easier to use for tracking tasks. As
a result, both position errors and velocity errors of HSMC-ECBF for time-optimal trajectory are completely better than
non-optimal ones.
Even though moving on a simple trajectory, both the velocity at the beginning and the end must be equal to 0, the tilt
angle of the body fluctuates to change the acceleration of the ball in two periods 0–3 s and 17–20 s. Position x, y subfigures
in the output responses graph (Figure 6) illustrate that the position errors of HSMC-ESO controller relative to the desired
trajectory are significantly smaller than in PD-ESO and LQR cases. That shows the effectiveness of the HSMC controller
and ESO observer in trajectory tracking tasks. The influence of ECBF is clearly performed in 𝜙x -subfigure of Figure 6,
the tilt angle 𝜙x of HSMC-ESO does not exceed the 0.1 m boundary line while PD-ESO and LQR responses touch and go
outside the safe range in 1 and 18 s time constants. The graphs in Figure 7 illustrate that when using HSMC-ESO, the
angular velocity of tilt angle and ball’s velocity have smaller values and change less suddenly compared to other methods.
The amplitude of all control signals is significantly reduced as shown in Figure 8.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al.

Rest-to-rest trajectory under the first simulation scenario.

Output responses under the first simulation scenario.


FIGURE 5

FIGURE 6
7600
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7601

Velocity responses under the first simulation scenario.

Control inputs under the first simulation scenario.


FIGURE 8
FIGURE 7
VU et al.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7602 VU et al.

FIGURE 9 Optimal and non-optimal comparison.

Figure 10 compares actual total disturbance f and estimated total disturbance q̂ 3 . It can be seen that ESO not only
accurately estimates position and velocity values, but it also has the ability to estimate the total disturbance in the system.
This has been proven in Theorem 1.

4.2 Obstacle avoidance simulation scenario

In the next scenario, the ballbot moves between two points as in the first scenario, while avoiding collision with a 4 × 1 m2
rectangular obstacle blocking the straight trajectory (as shown in Figure 11A,B). When the position and shape of the
obstacle as well as the starting and ending points of the trajectory are known, the time-optimal trajectory is found through
Algorithm 1 and becomes the reference for our proposed controller. The tracking ability as well as the safe-angle guarantee
is still superior to other methods (Figure 12). The graphs in Figure 13 show that the velocity responses of both position
and deflection angles when applying HSMC-ESO have smaller values and change less suddenly compared to the rest.
Therefore, the ballbot’s movement will be smoother and the amplitude of the control signal will be significantly reduced
as shown in Figure 14.

4.3 RRT* and time-optimal trajectory combination

In the third scenario, we combine the path planning algorithm RRT∗ and time-optimal based flatness following the
Algorithm 2. The RRT algorithm generates a series of waypoints and connects them.43 Therefore, a raw trajectory from the
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7603

F I G U R E 10 Total disturbance under the first simulation scenario.

F I G U R E 11 Obstacle-avoiding trajectory under the second simulation scenario. (A) 3D-view trajectory under the second simulation
scenario. (B) 2D-view trajectory under the second simulation scenario.

starting point to the ending point is found and it satisfies that avoiding obstacles in the map. But if using only RRT*, this tra-
jectory is discrete and difficult for ballbot to follow. In this section, we perform the optimization problem of time-optimal
between the RRT∗ waypoints that satisfy the boundary conditions of position and velocity.
Remark 6. By using the RRT* algorithm, a rough trajectory is certainly found. Then, the optimization problem
is performed for each sub-path. The solution condition of the sub-path optimization problem is always
satisfied following the Algorithm 1. Therefore the Algorithm 2 results exist.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al.

Velocity responses under the second simulation scenario.


Output responses under the second simulation scenario.
F I G U R E 12

F I G U R E 13
7604
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7605

F I G U R E 14 Control inputs under the second simulation scenario.

F I G U R E 15 Ballbot’s trajectory under the third simulation scenario.

Figure 15 depicts the operating surface and trajectory of the ballbot when moving in this complex environment. Start-
ing at point (0, 0), Ballbot needs to move to position (6, 0) and avoid obstacles in the environment. We consider that the
areas containing obstacles and RRT* waypoints (discrete black dots in Figure 14) are known, the optimal trajectory is gen-
erated as a continuous reference path based on Algorithm 2. Then HSMC-ESO will be applied and compared with other
tracking controllers such as PD-ESO and LQR. Figure 16 shows that when the ballbot needs to change moving direction,
HSMC-ESO position responses almost completely coincide with the reference path, while the responses of other methods
still have deviations and lead to these trajectories do not pass through the waypoints (as shown in Figure 15).
Another advantage of the proposed method lies in the control signals for three omnidirectional wheels as shown in
Figure 17. In the case of LQR and PD-ESO, the input torque exhibits rapid and abrupt variation throughout the entire
process, which can cause difficulties for actuators when applied in practice. Conversely, the input signal of HSMC-ESO
is noticeably smoother with no abrupt changes. As a result, the velocity responses in Figure 18 have smaller amplitudes,
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al.

Output responses under the third simulation scenario.

Control inputs under the third simulation scenario.


F I G U R E 16

F I G U R E 17
7606
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7607

F I G U R E 18 Velocity responses under the third simulation scenario.

T A B L E 2 The performance comparisons.


Output variable Control strategy ISE ITSE IAE ITAE

x HSMC-ESO 0.05 220.4 2.001 109.2


PD-ESO 0.09 339.0 2.464 145.3
LQR-3D 0.09 341.3 2.651 145.3
y HSMC-ESO 0.10 546.6 2.422 138.5
PD-ESO 0.24 1460 3.890 220.7
LQR-3D 0.25 1496 3.936 223.2
𝜙x HSMC-ESO 0.002 16.31 0.3595 22.35
PD-ESO 0.003 23.04 0.5235 26.28
LQR-3D 0.003 23.48 0.4328 26.8
𝜙y HSMC-ESO 0.0003 1.145 0.1138 6.401
PD-ESO 0.0002 0.829 0.0970 5.556
LQR-3D 0.0002 0.777 0.0969 5.475
𝜙z HSMC-ESO 4.4e−9 2.2e−6 0.0005 0.0302
PD-ESO 7.4e−9 2.7e−5 0.0006 0.0337
LQR-3D 1.4e−10 5.3e−7 8.6e−5 0.0049
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7608 VU et al.

change smoothly and gently, and avoid the phenomenon of too rapid and sudden velocity responses of other controllers.
This suggests that the HSMC-ESO approach provides more consistent and stable input torque to the ballbot.
Table 2 illustrates some evaluation criteria such as integrated square errors (ISE), integral time-multiplied square
errors (ITSE), integrated absolute errors (IAE), and integral time-multiplied absolute errors (ITAE). We can observe from
the table, four indices of HSMC-ESO in x, y and 𝜙x variables are much smaller than PD-ESO and LQR. That means
HSMC-ESO can handle the tracking task in complex environments more effectively than other methods. However, the
𝜙y and 𝜙z errors are slightly higher, but the differences among these controllers are small and insignificant.

5 CO N C LU S I O N

In this research, the 3D-ballbot is controlled through separate control signals designed in three 2D planes with coupling
interactions. These interactions can be perceived as system disturbances and ESO is used to cope with this problem. This
methodology offers a significant advantage by reducing the number of state variables and the complexity of control signals.
In the xz and yz planes, the HSMC takes the pivotal role as the main controller ensuring system stability, and unifying
with the CBF to enhance safety during motion by constraining the maximum tilt angle of the body. In addition, our
research also focuses on building a time-optimal trajectory for the ballbot based on the flatness theory. Obstacle constraints
or waypoints from path planning algorithms can be added to the time-optimizing problem to formulate a trajectory to
avoid static obstacles in complex environments. Numerical simulations and 3D visualization have shown the superior
effectiveness of our method in terms of control response, safe constraints, time optimization, and obstacle avoidance.
However, this proposed method still has some minor drawbacks: the matching between controlling on the 3D model and
controlling on three distinct planes depends on the effectiveness of ESO and has not been tested in real experiments, and
the obstacles are considered static objects. To overcome the above drawbacks, in the future, the proposed controller can be
applied in the experimental ballbot model. Verifying the algorithm on an experimental model will increase its reliability.
In addition, some control methods will be introduced to avoid the moving obstacle.

ACKNOWLEDGMENTS
This research is funded by the Hanoi University of Science and Technology (HUST) under project number T2023-TÐ-002.

CONFLICT OF INTEREST STATEMENT


The authors declare no potential conflict of interests.

DATA AVAILABILITY STATEMENT


Data sharing is not applicable to this article as no new data were created or analyzed in this study.

ORCID
Tung Lam Nguyen https://orcid.org/0000-0003-4108-8275

REFERENCES
1. Lauwers T, Kantor G, Hollis R. One is enough! Robotics Research: Results of the 12th International Symposium ISRR, Springer, 327-336.
2007.
2. Kumagai M, Ochiai T. Development of a robot balanced on a ball—application of passive motion to transport. 2009 IEEE International
Conference on Robotics and Automation, IEEE, 4106-4111. 2009.
3. Fankhauser P, Gwerder C. Modeling and Control of a Ballbot. B.S. thesis. Eidgenössische Technische Hochschule Zürich. Eidgenössische
Technische Hochschule Zürich; 2010.
4. Blonk JW. Modeling and control of a ball-balancing robot. Master’s thesis. University of Twente; 2014.
5. Lauwers T, Kantor G, Hollis R. A dynamically stable single-wheeled mobile robot with inverse mouse-ball drive. Proceedings 2006 IEEE
International Conference on Robotics and Automation, 2006. ICRA 2006, IEEE, 2884-2889. 2006.
6. Inal AN, Morgül Ö, Saranli U. A 3D dynamic model of a spherical wheeled self-balancing robot. 2012 IEEE/RSJ International Conference
on Intelligent Robots and Systems, IEEE, 5381-5386. 2012.
7. Vu DC, Thi THN, Vu DD, Pham VP, Nguyen DH, Nguyen TL. H-infinity optimal full-state feedback control for a ball-balancing robot.
The International Conference on Intelligent Systems & Networks, Springer, 326-334. 2023.
8. Studt M, Zhavzharov I, Abbas HS. Parameter identification and LQR/MPC balancing control of a ballbot. 2022 European Control
Conference (ECC), IEEE, 1315-1321. 2022.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
VU et al. 7609

9. Chiu CH, Tsai WR. Design and implementation of an omnidirectional spherical mobile platform. IEEE Trans Ind Electron.
2014;62(3):1619-1628.
10. Johnson J, Senthilnathan R, Negi M, Patel RG, Bhattacherjee A. A fuzzy logic-in-loop control for a novel reduced height ballbot prototype.
Procedia Comput Sci. 2018;133:960-967.
11. Enemegio R, Jurado F, Villanueva-Tavira J. Experimental evaluation of a Takagi-Sugeno fuzzy controller for an EV3 ballbot system. 2022
International Conference on Mechatronics, Electronics and Automotive Engineering (ICMEAE), IEEE. 2023.
12. Jespersen TK, Ahdab aM, dFM DJ, et al. Path-following model predictive control of ballbots. 2020 IEEE International Conference on
Robotics and Automation (ICRA), IEEE, 1498-1504. 2020.
13. Pham MD, Vu DC, Nguyen TTH, Vu DD, Nguyen TL. Nonlinear model predictive control for ballbot systems: a benchmark with hierar-
chical sliding mode and linear quadratic controls. 2023 12th International Conference on Control, Automation and Information Sciences
(ICCAIS), IEEE, 411-416. 2023.
14. Jespersen TK. Kugle-Modelling and Control of a Ball-Balancing Robot. Master Thesis. Aalborg University; 2019.
15. Pham MD, Pham CM, Do TG, et al. Auto-balancing ballbot systems: a fractional-order sliding mode based radial-basis neural network
approach. Advances in Engineering Research and Application: Proceedings of the International Conference on Engineering Research and
Applications, ICERA 2022, Springer, 270-280. 2022.
16. Tham BC, Pham DB. Modeling and second-order sliding mode control for a full three-dimensional ridable ballbot. Int J Model Simul.
2023;1–22. doi:10.1080/02286203.2023.2246834
17. Liao CW, Tsai CC, Li YY, Chan CK. Dynamic modeling and sliding-mode control of a ball robot with inverse mouse-ball drive. 2008 SICE
Annual Conference, IEEE, 2951-2955. 2008.
18. Pham DB, Lee SG. Aggregated hierarchical sliding mode control for a spatial ridable ballbot. Int J Precis Eng Manuf . 2018;19:1291-1302.
19. Zhou Y, Lin J, Wang S, Zhang C. Learning ball-balancing robot through deep reinforcement learning. 2021 International Conference on
Computer, Control and Robotics (ICCCR), IEEE, 1-8. 2021.
20. Han M, Zhang L, Wang J, Pan W. Actor-critic reinforcement learning for control with stability guarantee. IEEE Robot Autom Lett.
2020;5(4):6217-6224.
21. Yang Y, Pan Y, Xu CZ, Wunsch DC. Hamiltonian-driven adaptive dynamic programming with efficient experience replay. IEEE Trans
Neural Netw Learn Syst. 2022;35:3278-3290.
22. Yang Y, Kiumarsi B, Modares H, Xu C. Model-free 𝜆-policy iteration for discrete-time linear quadratic regulation. IEEE Trans Neural Netw
Learn Syst. 2021;34:635-649.
23. Nguyen Q, Sreenath K. Exponential control barrier functions for enforcing high relative-degree safety-critical constraints. 2016 American
Control Conference (ACC), IEEE, 322-328. 2016.
24. Pham DB, Kim H, Kim J, Lee SG. Balancing and transferring control of a ball segway using a double-loop approach [applications of
control]. IEEE Control Syst Mag. 2018;38(2):15-37.
25. Shomin M. Navigation and Physical Interaction with Balancing Robots. PhD Thesis. Carnegie Mellon University; 2016.
26. Shomin M, Hollis R. Differentially flat trajectory generation for a dynamically stable mobile robot. 2013 IEEE International Conference
on Robotics and Automation, IEEE, 4467-4472. 2013.
27. Fliess M, Lévine J, Martin P, Rouchon P. Flatness and defect of non-linear systems: introductory theory and examples. Int J Control.
1995;61(6):1327-1361.
28. Fliess M, Lévine J, Martin P, Rouchon P. A lie-backlund approach to equivalence and flatness of nonlinear systems. IEEE Trans Automat
Contr. 1999;44(5):922-937.
29. Karaman S, Frazzoli E. Sampling-based algorithms for optimal motion planning. Int J Robot Res. 2011;30(7):846-894.
30. LaValle S. Rapidly-exploring random trees: a new tool for path planning. Research Report 9811. 1998.
31. Tee KP, Ge SS, Tay EH. Barrier Lyapunov functions for the control of output-constrained nonlinear systems. Automatica.
2009;45(4):918-927.
32. Tee KP, Ren B, Ge SS. Control of nonlinear systems with time-varying output constraints. Automatica. 2011;47(11):2511-2516.
33. Tee KP, Ge SS. Control of state-constrained nonlinear systems using integral barrier Lyapunov functionals. 2012 IEEE 51st IEEE
Conference on Decision and Control (CDC), IEEE, 3239-3244. 2012.
34. Tang ZL, Tee KP, He W. Tangent barrier Lyapunov functions for the control of output-constrained nonlinear systems. IFAC Proc Vol.
2013;46(20):449-455. doi:10.3182/20130902-3-CN-3020.00122
35. Pio R. Euler angle transformations. IEEE Trans Automat Contr. 1966;11(4):707-715.
36. Guo BZ, Zl Z. On the convergence of an extended state observer for nonlinear systems with uncertainty. Syst Control Lett.
2011;60(6):420-430.
37. Farkas B, Wegner SA. Variations on Barb̆alat’s lemma. Am Math Month. 2016;123(8):825-830.
38. Ames AD, Grizzle JW, Tabuada P. Control barrier function based quadratic programs with application to adaptive cruise control. 53rd
IEEE Conference on Decision and Control, IEEE, 6271-6278. 2014.
39. Ames AD, Xu X, Grizzle JW, Tabuada P. Control barrier function based quadratic programs for safety critical systems. IEEE Trans Automat
Contr. 2016;62(8):3861-3876.
40. Chinelato CIG, Neves GPD, Angélico BA. Safe control of a reaction wheel pendulum using control barrier function. IEEE Access.
2020;8:160315-160324.
41. Wang H, Peng J, Zhang F, Wang Y. A composite control framework of safety satisfaction and uncertainties compensation for constrained
time-varying nonlinear MIMO systems. IEEE Trans Syst Man Cybern Syst. 2023;53:7864-7875.
10991239, 2024, 11, Downloaded from https://onlinelibrary.wiley.com/doi/10.1002/rnc.7358 by Rmit University Library, Wiley Online Library on [04/05/2025]. See the Terms and Conditions (https://onlinelibrary.wiley.com/terms-and-conditions) on Wiley Online Library for rules of use; OA articles are governed by the applicable Creative Commons License
7610 VU et al.

42. Andersson JAE, Gillis J, Horn G, Rawlings JB, Diehl M. CasADi–a software framework for nonlinear optimization and optimal control.
Math Program Comput. 2018;11:1-36.
43. Webb DJ, Van Den Berg J. Kinodynamic RRT*: asymptotically optimal motion planning for robots with linear dynamics. 2013 IEEE
International Conference on Robotics and Automation, IEEE, 5054-5061. 2013.

How to cite this article: Vu DC, Pham MD, Nguyen TTH, Nguyen TVA, Nguyen TL. Time-optimal trajectory
generation and observer-based hierarchical sliding mode control for ballbots with system constraints. Int J Robust
Nonlinear Control. 2024;34(11):7580-7610. doi: 10.1002/rnc.7358

You might also like