Method Article

Rapid Control Prototyping Simulation of Particle Swarm Optimization-Tuned Backstepping Tracking Control for A Rotary Inverted Pendulum

DOI:

10.3791/71850

July 24th, 2026

In This Article

Summary

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This protocol establishes a standardized rapid control prototyping procedure to evaluate Particle Swarm Optimization-tuned backstepping tracking control within a fixed-step real-time simulation environment.

Abstract

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The primary objective of this protocol is to provide a reproducible fixed-step simulation framework for evaluating Particle Swarm Optimization (PSO)-based gain tuning in nonlinear control systems. The implementation begins with the formulation of a Furuta-type pendulum model, followed by the integration of a backstepping controller within a 2 ms fixed-step execution environment. The methodology involves a systematic four-stage process: characterizing non-ideal implementation constraints, defining a multi-objective Particle Swarm Optimization search space, executing automated offline tuning, and evaluating the resulting parameters through a standardized suite of trajectory-tracking and disturbance-rejection scenarios. This setup, utilizing high-performance industrial workstations and standardized signal interfaces, supports consistent repeated-trial comparisons within the same control architecture. The design compares a baseline manually tuned backstepping controller with a PSO-optimized variant that shares the exact same control structure, thereby isolating the impact of gain selection. Controller performance is assessed across three distinct operational scenarios: step-trajectory following, mixed-frequency sinusoidal tracking, and disturbance rejection. Statistical analysis of 10 repeated trials showed that PSO-based optimization reduced the step-tracking RMSE from 0.065 to 0.050 rad and attenuated peak pendulum excursions by 33.1%. These improvements were achieved alongside a 22.1% reduction in RMS control effort, indicating that the optimized parameters facilitated more efficient energy distribution within the Lyapunov-based framework. Ultimately, this methodology provides a structured simulation framework to evaluate nonlinear control strategies before any subsequent physical hardware implementation.

Introduction

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The Furuta-type rotary inverted pendulum represents a fundamental benchmark for validating nonlinear control algorithms due to its open-loop instability and complex underactuated dynamics1,2,3. Before implementation-oriented evaluation can be considered, these theoretical designs require rigorous simulation-based intermediary testing. Therefore, this protocol establishes a standardized, rapid control prototyping simulation framework to systematically evaluate the performance changes induced by Particle Swarm Optimization (PSO) on backstepping tracking controllers in a fixed-step simulated environment.

In the broader literature, numerous studies have explored structural modifications and parameter tuning to improve control of rotary inverted pendulums. Optimization-based designs are prevalent; for instance, PSO has been utilized to select controller parameters and has been integrated into fuzzy-hybrid control architectures4,5. Compared to other bio-inspired metaheuristics, PSO is specifically selected for this framework due to its rapid convergence in low-dimensional continuous search spaces and its minimal hyperparameter tuning requirements. Recent literature increasingly highlights the necessity of intelligent optimization algorithms in diverse and complex control scenarios. For example, advanced optimization techniques have been effectively combined with model reference adaptive control (MRAC) and fractional-order frameworks to enhance the tracking precision of nonlinear servo plants6,7. Furthermore, optimization-based tuning has proven highly advantageous in managing the coupled dynamics and inherent constraints of complex electromechanical systems8,9.

Recent studies validate that PSO and its hybridized variants significantly improve the efficacy of maximum power point tracking in photovoltaic arrays, demonstrating robust parameter identification under partial shading conditions10. In robotics, PSO has been successfully utilized to optimize augmented linear and nonlinear proportional-derivative control designs for parallel manipulators, minimizing trajectory tracking errors11. Additionally, the integration of PSO with adaptive backstepping sliding mode control has proven critical for suppressing vibrations in pneumatic artificial muscle-actuated hanging masses12. Beyond fundamental parameter selection, the integration of modern signal processing and robust optimization strategies is critical for maintaining closed-loop stability under realistic, noisy physical conditions13,14.

Recent efforts have also focused on simultaneous joint-angle tracking and pendulum stabilization under uncertain conditions using robust generalized dynamic inversion15, as well as adaptive neural estimation16. Furthermore, backstepping control architectures have been extensively evolved to handle complex disturbances across various mechanical systems, such as incorporating sliding mode designs for building vibration suppression, utilizing quasi-sliding observers for electronic throttle valves, and integrating nonlinear disturbance observers for high-precision DC motor speed regulation17,18,19. These diverse applications underscore the versatility of backstepping designs when coupled with robust estimation or optimization strategies.

A critical weakness prevailing in contemporary literature is the conflation of structural controller modifications with parameter-tuning benefits. Many comparative studies contrast entirely distinct control architectures, rendering it impossible to discern whether performance gains stem from the fundamental algorithm or merely from superior gain selection20,21. Furthermore, existing simulation studies often assume ideal operating conditions and focus solely on basic stabilization. They frequently fail to address performance degradation induced by realistic implementation constraints. This methodology directly addresses these gaps. By introducing simulated sampling delays, sensor noise, and damping mismatch within a dynamic trajectory-tracking paradigm, the proposed protocol evaluates the optimization effect of PSO on a fixed control structure.

Unlike conventional numerical integration, this protocol differentiates itself by decoupling parameter-tuning efficacy from structural controller variations while enforcing fixed-step timing constraints. Rather than introducing a novel control architecture, this method evaluates a single backstepping tracking controller within a fixed-step real-time simulation environment. By comparing a manually tuned baseline against a PSO-optimized variant of the exact same controller, the protocol is designed to attribute observed differences in step-tracking, sinusoidal-tracking, and disturbance rejection to the gain-optimization process. The primary contribution of this study is the development of a benchmark-oriented real-time simulation protocol that isolates the impact of PSO-based gain selection from structural controller variations.

