Next Article in Journal
Heterogenous Image Matching Fusion Based on Cumulative Structural Similarity
Previous Article in Journal
Autonomous Reinforcement Learning for Intelligent and Sustainable Autonomous Microgrid Energy Management
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Modified Dual Hierarchical Terminal Sliding Mode Control Design for Two-Wheeled Self-Balancing Robot

by
Huaqiang Zhang
,
Norzalilah Mohamad Nor
*,† and
Siti Nur Hanisah Umar
Department of Mechanical Engineering, Faculty of Engineering, Universiti Sains Malaysia, Jln Transkrian—Bukit Panchor, Nibong Tebal 14300, Pulau Pinang, Malaysia
*
Author to whom correspondence should be addressed.
These authors contributed equally to this work.
Electronics 2025, 14(13), 2692; https://doi.org/10.3390/electronics14132692
Submission received: 7 June 2025 / Revised: 30 June 2025 / Accepted: 1 July 2025 / Published: 3 July 2025
(This article belongs to the Section Systems & Control Engineering)

Abstract

A modified dual hierarchical terminal sliding mode control (MDHTSMC) strategy is developed in this study for the control of a two-wheeled self-balancing robot (TWSBR). The control framework incorporates individually designed sliding surfaces within a structured dual-layer hierarchy, enabling explicit prediction of convergence time. To overcome the system’s underactuation characteristics, a hierarchical structure is embedded into the dual terminal sliding mode control law. Additionally, the proposed approach mitigates the chattering effect and enhances the system’s self-balancing capabilities. Numerical simulations were conducted to verify the controller’s effectiveness and to confirm the theoretical results.

1. Introduction

The rapid development of computing, electronics, and manufacturing technologies has substantially advanced the field of mobile robotics, enabling their integration into numerous practical scenarios. These robotic systems are capable of replacing human operators in dangerous or inaccessible environments, including post-disaster rescue missions, nuclear facility maintenance, and military reconnaissance, thereby enhancing operational safety [1]. Furthermore, mobile robots play a vital role in space exploration, underwater investigation, assistive care, rehabilitation, smart transportation, and entertainment, making them increasingly indispensable in modern society [2].
The concept of the two-wheeled self-balancing robot (TWSBR) was first introduced in the late 1980s by Professor Kazuo Yamato of the Automation Department at Tokyo Telecom University, Japan, as shown in Figure 1a. This robotic configuration presents distinct benefits when compared to conventional multi-wheeled mobile robots, including compactness and dynamic balancing capabilities, positioning it as a promising alternative in a wide range of application scenarios [3].
The two wheels of the TWSBR are arranged coaxially, enabling zero-radius turning capabilities [4]. The robot continuously maintains dynamic balance, enabling it to withstand interference and impacts that could topple statically stable robots [5]. Furthermore, its vertical orientation minimizes its spatial footprint, making it ideal for crowded and narrow indoor environments [6]. Additionally, this configuration enables the robot to function within a larger operational area, enhancing its interaction with humans [7]. These advantages have accelerated the development of TWSBRs in the transportation, entertainment, and service sectors in recent years. Prominent examples include the “Segway” (Figure 1b) [8,9] and the “uBot” (Figure 1c) [10,11], among others.
Sliding mode control (SMC), originally introduced by V.I. Utkin in the 1970s, is a robust control technique designed to address system uncertainties and external disturbances. It has since been widely applied in industrial automation. The basic form of SMC, known as first-order sliding mode control, utilizes a single sliding surface to guide system states and maintain motion along this surface once reached. Gao et al. [12] applied SMC to a two-wheeled self-balancing robot (TWSBR), demonstrating superior performance over a full-state feedback controller (LQR). Jmel et al. [13] developed a robust SMC for TWSBR trajectory tracking under tilt and disturbance conditions, employing continuous approximations near the switching surface to reduce chattering—undesirable high-frequency oscillations in the control signal that can degrade system performance or damage actuators.
Further comparative studies include Ghahremani et al. [14], who evaluated cascade control versus SMC, and Arani et al. [15], who confirmed that SMC provides better transient behavior and noise immunity than LQR. To address the discontinuity inherent in conventional SMC, Sinha et al. [16] introduced a smooth approximation to achieve robust yet continuous control. Yih et al. [17] proposed an SMC approach for low-speed TWSBR applications, showing that it outperforms linear optimal control under external disturbances and parameter uncertainties. Wang et al. [18] compared PD (Proportional-Derivative) and SMC for self-balancing control, revealing the advantages of SMC in dynamic responsiveness, steady-state precision, and oscillation mitigation.
Additionally, Yang et al. [19] addressed both matched and mismatched uncertainties in TWSBR systems through predefined nonlinear bounds and reduced-order SMC dynamics. Fukushima et al. [20] applied SMC to a mobile robot with a wheeled arm, transforming it into an inverted pendulum configuration while considering initial velocity within confined spaces. Their method derives an invariant set ensuring convergence to the origin. Durdevic et al. [21] further proposed a switching SMC strategy that stabilizes an open-loop TWSBR system with significant backlash, resulting in smoother control performance.
Terminal sliding mode control (TSMC), as an enhancement of conventional SMC, introduces terminal sliding surfaces to enable faster and more accurate convergence, particularly near equilibrium. Although TSMC improves transient performance, it may exhibit increased sensitivity to disturbances and residual steady-state oscillations in underactuated systems. For instance, Irfan et al. [22] compared several control strategies for two-wheeled self-balancing robots (TWSBRs), concluding that while TSMC outperformed both SMC and ISMC in convergence speed, it suffered from tracking fluctuations when subjected to nonlinear uncertainties. Zheng et al. [23] proposed a hierarchical fast TSMC for TWSBRs operating on uneven terrain; however, the controller structure became increasingly intricate with multiple sliding surfaces, and tuning the terminal parameters remained a nontrivial challenge.
Hierarchical sliding mode control (HSMC) improves modularity and robustness by assigning distinct sliding surfaces to multiple dynamic layers. Despite these advantages, HSMC generally lacks an explicit mechanism for ensuring finite-time convergence, often resulting in slower system responses near the equilibrium point. For example, Hou et al. [24] proposed a HSMC scheme integrated with a nonlinear disturbance observer, but their approach did not explicitly address chattering or convergence speed. Similarly, Ping et al. [25] and Chen et al. [26] demonstrated robust trajectory tracking using HSMC variants; however, their reliance on conventional sliding manifolds led to persistent steady-state errors under complex disturbance conditions.
Despite the advancements achieved by TSMC and HSMC individually, existing methods lack a unified framework that simultaneously incorporates terminal convergence characteristics within a hierarchical control architecture. To address this limitation, this study proposes a modified dual hierarchical terminal sliding mode control (MDHTSMC) scheme that embeds terminal sliding dynamics into a dual-layer hierarchical structure. This design features revised convergence laws and tunable parameters that ensure finite-time stability, enhance disturbance rejection, and suppress chattering. By adaptively coordinating control actions across both layers, the proposed MDHTSMC generalizes existing HSMC and TSMC methods and achieves improved performance in underactuated systems, particularly in terms of control smoothness, robustness, and convergence accuracy.
The main contributions of this paper are as follows:
  • A hierarchical sliding mode control (HSMC) scheme is combined with terminal sliding mode control (TSMC) to address the underactuated control problem of the two-wheeled self-balancing robot (TWSBR), resulting in a dual-terminal sliding mode control (DTSMC) law. Furthermore, a modified dual hierarchical terminal sliding mode control (MDHTSMC) scheme is designed based on the duality concept, with stability rigorously verified through Lyapunov theory.
  • A modified dual hierarchical terminal sliding mode control (MDHTSMC) scheme is proposed for the TWSBR nonlinear system, accounting for disturbances and uncertainties. Using Lyapunov theory, finite-time convergence on the newly defined MDHTSMC surface is proven, and the arrival and sliding times are explicitly calculated.
  • The Jellyfish Search Optimization (JSO) algorithm is employed to minimize the integral of the time-weighted absolute error (ITAE) by adjusting the x and θ parameters of the TWSBR, achieving optimal control parameters. These parameters are subsequently fine-tuned for enhanced optimization.
The remainder of the paper is structured as follows: Section 2 presents the mathematical model of the TWSBR. Section 3 introduces the DHTSMC, discusses its finite-time convergence, and provides the DHTSMC scheme with additional design parameters to derive the MHDTSMC. This section also covers the development of the MDHTSMC design to stabilize the underactuated TWSBR system. Section 4 presents the simulation results, and finally, the conclusions are drawn in Section 5.

2. Preliminary

2.1. Dynamic Models

