A self-balancing unicycle vehicle control system and method based on cascade PID and multi-sensor fusion
Through a control system that integrates cascade PID and multi-sensors, combined with adaptive filtering and blockchain technology, the limitations of the unicycle self-balancing vehicle in sensor dependence and fault handling are solved, stable balance and data credibility in complex environments are achieved, and the safety and reliability of unicycle vehicles are improved.
Patent Information
- Application Number
- CN202510542496.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2045-04-28
AI Technical Summary
Existing single-wheel self-balancing vehicles have limitations in sensor dependence, control parameter fixation, fault handling and data credibility, making it difficult to maintain stable balance in complex environments, and lack multi-sensor fusion and failure redundancy mechanisms, which poses safety risks.
The control system based on the fusion of cascade PID and multi-sensors, including sensors such as inertial measurement units, magnetometers, wheel encoders, etc. is adopted, and data fusion is combined with adaptive complementary filtering and Kalman filtering algorithms. Blockchain technology is introduced to ensure data credibility, and redundant control strategies are designed to deal with sensor failures.
It improves the balanced control performance and environmental adaptability of unicycles in multiple scenarios, ensures the safety and reliability of the system and the immutability of data, and enhances the stability and safety in complex environments.
Smart Images

Figure CN120065701B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of self-balancing electric vehicles and robot control, and in particular to a self-balancing unicycle control system and method based on cascade PID and multi-sensor fusion. Background Art
[0002] A self-balancing vehicle is a transport or mobile robot that can automatically maintain balance by relying on its own control system, including classic two-wheeled balancing vehicles and unicycle balancing vehicles. Among them, two-wheeled self-balancing robots have been widely studied and applied. Since this type of two-wheeled balancing vehicle has two support points, the control is relatively simple. However, a unicycle self-balancing vehicle (i.e., a balancing vehicle with only a single wheel) has the advantages of simpler structure, lighter weight, and higher flexibility because only one wheel is in contact with the ground, but its dynamic characteristics are more complex and the control difficulty is significantly increased.
[0003] First, most existing self-balancing unicycles only use a single attitude sensor (such as a simple gyroscope / accelerometer combination) and a fixed-parameter PID control algorithm to maintain balance. When the environment changes (such as changes in road slope, wind disturbance) or the load changes (such as changes in the center of gravity caused by carrying cargo), the fixed-parameter controller is difficult to adapt in a timely and effective manner, and is prone to unstable control, overshoot, or even unbalanced falling. Secondly, when the unicycle is running in complex terrain (such as rugged roads, ramps) or special environments (such as inspections in dangerous areas), the requirements for sensor accuracy and robustness are higher, but the existing technology often lacks multi-sensor fusion means, and the reliance on a single sensor leads to insufficient anti-interference ability. Once the sensor drifts or fails, the vehicle may not be able to maintain balance, posing a safety hazard. In addition, the existing unicycle balancing system rarely considers fault redundancy and data trustworthiness. For example, when multiple autonomous mobile devices work together or are remotely monitored, there is a lack of effective mechanisms to ensure the reliability and security of control instructions and sensor data. With the development of emerging technologies such as artificial intelligence and blockchain, the introduction of these cross-domain technologies into unicycle control is expected to significantly improve its intelligence and operational reliability. However, there is currently no mature solution to effectively integrate the above technologies into a unicycle self-balancing control system. Summary of the invention
[0004] Technical purpose: In view of the limitations of the prior art unicycle self-balancing vehicles in terms of sensor dependence, fixed control parameters, fault handling and data credibility, the present invention discloses a self-balancing unicycle control system and a control method based on cascade PID control and multi-sensor fusion, which improves the balance control performance, environmental adaptability and system safety and reliability of the unicycle in multiple scenarios.
[0005] Technical solution: To achieve the above technical objectives, the present invention adopts the following technical solution:
[0006] A self-balancing unicycle control system based on cascade PID and multi-sensor fusion, comprising:
[0007] A main drive module for driving the single wheel provided on the vehicle to achieve forward and backward movements;
[0008] An inertial balance flywheel module, which includes an inertial balance flywheel and its drive mechanism, for adjusting the lateral tilt angle of the vehicle by generating a lateral reaction torque through the rotation of the inertial balance flywheel;
[0009] A multi-sensor module, including an inertial measurement unit, a magnetometer, a wheel encoder, and an environmental sensor, for collecting the tilt angle, angular velocity, heading, speed, and environmental information of the vehicle;
[0010] A main controller, electrically connected to the multi-sensor module, the main drive module, the inertial balance flywheel module, and the communication module, for performing real-time data fusion, cascade PID control, adaptive parameter tuning, fault detection, and data recording and verification;
[0011] A lateral control module, which is provided in or cooperates with the main controller. The lateral control module is used to calculate the target lateral tilt angle according to the lateral state and steering requirements of the vehicle, and convert the target lateral tilt angle into a control command for the inertial balance flywheel;
[0012] A communication module for realizing wireless data communication between the vehicle and an external monitoring platform or other vehicles, and recording and verifying the real-time attitude and motion control data of the vehicle through blockchain technology;
[0013] A power supply module for providing a stable DC power supply for each module of the system.
[0014] Preferably, in the multi-sensor module, the inertial measurement unit includes a three-axis gyroscope and a three-axis accelerometer, and the collected data is used to estimate the longitudinal tilt angle, lateral tilt angle, and heading angle of the vehicle in real time after data fusion.
[0015] Preferably, the data fusion implemented by the main controller adopts an adaptive complementary filtering algorithm, and its filtering formula is:
[0016] , where, is the estimated longitudinal tilt angle of the vehicle at the k-th moment, is the angular velocity of the three-axis gyroscope on the lateral axis, is the sampling period, is the tilt angle calculated according to the measurement of the three-axis accelerometer, is the filtering gain adaptively adjusted according to the vehicle motion state.
[0017] Preferably, the cascade PID control implemented by the main controller includes an outer loop and an inner loop. The outer loop PID control takes the error ev = vref - v between the vehicle target speed vref and the actual speed v as the input and outputs the target longitudinal inclination angle. Its control law is:
[0018] ,
[0019] where, , and are the proportional, integral, and derivative control gains of the outer loop PID respectively;
[0020] The inner loop PID control takes the error between and the actual longitudinal inclination angle obtained by sensor fusion as the input and outputs the torque command for the drive wheel motor. Its control law is:
[0021] ,
[0022] where, , and are the proportional, integral, and derivative control gains of the inner loop PID respectively.
[0023] Preferably, the main controller further includes an adaptive parameter tuning module for monitoring the control performance index and automatically adjusting the PID control gains according to this index to achieve the purpose of optimizing control response and stability, where is the change rate of the wheel output torque, and w1, w2, and w3 are preset weight coefficients.
[0024] Preferably, the main controller further includes a fault detection module for real-time monitoring of the data of each sensor and the output state of the driver. When data anomalies or deviations from the predetermined range are detected, redundant or backup control strategies are automatically enabled to ensure the continuous and stable operation of the system.
[0025] Preferably, the communication module uses blockchain technology to generate a data digest of the key data during the vehicle operation process, and combines the timestamp and hash verification to record the data chain to ensure the immutability and traceability of the data during transmission and storage.
[0026] Preferably, the lateral control module calculates the target lateral inclination angle φref in combination with the vehicle driving state and the steering command, and converts the target lateral inclination angle into the control command τf of the inertial balance flywheel to drive the inertial balance flywheel module to adjust the vehicle lateral balance and assist in steering.
[0027] A self-balancing unicycle control method based on cascade PID and multi-sensor fusion, which is applied to a self-balancing unicycle control system based on cascade PID and multi-sensor fusion as described above, includes the following steps:
[0028] S1. After the vehicle is powered on, the main controller calibrates the multi-sensor module to determine the initial attitude of the vehicle;
[0029] S2. Periodically collect the original data of each sensor, and fuse the data through the adaptive complementary filtering or extended Kalman filtering method to obtain the actual longitudinal inclination angle θ, lateral inclination angle φ, heading angle ψ and actual speed v of the vehicle;
[0030] S3. Calculate the target longitudinal inclination angle according to the error ev between the target speed vref and the actual speed v of the vehicle , and use the error between and the actual longitudinal inclination angle θ as the input to calculate the torque command of the drive motor. At the same time, according to the lateral state and steering requirements of the vehicle, the lateral control module calculates the target lateral inclination angle φref and converts it into the control command of the inertial balance flywheel;
[0031] S4. Output the calculated torque command and control command to the main drive module and the inertial balance flywheel module respectively to realize the vehicle attitude adjustment and motion control;
[0032] S5. Through the feedback of the real-time monitoring system, adaptively adjust the PID parameters, and enable redundant or backup control strategies when anomalies are detected;
[0033] S6. Upload the real-time attitude and motion control data of the vehicle through the communication module, and use blockchain technology to record the data in an immutable manner;
[0034] S7. Repeat steps S2 to S6 to realize the closed-loop control of the vehicle self-balancing and motion.
[0035] Beneficial effects: The self-balancing unicycle control system and method based on cascade PID and multi-sensor fusion provided by the present invention have the following beneficial effects:
[0036] By integrating information from multiple sensors such as gyroscopes, accelerometers, magnetometers, and encoders, the present invention significantly improves the accuracy and reliability of vehicle attitude and motion state perception. In particular, attitude calculation algorithms and adaptive complementary filtering strategies are adopted, enabling the longitudinal and lateral tilt angle estimations to remain stable during dynamic motion without obvious drift. Compared with the prior art that relies solely on a single IMU, the multi-sensor fusion mechanism of the present invention can achieve mutual correction when sensors have noise or bias. Even if individual sensors fail, attitude estimation can still be maintained relying on redundant information, ensuring the continuous balance of the vehicle.
[0037] The present invention designs an innovative cascade PID dual-loop control structure for unicycle attitude and translational control, decoupling and coordinating high-speed tilt angle stabilization and low-speed speed control. At the same time, artificial intelligence algorithms are introduced to adaptively optimize the PID parameters, enabling the controller to automatically adjust the control gain according to load changes and terrain conditions. Compared with traditional control with fixed parameters, the recovery time under disturbances, the larger stability domain, and the tracking accuracy of this system are all improved. For example, when starting on a steep slope or under heavy load, the AI-optimized controller can dynamically enhance the output, thus maintaining balance and smooth acceleration, avoiding the common hysteresis or oscillation problems in the prior art.
[0038] Different from most self-balancing scooter solutions that only control the front and rear tilt angles, the present invention realizes the active balance control in the left and right directions of the unicycle by integrating an inertial balance flywheel inside the vehicle body. This structure provides a means of lateral torque adjustment independent of the ground, enabling the vehicle not only to stand and balance on its own when stationary, but also to turn safely by tilting during high-speed driving. Compared with the existing lateral stability methods that require passenger cooperation or rely on simple mechanical supports, the lateral balance control of the present invention has a faster response and higher accuracy, and can achieve stable steering in the case of driverless. When the vehicle is driving on complex terrain, even under disturbances such as lateral wind, it can adjust its attitude in time through the inertial flywheel, significantly improving the running safety of the unicycle. Brief Description of the Drawings
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art.
[0040] Figure 1 It is a schematic structural diagram of the self-balancing unicycle control system of the present invention;
[0041] Figure 2 It is a schematic flowchart of the self-balancing unicycle control method of the present invention;
[0042] Figure 3 It is a schematic diagram of the closed-loop structure of sensor fusion and state estimation. Detailed Embodiments
[0043] The present invention will be more clearly and completely described below by way of a preferred embodiment in conjunction with the accompanying drawings, but the present invention is not limited to the scope of the described embodiments.
[0044] As Figure 1 shown, a self-balancing unicycle control system based on cascade PID and multi-sensor fusion includes:
[0045] A main drive module for driving the single wheel provided on the vehicle to achieve forward and backward movement;
[0046] An inertial balance flywheel module, which includes an inertial balance flywheel and its drive mechanism, for adjusting the lateral tilt angle of the vehicle by generating a lateral reaction torque through the rotation of the inertial balance flywheel;
[0047] The body of the self-balancing unicycle is supported by a rigid frame, including a main walking wheel and a main drive module coaxially connected to the main walking wheel. In one embodiment, the main drive module is a main drive motor. The main drive motor is used to drive the wheel to rotate forward and backward to achieve forward, backward and dynamic balance control of the vehicle. An inertial balance flywheel is also installed on the vehicle body, and the inertial balance flywheel is controlled to rotate by an independent balance drive motor. The rotation axis of the inertial balance flywheel is arranged along the forward direction of the vehicle (i.e., horizontally pointing forward and backward). By adjusting the rotation angular velocity and acceleration of the inertial balance flywheel, a reaction torque around the forward direction axis can be generated to adjust the lateral tilt attitude of the vehicle and maintain balance in the left and right directions or achieve controlled steering. Necessary mechanical connection structures are provided on the vehicle body to fix the above motors and wheel sets, and shock absorption components can be installed as needed to buffer ground impacts.
[0048] A multi-sensor module, including an inertial measurement unit, a magnetometer, a wheel encoder, and an environmental sensor, for collecting the tilt angle, angular velocity, heading, speed, and environmental information of the vehicle;
[0049] This module includes but is not limited to: an inertial measurement unit IMU, a magnetometer, a wheel encoder, and an optional environmental perception sensor. The inertial measurement unit IMU includes a three-axis gyroscope and a three-axis accelerometer for measuring the angular velocity and acceleration of the vehicle body; the magnetometer is used to measure the heading angle, that is, the orientation of the vehicle relative to the geomagnetic field; the wheel encoder is used to measure the rotation angle and speed of the main wheel, so as to calculate the forward speed and mileage of the vehicle; the environmental perception sensor can be selected such as an ultrasonic / laser rangefinder for detecting terrain obstacles ahead, and a camera for visual-assisted balance or path tracking, etc.
[0050] The above sensors are connected to the main controller via a data bus to achieve real-time data acquisition. Among them, the IMU provides the original measurement of the vehicle attitude, the magnetometer provides the heading reference, and the wheel encoder provides the speed feedback. The data of each sensor will be time-synchronized and fused in the main controller to obtain a high-precision and anti-interference attitude and motion state estimation.
[0051] The main controller is electrically connected to the multi-sensor module, the main drive module, the inertial balance flywheel module and the communication module, and is used for real-time execution of data fusion, cascade PID control, adaptive parameter adjustment, fault detection and data recording and verification;
[0052] The main controller is the brain part for executing the control algorithm, usually composed of a high-performance microprocessor or an FPGA / DSP control board. The main controller communicates with the above multi-sensor module and the motor, and runs the control software of the present invention. The control software includes an attitude solution and state estimation module, a cascade PID control module, an adaptive parameter adjustment module, a fault detection and data recording module, etc. The main controller calculates the current attitude angles (including longitudinal inclination angle and lateral inclination angle), angular velocity, speed and other state variables of the vehicle according to the result of sensor fusion, and then calculates the target outputs of the main drive motor and the balance drive motor according to the set control strategy, so as to achieve closed-loop control. An artificial intelligence algorithm module is also integrated inside the main controller, which is used for optimizing and adjusting the parameters of the PID controller and intelligently discriminating and processing abnormal situations; at the same time, the main controller has data encryption and communication interfaces, which are used to realize functions such as blockchain data verification and remote monitoring.
[0053] In one embodiment, the main controller further includes an adaptive parameter adjustment module for monitoring control performance indicators , and automatically adjusting the PID control gain according to this indicator to achieve the purpose of optimizing control response and stability, where is the change rate of the wheel output torque, and w1, w2, w3 are preset weight coefficients.
[0054] In one embodiment, the main controller further includes a fault detection module for real-time monitoring of the data of each sensor and the output state of the driver. When data anomalies or deviations from the predetermined range are detected, redundant or backup control strategies are automatically enabled to ensure the continuous and stable operation of the system.
[0055] The lateral control module is arranged inside the main controller or works in cooperation with it. The lateral control module is used for calculating the target lateral inclination angle according to the lateral state and steering requirements of the vehicle, and converting the target lateral inclination angle into a control command for the balance flywheel;
[0056] The lateral control module is a part of the unicycle control system for coordinating the left-right stability and steering control of the vehicle. Specifically, the functions of this module include:
[0057] Collect lateral state data: Use the lateral tilt angle φ obtained from the inertial measurement unit (IMU) installed on the vehicle and the heading data from the magnetometer or additional sensors to judge the lateral stability of the vehicle in real time.
[0058] Calculate the lateral target tilt angle: According to the predetermined steering requirements or path planning instructions during vehicle operation, calculate the desired lateral target tilt angle φref. When the vehicle needs to turn or correct its lateral balance, this module generates a target tilt angle signal based on the deviation between the current lateral state of the vehicle and the expected trajectory.
[0059] Output the control instruction for the balance flywheel: Convert the above-calculated target tilt angle signal into a control signal, that is, the control instruction for the inertial balance flywheel (such as the corresponding torque instruction τf). This control instruction is sent to the inertial balance flywheel drive module through a digital signal to adjust the flywheel rotation speed, so that the vehicle can achieve lateral balance and steering adjustment through the flywheel reaction force.
[0060] The communication module is used to realize wireless data communication between the vehicle and an external monitoring platform or other vehicles, and record and verify the real-time attitude and motion control data of the vehicle through blockchain technology.
[0061] The communication module provides wireless data communication interfaces such as Wi-Fi, Bluetooth, cellular networks, or dedicated Internet of Things communication modules. On the one hand, it is used for data interaction between multiple single-wheel vehicles or between the vehicle and the background control center, supporting collaborative work or remote control; on the other hand, it cooperates with the blockchain network to upload the key state data or events of the vehicle to the blockchain for evidence storage. The key control data is the real-time attitude and motion control data of the vehicle, including but not limited to the longitudinal tilt angle, lateral tilt angle, heading angle, forward speed, torque instruction of the main drive module, control torque instruction of the balance flywheel module, adaptive parameter adjustment record, fault detection log, real-time position information, and power status data. The communication module is connected to the main controller, and the main controller obtains the data to be sent and provides the received remote instructions to the main controller for processing. In the blockchain application, the main controller of each vehicle can act as a node, generate data blocks from the key information of the sensor, calculate the verification value through an encryption algorithm, and broadcast it to the network to achieve data consistency and credibility among multiple devices.
[0062] The power supply module is used to provide a stable DC power supply for each module of the system.
[0063] The power supply module includes a power battery pack and a power management circuit, which provides the required electrical energy for the entire vehicle system. The power supply module can output a stable DC voltage, which is respectively supplied to the main drive motor, the balance drive motor, the main controller, and each sensor and communication module. The power management circuit includes overcurrent and overvoltage protection, power monitoring, and an emergency power-off device when necessary, ensuring the safe and reliable power supply of the system. When the battery power is insufficient, the main controller can receive the power information to adjust the corresponding control strategy (such as limiting the maximum speed to extend the endurance, etc.).
[0064] As Figure 2 shown, the present invention also provides a self-balancing unicycle vehicle control method based on cascade PID and multi-sensor fusion, which is applied to a self-balancing unicycle vehicle control system based on cascade PID and multi-sensor fusion as described above, and includes the following steps:
[0065] S1. After the vehicle is powered on, the main controller calibrates the multi-sensor module to determine the initial attitude of the vehicle;
[0066] After the system is powered on, the main controller first performs initialization, including the calibration and zero setting of each sensor, and establishing the alignment between the vehicle coordinate system and the sensor coordinate system. The initial inclination offset is obtained by statically placing the vehicle, and the attitude quaternion or direction cosine matrix is initialized by using the inertial navigation attitude solution method to ensure the accuracy of the initial attitude estimation. The blockchain node initializes the local ledger and records the data block of a system startup event (with a time stamp).
[0067] S2. Periodically collect the raw data of each sensor, and fuse the data through an adaptive complementary filtering or extended Kalman filtering method to obtain the actual longitudinal inclination angle θ, lateral inclination angle φ, heading angle ψ, and actual speed v of the vehicle;
[0068] The main controller collects the data of each sensor at a fixed frequency: the IMU outputs the angular velocity (p, q, r) and acceleration (ax, ay, az) of the vehicle on the three axes, the magnetometer outputs the heading angle reference value, and the encoder outputs the wheel speed etc. These raw data are input into the attitude solution and state estimation module, and the state quantities such as the longitudinal inclination angle θ (front and rear tilt angle), lateral inclination angle φ (left and right tilt angle), heading angle ψ, and forward speed v of the vehicle are calculated through the fusion algorithm. The present invention adopts an improved sensor fusion algorithm: mainly relying on gyroscope integration to obtain the attitude change during high-speed dynamic movement, adding accelerometer signals to correct the drift in the static state, and combining the magnetometer to eliminate the heading drift. Specifically, the controller uses an adaptive complementary filtering or extended Kalman filtering method to give adaptive weights to different sensor data. For example, for the estimation of the longitudinal inclination angle φ, the weighted fusion formula is defined:
[0069] ,
[0070] wherein, is the estimated longitudinal inclination angle of the vehicle at the k-th moment, is the angular velocity of the three-axis gyroscope on the lateral axis, is the sampling period, is the inclination angle calculated based on the measurement of the three-axis accelerometer, is the filtering gain adaptively adjusted according to the vehicle motion state. When the vehicle acceleration changes drastically, is appropriately increased to rely more on gyro integration prediction; when the vehicle tends to be stationary or in uniform linear motion, is decreased to utilize the accelerometer feedback to eliminate zero drift. Similarly, the estimation of the lateral inclination angle φ is calculated complementarily by combining the angular velocity of the gyroscope around the x-axis and the lateral reading of the accelerometer. Through the above fusion, accurate and smooth attitude angle signals and system states such as angular velocity and speed are obtained.
[0071] As Figure 3 shown, it mainly shows how the vehicle uses different sensors to collect data and how to obtain accurate state estimation through data fusion. The arrows indicate the path of data flowing from each sensor to the Kalman filter and then from the filter to the state estimation module, demonstrating the process of closed-loop data fusion.
[0072] S3. Calculate the target longitudinal inclination angle based on the error ev between the target speed vref of the vehicle and the actual speed v, and use as the input of the error between and the actual longitudinal inclination angle θ to calculate the torque command
[0073] of the drive motor. At the same time, according to the lateral state and steering requirements of the vehicle, the lateral control module calculates the target lateral inclination angle φref and converts it into the control command of the balance flywheel;
[0074] The main controller calculates the control output according to the desired motion command and the current estimated state in each control cycle. The present invention adopts an innovative cascade PID control structure to achieve the attitude and speed control of the unicycle vehicle, including the double-loop control in the longitudinal (front-back direction) and the balance control in the lateral (left-right direction).
[0074] The longitudinal control adopts a cascade double-loop PID structure. The outer loop is a speed / displacement control loop, and the inner loop is an attitude angle control loop. The outer-loop PID takes the error ev = vref - v between the desired forward speed vref (or position command) of the vehicle and the current actual speed v as the input and outputs the desired longitudinal inclination angle setting value . For example, the outer-loop control law can be expressed as:
[0075] ,
[0076] Among them, , and are the proportional, integral, and derivative control gains of the outer-loop PID, respectively. Their values can be pre-tuned according to vehicle dynamics parameters or adjusted online by the adaptive module described later;
[0077] The inner-loop PID takes the error between the target longitudinal inclination angle and the current actual longitudinal inclination angle θ obtained by sensor fusion as the input, and calculates the torque command required to be output by the main drive motor. Its control law is, for example:
[0078] ,
[0079] Among them, , and are the proportional, integral, and derivative control gains of the inner-loop PID, respectively. The main controller calculates appropriate motor control signals (such as PWM duty cycle) according to , drives the main drive motor through the motor drive module, makes the wheels rotate at an accelerated or decelerated speed, thereby realizing the adjustment of the vehicle's front and rear inclination angles, maintaining longitudinal balance or generating the required front and rear motion accelerations.
[0080] In the cascade control structure, the outer loop is responsible for slower speed dynamics and long-period error correction, and the inner loop is responsible for quickly correcting the attitude inclination error. By reasonably designing the two-stage PID parameters, the vehicle can balance fast response and steady-state accuracy: the inner loop provides rapid suppression of inclination disturbances, and the outer loop ensures that the vehicle follows the desired speed without long-time deviation. The cascade PID control scheme of the present invention draws on the double-loop regulation idea in flexible robot control, decouples the motor-body elastic inverted pendulum system into two parts: inclination control and speed control, greatly simplifies the controller design difficulty and improves the robustness.
[0081] S4. Output the calculated torque command and control command to the main drive module and the inertial balance flywheel module respectively to realize vehicle attitude adjustment and motion control;
[0082] Lateral control mainly targets the balance of the vehicle's left - right tilt (i.e., φ) and the control of steering motion. When driving straight normally, the desired lateral tilt angle is 0, that is, the vehicle maintains a vertical balance perpendicular to the ground; when turning is required, an appropriate lateral tilt angle command φref is given to the vehicle, causing the vehicle to lean and thus turn (similar to a bicycle leaning when turning to obtain lateral centripetal force). The present invention realizes lateral tilt angle control through an inertial balance flywheel and its balance drive motor. The main controller collects and fuses the estimated current lateral tilt angle φ and possible steering commands (turning radius or desired heading change), and calculates the control command τf that the inertial balance flywheel needs to provide through a simple PID or other control algorithms. An implementation example of lateral control is: using proportional - derivative control to stabilize the roll, , where Kpr and Kdr are the gains of lateral balance control, is the target lateral tilt angle, is the desired change rate of the target lateral tilt angle, is the change rate of the current actual lateral tilt angle. When = 0, the controller will stably control the lateral tilt angle φ near 0; when turning is required, for example, when turning left, an appropriate tilt angle is set such that > 0. The controller drives the inertial balance flywheel to accelerate or decelerate to make the vehicle body lean to the right (generate the tilt required for a left turn), so that the vehicle naturally turns along a curve during forward movement. The high - speed rotation of the inertial balance flywheel, while adjusting the vehicle body tilt, does not directly contact the ground, does not affect the forward speed, and only provides internal torque. Therefore, by coordinating the acceleration and deceleration of the main wheels and the angular velocity change of the inertial balance flywheel, the unicycle of the present invention can simultaneously achieve stable balance control and steering motion control in both the front - rear and left - right directions.
[0083] S5. Through the feedback of the real - time monitoring system, adaptively adjust the PID parameters, and enable redundant or backup control strategies when abnormalities are detected;
[0084] The present invention designs a real-time fault detection and redundancy correction mechanism in the control system to improve the reliability of the system. When the multi-sensor fusion module detects that the data of a certain sensor deviates from the reasonable range or has not been updated for a long time, the main controller will determine that the sensor may be faulty, and then initiate an emergency strategy: for example, if the gyroscope fails, the weight of the accelerometer signal in attitude calculation will be temporarily increased, and a spare gyroscope will be enabled (if there is a redundant IMU in the system); if the main drive motor or its drive circuit shows abnormalities, the controller will immediately limit the output and notify the upper management system, and at the same time try to assist the vehicle to decelerate and stop stably by adjusting the rotation of the inertial balance flywheel to prevent sudden imbalance. The system also provides redundant designs for key components, such as the optional installation of dual gyroscopes / accelerometers, dual power switching devices, etc., to tolerate single-point failures. The fault detection module timely discovers abnormalities by analyzing the consistency of sensor data (such as comparing the differences in readings of dual-channel sensors), monitoring the response of the control loop (such as whether the expected attitude change matches the actual situation), etc., and adopts a predetermined fault-tolerant control strategy to ensure the safety of the vehicle. Moreover, with the help of the communication module, the vehicle can also upload the fault information to the blockchain network in real time for broadcasting, inform other collaborating nodes to avoid or request support, and write the sensor data before and after the fault occurs into the blockchain for post-event analysis to ensure that these data cannot be tampered with.
[0085] S6. Upload the real-time attitude and motion control data of the vehicle through the communication module, and use blockchain technology to record the data in an immutable manner;
[0086] In the background of the control process, the main controller continuously records the operation data of the vehicle, including the time series of sensor readings, control instruction outputs, key events (such as sudden acceleration, sudden stop, collision, fall, etc.). Different from traditional vehicles that only store data locally, the present invention introduces blockchain technology into the data recording link: the controller submits the selected important data digest to a preset blockchain network through the communication module. The blockchain node records the timestamp and performs hash verification on the data, for example, generating a hash value for the state data at each moment and forming a chained record, so that any post-event data tampering will destroy the hash chain and be detected, where represents the hash value generated at the previous moment, represents the state data at the current moment, and the symbol represents the concatenation operation, that is, concatenating with After being connected in series, they are used as input for hash calculation. This mechanism ensures the credibility of the data reported by each unicycle vehicle when multiple machines work together, facilitating the review and traceability of task execution by remote supervisors or upper-level systems. Additionally, through smart contracts, automatic monitoring of the behavior of unicycle vehicles can be achieved. For example, when a vehicle experiences excessive abnormal inclination events multiple times, a maintenance warning is triggered. The data verification and sharing mechanism of the blockchain improves the transparency and security of system operation, providing guarantee for the application of self-balancing unicycle vehicles in fields with high safety requirements such as intelligent security patrol and unmanned delivery.
[0087] S7. Repeat steps S2 to S6 to achieve closed-loop control of vehicle self-balancing and movement.
[0088] Embodiment 1
[0089] A self-balancing unicycle vehicle provided in this embodiment includes a unicycle body and its control system. The unicycle body is supported by a frame made of strong and lightweight materials. A main driving wheel is installed at the lower part of the frame through bearings. The main driving wheel is directly driven by a brushless DC motor as the main driving motor. The motor shaft is fixedly connected to the wheel axle and can output bidirectional torque to drive the wheel to rotate forward or backward. The tire of the wheel can use pneumatic tires or solid tires to balance shock absorption and durability. An inertial balance flywheel is installed at the central position inside the vehicle body near the wheel axle. Its axis is horizontally arranged along the front and back directions of the vehicle body and is installed on the frame through bearings. The inertial balance flywheel is driven by a balance driving motor, and its axis is fixedly connected to the inertial balance flywheel. The inertial balance flywheel itself is made of high-density materials to increase the moment of inertia and is designed with an appropriate aerodynamic shape to reduce resistance and noise during high-speed rotation. The balance driving motor selects a high-speed motor with fast response. By precisely controlling its acceleration and deceleration, the angular velocity of the inertial balance flywheel can be changed within a short time, thereby applying a roll moment to the vehicle body.
[0090] In terms of sensors, the vehicle in this embodiment is equipped with a high-performance six-axis inertial measurement unit as part of the multi-sensor module. The gyroscope has a range of ±500° / s, the accelerometer has a range of ±4g, and the sampling frequency can reach 1 kHz, enabling fine capture of the vehicle's angular motion and acceleration / deceleration changes. In addition, a three-axis magnetometer is integrated to provide an absolute heading reference. An optical encoder is installed on the axle of the main wheel, which is another part of the multi-sensor module used to measure the wheel speed and the angle turned, realizing odometer and speed calculation. The resolution of this encoder is 500 pulses per revolution, and the speed measurement accuracy can reach ±0.1 m / s when combined with the wheel diameter calculation. To enhance the environmental adaptability, this embodiment also installs a pair of ultrasonic ranging sensors (regarded as part of the extended multi-sensor module) at the front of the vehicle body to detect the distance to obstacles on the front road and the height change of the ground. If necessary, a wide-angle camera can also be installed on the top to cooperate with the image processing algorithm to identify terrain landmarks or road driving trajectories. In the vehicle electronic control part, an embedded ARM Cortex-M7 microcontroller is used as the core processor of the main controller, with a main frequency of 300 MHz and a built-in floating-point operation unit to meet the requirements of real-time filtering and control calculations. The necessary AD conversion interfaces for sensor signal acquisition, PWM and DAC interfaces for motor control, and CAN / serial ports for communication module connection are integrated on the controller board. In this embodiment, the communication module uses a 4G cellular communication module to ensure that the vehicle can maintain data communication with the remote server or other vehicles in the outdoor wide-area environment; at the same time, it also supports the local Wi-Fi network for easy debugging and short-distance vehicle group cooperation. The power module uses a set of high-rate lithium-ion batteries to provide 24V DC power, with a rated capacity of 5000 mAh, which can support the vehicle to run for more than 2 hours. The battery management system monitors the voltage, current, and temperature in real time and reports the power status through the interface provided by the main controller. When the power is low, the control algorithm automatically enters the energy-saving mode or notifies the operator to replace the battery.
[0091] Embodiment 2
[0092] This embodiment details the implementation steps and parameter selection of the control algorithm.
[0093] In the system power-on initialization stage, the main controller reads the stored sensor calibration parameters and compensates for the gyroscope zero bias and accelerometer static bias. Subsequently, the main controller runs the attitude initialization program: assuming the vehicle is initially stationary, the gravity direction is determined through the accelerometer readings, and thus the initial longitudinal tilt angle and lateral tilt angle are calculated, and the heading angle of the vehicle Set as the reference direction of the magnetometer reading. Then, by combining the integration of the gyroscope angular velocity and the direction of the accelerometer gravity vector, the quaternion attitude update algorithm is used to quickly establish an initial estimate of the vehicle attitude. After initialization, the main controller enters the main loop control.
[0094] In each control loop (in this embodiment, the period Δt = 5ms is adopted, which is equivalent to a control frequency of 200Hz), the main controller first obtains the latest angular velocity (p, q, r) and acceleration (ax, ay, az) data from the IMU, obtains the wheel angular increment from the encoder and calculates the current speed v, and reads the heading change from the magnetometer. . After these data are aligned by timestamp, they are input into the Kalman filter. The state vector of the filter includes , where θ is the longitudinal inclination angle of the vehicle, is its change rate, φ is the lateral inclination angle, is the change rate of the lateral inclination angle, v is the forward speed, ψ is the heading angle. The state equation is constructed based on the simplified dynamic model of the unicycle. To improve the model accuracy, the filter considers the influence of wheel rotation on the longitudinal inclination angle and the influence of the rotation of the inertial balance flywheel on the lateral inclination angle, and assumes that the kinematic relationship is approximately linear within a small inclination range. The measurement equation consists of the inclination measurement of the accelerometer, the angular velocity of the gyroscope, the speed of the encoder, etc. Through Kalman filter iteration, the main controller obtains an optimized estimate of the above states , and etc. At the same time, the system compares the data of the dual-redundant IMU (if installed) to detect whether the sensor drift exceeds the threshold. If so, the corresponding sensor is marked as abnormal.
[0095] Subsequently, the main controller determines the target motion parameters according to the high-level instructions. For example, in this embodiment, the target forward speed vref and the target heading (or turning radius) ψref are set. Assuming that the vehicle is currently desired to maintain static in-place balance, then vref = 0 and ψref is equal to the current orientation. In this case, the outer-loop speed PID will drive the vehicle speed error to zero. If the vehicle is desired to move forward or backward, the corresponding vref value is set; if a turn is required, the required lateral inclination angle (for example, according to a simple balanced turning model , where R is the turning radius and g is the acceleration due to gravity). In each cycle, the outer-loop PID calculates according to vref and , and the inner-loop PID calculates the torque command of the main drive motor according to . At the same time, the lateral control module calculates according to φref and . Calculate the control command τf of the inertial balance flywheel motor. The main controller will Convert it into the required motor current or PWM, and consider the motor model to estimate the actual obtained acceleration, and feedforward compensate for the motor lag. For the inertial balance flywheel control, τf is also converted into a command to accelerate or decelerate the inertial balance flywheel, and then output to the main motor and the balance motor through the drive circuit.
[0096] After the control is executed, the main controller updates the adaptive adjustment module. This module reads the control effect of this cycle, such as Whether it stably tracks And the convergence of the speed error. If it is found that some error terms are too large in several consecutive cycles, or the system shows an oscillation trend, the parameter adjustment algorithm is triggered. For example, in this embodiment, when it is detected that the inner loop tilt control has underdamped oscillations, the system calls the tuning rule to slightly increase Kd2 (tilt PID differential gain) to increase the damping; when it is found that the vehicle responds slowly to the outer loop speed command and there is no overshoot, Kp1 can be appropriately increased to enhance the speed following performance. This adjustment amplitude is set to be small and the frequency is limited to ensure that the parameter change will not damage the system stability. At the same time, all parameter adjustments and the corresponding environmental states will be recorded as data for future improvement of the control strategy. After running for a period of time, the parameters will gradually approach the optimal value, thereby globally improving the control performance.
[0097] In this embodiment, the vehicle control achieved by the above method is manifested as follows: when a new forward speed command is given, the vehicle will lean forward slightly to accelerate, and then return to the upright position to maintain after reaching the target speed; when braking or reversing is required, the vehicle will lean backward to generate a braking torque; regardless of acceleration or deceleration, the vehicle body always swings slightly around the vertical posture, and the riding platform remains stable. Laterally, when the vehicle is going straight, any slight roll deviation is corrected by the fine adjustment of the inertial balance flywheel. When turning is required, the vehicle body tilts smoothly according to the calculated tilt angle and returns to the upright position after turning. When the load suddenly changes (for example, adding a heavy object on the top), the adaptive module of the controller will automatically adjust the tilt zero point and the PID gain, and the driver can hardly perceive obvious imbalance or control lag. When multiple vehicles operate in coordination, the controller of each vehicle shares its own state and position through the communication module. When it is found that another vehicle is approaching, it will automatically decelerate and deflect to avoid, and the relevant data is synchronously recorded on the blockchain to ensure traceability afterwards.
[0098] Embodiment 3
[0099] This embodiment describes an application scenario of the present invention in autonomous inspection in a hazardous environment. The inspection unicycle robot needs to move autonomously in an industrial facility with narrow passages and obstacles and regularly upload inspection data. After adopting the control system of the present invention, the robot can give full play to its advantages of being small and flexible while ensuring stability and data security. During the inspection route, the robot needs to start and stop frequently and bypass obstacles. This poses high requirements for balance control: every time it stops, it means a rapid transition from the driving state to the static balance state; bypassing obstacles requires turning around within a limited space. The cascade PID control of the present invention combined with the flywheel balance mechanism ensures that the robot does not fall forward or backward when stopping suddenly but stops steadily. When turning, the robot calculates an appropriate lateral tilt angle φref and cooperates with the forward speed to smoothly turn within a very small radius. The flywheel reaction torque is used to quickly adjust the attitude to avoid hitting the wall. During the whole process, the multi-sensor fusion module maintains an accurate estimation of the attitude. Even when the magnetometer fails due to the metal environment, the gyroscope and accelerometer can still be relied on to maintain heading calculation for a short time. The fault detection module immediately notifies the controller to switch to the single-probe mode and reduces the vehicle speed to compensate for the halved field of view after detecting an abnormality in one ultrasonic sensor. All inspection data (including the driving trajectory, environmental measurement values, abnormal alarms, etc.) are uploaded in real time through the blockchain network, ensuring that the data cannot be tampered with and can be instantly viewed by remote monitoring personnel. After the inspection is completed and the robot returns to the base, the system generates a blockchain data report for this mission, including the driving mileage, balance status log, the number of alarms occurred, etc., providing a basis for equipment maintenance. It can be seen that the control system of the present invention improves the reliability, safety, and data credibility of the unicycle robot in the application of hazardous environment inspection.
[0100] The above are only the preferred embodiments of the present invention. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can still be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A self-balancing unicycle vehicle control system based on cascade PID and multi-sensor fusion, characterized in that, Comprising: A main drive module for driving the single wheel provided on the vehicle to achieve forward and backward movement; An inertial balance flywheel module, which includes an inertial balance flywheel and its drive mechanism, for adjusting the lateral inclination angle of the vehicle by generating a lateral reaction torque through the rotation of the inertial balance flywheel; A multi-sensor module, including an inertial measurement unit, a magnetometer, a wheel encoder, and an environmental sensor, for collecting the inclination angle, angular velocity, heading, speed, and environmental information of the vehicle; A main controller, electrically connected to the multi-sensor module, the main drive module, the inertial balance flywheel module, and the communication module, for performing data fusion, cascade PID control, adaptive parameter adjustment, fault detection, and data recording and verification in real time; A lateral control module, provided inside the main controller or working in cooperation with it, the lateral control module is used to calculate the target lateral inclination angle according to the lateral state and steering requirements of the vehicle, and convert the target lateral inclination angle into a control command for the balance flywheel; A communication module for realizing wireless data communication between the vehicle and an external monitoring platform or other vehicles, and recording and verifying the real-time attitude and motion control data of the vehicle through blockchain technology; A power supply module for providing a stable DC power supply for each module of the system; The cascade PID control implemented by the main controller includes an outer loop and an inner loop. The outer loop PID control takes the error ev = vref - v between the vehicle target speed vref and the actual speed v as the input, and outputs the target longitudinal inclination angle. Its control law is: ; Among them, , and are the proportional, integral, and derivative control gains of the outer-loop PID respectively, represents the target longitudinal inclination angle at time t, represents the error between the target vehicle speed and the actual speed at time t, represents the error between the target vehicle speed and the actual speed at time which also represents time and is used as the integration variable inside the integral sign; The inner-loop PID control takes the error between the actual longitudinal inclination angle obtained by fusing with the sensor as the input and outputs the torque command for driving the wheel motor , and its control law is: ; Among them, , and are the proportional, integral, and derivative control gains of the inner-loop PID respectively, represents the error between the target longitudinal inclination angle and the actual longitudinal inclination angle at time t, represents the error between the target longitudinal inclination angle and the actual longitudinal inclination angle at time The main controller further includes an adaptive parameter tuning module for monitoring control performance indicators , and automatically adjusting the PID control gain according to the indicator to achieve the purpose of optimizing control response and stability, where is the change rate of the wheel output torque, and w1, w2, and w3 are preset weight coefficients.
2. The self-balancing unicycle vehicle control system based on cascade PID and multi-sensor fusion according to claim 1, characterized in that, In the multi-sensor module, the inertial measurement unit includes a three-axis gyroscope and a three-axis accelerometer. The collected data is used to estimate the longitudinal inclination angle, lateral inclination angle, and heading angle of the vehicle in real time after data fusion.
3. The self-balancing unicycle vehicle control system based on cascade PID and multi-sensor fusion according to claim 2, wherein, The data fusion implemented by the main controller adopts an adaptive complementary filtering algorithm, and its filtering formula is: ; wherein, is the estimated longitudinal vehicle inclination angle at the k-th moment, is the angular velocity of the three-axis gyroscope on the lateral axis, is the sampling period, is the inclination angle calculated based on the measurement of the three-axis accelerometer, is the filtering gain adaptively adjusted according to the vehicle motion state.
4. A self-balancing unicycle vehicle control system based on cascade PID and multi-sensor fusion according to claim 1, characterized in that, The main controller also includes a fault detection module for real-time monitoring of the data of each sensor and the output state of the driver. When data anomalies or deviations from the predetermined range are detected, redundant or backup control strategies are automatically enabled to ensure the continuous and stable operation of the system.
5. A self-balancing unicycle vehicle control system based on cascade PID and multi-sensor fusion according to claim 1, characterized in that, The communication module uses blockchain technology to generate a data digest of the key data during the vehicle operation process, and combines the time stamp and hash verification to record the data chain, ensuring the immutability and traceability of the data during the transmission and storage processes.
6. A self-balancing unicycle vehicle control system based on cascade PID and multi-sensor fusion according to claim 1, characterized in that, The lateral control module combines the vehicle driving state and steering command to calculate the target lateral inclination angle φref, and converts the target lateral inclination angle into a control command τf for the inertial balance flywheel to drive the inertial balance flywheel module to adjust the vehicle lateral balance and assist in steering.
7. A self-balancing unicycle vehicle control method based on cascade PID and multi-sensor fusion, characterized in that, Applied to a self-balancing unicycle control system based on cascade PID and multi-sensor fusion as described in any one of claims 1-6, including the following steps: S1. After the vehicle is powered on, the main controller calibrates the multi-sensor module to determine the initial attitude of the vehicle; S2. Periodically collect the original data of each sensor, and fuse the data through an adaptive complementary filtering or extended Kalman filtering method to obtain the actual longitudinal inclination angle θ, lateral inclination angle φ, heading angle ψ, and actual speed v of the vehicle; S3. Calculate the target longitudinal tilt angle according to the error ev between the target vehicle speed vref and the actual speed v , taking the error between and the actual longitudinal tilt angle θ as the input, calculate the torque command of the drive motor . At the same time, according to the lateral state and steering requirements of the vehicle, the lateral control module calculates the target lateral tilt angle φref and converts it into the control command of the inertial balance flywheel; S4. Output the calculated torque command and control command to the main drive module and the inertial balance flywheel module respectively to achieve vehicle attitude adjustment and motion control; S5. Perform adaptive tuning of the PID parameters based on the feedback from the real-time monitoring system, and enable redundant or backup control strategies when anomalies are detected; S6. Upload the real-time attitude and motion control data of the vehicle through the communication module, and use blockchain technology to record the data in an immutable manner; S7. Repeat steps S2 to S6 to achieve closed-loop control of vehicle self-balancing and motion.
Citation Information
Patent Citations
Balance car system measurement and control method based on camera pavement detection
CN107340298A
Unmanned bicycle self-balancing control method based on LQR and Kalman filtering
CN118131633A