Specifically, this work: (1) establishes a 2 ms fixed-step execution environment to emulate implementation constraints; (2) integrates a multifaceted evaluation suite including step, mixed-frequency sinusoidal, and torque-pulse disturbance scenarios; and (3) provides a quantitative benchmark for comparing gain-tuning effects under standardized simulated non-ideal conditions. This methodology is specifically designed for control researchers and systems engineers who require an intermediate simulation-evaluation stage for nonlinear control laws under fixed-step timing, measurement noise, delay, damping mismatch, and saturation constraints. It is particularly applicable to underactuated electromechanical systems, where tracking precision and internal-state stability must be balanced under realistic measurement noise and communication delays.

Protocol

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

This protocol does not involve human subjects, animal testing, or clinical specimens. The procedures are executed entirely within a fixed-step simulation environment representing a nonlinear electromechanical control system. No physical rotary inverted pendulum experiment, physical hardware-in-the-loop validation, or physical deployment test was performed in this study.

1. Plant construction and signal convention establishment

  1. Construct a high-fidelity simulation model of a Furuta-type rotary inverted pendulum. Define two generalized coordinates for the system: the rotary arm angle, θ, and the pendulum deviation angle from the upright vertical, α.
  2. Define the system state vector as x = [θ, α, θ̇, α̇]T, designating α = 0 as the unstable upright equilibrium. Formulate the mathematical plant model using the Euler-Lagrange equations to explicitly define the nonlinear inertia matrix, Coriolis forces, and gravitational vectors coupling the active rotary arm and the passive pendulum22.
  3. Define positive θ and positive α consistently using the same encoder polarity across the plant, controller, and post-processing scripts.
  4. Establish the fixed-step real-time simulation solver strictly utilizing the nominal mechanical and electromechanical parameters detailed in Table 1. Configure the closed-loop system within the designated real-time execution environment as specified in the Table of Materials. Set the controller update period to 2 ms and ensure the data logging interval is fixed at 20 ms.
  5. Incorporate three specific non-ideal effects into the plant model to emulate realistic implementation limitations. Inject zero-mean white measurement noise with standard deviations of 0.003 rad and 0.004 rad into the arm and pendulum feedback channels, respectively.
  6. Introduce a 4 ms transport delay into the measured pendulum signal. Simultaneously, increase the simulated plant damping coefficients by 8% relative to the nominal values used in the controller design to simulate modeling mismatch.
  7. Limit the motor command output strictly to ±10 V.
    CAUTION: Configure software-level safety stops to terminate the trial execution immediately if |θ| exceeds 0.70 rad or if |α| exceeds 0.35 rad. Additionally, implement a watchdog timer to trigger a system reset if the control command remains at the ±10 V saturation limit for more than 100 ms.

2. Initial state stipulation and prepositioning

  1. Initialize the system in a downwards resting state before each test.
  2. Execute a prepositioning task to swing the pendulum up to the inverted position and engage the stabilizing controller. Exclude this prepositioning phase from the formal performance assessment.
  3. Begin formal data collection only after verifying that the pendulum deviation has continuously remained within ±0.05 rad of the upright equilibrium for at least 1.0 s, thereby keeping the dynamic initial conditions practically comparable across all evaluated trials.
  4. Reset the trial time to 0.0 s upon satisfying this condition and immediately begin executing the designated setpoint profile. Ensure all controllers utilize this identical prepositioning procedure and meet the exact same acceptance standards.

3. Baseline backstepping controller implementation

  1. Define the tracking error eθ(t) according to the commanded arm-angle reference θr(t) using Equation
    eθ(t) = θr(t) − θ(t) (1)
  2. Construct the composite sliding surface, s(t), according to Equation 2. Within this formulation, define λ as the strictly positive error-surface slope coefficient.
    s(t) = ėθ(t) + λeθ(t) (2)
  3. Formulate the reference backstepping controller by integrating a nominal model-based compensation term with an error-stabilizing proportional term. Define the tracking error variables mathematically as z1 = eθ(t) and z2 = s(t).
  4. Conduct a Lyapunov stability analysis to assess tracking error convergence. Differentiate the chosen control Lyapunov function V = 1/2z12 + 1/2z22 with respect to time to yield V̇ = z1ż1 + z2ż2. Substitute the formulated control law into this derivative to verify that V̇ ≤ −k1z12 − k2z22 ≤ 0. This negative-semidefinite condition theoretically ensures that the closed-loop system errors converge to the origin.
  5. Constrain the subsequent PSO algorithm to explore the multidimensional parameter space within boundaries selected to preserve this Lyapunov-based stability condition.
  6. Substitute the discontinuous sign function with a continuous saturation function, sat(x/ϕ), to mitigate high-frequency chattering near the equilibrium, following standard boundary-layer backstepping practice23. Define ϕ as the boundary-layer width used to smooth the control transitions within Equation 3.
    sat(x/ϕ) = 1 for x/ϕ > 1; sat(x/ϕ) = x/ϕ for |x/ϕ| ≤ 1; sat(x/ϕ) = −1 for x/ϕ < −1 (3)
  7. Estimate the angular velocities from position measurements by applying a first-order filtered backward difference algorithm with a cutoff frequency of 25 Hz.
  8. Apply the fixed baseline gains listed in Table 2 (k1 = 3.60, k2 = 1.95, λ = 2.10, and ϕ = 0.12). Do not retune these values once formal testing commences.