This section outlines the derivation of the dynamic equations governing the two-wheeled self-balancing robot (TWSBR). The dynamic model is developed based on Newtonian mechanics and vector methods, taking into account the forces and torques acting on the left and right wheels, along with the chassis, as equilibrium conditions. Figure 2 illustrates the forces and torques applied to the TWSBR, while Table 1 defines the related parameters and variables. A comprehensive derivation can be found in the literature [27,28]. The derivation here has been reorganized to enhance clarity and facilitate understanding.
Assuming no slip occurs between the wheels and the ground, the equations describing the balance of motion for the left and right wheels are expressed as follows:
J w θ ¨ L = T L H L R , M w x ¨ L = f d L F L + H L ,
J w θ ¨ R = T R H R R , M w x ¨ R = f d R F R + H R ,
where J w denotes the wheel’s moment of inertia with respect to the y-axis.
The force equilibrium equations, derived from the components of the balancing forces along the x-axis and the moments about the center of the wheel axle, are expressed as follows:
m l cos θ · θ ¨ + m l θ ˙ 2 sin θ m x ¨ = F p , m l 2 θ ¨ + m l cos θ · x ¨ m g l sin θ = M p ,
where F p represents the interaction force between the pendulum and the chassis along the x-axis, and M p denotes the interaction moment between the pendulum and the chassis around the y-axis.
The equations for force equilibrium, derived from the forces exerted on the chassis along the x-axis and the moments about the z-axis, are formulated as follows:
M x ¨ = F L + F R + F p , J c θ ¨ = M p
where J c denotes the moment of inertia of the chassis around the y-axis.
The equation derived from the equilibrium of moments acting on the chassis and pendulum about the z-axis is expressed as follows:
J v φ ¨ = D 2 F L F R ,
where J v represents the moment of inertia of both the chassis and pendulum around the z-axis.
Utilizing the aforementioned five equilibrium equations, and acknowledging that v = x ˙ , the dynamic equations for the TWSBR are formulated as follows:
φ ¨ = D 2 R J φ T L T R + D 2 J φ f d L f d R ,
v ˙ = 1 Ω J θ m l θ ˙ 2 sin θ m 2 l 2 g sin θ cos θ + J θ Ω R T L + T R + J θ Ω f d L + f d R ,
θ ¨ = 1 Ω M x m g l sin θ m 2 l 2 θ ˙ 2 sin θ cos θ m l cos θ Ω R T L + T R m l cos θ Ω f d L + f d R ,
where
J φ = J v + D 2 2 M w + J w R 2 , M x = M + m + 2 M w + J w R 2 , J θ = J p + J c = m l 2 + J c , Ω = M x J θ m 2 l 2 cos 2 θ
Ω = M x J θ m 2 l 2 cos 2 θ = M + m + 2 M w + J w R 2 m l 2 + J c m 2 l 2 cos 2 θ .
Since the first term is strictly positive and dominates the second term for all θ R , it follows that Ω > 0 for all θ . This ensures that the denominator in the system equations does not vanish, preserving the well-posedness of the model and the stability of the controller design.
Furthermore, by defining T w = T L T R and T v = T L + T R , the original system can be decomposed into two independent subsystems: rotational and longitudinal dynamics. Through the implementation of a control strategy to form a closed-loop system, sliding mode controllers (SMCs) effectively attenuate disturbances affecting the left and right wheels, denoted as f d L and f d R , respectively.

2.2. Actuated and Underactuated Subsystems

By exploiting the robustness to parameter variations and disturbance rejection offered by variable structure control, sliding mode control (SMC) is employed to design the control inputs T v and T w . It is assumed that the reference trajectories x d , φ d ( t ) , and θ d ( t ) are bounded and twice continuously differentiable. Generally, these conditions are readily satisfied for x d and φ d ( t ) . Regarding θ d ( t ) , as previously discussed, it is influenced by the system dynamics and rolling friction. Practically, when high-order body dynamics are neglected, the conditions of boundedness and continuous differentiability for θ d ( t ) hold, enabling the achievement of the control objectives. Accordingly, the control strategy is devised to ensure that the rotational angle φ precisely tracks its desired trajectory φ d while maintaining the robot body in a stable upright posture.

2.2.1. φ -Subsystem

The φ -subsystem corresponds to Equation (6) of the dynamics, which is reformulated as follows:
φ ¨ = D 2 R J φ T w
It is evident that this subsystem is fully actuated and can be decoupled from the remaining components of the overall system.

2.2.2. { v , θ } -Subsystem

The { v , θ } -subsystem, represented by Equations (7) and (8), can be reformulated as follows:
v ˙ = 1 Ω J θ m l θ ˙ 2 sin θ m 2 l 2 g sin θ cos θ + J θ Ω R T v θ ¨ = 1 Ω M x m g l sin θ m 2 l 2 θ ˙ 2 sin θ cos θ m l cos θ Ω R T v
This subsystem is underactuated, requiring at least two variables, v and θ , to be controlled using only a single control input signal, T v . Compared to the fully actuated subsystem, controlling this underactuated subsystem is considerably more challenging and critical. Consequently, this study focuses solely on the { v , θ } -subsystem.

3. Modified Dual Hierarchical Terminal SMC

3.1. Dynamic Model

To begin, examine two second-order nonlinear systems, each with two inputs and two outputs, structured as follows:
x ˙ 1 = x 2 x ˙ 2 = f 1 ( x , t ) + g 1 ( x , t ) + b 1 ( x , t ) u 1 x ˙ 3 = x 4 x ˙ 4 = f 2 ( x , t ) + g 2 ( x , t ) + b 2 ( x , t ) u 2
where x = x 1 , x 2 , x 3 , x 4 T is the state vector of the system. The functions f i ( x , t ) and b i ( x , t ) ( i = 1 , 2 ) are smooth nonlinear functions, with b i ( x , t ) 0 , representing the system dynamics and input gain functions, respectively. The terms u i ( i = 1 , 2 ) denote the control inputs. The functions g i ( x , t ) ( i = 1 , 2 ) capture bounded disturbances and uncertainties, satisfying g i ( x , t ) l i , where l i > 0 is a known constant.

3.2. Hierarchical Terminal Sliding Mode Control (HTSMC)

To enhance clarity and facilitate understanding for readers less familiar with hierarchical sliding mode control, Table 2 summarizes the key variables, control parameters, and system states used throughout the paper. This nomenclature table serves as a quick reference for the notation employed in the modeling, control law derivation, and stability analysis. It complements the previously presented physical parameters (Table 1) by focusing specifically on dynamic and control-related symbols.
For the two second-order systems described in Equation (11), two terminal sliding surfaces for TSMC are defined as follows:
s 1 = x 2 + λ 1 | x 1 | α 1 , s 2 = x 4 + λ 2 | x 3 | α 2 ,
where λ 1 , λ 2 , α 1 , and α 2 are positive design parameters. The equivalent control rate is applied to eliminate the terminal sliding dynamics on the sliding surface, ensuring s ˙ 1 = 0 and s ˙ 2 = 0 .
For the first subsystem:
u e q 1 = f 1 ( x , t ) + g 1 ( x , t ) + λ 1 α 1 x 1 α 1 1 x 2 b 1 ( x , t )
For the second subsystem:
u e q 2 = f 2 ( x , t ) + g 2 ( x , t ) + λ 2 α 2 x 3 α 2 1 x 4 b 2 ( x , t )
where, u s w denotes the switching control component of the terminal sliding mode controller. For simplicity, the symbol t is generally omitted in this paper and will only appear when time dependence is explicitly involved, such as in the desired sliding mode surface s ( t ) , which is often abbreviated as s . The second-level terminal sliding surface is then defined as
S = c 1 s 1 + c 2 s 2
where c 1 and c 2 are terminal sliding-mode parameters that may either be constant or vary according to different conditions. Next, the switching control law is derived following the Lyapunov stability theorem. The Lyapunov energy function is defined as
V ( t ) = 1 2 S 2
Differentiating V ( t ) with respect to time t yields
V ˙ = S S ˙ = S c 1 s ˙ 1 + c 2 s ˙ 2 = S c 1 λ 1 α 1 x 1 α 1 1 x ˙ 1 + x ˙ 2 + c 2 λ 2 α 2 x 3 α 2 1 x ˙ 3 + x ˙ 4 = S c 1 λ 1 α 1 x 1 α 1 1 x 2 + f 1 + b 1 ( u e q 1 + u e q 2 + u s w ) + g 1 + c 2 λ 2 α 2 x 3 α 2 1 x 4 + f 2 + b 2 ( u e q 1 + u e q 2 + u s w ) + g 2 = S c 1 b 1 ( u e q 2 + u s w ) + c 2 b 2 ( u e q 1 + u s w ) + c 1 g 1 + c 2 g 2 = S ( c 2 b 2 u e q 1 + c 1 b 1 u e q 2 ) + u s w ( c 2 b 2 + c 1 b 1 ) + c 1 g 1 + c 2 g 2
Let u s w c 2 b 2 + c 1 b 1 + c 2 b 2 u e q 1 + c 1 b 1 u e q 2 = η sgn ( S ) k S , where η and k are positive constants.
Then,
u s w = ( c 1 b 1 + c 2 b 2 ) 1 c 2 b 2 u e q 1 + c 1 b 1 u e q 2 + η sgn ( S ) + k S
The switching control law u s w and the overall control law u for the control system are defined as follows:
u s w = c 2 b 2 c 1 b 1 + c 2 b 2 u e q 1 c 1 b 1 c 1 b 1 + c 2 b 2 u e q 2 η * sgn ( S ) k * S
u = u e q 1 + u e q 2 + u s w = u e q 1 + u e q 2 c 2 b 2 c 1 b 1 + c 2 b 2 u e q 1 c 1 b 1 c 1 b 1 + c 2 b 2 u e q 2 η * sgn ( S ) k * S = c 1 b 1 c 1 b 1 + c 2 b 2 u e q 1 + c 2 b 2 c 1 b 1 + c 2 b 2 u e q 2 η * sgn ( S ) k * S
where η * = c 1 b 1 + c 2 b 2 1 η and k * = c 1 b 1 + c 2 b 2 1 k .
Remark 1.
For the HTSMC system of the TWSBR, the convergence proof of the first and second sliding surfaces is fundamentally the same as the convergence process for MDHTSMC (see the proofs of Theorems 3 and 4 below); hence, a detailed analysis is not provided here; for more comprehensive information, please refer to the literature [29].

