1. Introduction
Unmanned bicycle robots (UBRs) have attracted significant attention for detection, transport, and first response domains while reducing the exposure of human to threats and dangers. Due to the three-dimensional spatial rolling of the two wheels and the self-stability in specific speed range, the bicycle combines agility and maneuverability property. To exploit such property superiority, motion control of the UBR needs to be urgently captured, which brings a challenging avenue for actuation mechanism, self-balancing, and trajectory tracking control.
Due to the lack of direct torque in the rolling direction, several mechanisms have been designed which are different in various aspects such as the number and/or types of actuators. The most well-known mechanism is the flywheel, which can directly generate a rolling torque when accelerating [
1]. To generate larger rolling torque and improve the loading capacity, some scholars have adopted twin control moment gyros (CMGs) with opposing arrangement [
2], which can generate superimposed rolling torque and offset vertical torque [
3]. The earliest engineering application of such an idea can be traced back to 1903 when the Irish mechanical engineer Louis Brennan invented the single-track train by placing two large CMGs opposite each other in the carriage, and rotated them through electrical devices. The train weighing 22 tons successfully maintained balance while carrying more than 40 people. Furthermore, some added a heavy pendulum to the vehicle body, which can swing in the roll direction to maintain balance by adjusting the center of mass like cyclist [
4,
5]. However, the weight of the additional device is about 25% of the vehicle weight and deterioration in the maneuverability cannot be ignored [
6]. Recently, Japan
Honda company proposes a riding assistance system with rear-wheel-swing mechanism, which enables balance at extremely low speeds [
7]. However, this special mechanism equipped with a four-bar linkage remains heavy and insecure. To ensure safety and low cost, this paper studies the UBR without any auxiliary mechanism.
Different controllers have been proposed to deal with the complex and nonlinear UBR dynamics. For instance, a non-singular terminal sliding mode controller, capable of realizing finite-time convergence of the roll angle was proposed in [
8]. For the MIMO System, reference [
9] adopts integral sliding mode control with an improved reaching law, which can reduce chattering and smooth the control input. Reference [
10] proposes a scheme that does not adjust the SMC structure or rely on nonlinear sliding manifolds. By optimizing the control law through disturbance estimation, this scheme mitigates chattering while ensuring system stability. Zhang [
11] proposed a variable-gain LQR to keep balance while the speed is changing. In [
12], a novel command-filtered adaptive control scheme for uncertain nonlinear systems with unknown external disturbances was proposed. This scheme adopts an asymmetric Bouc–Wen model to characterize the hysteretic nonlinearity, which significantly improves the accuracy. Kim [
13] designed a GPR-based data-driven state feedback controller to achieve reference tracking of nonlinear discrete-time system. Considering the adverse effects by sensor error and actuator fault, an active fault-tolerant control based on the integration of SMC, fault detection, and fault estimation visa residual signals was proposed in [
14]. Li [
15] proposed a cascaded PID control method, which enhances the response speed and control precision. Xu [
16] designed a variable universe fuzzy exponential rate reaching law sliding mode controller. Choi [
17] proposed a controller using a deep reinforcement learning algorithm, which creates reward functions and neural networks, enabling UBR to maintain balance and reach the desired position through instructions. Kumar [
18] derived a reduced-order method to enhance capacity of resisting disturbance. Sun [
19] proposed an adaptive law, which estimates high-order dynamics to avoid robust terms, and the accuracy of compensation and position was improved. Most controllers depend on the simplified dynamic model which accuracy limits their performance. Therefore, some scholars directly identify balance state points from the dynamic phase diagram. Yu [
20] revealed the inherent dynamics and balance characteristic of UBR and the potential application in self-balancing, drifting, and other aspects through the Steady-State Manifold theory.
Some trajectory tracking controller have been designed based on Ackerman kinematic model. Zhou [
21] employed the Pure Pursuit (PP) algorithm with an appropriate look-ahead distance for prompt tracking of the desired trajectory. Yu [
22] proposed an integrated tracking algorithm, which employs the PP algorithm when the positional deviation exceeds a threshold and switches to the Model Predictive Control within the threshold. He [
23] designed a Gaussian process approach to adapt the control gains and hyperparameters through a learning algorithm for trajectory tracking. Yi [
24] designed the expected trajectory of the internal subsystem and completed the tracking task of the external subsystem based on the Gaussian process regression model predictive control method. For a class of underactuated systems, Fang [
25] proposed a variable-gain controller with online trajectory that satisfies the output constraints, and integrated proportional–integral regulator into the trajectory to ensure the precise convergence of the actuated output.
To coordinate trajectory tracking and self-balancing with bounded disturbance, this study proposes a double closed-loop control framework for UBRs, in which a saturation function-based velocity planner and an FSMC-based balance controller combined with RBFNN-based approximator are designed. Compared to the existing stability control methods for UBRs, the contribution of this study can be marked as the following significant points.
A dynamic equilibrium model with system uncertain term is constructed to ensure physical interpretability, in which external lateral wind disturbance and internal parameter measurement error are incorporated.
A double closed-loop framework, composed of planner, controller and approximator, is proposed for coordinating trajectory tracking and self-balancing control, which considerably reduces the design complexity of control system.
A virtual and visualized bicycle simulation validation platform is developed in Gazebo to intuitively demonstrate the effectiveness and advantages of the proposed approach with the uncertain system.
The paper is organized as follows:
Section 2 presents the dynamic and kinematic models of the UBR, as well as the natural wind model.
Section 3 addresses the design of the double closed-loop controller composed of RBFNN approximator, FSMC, and saturated velocity planner. In
Section 4, the simulation results are illustrated. Finally, conclusions are drawn in
Section 5.
3. Double Closed-Loop Control System Design
In this section, we propose a double closed-loop control scheme for coordinating trajectory tracking and self-balancing of the UBR, as depicted in
Figure 2.
Specifically, the outer control loop includes the saturated velocity planner based on the hyperbolic tangent function, which eliminates tracking errors and enhances stability under the saturation constraints of longitudinal velocity and yaw rate. Through inverse kinematic, the desired speeds can be transformed to roll angle and taken into the inner balance control loop, which integrates the RBFNN approximator and FSMC. By designing an appropriate fuzzy rule, FSMC adapts the exponential rate reaching law coefficient to attenuate the chattering effect. The RBFNN approximator can identify and compensate for the disturbance term to further improve adaptability and robustness of the control system.
3.1. Sliding Mode Control Law Design
The lateral wind force can generate a torque
. Therefore, the dynamic model with the disturbance term can be formulated as follows:
To track the desired roll angle
from the outer loop, the tracking error of the roll angle is formulated:
Since the system is second-order, the sliding surface functions are defined as
where
c must satisfy the Hurwitz condition, i.e.,
.
Substituting Equations (
23) and (
24) into (
22), the expression of
can be obtained as follows:
To proof the stability of the controller, a Lyapunov function is selected as
To satisfy
, the sliding mode control law
u is obtained by putting the exponential rate reaching law
into Equation (
25):
Since the lateral wind force
is unknown, the sliding mode control law is
Then, substituting Equations (
25) and (
28) into (
26) yields the following expression:
where
n denotes the upper bound of the disturbance, it needs to be sufficiently large, but a large upper bound will cause chattering. Since
may be negative due to changes in wind direction and
, condition
must be satisfied to ensure the above inequality.
Based on the above analysis, the Lyapunov function V is positive definite and is negative definite. According to the LaSalle invariance principle, the control system is asymptotically stable. As , and the convergence rate of s depends on n.
3.2. RBFNN Approximator Design
The sliding mode control law (
27) neglects the disturbance
. We define the following disturbance term
f to simplify the control law:
where
f is uncertain under varying wind conditions and physical measurement error.
Substituting Equation (
30) into (
27) yields control law:
To reduce its impact on self-balancing control, it employs the RBFNN to approximate the disturbance term
f. The algorithm of this network is as follows:
where
x is the input vector,
f is the output,
i represents the
i-th input of the network input layer, and
j is the
j-th input of the network hidden layer,
is the output of the Gaussian basis function,
is the ideal network weight,
is the network approximation error, and
,
and
are, respectively, the center coordinates and width parameters of the Gaussian function.
Disturbances ultimately result in changes in
and
. Therefore, the network input is set as
, and the network output is
where
is the network weight designed by the adaptive law (
35).
The obtained approximation term
replaces
f in the control law
u (
31), and the new control law is
Substituting Equations (
30) and (
35) into (
25), we get
where
Define the Lyapunov function as (
), as follows:
From Equations (
35) and (
36), the following can be obtained:
The adaptive law is taken as
Substituting the adaptive law (
39) into the Lyapunov function, we obtain
Since the approximation error is very small, and , it is necessary to satisfy to ensure . The control system is asymptotically stable according to the LaSalle invariance principle.
3.3. FSMC Design
The inequality (
29) indicates that the condition
is necessary. However, a large
n will cause chattering, since
corresponds to the constant rate reaching term in the exponential reaching law. Given that the disturbance
is time-varying,
n also needs to be adjusted accordingly. To ensure the system rapidly reaches the sliding mode surface while reducing chattering, fuzzy control is introduced to update parameter
n, and the fuzzy rules are designed based on experience as follows:
According to the fuzzy rule, the input variable is taken as
, and the output variable is taken as the switching gain parameter
. The definition of the input and output fuzzy is as follows:
where
is negative big,
is negative medium,
is zero,
is positive medium, and
is positive big.
The membership functions of both input and output variables use triangular, Z-shaped and S-shaped functions, respectively, as shown in
Figure 3.
The fuzzy rules is designed as follows:
The upper bound of the switching gain parameter
n is estimated using the integral method:
where
G is a proportional coefficient.
3.4. Saturated Velocity Planner Design
The state vector of the reference trajectory is
, and the actual state vector of the UBR obtained from the kinematic model is
. Therefore, the tracking error vector can be expressed as
. The longitudinal, lateral, and yaw angle error can be further obtained:
And the saturated velocity planner [
27] is designed as follows:
where
,
and
are the reference forward velocity and angular velocity of the trajectory, respectively.
,
and
are the positive design parameters.
Consider the following Lyapunov function as
Differentiating (
47) with respect to time results in
Differentiating (
45) and incorporating the nonholonomic constraint
yields
Substituting (
46) and (
49) into (
48) yields the following result:
Considering the property of the hyperbolic tangent function, for any
and
, we have
and
. Therefore, for any initial error, it follows that
and
. Furthermore, according to Equation (
45), we obtain
.
Moreover, considering
,
and
, according to Equation (
46) and the properties of inequalities, we have
It can be seen from Equation (
51) that by selecting different
,
, and
,
and
can have different ranges, thereby making the system meet the corresponding speed constraint.
To sum up, the double closed-loop control system can be realized by the following steps:
In the first step, the tracking error [
] is obtained from Equation (
45). Then, the forward velocity
and angular velocity
required for tracking the trajectory can be obtained from the saturated velocity planner (
46).
In the second step, the desired roll angle
is obtained through inverse kinematic:
In the third step, is taken into the inner loop to realize the balance control.
The fourth step is to obtain actual state vector
through the kinematic model (
5) and take it to the outer loop to achieve closed-loop control.
Through the four steps, we build the double closed-loop control system to realize precise trajectory tracking and self-balancing simultaneously.
4. Results and Discussions
In this section, we train the parameters and structure of the RBF neural network and then verify the above controller in Matlab-Simulink and ROS-Gazebo environment. Specifically, the study employs Matlab R2023b, ROS Noetic, and Gazebo 11.15 with the ROS-Gazebo environment deployed on the Ubuntu 20.04 system.
4.1. RBF Neural Network Train
The physical parameters of the UBR are shown in
Table 1. The location of the central mass is uniform random to simulate measurement error. Under normal trail condition,
is small, so its influence can be neglected.
The simulation results of wind speed are presented in
Figure 4, with the relevant parameters set as follows:
,
,
,
,
,
,
,
,
,
,
, and
. The grade of wind varies from Level 1 to Level 5.
During the train process, the inputs are the roll angle
and the steering angle
, and the output is the value of function
f. We use 1000 random data as train samples with the input range [−1.5, 1.5] and 500 random data as test samples. Since the actual inputs of the RBFNN are
e and
, the random input range of the test samples is set to [−1, 1]. Furthermore, COG’s height
h and wind force
are also random to express the uncertainty. The training results are shown in
Figure 5,
Figure 6 and
Figure 7.
It can be seen from
Figure 5 that the mean square error (MSE) is 0.0117741 when the number of hidden layer neurons is 300. But the MSE only decreases by 0.001162 when the number is 450. Hence, we set the number of hidden layer neurons as 300 to avoid increasing the complexity of the network and ensure a good approximation effect. The structure of the RBFNN is 2-300-1 with the parameter
after training and optimization. The column size of matrix
is 2 × 300 related to the number of hidden layer neurons. It can be seen from
Figure 7 that the optimized RBFNN has a good approximation effect on the test samples with errors distributed between [−0.4, 0.4].
4.2. Matlab/Simulink
From the stability proofs of the FSMC in the above section, the ranges and implications of the control parameters have been derived. Specifically, these constraints include and , where n denotes the upper bound of the disturbance and must be selected as a sufficiently large value. However, a excessively large upper bound will cause chattering. Therefore, the control parameters of the FSMC should be carefully tuned in accordance with these constraints.
Moreover, with the forward velocity set as constant,
is taken as an extremely small value to make
almost equal to
based on the saturation constraints (
51). In addition,
must be adjusted cautiously to maintain maneuverability while avoiding rollover caused by overly rapid heading adjustments. The final control parameters are shown in
Table 2.
The reference trajectory data is provided by the Beijing Institute of Technology racing team, which includes straight segments and various curves. Fix the speed to and simulation step size to .
As illustrated in
Figure 8, the UBR achieves precise tracking of the reference trajectory and always locates the outer side of the curves. As the reference path point in each computation cycle is chosen as the closest point ahead of the current rear wheel–ground contact point, a minor tracking delay is unavoidable, and this issue can be alleviated by decreasing the interval between reference path points. Specifically,
Figure 9 shows that the trend of lateral deviation is similar to the curvature and their peak times are the same. The reason for the lag phenomenon is that the desired roll angle, the input to the balance control loop, is not a control quantity directly generated by the actuator, which causes the steering angle to rotate in the opposite direction to generate corresponding inertial force and, then, obtain desired roll angle. The phenomenon is also called “left-turn first-right”. Although the lag cannot be avoided, the peak lateral deviation remains within 0.4 m and the peak yaw angle deviation does not exceed 4.5°. Therefore, the controller is effective in complex tracking scenario.
As can be seen from
Figure 10, the trend of the steering angle and the roll angle is similar while their directions are opposite, indicating the coupling between these two variables. The simulation results of SMC and the proposed control law are compared under the same control parameters. It is known that both the chattering amplitude and frequency of the roll angle and handlebar angle are significantly reduced under the proposed law. Specifically, the chattering amplitude of the roll angle is constrained within 1°, the effect of which can be neglected. Meanwhile, the chattering amplitude of the handlebar angle is reduced by nearly 20°.
The chattering frequency originates from the high-frequency random wind . In the case of the SMC, such wind disturbance induces high-frequency fluctuations in the handlebar angle, which further lead the roll angle to chatter. In contrast, the proposed law is capable of approximating and compensating for the wind, thereby reducing the impact effectively.
The chattering amplitude is associated with the control parameter n. In the SMC, the coefficient n of the term is fixed, which tends to cause large amplitude when the system state crosses the sliding surface. By contrast, the proposed law incorporates a fuzzy control to adaptively adjust this coefficient, thus effectively attenuating the chattering amplitude. What is more, the handlebar angle still rapidly varies due to the ignored steering dynamics. To address this, a low-pass filter is incorporated in the Gazebo simulation to smooth the angle output, which can approximately simulate the effect of steering dynamics.
In summary, the roll angle is stably maintained within ±4.2°, and the lateral tracking deviation is maintained within 0.4 m, within the disturbances of wind and system parameter uncertainties. Therefore, it can be concluded that the UBR remains stable and balanced throughout the entire trajectory tracking process under the regulation of the proposed double closed-loop cooperative control scheme.
4.3. ROS/Gazebo
Gazebo is a 3D dynamic simulator, enabling accurate and efficient simulation of UBR with physical properties. It offers high-fidelity physical simulations, sensor models, as well as user-friendly and program-friendly interaction interfaces [
28].
First, a URDF file to describe the UBR is built, which contains precise physical information such as mass, inertia matrix, centroid position and so on. Inaccurate physical parameters could lead to unpredictable mistakes in simulation; thus, we adopted the open-source model from reference [
29] and configured the controller based on it. The model is mainly made up of links and joints, while a joint connects two links through a parent–child relationship. The URDF model is shown in
Figure 11.
After establishing the URDF model, it is necessary to configure motor controllers for driving the joints. The rear wheel rotation joint uses a velocity controller called “JointVelocityController”, while the front fork steering joint employs a position controller called “JointPositionController”. The underlying layer of these controllers employs the PID algorithm. Proper adjustment of the PID parameters is necessary for smooth joint movements, but it is quite complicated. To simplify this process, we smooth the control command instead. As shown in Equation (
53), we first integrate the control output and then filter it.
is the smoothing coefficient, with
. The closer
is to 1, the smoother the result, but the slower the response. In the experiment,
is set to 0.92. Finally, we describe the control type of each joint in the “yaml” file.
We used C++ 17 and Python 3.0 language to develop the nodes and topics for trajectory tracking and balance control of the UBR.
In this simulation, due to different physical parameters, the controller parameter
is modified to 2 while other parameters remain unchanged. The direction of the wind force is also set to be lateral at the centroid position. We use ros_bag tool to record the simulation results. The simulation video can be found at the following link:
https://www.youtube.com/watch?v=-90zBuK3bcY (accessed on 31 December 2025).
By comparing the simulation results of
Matlab and
Gazebo as shown in
Figure 12, the amplitude of lateral deviation in the
Gazebo simulation has increased by 0.2 m and the yaw deviation has increased by 6°. In
Figure 13, the amplitude of roll angle has increased by 2° and the handlebar angle has decreased by 5° since the
Matlab does not consider steering dynamics. Such results are still within acceptable range, and the simulations in
Gazebo prove the feasibility of the proposed control law.
4.4. Discussions
Considering the future deployment of this control law on a real UBR, the potential challenges and corresponding countermeasures are summarized as follows:
In Gazebo simulation, the precise position coordinates and roll angle can be directly obtained. However, the collected data are inevitably affected by noise and accuracy in real UBR. Therefore, it is necessary to use RTK technology to achieve centimeter-level location accuracy, and integrate the IMU with Kalman filter to obtain precise roll data.
It is different in the response speed and torque limitations of the actuator motor between the real world and the simulation, as well as the mechanical damping and stiffness. Therefore, it is essential to select motors and adjust control parameters to compensate for the differences.
A real UBR needs sufficient computing power to ensure real-time performance. For this purpose, the NVIDIA Jetson Orin NX equipped with the ROS system can be adopted. This main controller unit can not only provide adequate computing power, but also conveniently transplant simulation codes to the real UBR.