4. Backstepping gain optimization via particle swarm optimization (PSO)

  1. Execute offline tuning prior to the real-time evaluation. Optimize the four controller parameters (k1, k2, λ, and ϕ) employing PSO configured with 20 particles and strictly limit the execution to 35 iterations24. Terminate the optimization at this threshold to prevent unnecessary computational overhead, as empirical offline tuning indicated that the swarm consistently converged to a stable global-best fitness value within the first 20 iterations.
  2. Initialize the particles uniformly within the designated search boundaries: k1 ∈ [2.5, 5.5], k2 ∈ [1.2, 3.0], λ ∈ [1.2, 2.8], and ϕ ∈ [0.05, 1.20].
  3. Evaluate each particle using a 20 s offline training scenario. Ensure this evaluation environment strictly replicates the saturation limits, sensor noise, delay, and damping mismatch established for the formal real-time trials.
  4. Formulate the minimization objective function as J = 0.55RMSE + 0.25max|α| + 0.20RMSU.
  5. Normalize these three objective components using fixed baseline reference values, computed as the mean of five initial baseline runs executed before initiating the swarm search. Maintain these normalization constants rigidly throughout the optimization process.
  6. Decrease the inertia weight linearly from 0.90 to 0.40 over the course of the optimization run. Fix both acceleration coefficients at 1.50.
  7. Assign a predetermined penalty cost to any particle configuration that triggers a safety stop during its evaluation phase.
  8. Extract the global-best solution directly upon completing the final iteration and designate it as the optimized controller.
  9. Implement the optimized gains detailed in Table 2 for all formal PSO-optimized real-time trials (k1 = 4.19, k2 = 2.44, λ = 1.83, and ϕ = 0.92).

5. Real-time execution platform configuration

  1. Execute the control logic and the mathematical plant models simultaneously within a rapid control prototyping (RCP) fixed-step real-time simulation environment. Utilize a high-performance industrial workstation with sufficient computational capacity to serve as the real-time target machine. Interface the control algorithms with the simulated plant dynamics via virtual analog output and encoder input channels to emulate implementation-level signal constraints.
  2. Enforce a strict 2 ms interval for the real-time step size. Refer to Table 3 for a comprehensive summary of the hardware and execution settings.
  3. Reset all controller states before initiating each trial.
  4. Set the reference value to zero and collect a 2.0 s baseline data segment in the upright position. Inspect this window to confirm the absence of abnormal saturation events or sensor drift prior to launching the designated tracking profile.
  5. Regenerate the measurement noise realization using a distinct seed selected from a predefined array of seeds for every new trial.

6. Step-tracking test execution

  1. Apply a 20 s piecewise step sequence defined as θr = 0 rad from 0.0 s to 2.0 s, θr = 0.50 rad from 2.0 s to 10.0 s, and θr = 0.20 rad from 10.0 s to 20.0 s.
  2. Conduct 10 valid trials for the baseline controller and 10 valid trials for the PSO-optimized controller.
  3. Record the time elapsed, reference angle, measured arm angle, tracking error, pendulum deviation, and control voltage continuously during each trial.
  4. Assess the transient performance specifically following the 0.50 rad step input occurring at t = 2.0 s.
  5. Calculate the rise time, defined as the duration required for the measured arm-angle response to transition from 10% to 90% of its target setpoint.
  6. Calculate overshoot as the percentage by which the peak angular deviation exceeds the 0.50 rad target.
  7. Calculate the settling time, determined as the first instance after which the response remains bounded within ±2% of the 0.50 rad target for a minimum of 1.0 s.
  8. Mark any trial that fails to meet this settling condition before the 10.0 s mark as unresolved. Exclude it strictly from the settling-time average calculations while retaining it for all other metrics.
  9. Compute the steady-state error by averaging the tracking error over the temporal window extending from 9.0 s to 10.0 s.

7. Sinusoidal tracking test execution

  1. Inject a 20 s mixed-frequency sinusoidal reference trajectory governed by Equation 4.
    θr(t) = 0.26sin(2π·0.10t) + 0.12sin(2π·0.30t + 0.40) rad (4)
  2. Complete 10 valid trial runs for each respective controller configuration.
  3. Extract the full-trial tracking RMSE, maximum absolute tracking error, control RMS voltage, maximum absolute pendulum deviation, and phase lag for every individual trial.
  4. Estimate the phase lag by performing a cross-correlation between the measured arm-angle trajectory and the commanded reference within a specified search window of ±0.50 s. Record the lag as a positive value when the measured output temporally trails the reference signal.

8. Disturbance rejection test execution

  1. Maintain the arm-angle reference strictly at 0 rad throughout the entire 20 s duration.
  2. Inject an additive motor-side torque pulse at exactly 6.0 s, and apply a second identical pulse at 12.2 s.
  3. Configure the disturbance amplitude to 0.030 N·m and set the pulse width to 0.12 s for both injection events. Complete 10 valid trials per controller.
  4. Compute the peak absolute tracking error exclusively within the 0.50 s window immediately following each pulse onset. Identify and retain the larger of the two values as the representative post-disturbance peak error for that trial.
  5. Calculate the recovery time, defined as the elapsed duration from the pulse onset until the first recorded sampling instant where |eθ| ≤ 0.010 rad. Do not interpolate sub-sample recovery times, as the data logging strictly occurs at 20 ms intervals.
  6. Integrate the absolute tracking error and calculate the control RMS voltage cumulatively over the full 20 s trial run.