3.3. Dual Hierarchical Terminal SMC (DHTSMC)

For the system described in Equation (11), the desired DHTSMC surface is constructed as follows:
s = s 1 , s 2 T
where
s 1 = x 2 + x 1 α sgn x 1 + x 1 3 x 3 s 2 = x 4 + x 3 α sgn x 3 + x 3 3 + x 1
where sgn ( x ) denotes the sign function, and α is a positive scalar.
Two lemmas are introduced to facilitate the derivation of finite-time convergence for the DHTSM controller.
Lemma 1.
According to the work in [30], suppose the continuous function V is positive definite and fulfills the following condition:
V ˙ d V β for all t t 0 , where V t 0 0 ,
where d is a positive constant and 0 < β < 1 . Under these circumstances, the function V will reach zero starting from any initial time t 0 , and the finite convergence time t r can be computed as
t r t 0 + V 1 β t 0 d ( 1 β )
Lemma 2.
Consider a second-order dynamic system represented by
x ˙ 1 = x 1 α sgn x 1 x 1 3 + x 2 x ˙ 2 = x 2 α sgn x 3 x 2 3 x 1 ,
The function V = x 1 2 + x 2 2 2 is selected to determine the finite convergence time, as discussed in [30].
t s t 0 + 2 V t 0 1 α 2 1 α
where the meanings of t s , t 0 , and α remain consistent with those in Lemma 1. By incorporating the scalar d into Equation (24), the system dynamics are modified as follows:
x ˙ 1 = d x 1 α sgn x 1 x 1 3 + x 2 x ˙ 2 = d x 2 α sgn x 2 x 2 3 x 1 ,
with the convergence time now being
t s t 0 + 2 V t 0 1 α 2 d ( 1 α ) .
To stabilize the second-order system depicted in Equation (11), the DHTSM control inputs are designed according to the subsequent theorem:
Theorem 1.
DHTSM controller design.
The states of System (11) will reach the origin along the surface s = 0 within a finite time if the control inputs are defined as follows:
u 1 = b 1 1 ( x ) f 1 ( x ) + α | x 1 | α 1 x 2 + 3 x 1 2 x 2 x 4 + k 1 sgn ( s 1 ) u 2 = b 2 1 ( x ) f 2 ( x ) + α | x 3 | α 1 x 4 + 3 x 3 2 x 4 + x 2 + k 2 sgn ( s 2 ) ,
where k i = l i + η i for i = 1 , 2 and η i > 0 is a positive scalar constant.
Proof. 
For the system expressed in (11) and the sliding surface defined in (21), the control inputs are designed using the equivalent control approach combined with the sliding mode reaching condition, as proposed in [31]. The resulting control law is formulated as follows:
u 1 = u e q 1 + u s w 1 u 2 = u e q 2 + u s w 2
where
u e q 1 = b 1 1 ( x ) f 1 ( x ) + α | x 1 | α 1 x 2 + 3 x 1 2 x 2 x 4 u e q 2 = b 2 1 ( x ) f 2 ( x ) + α | x 3 | α 1 x 4 + 3 x 3 2 x 4 + x 2 .
Here, u e q 1 and u e q 2 are the equivalent control inputs ensuring s ˙ 1 = 0 and s ˙ 2 = 0 when u i = u e q i for i = 1 , 2 . The switching control inputs u s w i = b i 1 k i sgn ( s i ) for i = 1 , 2 can be used to satisfy the finite-time reaching conditions of the sliding mode surface.
Consider the Lyapunov function V = 1 2 s T s , which results in
V ˙ = s T s ˙ = s 1 s ˙ 1 + s 2 s ˙ 2 = s 1 f 1 ( x ) + g 1 ( x ) + b 1 ( x ) u 1 + α | x 1 | α 1 x 2 + 3 x 1 2 x 2 x 4 + s 2 f 2 ( x ) + g 2 ( x ) + b 2 ( x ) u 2 + α | x 3 | α 1 x 4 + 3 x 3 2 x 4 + x 2 .
By substituting the control inputs from Equation (28) into Equation (31), we obtain
V ˙ = s 1 k 1 sgn ( s 1 ) + g 1 ( x ) + s 2 k 2 sgn ( s 2 ) + g 2 ( x ) = η 1 s 1 sgn ( s 1 ) η 2 s 2 sgn ( s 2 ) + g 1 ( x ) s 1 l 1 s 1 sgn ( s 1 ) + g 2 ( x ) s 2 l 2 s 2 sgn ( s 2 ) = η 1 s 1 η 2 s 2 + g 1 ( x ) s 1 l 1 s 1 + g 2 ( x ) s 2 l 2 s 2 min ( η 1 , η 2 ) s 1 + s 2 min ( η 1 , η 2 ) s T s 1 2 2 min ( η 1 , η 2 ) V 1 2 0 .
Consequently, the system defined by Equation (11) converges to the designated sliding surface given in Equation (22), with the convergence time determined based on finite-time stability theory. Once the sliding condition s = 0 is satisfied, the system dynamics reduce to the following form:
x ˙ 1 = x 1 α sgn ( x 1 ) x 1 3 + x 3 x ˙ 3 = x 3 α sgn ( x 3 ) x 3 3 x 1 .
The overall convergence time can be partitioned into two distinct phases: the reaching phase and the sliding phase, depending on the relationship between the system states and the DHTSM surface. Based on Lemma 2, the total finite-time convergence duration t f can be estimated as follows:
t f = t 0 + 2 V 1 2 ( t 0 ) min ( η 1 , η 2 ) t r + 2 V ^ ( t r ) 1 α 2 1 α t s < ,
where V ^ = x 1 2 + x 3 2 2 is the Lyapunov function selected for the reduced system in Equation (33). Here, t r and t s represent the reaching time and the sliding time, respectively.
This concludes the proof. □
Building upon Theorem 1, the parameters of the sliding surface are designed to improve the system’s performance during the reaching phase. Moreover, the modified approach provides enhanced flexibility in the controller design. Consider the system governed by Equation (11), with the sliding surface defined as s = s 1 , s 2 T according to the following expressions:
s 1 = x 2 + γ x 1 α sgn ( x 1 ) + x 1 3 λ x 3 s 2 = x 4 + γ x 3 α sgn ( x 3 ) + x 3 3 + λ x 1 ,
where γ is a positive constant, and λ R is a design parameter. Accordingly, the modified DHTSM control inputs are defined in the following theorem.
Theorem 2.
Modified DHTSM controller (MDHTSMC) design.
The second-order system described by Equation (11) will reach the specified sliding surface s = 0 , as defined in Equation (28), within a finite time. Once on the sliding surface, the system states will converge to the origin along s = 0 in finite time, provided that the control inputs are designed as follows:
u 1 = b 1 1 ( x ) f 1 ( x ) + γ α x 1 α 1 x 2 + 3 γ x 1 2 x 2 λ x 4 + k 1 sgn ( s 1 ) u 2 = b 2 1 ( x ) f 2 ( x ) + γ α x 3 α 1 x 4 + 3 γ x 3 2 x 4 + λ x 2 + k 2 sgn ( s 2 )
where k i = l i + η i for i = 1 , 2 , and η i > 0 is a positive scalar value. The overall finite convergence time is given by
t f = t 0 + 2 V 1 2 ( t 0 ) min ( η 1 , η 2 ) t r + 2 V ^ ( t r ) 1 α 2 γ ( 1 α ) t s < ,
where V ^ = x 1 2 + x 3 2 2 is the Lyapunov function for the reduced system. Here, t r denotes the reaching time, and t s signifies the sliding time.
Proof. 
The proof follows a procedure analogous to that of Theorem 1 and is, therefore, omitted here.
Within the MDHTSM control framework, the system’s behavior during both the reaching and sliding phases can be enhanced by appropriately tuning the parameters λ and γ . Since the initial state x ( t 0 ) is predetermined, the value of V ( t 0 ) is directly influenced by λ , which in turn affects the distance between V ( t 0 ) and V ( t r ) . Generally, V ( t r ) corresponds to the state at time t r , where V = s T s = 0 holds for all t t r . The parameter η governs the reaching speed and can be adjusted to regulate the reaching time. Consequently, λ and η jointly control the reaching phase dynamics, whereas γ determines the convergence rate during the sliding phase. □