9. Data export and statistical summarization

  1. Export the raw time-domain data sets from the step, sinusoidal, and disturbance tests into separate data files.
  2. Organize the repeated-trial metrics into a structured matrix format, assigning one row per trial and one designated column per evaluated metric.
  3. Exclude strictly any trials marked as incomplete or terminated by safety stops. Replace every excluded run by conducting an additional trial under identical conditions to guarantee a final dataset comprising exactly 10 valid trials per controller for each testing scenario.
  4. Report the aggregated repeated-trial results as the mean ± standard deviation.
  5. Evaluate the distribution normality of the extracted metrics utilizing the Shapiro-Wilk test25.
  6. Analyze the statistical differences between the baseline and optimized controllers using two-tailed independent-sample t-tests for normally distributed data. Apply the Mann-Whitney U-test for any parameters exhibiting non-normal distributions.
  7. Establish the threshold for statistical significance at p < 0.05.

Results

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The particle swarm optimization (PSO) algorithm demonstrated a rapid initial reduction in the composite objective function, followed by a period of gradual convergence. Specifically, the optimal fitness value decreased to 1.8757 within the first computational cycle, while the mean-swarm fitness dropped from 2.0573 to 1.2518 by the 35th iteration. The majority of this convergence occurred during the initial 15 to 20 iterations. Beyond this stage, the trajectory of the global-best solution converged, indicating that the swarm had reached a stable region within the predefined search space rather than wandering randomly. The final PSO-derived gain set maintained the structural integrity of the baseline backstepping law but redistributed the relative weighting among the stabilizing terms (Table 2). As illustrated in Figure 1, the optimization algorithm facilitated a rapid decay of the fitness function, transitioning from an initial exploration phase to a stable global-best solution within 35 iterations. Compared to the manually tuned baseline, the optimized controller adopted larger values for k1 and k2, a reduced error-surface slope λ, and a wider boundary layer ϕ.

Step-tracking performance

A comparative analysis reveals distinct performance differences between the two controllers during the step-tracking experiment, illustrating the expected positive and suboptimal outcomes of this protocol. The baseline backstepping control represents a typical suboptimal outcome; while it maintained overall stability following the 0.50 rad command injected at 2.0 s, it exhibited a rapid initial rise rate that prematurely deviated from the target trajectory, resulting in persistent residual oscillations and requiring a prolonged duration to converge. Conversely, the PSO-optimized controller demonstrates a representative positive outcome, characterized by a rapid, damped approach to the setpoint without triggering command saturation. Over ten consecutive trials, the optimized controller reduced the step-tracking RMSE from 0.065 ± 0.002 rad to 0.050 ± 0.002 rad (Welch t-test, p < 0.001, Table 4). Transient metrics also improved: overshoot decreased from 4.644 ± 0.604% to 3.627 ± 0.620% (Mann–Whitney U, p = 0.009), and the rise time was shortened from 0.788 ± 0.025 s to 0.548 ± 0.025 s (Mann–Whitney U, p < 0.001). These performance differences are shown in Figure 2 and Figure 3, where the optimized response exhibits improved damping and faster setpoint convergence. This enhanced precision was achieved alongside a 22.1% reduction in the root-mean-square control voltage (from 0.669 ± 0.004 V to 0.521 ± 0.003 V). Concurrently, the maximum pendulum swing was attenuated by 33.1%, dropping from 5.812° to 3.889° (Table 4). Furthermore, while no baseline trials satisfied the 1.0 s settling criterion within the 10.0 s window, the optimized controller achieved successful settling in 70% of the trials, recording an average settling time of 1.057 ± 0.348 s.

Sinusoidal-tracking performance

Both control strategies maintained bounded tracking under the mixed-frequency sinusoidal reference throughout the 20 s test duration. Although the performance gap was visually less pronounced than in the step-response tests, statistical results across repeated trials indicated improved performance with the optimized approach. The baseline control signal exhibited a broader tracking error envelope and noticeably lagged behind the target waveform. In contrast, the optimized controller tracked the setpoint more closely during both low- and high-frequency variations, yielding a tighter distribution of peak errors along the reference trajectory. Consequently, the full-trial RMSE was reduced from 0.061 ± 0.003 rad to 0.040 ± 0.003 rad post-optimization. As detailed in Table 5, the optimized controller also facilitated a reduction in the control RMS voltage (from 0.557 ± 0.002 V to 0.402 ± 0.002 V) and restricted the maximum pendulum displacement from 2.156 ± 0.079° to 1.464 ± 0.061°, indicating improved phase synchronization and energy efficiency (p < 0.001, Table 5; Figure 4).

Disturbance rejection and cross-scenario robustness

The injection of additive torque pulses at 6.0 s and 12.2 s induced larger arm-angle deviations and wider pendulum excursions in the baseline controller's response. While the optimized controller also registered the perturbations immediately, its post-disturbance excursions were lower. The recovery process toward the zero-reference equilibrium exhibited a qualitatively faster trend (from 0.014 s to 0.000 s); however, this specific metric did not reach statistical significance (p = 0.078), primarily because the 20 ms data logging resolution induced a measurable floor effect. Over repeated trials, the optimized parameterization reduced the peak post-disturbance error. The integral of absolute error (IAE) computed over the 20 s duration was reduced from 0.377 ± 0.012 to 0.248 ± 0.015, alongside a corresponding drop in control RMS voltage from 0.656 ± 0.003 V to 0.508 ± 0.005 V. The maximum amplitude of the pendulum oscillation was similarly attenuated from 11.456 ± 0.117° to 7.561 ± 0.063° (Table 6). The ranking of the controllers remained consistent across all three test profiles. The PSO-optimized backstepping strategy yielded lower transient errors, reduced steady-state inaccuracies, and minimized passive pendulum excursions (p < 0.001, Table 6; Figure 5) without demanding an increase in overall actuator effort. The cross-trial distributions of the primary performance indicators are summarized in Figure 6.

DATA AVAILABILITY:

The supporting dataset used to generate the figures and tables, including representative data, trial-level metrics, predefined random seeds, and PSO tuning records, has been deposited in Zenodo and is publicly available under DOI 10.5281/zenodo.20395966.

figure-results-1
Figure 1: Particle swarm optimization convergence in controller tuning. (A) The best fitness values of the swarm over 35 iterations; (B) Mean fitness values for each time point. The composite objective decayed quickly in the initial exploration phase but gradually slowed down as it converged to a stable region of the PSO-optimized backstepping control law. Please click here to view a larger version of this figure.

figure-results-2
Figure 2: Representative step-tracking responses of the baseline and PSO-optimized backstepping controller. (A) Commanded arm-angle reference and measured arm-angle response for a full 20 s step sequence; (B) Enlarged view of the response immediately after a 0.50 rad step applied at 2.0 s; (C) Enlarged view of the response after the second 0.20 rad command segment begins at 10.0 s. After optimization, the PSO-optimized controller demonstrated faster rise time, lower peak error, and better damping compared with the baseline controller. Please click here to view a larger version of this figure.

figure-results-3
Figure 3: Arm-angle tracking error and control behavior under the two controllers. (A) Arm-angle tracking error during the complete step-tracking test; (B) Control voltage signal for the same trial; (C) Pendulum deviation angle during the step response. The optimized controller showed smaller error excursions, a narrower range of oscillation, and relatively smoother motion under a lower RMS command level. Please click here to view a larger version of this figure.

figure-results-4
Figure 4: Representative sinusoidal-tracking performance under a mixed-frequency reference. (A) Commanded sinusoidal reference and measured arm-angle responses within the 20 s tracking experiment; (B) Tracking error within the same time range; (C) Pendulum deviation angle during the sinusoidal tracking process. The PSO-optimized controller tracked the composite command more closely than the baseline controller, demonstrating reduced phase lag and a decreased range of errors in consecutive cycles. Please click here to view a larger version of this figure.

figure-results-5
Figure 5: Representative disturbance-rejection responses under zero-reference regulation. (A) Arm-angle tracking error during the disturbance-rejection test, including torque-pulse disturbances at 6.0 s and 12.2 s; (B) Pendulum deviation angle during the same trial; (C) Control voltage signal during disturbance rejection. Compared with the baseline controller, the PSO-optimized control showed lower post-disturbance maximum deviation and faster recovery toward the setpoint. Please click here to view a larger version of this figure.

figure-results-6
Figure 6: Cross-trial distribution of the primary performance indicators in all three test situations. (A) Step-tracking RMSE; (B) Step-tracking rise time; (C) Sinusoidal-tracking RMSE; (D) Sinusoidal phase lag; (E) Peak post-disturbance tracking error; (F) Maximum pendulum displacement under the disturbance-rejection condition. Each panel shows the distribution of 10 valid trials under each controller condition. The central tendency and dispersion of the baseline and PSO-optimized backstepping control systems are compared directly. Please click here to view a larger version of this figure.

ParameterSymbolValueUnit
Rotary arm lengthLr0.215m
Pendulum center-of-mass lengthLp0.168m
Rotary arm massmr0.254kg
Pendulum massmp0.097kg
Arm viscous dampingbr0.0031N·m·s/rad
Pendulum viscous dampingbp0.0018N·m·s/rad
Motor torque constantKt0.053N·m/A
Encoder resolutionNenc4096counts/rev
Controller update periodTs0.002s

Table 1: Nominal system parameters of the nonlinear rotary inverted pendulum model. The nominal geometric, inertial, damping, actuation, and sensor parameter list for the real-time nonlinear plant model and control system development. The damping mismatch added at the time of formal test application is independent and excluded from these nominal figures.

ControllerGainValueDescription
Baseline backsteppingk13.6Hand-tuned initial stabilizing gain
Baseline backsteppingk21.95Hand-tuned virtual control gain
Baseline backsteppingλ2.1Error-surface slope
Baseline backsteppingφ0.12Boundary-layer width
PSO-optimized backsteppingk14.19Global-best particle after 35 iterations
PSO-optimized backsteppingk22.44Global-best particle after 35 iterations
PSO-optimized backsteppingλ1.83Global-best particle after 35 iterations
PSO-optimized backsteppingφ0.92Global-best particle after 35 iterations

Table 2: Baseline backstepping controller gains and PSO-optimized backstepping controller gains. The table presents the gain combinations for both controllers' operating states. Baseline values were fixed during manual tuning; PSO-optimized gains refer to the final global-best particle retained following 35 optimization iterations.