3.4. MDHTSM Controller Design for TWSBR

When the control input u 1 is set equal to u 2 in System (11), the system becomes underactuated due to having fewer control inputs than degrees of freedom. Underactuated systems are widely encountered and studied in both scientific research and engineering practice, as they enable a reduction in actuator count, leading to decreased system mass and enhanced energy efficiency. By adopting a hierarchical sliding mode framework, the proposed MDHTSM control scheme can robustly stabilize such systems [31]. The hierarchical MDHTSM controller is formulated as follows:
Theorem 3.
Consider the following underactuated nonlinear model representing the dynamics of a two-wheeled self-balancing robot (TWSBR):
x ˙ 1 = x 2 x ˙ 2 = f 1 ( x ) + g 1 ( x ) + b 1 ( x ) u x ˙ 3 = x 4 x ˙ 4 = f 2 ( x ) + g 2 ( x ) + b 2 ( x ) u
where the variables satisfy the same assumptions as those outlined in System (11). The corresponding sliding mode surfaces are defined as follows:
S = c 1 s 1 + c 2 s 2 ,
where c 1 and c 2 are positive design parameters, and s 1 and s 2 are defined in Equation (35). Applying the equivalent control design method yields the corresponding equivalent control inputs.
For the previously described system, the desired MDHTSM surface can be constructed as follows:
s = s 1 , s 2 T ,
where the terms s 1 and s 2 are defined as
s 1 = x 2 + γ x 1 α sgn ( x 1 ) + x 1 3 λ x 3 , s 2 = x 4 + γ x 3 α sgn ( x 3 ) + x 3 3 + λ x 1 ,
where sgn ( x ) denotes the sign function, and α is a positive constant. For brevity, the time variable t is omitted throughout this paper unless explicitly required in the derivation. Accordingly, the desired sliding mode surface s ( t ) is abbreviated as s .
Two lemmas are employed to facilitate the proof of finite-time convergence properties of the MDHTSM controller.
The equivalent control inputs u e q 1 and u e q 2 are expressed as follows:
u e q 1 = b 1 1 ( x ) f 1 ( x ) + γ α x 1 α 1 x 2 + 3 γ x 1 2 x 2 λ x 4 , u e q 2 = b 2 1 ( x ) f 2 ( x ) + γ α x 3 α 1 x 4 + 3 γ x 3 2 x 4 + λ x 2
The control law u for stabilizing the underactuated system (37) is formulated as
u = c 1 b 1 ( x ) + c 2 b 2 ( x ) 1 c 1 b 1 ( x ) u e q 1 + c 2 b 2 ( x ) u e q 2 η u sgn ( S ) k u S ,
This guarantees that the underactuated system described by (37) attains stability within the anticipated finite time.
Proof. 
Consider the Lyapunov function candidate V = 1 2 S 2 and take its time derivative as follows:
V ˙ = S S ˙ = S c 1 s ˙ 1 + c 2 s ˙ 2 = S ( c 1 f 1 ( x ) + g 1 ( x ) + b 1 ( x ) u + γ α | x 1 | α 1 x 2 + 3 γ x 1 2 x 2 λ x 4 + c 2 f 2 ( x ) + g 2 ( x ) + b 2 ( x ) u + γ α | x 3 | α 1 x 4 + 3 γ x 3 2 x 4 + λ x 2 ) = S ( c 1 f 1 ( x ) + g 1 ( x ) + γ α | x 1 | α 1 x 2 + 3 γ x 1 2 x 2 λ x 4 + c 2 f 2 ( x ) + g 2 ( x ) + γ α | x 3 | α 1 x 4 + 3 γ x 3 2 x 4 + λ x 2 + ( c 1 b 1 ( x ) + c 2 b 2 ( x ) ) u ) .
Substituting the control input from Equation (42) into Equation (43) results in
V ˙ = S ( c 1 f 1 ( x ) + g 1 ( x ) + γ α | x 1 | α 1 x 2 + 3 γ x 1 2 x 2 λ x 4 + c 2 f 2 ( x ) + g 2 ( x ) + γ α | x 3 | α 1 x 4 + 3 γ x 3 2 x 4 + λ x 2 + c 1 b 1 ( x ) u e q 1 + c 2 b 2 ( x ) u e q 2 η u sign ( S ) k u S ) = S c 1 g 1 ( x ) + c 2 g 2 ( x ) η u sign ( S ) k u S η u | c 1 g 1 ( x ) + c 2 g 2 ( x ) | | S | k u S 2 .
Define D M = sup t 0 c 1 g 1 ( x ) + c 2 g 2 ( x ) . If η u > D M , then
V ˙ k u S 2 | S | · η u c 1 g 1 + c 2 g 2 k u S 2 ( η u D M ) | S | < 0 .
Hence, the second-level sliding surface is stable.
Given that g i ( x ) < l i , selecting a sufficiently large η u ensures the reaching condition of the surface S. The stability proof for the sliding mode surfaces s 1 and s 2 follows the approach outlined in [29] and is, therefore, omitted here. This concludes the proof. □
It is essential to establish the asymptotic stability of the first-level sliding surfaces for various control systems.
Remark 2.
Theorem 3 guarantees that the sliding surface S = c 1 s 1 + c 2 s 2 will converge to zero within a finite time. Physically, this implies that the combined tracking error of the system’s displacement (x) and pitch angle (θ), along with their derivatives, will be driven to a coordinated balance state in a predictable and bounded time. This ensures that the robot will recover from any initial deviation and move back to an upright position without excessive oscillation.
Theorem 4.
Consider a class of underactuated systems possessing a stable equilibrium point. Define the sliding surfaces as in Equations (38)–(40), and implement the control law given in (42). If both s 1 and its derivative s ˙ 1 are bounded, i.e., s 1 L and s ˙ 1 L , and the parameter η satisfies η > D M , then the first-level sliding surfaces s 1 and s 2 are guaranteed to be asymptotically stable.
Proof. 
Integrating both sides of Equation (45) yields
0 t V ˙ d τ = 0 t η u D M | S | k u S 2 d τ .
Then,
V ( t ) V ( 0 ) = 0 t η u D M | S | k u S 2 d τ .
We can observe that
V ( t ) = 1 2 S 2 = V ( 0 ) 0 η u D M | S | + k u S 2 d τ V ( 0 ) < .
Thus, S L , i.e.,
sup t 0 | S | = S < .
From the above inequality, it follows that
V ˙ = S S ˙ η u D M | S | k u S 2 < .
This shows that S ˙ L , i.e.,
sup t 0 | S ˙ | = S ˙ < .
Given that sup t 0 | s 1 | = s 1 < and sup t 0 | s ˙ 1 | = s ˙ 1 < , we obtain from Equation (38) that s 2 L and s ˙ 2 L , i.e.,
sup t 0 | s 2 | = s 2 < , sup t 0 | s ˙ 2 | = s ˙ 2 < .
From the HSMC derivation, it is evident that the values of c 1 and c 2 do not impact system stability as long as η u > D M . Consequently, the following sliding surfaces can be defined:
S 1 = c 1 s 1 + β s 2 , S 2 = c 2 s 1 + β s 2 ,
where c 1 and c 2 are arbitrary positive constants, with c 1 c 2 . Therefore, S 1 S 2 . Assuming that > 0 S 1 2 d τ > 0 S 2 2 d τ 0 , we have
0 0 S 1 2 d τ = 0 c 1 2 s 1 2 + 2 c 1 β s 1 s 2 + β 2 s 2 2 d τ < , 0 0 S 2 2 d τ = 0 c 2 2 s 1 2 + 2 c 2 β s 1 s 2 + β 2 s 2 2 d τ < .
Therefore,
0 < 0 S 1 2 S 2 2 d τ = 0 c 1 2 c 2 2 s 1 2 + 2 c 1 c 2 β s 1 s 2 d τ < .
0 S 1 2 S 2 2 d τ = 0 c 1 2 c 2 2 s 1 2 + 2 c 1 c 2 β s 1 s 2 d τ = 0 c 1 2 c 2 2 s 1 2 + 2 c 1 c 2 s 1 S 1 c 1 s 1 d τ = 0 c 1 c 2 2 s 1 2 d τ + 0 2 c 1 c 2 s 1 S 1 d τ > 0 .
From Equation (48), we obtain
0 1 2 S 2 = V ( 0 ) 0 η u D M | S | + k u S 2 d τ .
Furthermore,
0 η u D M | S | + k u S 2 d τ = 0 η u D M | S | d τ + 0 k u S 2 d τ V ( 0 ) < .
Since η u > D M and k u > 0 , we have 0 η u D M | S | d τ 0 and 0 k u S 2 d τ 0 . If the sum of two positive terms is finite, then each must also be finite. Therefore, we have 0 η u D M 0 | S | d τ = S 1 < , i.e., S L 1 . Hence, from Equation (56),
0 c 1 c 2 2 s 1 2 d τ < 0 2 c 1 c 2 s 1 S 1 d τ 2 0 c 1 c 2 s 1 S 1 d τ 2 c 1 c 2 0 s 1 | S 1 | d τ = 2 c 1 c 2 · s 1 S 1 1 < .
Thus,
0 s 1 2 d τ < ,
and similarly,
0 s 2 2 d τ < .
From Equations (60) and (61), it can be concluded that s 1 L 2 and s 2 L 2 (square integrable). Given that s 1 L , s ˙ 1 L , s 2 L , and s ˙ 2 L , it follows from Barbalat’s lemma that lim t s 1 = 0 and lim t s 2 = 0 .
In conclusion, the sliding surfaces s 1 and s 2 of the first-level subsystems are not only stable but also asymptotically stable. □
Remark 3.
Theorem 4 applies to underactuated systems possessing a stable equilibrium point. Therefore, the boundedness conditions s 1 L and s ˙ 1 L are naturally fulfilled.
Remark 4.
Theorem 4 establishes the asymptotic stability of the individual sliding surfaces s 1 and s 2 , which correspond to error dynamics in pitch angle (θ) and displacement (x), respectively. From a physical standpoint, this means that even under the presence of modeling uncertainties or external disturbances, the robot will not only stabilize but also avoid long-term drift or residual oscillation in its posture or position. This is critical for ensuring practical robustness in real-time control implementations.

4. Simulation Result

For its v , θ subsystem, Equation (10) is rewritten as in Equation (37). The state variable is selected as x = ( x , x ˙ , θ , θ ˙ ) , as follows:
f 1 ( x ) = 1 Ω J θ m l θ ˙ 2 sin θ m 2 l 2 g sin θ cos θ b 1 ( x ) = J θ Ω R f 2 ( x ) = 1 Ω M x m g l sin θ m 2 l 2 θ ˙ 2 sin θ cos θ b 2 ( x ) = m l cos θ Ω R
where x represents the displacement of the TWSBR and θ denotes the pitch angle of the robot. The parameters of the TWSBR are as follows: m = 0.25 kg , M = 0.5 kg , M w = 0.3 kg , R = 0.0325 m , l = 0.03 m , J w = 1.5 × 10 4 kg · m 2 , J c = 1 × 10 4 kg · m 2 , J p = m l 2 , g = 9.8 m / s 2 .
This study utilized MATLAB/Simulink for simulation, employed a fixed-step solver, and set the simulation time to 0.01 s. The initial condition of the system is given by the state vector x 0 = [ 0.2 , 0.1 , 0.1 , 0.1 ] , where the initial values of the state variables are θ ( 0 ) = 0.2 , θ ˙ ( 0 ) = 0.1 , x ( 0 ) = 0.1 , and x ˙ ( 0 ) = 0.1 . The control objective is to ensure that as t , each state variable x i converges to 0 for i = 1 , 2 , 3 , 4 .

4.1. Optimization Algorithm

The Jellyfish Search Optimization (JSO) algorithm, originally proposed by Chou and Truong in 2021, is a bio-inspired metaheuristic method that simulates the foraging behavior of jellyfish in ocean environments [32]. The algorithm models two key behaviors: passive movement influenced by ocean currents and active movement driven by the jellyfish’s own swarm intelligence. A time control mechanism is introduced to probabilistically govern the switch between these two movement strategies.
JSO offers several notable advantages, including a simple algorithmic structure, ease of implementation, and strong global search ability across high-dimensional and complex optimization landscapes. Owing to these strengths, it has been widely adopted in diverse applications such as engineering design, control parameter optimization, feature selection, and trajectory planning [33].
The Integral of Time-weighted Absolute Error (ITAE) criterion is widely used to assess control system performance, emphasizing the minimization of long-term errors. The ITAE performance index is defined as follows:
I T A E = 0 t | e ( t ) | d t
where e ( t ) denotes the error signal at time t. This criterion integrates the absolute error weighted by time, thereby assigning greater significance to errors that persist for extended durations. The typical objective in controller design is to minimize this integral, thereby improving system performance.
Given that the proposed sliding mode control method involves numerous parameters, many of which require manual tuning, an optimization algorithm is employed for parameter adjustment. The objective function is defined as
f = I T A E ( θ ) + I T A E ( x ) .
In the JSO optimization algorithm, when tuning the parameters of various sliding mode controllers, a population size of 20 and 300 iterations was selected. These values are generally determined through experimental or empirical methods to achieve an optimal balance between computational efficiency and algorithmic performance, preventing both overfitting and underfitting. The parameter bounds for the sliding mode controller within the optimization process were set to [ 0 , 5 ] . Considering that the motor employed is a micro-reduction DC motor with a rated torque of only 0.6 N · m , and that the total torque of the two motors is 1.2 N · m , the control input is constrained within the range [ 2 , 2 ] .
The three controllers were optimized using the JSO algorithm. The parameters of the optimized controllers, rounded to four significant figures, are as follows:
The optimized parameters of HSMC (See Appendix A for details) are
η * = 0.3702 , k * = 3.720 , λ 1 = 4.573 , λ 2 = 0.3215 , c 1 = 3.983 , c 2 = 0.02035
The optimized parameters of HTSMC are
η * = 0.6037 , k * = 1.435 , λ 1 = 0.4865 , λ 2 = 0.06401 , α 1 = 2.490 , α 2 = 1.188 , c 1 = 3.641 , c 2 = 6.554 × 10 4
The optimized parameters of MDHTSMC are
η u = 0.03835 , k u = 4.800 , α = 1.089 , γ = 4.996 , λ = 6.951 × 10 5 , c 1 = 4.878 , c 2 = 0.2363
As shown in Figure 3, following the optimization of the three controllers (JSO-HSMC, JSO-HTSMC, and JSO-MDHTSMC), the fitness curves demonstrate the effectiveness of the JSO algorithm in terms of convergence speed and result stability. Specifically, the JSO-MDHTSMC controller exhibits the lowest fitness value, indicating superior performance on the optimization objective, whereas the JSO-HSMC and JSO-HTSMC controllers have higher fitness values, reflecting relatively lower optimization effectiveness. Overall, the JSO algorithm efficiently identifies a stable optimal solution within a high-dimensional, complex search space, particularly for the JSO-MDHTSMC controller.
Through a systematic analysis of the state response, control input, and sliding surface of the TWSBR under HSMC (Figure 4), HTSMC (Figure 5), and MDHTSMC (Figure 6), significant differences in the performance of each control strategy are evident. HSMC is capable of achieving basic system stability; however, due to the inherent chattering problem, the system exhibits significant oscillations and large control input fluctuations when dealing with uncertainty and interference, making it challenging to fully eliminate dynamic errors. In contrast, HTSMC significantly reduces the oscillation amplitude and chattering phenomenon in the control input, demonstrating higher control accuracy and robustness, thereby enabling stable system operation near the sliding surface. Nevertheless, both HSMC and HTSMC exhibit steady-state errors in the pitch angle ( θ ). MDHTSMC, on the other hand, exhibits rapid convergence and high system stability, effectively suppresses initial oscillations, and maintains the sliding surface near zero, verifying the effectiveness and robustness of the control strategy while simultaneously eliminating the steady-state error in the pitch angle ( θ ). In summary, MDHTSMC not only eliminates the steady-state error in the pitch angle ( θ ) but also exhibits superior control performance, making it the most effective control strategy among the three methods.
Remark 5.
As observed in Figure 3, HSMC and HTSMC exhibit higher fitness values, primarily because the pitch angle (θ) retains a certain steady-state error in the optimization solution, resulting in a higher fitness value that cannot be minimized further. Figure 4 and Figure 5 further confirm this observation, validating our hypothesis that this issue is attributed to multiple factors, including modeling inaccuracies, external interference, and omitted friction.