ItemSpecification
Real-time target computerIndustrial PC, Intel i7-class CPU, 16 GB RAM
Execution modeFixed-step real-time simulation
Controller update period2 ms
Signal export interval20 ms
Signal interfaceEncoder input and analog output, ±10 V
Plant configurationNonlinear Furuta-type rotary inverted pendulum model
Injected nonideal effectsMeasurement noise, pendulum-channel delay, and damping mismatch
Measurement noise0.003 rad on arm angle; 0.004 rad on pendulum angle
Pendulum-channel delay4 ms
Plant damping mismatch+8% relative to nominal controller model
Command saturation±10 V
Safety stop criteria|θ| > 0.70 rad, |α| > 0.35 rad, or saturation > 100 ms
Pre-positioning acceptance|α| ≤ 0.05 rad for at least 1.0 s before trial start
Step reference profile0 rad (0.0-2.0 s), 0.50 rad (2.0-10.0 s), 0.20 rad (10.0-20.0 s)
Sinusoidal reference profile0.26 sin(2π·0.20t) + 0.12 sin(2π·0.30t + 0.40) rad
Disturbance protocolTwo additive torque pulses at 6.0 s and 12.2 s
Disturbance amplitude and width0.030 N·m, 0.12 s
Valid trials per controller and scenario10

Table 3: Real-time simulation environment, signal settings, and trial qualification rules. Summary of the execution platform, controller refresh rate, signal export intervals, injection of non-ideal effects, safety stop conditions, reference trajectories, disturbance settings, and valid trial criteria.

MetricBaseline backstepping n=10PSO-optimized backstepping  n=10p valueStatistical test
Tracking RMSE (rad)0.065 ± 0.0020.050 ± 0.002<0.001Welch t-test
Steady-state error, 9.0–10.0 s (rad)-0.007 ± 0.001-0.004 ± 0.001<0.001Mann–Whitney U
Overshoot (%)4.644 ± 0.6043.627 ± 0.6200.009Mann–Whitney U
Rise time (s)0.788 ± 0.0250.548 ± 0.025<0.001Mann–Whitney U
Settling time (s)No valid settled trials (0/10)1.057 ± 0.348 (7/10 valid settled trials)NANot compared
Control RMS (V)0.669 ± 0.0040.521 ± 0.003<0.001Welch t-test
Maximum pendulum deviation (deg)5.812 ± 0.1563.889 ± 0.109<0.001Welch t-test

Table 4: Step-tracking performance metrics across 10 valid trials per controller. This table presents the repeated-trial summary statistics of the step-tracking experiment, which include tracking RMSE, steady-state error, overshoot, rise time, setpoint convergence speed, control RMS voltage, and maximum pendulum deviation. Values are reported as means ± standard deviations unless otherwise noted.

PSO-optimized backstepping  n=10p valueStatistical test
0.040 ± 0.003<0.001Welch t-test
0.088 ± 0.006<0.001Welch t-test
0.232 ± 0.019<0.001Welch t-test
0.402 ± 0.002<0.001Welch t-test
1.464 ± 0.061<0.001Welch t-test

Table 5: Sinusoidal-tracking performance metrics across 10 valid trials per controller. This table presents the repeated-trial summaries of the sinusoidal-tracking test, which include full-trial root-mean-square error (RMSE), maximum absolute tracking error, phase lag, and control RMS voltage. The largest pendulum deviation is also provided. A positive phase lag indicates that the measured output trails the setpoint.

p valueStatistical test
<0.001Welch t-test
0.078Mann–Whitney U
<0.001Welch t-test
<0.001Welch t-test
<0.001Welch t-test

Table 6: Disturbance-rejection performance metrics across 10 valid trials per controller. Repeated-trial data from the disturbance-rejection experiments include peak post-disturbance tracking error, recovery time, integral of absolute error (IAE), control RMS voltage, and maximum pendulum deviation. As dictated by the signal export settings, the measurable recovery time is limited by the 20 ms logging period.

Discussion

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The primary objective of this study is not merely to declare one controller superior to another under isolated conditions, but to demonstrate that the PSO-based gain optimization framework evaluated here can improve the performance of a backstepping controller across defined simulated non-ideal scenarios. The rotary inverted pendulum serves as an excellent benchmark for this evaluation due to its highly nonlinear, non-minimum phase, and underactuated characteristics26. Beyond performance metrics, the technical integrity of this protocol hinges on the deliberate characterization of the real-time simulation environment. A critical implementation step involves the controlled injection of the 8% damping mismatch and 4 ms sensor delay, as these specific non-ideal effects allow the PSO algorithm to optimize gains under the same perturbations used in the formal evaluation rather than under idealized conditions alone.

By testing the control strategies through step-tracking, sinusoidal-tracking, and disturbance-rejection protocols under a unified fixed-step execution setting, the simulation results showed a consistent performance trend. Notably, the enhancements observed in both step and sinusoidal responses—specifically, reduced tracking errors, minimized overshoot, and attenuated phase lag—were achieved alongside a measurable decrease in the RMS control voltage. This indicates that the optimization process did not simply improve tracking accuracy by saturating the drive unit; rather, it redistributed control effort within the existing Lyapunov-based backstepping framework. The consistency of this parameter redistribution is significantly influenced by the prepositioning acceptance criteria defined in protocol Step 2.4. Strictly ensuring that the pendulum remains within the designated equilibrium window for a sustained duration is essential; otherwise, erratic initial transients may lead to premature cost-function stagnation or non-convergent swarm behavior during the subsequent offline tuning phase. For underactuated mechanical systems, this redistribution is important because it governs how control effort is allocated to manage the coupling between the active coordinate (rotary arm) and the passive coordinate (pendulum)27.