4.2. Parameter Tuning

Based on the preceding analysis and figures, to achieve optimal results, we fine-tuned the aforementioned parameters accordingly. The parameters after fine-tuning are as follows:
The optimized parameters of HSMC are
η * = 5 , k * = 3 , λ 1 = 0.5 , λ 2 = 0.5 , c 1 = 4 , c 2 = 0.1
The optimized parameters of HTSMC are
η * = 5 , k * = 2 , λ 1 = 0.01 , λ 2 = 0.01 , α 1 = 1 , α 2 = 1 , c 1 = 1 , c 2 = 0.1
The optimized parameters of MDHTSMC are
η u = 5 , k u = 3 , α = 1.1 , γ = 4 , λ = 0.001 , c 1 = 4 , c 2 = 0.2
To more effectively demonstrate the superiority of our proposed method, we conducted two primary simulation cases:
  • The performance of each sliding mode controller under ideal, disturbance-free conditions;
  • The performance of each sliding mode controller in the presence of disturbances d u = 0.2 s i n ( 5 t ) .

4.2.1. Case 1: Ideal State

In the absence of external interference, it is evident from Figure 7 that under HSMC, the system state and control input exhibit pronounced high-frequency oscillations. The sliding surface is slow to stabilize near the zero point, resulting in significant chattering, which may damage the actuator. From Figure 8, although HTSMC exhibits significant initial peaks, it demonstrates good overall convergence speed and stability. Once the system enters the sliding mode state, the chattering is reduced, and the sliding surface stabilizes rapidly, though the initial peak may still pose challenges in certain applications. In contrast, Figure 9 indicates that MDHTSMC offers superior control performance. The high-frequency oscillations in the system state diminish rapidly, the control input is smooth and stable, and the sliding surface quickly converges to zero and remains stable, demonstrating significant advantages in enhancing system stability.

4.2.2. Case 2: With Disturbance

Under disturbance conditions, as shown in Figure 10, the performance of HSMC remains largely unchanged compared to non-disturbance conditions, particularly in terms of chattering suppression and stability maintenance. However, this reveals its inadequate control performance under high-frequency chattering. This shortcoming underscores the advantages of alternative sliding mode control techniques, such as MDHTSMC and HTSMC, which excel in suppressing disturbances and maintaining system stability. Specifically, as shown in Figure 11, HTSMC preserves its robustness and stability under disturbances and swiftly recovers stability in complex environments, making it well-suited for applications demanding stringent disturbance suppression. However, HTSMC does show a noticeable initial peak but compensates with a commendable convergence speed and stability. MDHTSMC demonstrates strong disturbance suppression capabilities, as shown in Figure 12. Although the initial oscillation amplitude of the pitch angular velocity ( θ ˙ ) slightly increases when subjected to disturbance, the system quickly stabilizes and converges to the desired state, further confirming its excellent ability to maintain system stability.
Remark 6.
Although we adjusted the system parameters, due to inaccurate mathematical modeling, neglecting frictional resistance, external disturbances, and the strong coupling inherent in the TWSBR, HSMC, and HTSMC cannot ensure that all state variables of the system converge to zero, particularly the pitch angle (θ), which exhibits a small steady-state error. However, MDHTSMC can ensure that all state variables of the TWSBR are close to zero.
In summary, there are significant differences in the performance of each sliding mode controller between disturbed and undisturbed conditions. Under disturbance conditions, HSMC can achieve fundamental system stability, but the chattering issue becomes more pronounced. HTSMC demonstrates good convergence and stability under disturbance, maintaining high robustness and quickly restoring system stability, making it suitable for scenarios with strict disturbance requirements, although it exhibits a pronounced initial peak. MDHTSMC shows excellent performance under disturbance and can quickly converge to a stable state. Although the initial oscillation amplitude of the pitch angular velocity ( θ ˙ ) increases under disturbance, the system rapidly stabilizes and maintains the sliding mode surface close to zero, further demonstrating its excellent ability to sustain system stability in complex environments. Therefore, MDHTSMC is significantly superior to HSMC and HTSMC in terms of disturbance rejection capability and stability.

4.3. Indicator Evaluation

Table 3 presents a comparative evaluation of the three control strategies under both nominal and disturbed conditions. The results clearly demonstrate that the proposed MDHTSMC approach achieves superior performance across all key indicators.
Under nominal conditions, MDHTSMC exhibits the lowest ITAE, fastest settling time, minimal overshoot, and zero steady-state error. It also significantly reduces the chattering effect compared to the conventional HSMC and HTSMC methods. When disturbances are introduced, the advantages of MDHTSMC remain consistent, confirming its robustness and disturbance rejection capabilities.
Although HTSMC improves upon HSMC by reducing chattering and enhancing transient performance, it still exhibits noticeable steady-state errors, especially under external perturbations. In contrast, MDHTSMC not only ensures rapid and accurate convergence but also maintains control smoothness, making it a more practical and reliable solution for underactuated systems such as the two-wheeled self-balancing robot.

5. Conclusions and Future Work

In this paper, a modified dual hierarchical terminal sliding mode control (MDHTSMC) scheme is proposed for the control of a two-wheeled self-balancing robot (TWSBR). The designed MDHTSMC integrates multiple sliding surfaces into a structured framework, guaranteeing finite-time convergence of tracking errors. The underactuated nature of the TWSBR was effectively handled through a hierarchical control design embedded in a dual-terminal sliding mode structure. Furthermore, the proposed controller significantly reduced chattering effects, thereby improving system robustness and stabilization during dynamic self-balancing tasks. The effectiveness of MDHTSMC was validated through comprehensive simulation studies, which confirmed the theoretical analysis and demonstrated superior tracking accuracy and disturbance rejection compared to conventional HSMC and HTSMC schemes.
Despite its promising results, this study has some limitations. Experimental validation on a physical platform has not yet been conducted, and certain modeling simplifications—such as the omission of friction and actuator nonlinearity—may affect real-world performance. Additionally, real-time implementation feasibility and computational efficiency were not explicitly addressed.
Future work will focus on extending the proposed controller to hardware-in-the-loop simulations and real-time embedded implementations. Incorporating sensor noise, unmodelled dynamics, and frictional effects into the system model will further enhance the controller’s applicability in practical scenarios.

Author Contributions

Conceptualization, H.Z. and N.M.N.; methodology, H.Z.; software, H.Z.; validation, H.Z., N.M.N., and S.N.H.U.; formal analysis, H.Z.; investigation, H.Z.; resources, H.Z.; data curation, H.Z.; writing—original draft preparation, H.Z.; writing—review and editing, H.Z.; visualization, H.Z.; supervision, N.M.N.; project administration, N.M.N. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The data that support the findings of this study are available from the corresponding author upon reasonable request.

Acknowledgments

The authors would like to thank the Department of Mechanical Engineering, Universiti Sains Malaysia, for providing technical support and laboratory resources during this research.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
TWSBRTwo-Wheeled Self-Balancing Robot
SMCSliding Mode Control
TSMCTerminal Sliding Mode Control
HSMCHierarchical Sliding Mode Control
HTSMCHierarchical Terminal Sliding Mode Control
DHTSMCDual Hierarchical Terminal Sliding Mode Control
MDHTSMCModified Dual Hierarchical Terminal Sliding Mode Control
JSOJellyfish Search Optimization
ITAEIntegral of Time-weighted Absolute Error
LQRLinear Quadratic Regulator
PDProportional-Derivative

Appendix A

For the two second-order systems described in Equation (11), two sliding surfaces are defined to facilitate the implementation of SMC:
s 1 = x 2 + λ 1 x 1 , s 2 = x 4 + λ 2 x 3 ,
where λ 1 and λ 2 are positive design parameters.
The equivalent control law is applied to nullify the sliding dynamics on the sliding surface, ensuring that s ˙ 1 = 0 and s ˙ 2 = 0 .
For the first subsystem, the equivalent control input is defined as
u e q 1 = f 1 ( x , t ) + g 1 ( x , t ) + λ 1 x 2 b 1 ( x , t )
Similarly, for the second subsystem, the equivalent control input is expressed as
u e q 2 = f 2 ( x , t ) + g 2 ( x , t ) + λ 2 x 4 b 2 ( x , t )
where u s w represents the switching control component of the sliding mode controller. For clarity, the symbol t is typically omitted throughout this paper and will only be included when time-dependence is explicitly required, such as in the desired sliding mode surface s ( t ) , which is often abbreviated as s . The second-level sliding surface is defined as
S = c 1 s 1 + c 2 s 2
where c 1 and c 2 are sliding-mode parameters that can be constant or vary based on specific conditions. Next, the switching control law is derived following the Lyapunov stability theorem, and the Lyapunov energy function is defined as
V ( t ) = 1 2 S 2
Differentiating V ( t ) with respect to time t yields
V ˙ = S S ˙ = S c 1 s ˙ 1 + c 2 s ˙ 2 = S c 1 λ 1 x ˙ 1 + x ˙ 2 + c 2 λ 2 x ˙ 3 + x ˙ 4 = S c 1 λ 1 x 2 + f 1 + b 1 u e q 1 + u e q 2 + u s w + g 1 + c 2 λ 2 x 4 + f 2 + b 2 u e q 1 + u e q 2 + u s w + g 2 = S c 1 b 1 u e q 2 + u s w + c 2 b 2 u e q 1 + u s w + c 1 g 1 + c 2 g 2 = S c 2 b 2 u e q 1 + c 1 b 1 u e q 2 + u s w c 2 b 2 + c 1 b 1 + c 1 g 1 + c 2 g 2
Let u s w c 2 b 2 + c 1 b 1 + c 2 b 2 u e q 1 + c 1 b 1 u e q 2 = η sgn ( S ) k S , where η and k are positive constants.
Then, the switching control input is given by
u s w = ( c 1 b 1 + c 2 b 2 ) 1 c 2 b 2 u e q 1 + c 1 b 1 u e q 2 + η sgn ( S ) + k S
The switching control law u s w and the overall control law u for the system are formulated as
u s w = c 2 b 2 c 1 b 1 + c 2 b 2 u e q 1 c 1 b 1 c 1 b 1 + c 2 b 2 u e q 2 η * sgn ( S ) k * S
u = u e q 1 + u e q 2 + u s w = u e q 1 + u e q 2 c 2 b 2 c 1 b 1 + c 2 b 2 u e q 1 c 1 b 1 c 1 b 1 + c 2 b 2 u e q 2 η * sgn ( S ) k * S = c 1 b 1 c 1 b 1 + c 2 b 2 u e q 1 + c 2 b 2 c 1 b 1 + c 2 b 2 u e q 2 η * sgn ( S ) k * S
where η * = c 1 b 1 + c 2 b 2 1 η and k * = c 1 b 1 + c 2 b 2 1 k .

References

  1. Zhang, S.; Yao, J.; Wang, Y.; Liu, Z.; Xu, Y.; Zhao, Y. Design and motion analysis of reconfigurable wheel-legged mobile robot. Def. Technol. 2022, 18, 1023–1040. [Google Scholar] [CrossRef]
  2. Rubio, F.; Valero, F.; Llopis-Albert, C. A review of mobile robots: Concepts, methods, theoretical framework, and applications. Int. J. Adv. Robot. Syst. 2019, 16, 1–22. [Google Scholar] [CrossRef]
  3. Olmez, Y.; Koca, G.O.; Akpolat, Z.H. Clonal selection algorithm based control for two-wheeled self-balancing mobile robot. Simul. Model. Pract. Theory Int. J. Fed. Eur. Simul. Soc. 2022, 118, 102552. [Google Scholar] [CrossRef]
  4. Guo, Y.; Guo, J.; Liu, L.; Liu, Y.; Leng, J. Bioinspired multimodal soft robot driven by a single dielectric elastomer actuator and two flexible electroadhesive feet. Extrem. Mech. Lett. 2022, 53, 101720. [Google Scholar] [CrossRef]
  5. Khan, M.B.; Chuthong, T.; Do, C.D.; Thor, M.; Billeschou, P.; Larsen, J.C.; Manoonpong, P. icrawl: An inchworm-inspired crawling robot. IEEE Access 2020, 8, 200655–200668. [Google Scholar] [CrossRef]
  6. Wang, P.; Tang, Q.; Sun, T.; Dong, R. Research on stability of the four-wheeled robot for emergency obstacle avoidance on the slope. Recent Pat. Eng. 2021, 15, 14–28. [Google Scholar] [CrossRef]
  7. Nker, F. Proportional controlled moment of gyroscope for two-wheeled self-balancing robot. J. Vib. Control 2021, 28, 2310–2318. [Google Scholar] [CrossRef]
  8. Voth, D. Segway to the future [autonomous mobile robot]. IEEE Intell. Syst. 2005, 20, 5–8. [Google Scholar] [CrossRef]
  9. Delgado-Spíndola, A.; Campa, R.; Bugarin, E.; Soto, I. Design and real-time implementation of a nonlinear regulation controller for the rmp-100 segway twip. Mechatronics 2021, 79, 102668. [Google Scholar] [CrossRef]
  10. Zhao, J.; Cui, X.; Zhu, Y.; Tang, S. A new self-reconfigurable modular robotic system ubot: Multi-mode locomotion and self-reconfiguration. In Proceedings of the 2011 IEEE International Conference on Robotics and Automation, Shanghai, China, 9–13 May 2011; IEEE: Piscataway, NJ, USA, 2011; pp. 1020–1025. [Google Scholar] [CrossRef]
  11. Cui, X.; Zhu, Y.; Zhao, J.; Piao, S.; Yang, E. Bio-inspired locomotion control for ubot self-reconfigurable modular robot. In Proceedings of the 2023 International Conference on Control, Automation and Diagnosis (ICCAD), Rome, Italy, 10–12 May 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 1–6. [Google Scholar] [CrossRef]
  12. Gao, D.Y.; Han, P.W.; Zhang, D.S.; Lu, Y.J. Study of sliding mode control in self-balancing two-wheeled inverted car. Appl. Mech. Mater. 2013, 241, 2000–2003. [Google Scholar] [CrossRef]
  13. Jmel, I.; Dimassi, H.; Hadj-Said, S.; M’Sahli, F. Sliding mode control for two wheeled inverted pendulum under terrain inclination and disturbances. In Proceedings of the 2021 9th International Conference on Systems and Control (ICSC), Caen, France, 24–26 November 2021; IEEE: Piscataway, NJ, USA, 2021; pp. 467–471. [Google Scholar] [CrossRef]
  14. Ghahremani, A.; Khalaji, A.K. Simultaneous regulation and velocity tracking control of a two-wheeled self-balancing robot. In Proceedings of the 2023 International Conference on Control, Automation and Diagnosis (ICCAD), Rome, Italy, 10–12 May 2023; IEEE: Piscataway, NJ, USA, 2023; pp. 1–6. [Google Scholar] [CrossRef]
  15. Arani, M.S.; Orimi, H.E.; Xie, W.-F.; Hong, H. Comparison of Sliding Mode Controller and State Feedback Controller Having Linear Quadratic Regulator (lqr) on a Two-Wheel Inverted Pendulum Robot: Design and Experiments. 2018. Available online: http://hdl.handle.net/10315/35251 (accessed on 30 June 2025).
  16. Sinha, A.; Prasoon, P.; Bharadwaj, P.K.; Ranasinghe, A.C. Nonlinear autonomous control of a two-wheeled inverted pendulum mobile robot based on sliding mode. In Proceedings of the 2015 International Conference on Computational Intelligence and Networks, Odisha, India, 12–13 January 2015; IEEE: Piscataway, NJ, USA, 2015; pp. 52–57. [Google Scholar] [CrossRef]
  17. Yih, C.-C. Sliding-mode velocity control of a two-wheeled self-balancing vehicle. Asian J. Control 2014, 16, 1880–1890. [Google Scholar] [CrossRef]
  18. Wang, L.; Lei, J. Research on self-balancing control for upright vehicle with two wheels based on sliding mode control. In Proceedings of the 2017 International Conference on Computer Technology, Electronics and Communication (ICCTEC), Dalian, China, 19–21 December 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 1192–1195. [Google Scholar] [CrossRef]
  19. Yang, Y.; Yan, X.; Sirlantzis, K.; Howells, G. Regular form-based sliding mode control design on a two-wheeled inverted pendulum. Int. J. Model. Identif. Control 2021, 37, 312–320. [Google Scholar] [CrossRef]
  20. Fukushima, H.; Muro, K.; Matsuno, F. Sliding-mode control for transformation to an inverted pendulum mode of a mobile robot with wheel-arms. IEEE Trans. Ind. Electron. 2014, 62, 4257–4266. [Google Scholar] [CrossRef]
  21. Durdevic, P.; Yang, Z. Hybrid control of a two-wheeled automatic-balancing robot with backlash feature. In Proceedings of the 2013 IEEE International Symposium on Safety, Security, and Rescue Robotics (SSRR), Linkoping, Sweden, 21–26 October 2013; IEEE: Piscataway, NJ, USA, 2013; pp. 1–6. [Google Scholar] [CrossRef]
  22. Irfan, S.; Mehmood, A.; Razzaq, M.T.; Iqbal, J. Advanced sliding mode control techniques for inverted pendulum: Modelling and simulation. Eng. Sci. Technol. Int. J. 2018, 21, 753–759. [Google Scholar] [CrossRef]
  23. Zheng, N.; Zhang, Y.; Guo, Y.; Zhang, X. Hierarchical fast terminal sliding mode control for a self-balancing two-wheeled robot on uneven terrains. In Proceedings of the 2017 36th Chinese Control Conference (CCC), Dalian, China, 26–28 July 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 4762–4767. [Google Scholar] [CrossRef]
  24. Hou, M.; Zhang, X.; Chen, D.; Xu, Z. Hierarchical sliding mode control combined with nonlinear disturbance observer for wheeled inverted pendulum robot trajectory tracking. Appl. Sci. 2023, 13, 4350. [Google Scholar] [CrossRef]
  25. Ping, H.; Hai, W.; Linfeng, L.; Huifang, K.; Ming, Y.; Canghua, J.; Zhihong, M. A novel hierarchical sliding mode control strategy for a two-wheeled self-balancing vehicle. In Proceedings of the 2017 36th Chinese Control Conference (CCC), Dalian, China, 26–28 July 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 3731–3736. [Google Scholar] [CrossRef]
  26. Chen, L.; Wang, H.; Huang, Y.; Ping, Z.; Yu, M.; Zheng, X.; Ye, M.; Hu, Y. Robust hierarchical sliding mode control of a two-wheeled self-balancing vehicle using perturbation estimation. Mech. Syst. Signal Process. 2020, 139, 106584. [Google Scholar] [CrossRef]
  27. Do, K.D.; Seet, G. Motion control of a two-wheeled mobile vehicle with an inverted pendulum. J. Intell. Robot. Syst. 2010, 60, 577–605. [Google Scholar] [CrossRef]
  28. Grasser, F.; D’arrigo, A.; Colombi, S.; Rufer, A.C. Joe: A mobile, inverted pendulum. IEEE Trans. Ind. Electron. 2002, 49, 107–114. [Google Scholar] [CrossRef]
  29. Wang, W.; Yi, J.; Zhao, D.; Liu, D. Design of a stable sliding-mode controller for a class of second-order underactuated systems. IEE Proc. Contr. Theory Appl. 2004, 151, 683–690. [Google Scholar] [CrossRef]
  30. Moulay, E.; Perruquetti, W. Finite time stability and stabilization of a class of continuous systems. J. Math. Anal. Appl. 2006, 323, 1430–1443. [Google Scholar] [CrossRef]
  31. Levant, A. Sliding order and sliding accuracy in sliding mode control. Int. J. Control 1993, 58, 1247–1263. [Google Scholar] [CrossRef]
  32. Chou, J.S.; Truong, D.N. A novel metaheuristic optimizer inspired by behavior of jellyfish in ocean. Appl. Math. Comput. 2021, 389, 125535. [Google Scholar] [CrossRef]
  33. Chou, J.S.; Molla, A. Recent advances in use of bio-inspired jellyfish search algorithm for solving optimization problems. Sci. Rep. 2022, 12, 19157. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Different types of TWSBRs.