Furthermore, the simultaneous reduction in both the arm-angle tracking error and the internal pendulum excursion highlights an advantage of the proposed tuning protocol. In the control of underactuated systems, achieving precise coordinate tracking at the expense of volatile internal states is generally considered a suboptimal or even failed design. The optimized control law reduced the unactuated pendulum's reaction amplitude by 33.1% while simultaneously improving tracking fidelity. This combined improvement suggests that the PSO algorithm identified a gain combination that better balanced the nonlinear coupling between the active and passive coordinates, rather than relying on high-gain feedback that can amplify parasitic oscillations. This balanced performance is a more informative indicator of control efficacy than pure trajectory tracking alone, as it indicates that the internal state dynamics were adequately bounded during the energy conversion processes28. Similarly, the disturbance-rejection results support the practical robustness of the optimized gains within the simulated test conditions. While the 20 ms logging interval induced a floor effect that obscured precise sub-sample recovery times, the concurrent reductions in peak post-disturbance error, cumulative absolute error, and maximum pendulum displacement indicate that the optimized parameters limited the degree to which external pulse injections propagated through the system dynamics29.

Successful execution of this protocol requires addressing common implementation bottlenecks. For instance, if the swarm trajectory fails to stabilize within 35 iterations, researchers should first verify whether the search boundaries stipulated in protocol Step 4.2 adequately encompass the stable Lyapunov region. Furthermore, if the real-time target machine triggers frequent safety stops during the disturbance rejection phase, reducing the controller update period, if supported by the platform, or refining the backward difference filter cutoff frequency may help maintain closed-loop integrity without compromising the optimization logic.

Despite these promising outcomes, the methodology remains bounded by the abstractions inherent to simulation environments. The implemented protocol accounted for sampling delays, command saturation, damping mismatch, and measurement noise—factors frequently neglected in pure offline numerical integration. However, the present study did not include physical rotary inverted pendulum experiments, physical hardware-in-the-loop validation, or physical deployment testing. Therefore, the findings should be interpreted as simulation-based evidence of the performance effect of PSO-based gain tuning under the specified fixed-step and non-ideal simulation conditions. Future work may extend the modeled uncertainty set by incorporating additional friction, actuator, compliance, and quantization effects within simulation before any separate hardware-oriented study is considered30,31,32.

This study establishes a rapid control prototyping simulation protocol to evaluate PSO-based gain optimization for backstepping control. Quantitative results from 10 repeated trials demonstrate that the optimized controller reduces the step-tracking RMSE from 0.065 to 0.050 rad and achieves a 22.1% reduction in RMS control effort compared to the hand-tuned baseline. The 33.1% attenuation in pendulum excursions indicates improved internal state stability under the simulated non-ideal conditions. While this simulation environment incorporates noise, delay, damping mismatch, and saturation, it does not fully replicate the complex Coulomb friction, motor deadbands, structural compliance, or sensor quantization found in physical systems. Future work will focus on expanding the simulation model to include additional non-ideal effects and on testing whether the same ranking pattern remains stable across broader simulated uncertainty conditions.

Disclosures

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The authors declare no conflicts of interest.

Acknowledgements

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,

The authors acknowledge the College of Power Engineering at the Naval University of Engineering for providing the research facilities and real-time simulation platform necessary to conduct the simulations presented in this protocol. The authors also thank the laboratory technical staff for their support in maintaining the computational resources and simulation environment used for the control performance evaluations.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
High-performance Workstation (Windows 11 Pro)Various / Custom BuildN/AHost machine for fixed-step real-time simulation and post-processing.
MATLAB (Version R2024a)MathWorkshttps://www.mathworks.com/products/matlab.htmlNonlinear plant modeling, controller coding, data export, and parameter management.
Simulink (Version R2024a)MathWorkshttps://www.mathworks.com/products/simulink.htmlBlock-diagram model construction for the Furuta-type pendulum and controller execution.
Simulink Desktop Real-Time (Version R2024a)MathWorkshttps://www.mathworks.com/products/simulink-desktop-real-time.htmlFixed-step real-time kernel for desktop execution of the control model.
Python (Version 3.11)Python Software Foundationhttps://www.python.org/Secondary data processing, statistical handling, and figure preparation.
NumPy (Version 1.26)NumPy Developershttps://numpy.org/Numerical array operations for exported trial data.
pandas (Version 2.2)pandas Developershttps://pandas.pydata.org/Repeated-trial data organization and summary-table generation.
SciPy (Version 1.13)SciPy Developershttps://scipy.org/Statistical testing and signal-analysis utilities.
Matplotlib (Version 3.8)Matplotlib Developershttps://matplotlib.org/Plot generation for convergence, tracking, and distribution figures.

References

Loading...
$$\rightleftharpoonup{xx}$$ $$\longleftharp{xx}$$, $$\longrightharp{xx}$$,
  1. Boubaker, O. The inverted pendulum benchmark in nonlinear control theory: a survey. Int J Adv Robot Syst. 10, 233 (2013).
  2. Krafes, S., Chalh, Z., Saka, A. A review on the control of second order underactuated mechanical systems. Complexity. 2018, 9573514 (2018).
  3. Casanova, V., et al. Control of the rotary inverted pendulum through threshold-based communication. ISA Trans. 62, 357-366 (2016).
  4. Rahimi, A., Raahemifar, K., Kumar, K. D., Alighanbari, H. Controller design for rotary inverted pendulum system using particle swarm optimization algorithm. , 1-5 (2013).
  5. Hamza, M. F., Yap, H. J., Choudhury, I. A. Genetic algorithm and particle swarm optimization based cascade interval type 2 fuzzy PD controller for rotary inverted pendulum system. Math Probl Eng. 2015, 695965 (2015).
  6. Rajesh, R. Optimal tuning of FOPID controller based on PSO algorithm with reference model for a single conical tank system. SN Appl Sci. 1 (7), 758 (2019).
  7. Rajesh, R., Deepa, S. N. Design of direct MRAC augmented with 2 DOF PIDD controller: an application to speed control of a servo plant. J King Saud Univ Eng Sci. 32 (5), 310-320 (2020).
  8. Ramakrishnan, R., Subramaniam Nachimuthu, D. Design of state feedback LQR based dual mode fractional-order PID controller using inertia weighted PSO algorithm: for control of an underactuated system. J Inst Eng India Ser C. 102 (6), 1403-1417 (2021).
  9. Rajamani, M. P. E., Rajesh, R., Iruthayarajan, M. W. A PID control scheme with enhanced non-dominated sorting genetic algorithm applied to a non-inverting buck-boost converter. Sādhanā. 47 (4), 222 (2022).
  10. Challoob, A. F., et al. Hybridization of CSA and PSO improves the efficacy of MPPT for solar photovoltaic array with partial shading. Int Rev Appl Sci Eng. 15 (3), 323-337 (2024).
  11. Oglah, A. A. Optimal augmented linear and nonlinear PD control design for parallel robot based on PSO tuner. Int Rev Model Simul. 12 (5), 281-291 (2019).
  12. Humaidi, A. J., Hashim, A. A., Al-Shuwaili, A., Kadhim, S. K. Particle swarm optimization of adaptive backstepping sliding mode control for a PAM-actuated hanging mass. Int Rev Appl Sci Eng. , (2026).
  13. Rajesh, R., et al. Data-driven fault detection framework for wheel speed sensor in heavy road vehicles. Signal Process. 239, 110266 (2026).
  14. Rajesh, R., et al. Impact of wheel speed signal processing on antilock brake system in heavy road vehicles. Veh Syst Dyn. , 1-22 (2025).
  15. Mehedi, I. M., et al. Underactuated rotary inverted pendulum control using robust generalized dynamic inversion. J Vib Control. 26 (23-24), 2210-2220 (2020).
  16. Bajodah, A. H., Ansari, U. Rotary inverted pendulum control using neuro-adaptive robust generalized dynamic inversion. J Vib Control. 31 (7-8), 1427-1437 (2025).
  17. Shayeghi, H., et al. Adaptive backstepping sliding mode control design for vibration suppression of earth-quaked building supported by magneto-rheological damper. J Cent South Univ. 28 (5), 1421-1435 (2021).
  18. Yuan, X., Wang, H., Wu, Y. Active unmatched disturbance rejection quasi-sliding observer for electronic throttle valve system based on backstepping control. Entropy. 22 (7), 784 (2020).
  19. Zhao, L., Wang, J., Zhou, H., Li, G. Backstepping-based nonlinear disturbance observer for speed control of DC motor. IEEE Access. 8, 18451-18459 (2020).
  20. Chawla, I., Singla, A. Real-time stabilization control of a rotary inverted pendulum using LQR-based sliding mode controller. Arab J Sci Eng. 46 (3), 2589-2596 (2021).
  21. Pramanik, S., Anwar, S. Robust controller design for rotary inverted pendulum using H∞ and µ-synthesis techniques. J Eng. 2022 (3), 249-260 (2022).
  22. Acosta, J. &. #. 1. 9. 3. ;. Furuta’s pendulum: a conservative nonlinear model for theory and practise. Math Probl Eng. 2010, 742894 (2010).
  23. Krstic, M., Kanellakopoulos, I., Kokotovic, P. . Non-linear and adaptive control design. , (1995).
  24. Kennedy, J., Eberhart, R. C. Particle swarm optimization. , 1942-1948 (1995).
  25. Shapiro, S. S., Wilk, M. B. An analysis of variance test for normality: complete samples. Biometrika. 52 (3-4), 591-611 (1965).
  26. Hamza, M. F., Yap, H. J., Choudhury, I. A. Current development on using rotary inverted pendulum as a benchmark for testing linear and nonlinear control algorithms. Mech Syst Signal Process. 116, 347-369 (2019).
  27. Adıgüzel, F., Yalçın, Y. Backstepping control for a class of underactuated nonlinear mechanical systems with a novel coordinate transformation in the discrete-time setting. Proc Inst Mech Eng I J Syst Control Eng. 236 (6), 1211-1223 (2022).
  28. Liu, Y., Yu, H. A survey of underactuated mechanical systems. IET Control Theory Appl. 7 (7), 921-935 (2013).
  29. Ullah, S., et al. Robust control design of under-actuated nonlinear systems: quadcopter unmanned aerial vehicles with integral backstepping integral terminal fractional-order sliding mode. Fractal Fract. 8 (7), 412 (2024).
  30. Hernandez, R., Garcia-Hernandez, R., Jurado, F. Modeling, simulation, and control of a rotary inverted pendulum: a reinforcement learning-based control approach. Modelling. 5 (4), 1824-1852 (2024).
  31. Lakshmi, K. V., Manimozhi, M. Real-time HIL implementation of DDPG-based reinforcement learning controller for a DC servo motor with inertia disc and rotary inverted pendulum. IEEE Access. 13, 208397-208413 (2025).
  32. Ledin, J. Hardware-in-the-loop simulation. Embed Syst Program. 12 (2), 44-54 (1999).

Reprints and Permissions

Request permission to reuse the text or figures of this JoVE article

Request Permission

Tags

Backstepping ControlNonlinear ControlTrajectory TrackingDisturbance RejectionGain TuningFixed Step SimulationLyapunov FrameworkControl Performance

Related Articles