Figure 1. Different types of TWSBRs.
Electronics 14 02692 g001
Figure 2. Math model of TWSBR.
Figure 2. Math model of TWSBR.
Electronics 14 02692 g002
Figure 3. Fitness graph of JSO optimization algorithm.
Figure 3. Fitness graph of JSO optimization algorithm.
Electronics 14 02692 g003
Figure 4. Performance of HSMC under JSO optimization algorithm.
Figure 4. Performance of HSMC under JSO optimization algorithm.
Electronics 14 02692 g004
Figure 5. Performance of HTSMC under JSO optimization algorithm.
Figure 5. Performance of HTSMC under JSO optimization algorithm.
Electronics 14 02692 g005
Figure 6. Performance of MDHTSMC under JSO optimization algorithm.
Figure 6. Performance of MDHTSMC under JSO optimization algorithm.
Electronics 14 02692 g006
Figure 7. Performance of HSMC at the ideal state.
Figure 7. Performance of HSMC at the ideal state.
Electronics 14 02692 g007
Figure 8. Performance of HTSMC at the ideal state.
Figure 8. Performance of HTSMC at the ideal state.
Electronics 14 02692 g008
Figure 9. Performance of MDHTSMC at the ideal state.
Figure 9. Performance of MDHTSMC at the ideal state.
Electronics 14 02692 g009
Figure 10. Performance of HSMC with d u = 0.2 s i n ( 5 t ) .
Figure 10. Performance of HSMC with d u = 0.2 s i n ( 5 t ) .
Electronics 14 02692 g010
Figure 11. Performance of HTSMC with d u = 0.2 s i n ( 5 t ) .
Figure 11. Performance of HTSMC with d u = 0.2 s i n ( 5 t ) .
Electronics 14 02692 g011
Figure 12. Performance of MDHTSMC with d u = 0.2 s i n ( 5 t ) .
Figure 12. Performance of MDHTSMC with d u = 0.2 s i n ( 5 t ) .
Electronics 14 02692 g012
Table 1. The vehicle parameters and variables.
Table 1. The vehicle parameters and variables.
NotationDefinition
T L , T R Torques acting on the left and right wheels provided by wheel motors
F L , F R Interacting forces between the left and right wheels and the chassis
H L , H R Friction forces acting on the left and right wheels
f d L , f d R External forces acting on the left and right wheels
θ L , θ R Rotational angles of the left and right wheels
x L , x R Displacements of the left and right wheels along the x-axis
θ Tilt angle of the vehicle body
φ Rotational angle of the vehicle
xDisplacement of the vehicle along the direction of the longitudinal velocity
vLongitudinal velocity of the vehicle
mMass of the inverted pendulum
MMass of the chassis
M w Mass of the wheels
RRadius of the wheels
lDistance between the body center of gravity and the wheel axis
DDistance between the two wheels along the axle center
x c , y c Current position of the vehicle on the x y plane
F p Interacting force between the pendulum and the chassis on the x-axis
Table 2. Nomenclature and definitions of variables and control-related parameters.
Table 2. Nomenclature and definitions of variables and control-related parameters.
SymbolDescription
x State vector x = x 1 , x 2 , x 3 , x 4 T
f i ( x , t ) Nonlinear dynamic function in the ith subsystem ( i = 1 , 2 )
b i ( x , t ) Control gain function in the ith subsystem, with  b i ( x , t ) 0
g i ( x , t ) Bounded disturbance in the ith subsystem, satisfying g i ( x , t ) l i
u i Control input applied to the ith subsystem ( i = 1 , 2 )
e 1 , e 2 Tracking errors for pitch angle and yaw/position
s 1 , s 2 Sliding surface variables
k 1 , k 2 Sliding mode control gains
λ 1 , λ 2 Positive constants defining sliding surface slopes
η 1 , η 2 Reaching law coefficients
α i , β i Terminal sliding exponents in subsystem i  ( i = 1 , 2 )
sign ( · ) Signum function used in sliding mode control
Table 3. Comparative summary of control performance for HSMC, HTSMC, and MDHTSMC under nominal and disturbed conditions.
Table 3. Comparative summary of control performance for HSMC, HTSMC, and MDHTSMC under nominal and disturbed conditions.
DisturbanceControllerITAE ( θ )Settling Time (s)Overshoot (%)Steady-State Error ( θ )Chattering Level
WithoutHSMC2.34.2180.025Severe
HTSMC1.63.0110.010Moderate
MDHTSMC0.91.840.000Minimal
WithHSMC3.75.1220.035Severe
HTSMC2.13.4140.015Moderate
MDHTSMC1.22.260.000Minimal
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Zhang, H.; Mohamad Nor, N.; Umar, S.N.H. Modified Dual Hierarchical Terminal Sliding Mode Control Design for Two-Wheeled Self-Balancing Robot. Electronics 2025, 14, 2692. https://doi.org/10.3390/electronics14132692

AMA Style

Zhang H, Mohamad Nor N, Umar SNH. Modified Dual Hierarchical Terminal Sliding Mode Control Design for Two-Wheeled Self-Balancing Robot. Electronics. 2025; 14(13):2692. https://doi.org/10.3390/electronics14132692

Chicago/Turabian Style

Zhang, Huaqiang, Norzalilah Mohamad Nor, and Siti Nur Hanisah Umar. 2025. "Modified Dual Hierarchical Terminal Sliding Mode Control Design for Two-Wheeled Self-Balancing Robot" Electronics 14, no. 13: 2692. https://doi.org/10.3390/electronics14132692

APA Style

Zhang, H., Mohamad Nor, N., & Umar, S. N. H. (2025). Modified Dual Hierarchical Terminal Sliding Mode Control Design for Two-Wheeled Self-Balancing Robot. Electronics, 14(13), 2692. https://doi.org/10.3390/electronics14132692

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop