Self-balancing bicycle software control method and system capable of realizing zero sample migration

By employing a deep reinforcement learning method with large-scale domain randomization training in a simulation environment, the simulation-reality gap problem of self-balancing bicycle software control methods on real hardware is solved, achieving efficient and low-cost zero-shot transfer deployment and improving the robustness and development efficiency of bicycle control.

CN121894087APending Publication Date: 2026-04-21SUN YAT SEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SUN YAT SEN UNIV
Filing Date
2026-03-03
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

Existing software control methods for self-balancing bicycles suffer from problems such as a simulation-reality gap, poor robustness, and low development efficiency, making them difficult to successfully apply on real hardware.

Method used

A deep reinforcement learning method with large-scale domain randomization is adopted to train a self-balancing neural controller in a simulation environment. By randomizing parameters and environment on a large scale, the neural network is forced to learn to adapt to various uncertainties, thus achieving zero-shot transfer deployment.

Benefits of technology

It achieves zero-sample transfer of control strategies, shortens the development cycle from months to hours, reduces R&D costs and technical barriers, and provides a high-performance and lightweight software control system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121894087A_ABST
    Figure CN121894087A_ABST
Patent Text Reader

Abstract

The invention discloses a self-balancing bicycle software control method and system capable of achieving zero sample migration. The method comprises the steps that bicycle body posture information of a self-balancing bicycle and a motion instruction from the outside are obtained in real time; the trained self-balancing neural controller receives vehicle body attitude information, a motion instruction, a current steering motor position fed back by a control layer and a vehicle body linear speed, forward reasoning calculation is carried out once, and a neural network directly outputs two control variables including a target steering angle instruction and a driving accelerator instruction; generating a steering control signal based on the target steering angle instruction according to a servo motor communication protocol, wherein the steering control signal is used for driving a steering servo motor to accurately rotate to a target angle; based on the accelerator driving instruction, the accelerator driving instruction is converted into an accelerator control command for the hub brushless motor, and the accelerator control command adjusts the forward speed of the vehicle. The technical problems of simulation-reality gaps, poor robustness and low development efficiency of existing self-balancing bicycle control are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of self-balancing bicycle control technology, specifically to a software control method and system for a self-balancing bicycle with zero-sample transfer capability. Background Technology

[0002] Bicycles are a typical dynamic nonholonomic constraint system. Their center of gravity is relatively high, and unlike four-wheeled vehicles, they lack a stable chassis support, making them inherently unstable and unable to maintain balance on their own. Therefore, active intervention from an external controller is required to adjust the handlebars, wheels, and other actuators, thereby achieving self-balancing and steering control of the bicycle.

[0003] While existing control methods have demonstrated feasibility in theory and simulation, they suffer from profound and insurmountable inherent defects in the process of deploying them from ideal to reality, resulting in poor robustness, high development costs, and difficulty in successful application on ordinary hardware.

[0004] 1. Traditional control methods all rely on an idealized assumption, which cannot adapt to the complexity of the real world.

[0005] Model dependency and model mismatch: Methods such as LQR and MPC rely entirely on a precise mathematical model for performance. However, the dynamics of a real bicycle are extremely complex, with factors such as the nonlinear interaction between the tires and the ground, the flexible deformation of the frame, and air resistance being difficult to model accurately. Therefore, controllers based on idealized or linearized models will experience a sharp decline in performance or even complete failure when dealing with real, uncertain physical systems.

[0006] Difficult parameter tuning and poor adaptability: Although PID control does not directly rely on complex models, its three parameters, P, I, and D, require extensive, tedious, repetitive, and risky physical adjustments by experienced engineers for a specific bicycle under specific operating conditions. Once the vehicle's load, speed, or road surface changes, these fixed parameters become ineffective, leading to a deterioration in control performance. Fuzzy control also suffers from the problem of its rule base design relying on expert experience and being difficult to perfect.

[0007] Physical manifestation of theoretical defects: Although sliding mode control is theoretically robust, its inherent high-frequency "chattering" characteristics can cause huge impacts on actuators such as motors when applied to physical systems, making it difficult to operate stably in practice.

[0008] 2. The "simulation-to-real gap" is a bottleneck that current technologies struggle to overcome.

[0009] This is a concentrated manifestation of all the aforementioned shortcomings. The existing software development process is typically "simulation design - real-world deployment," but in practice, this process is fragmented. A controller that performs exceptionally well in a "clean" and perfectly modeled simulation environment will almost inevitably fail once deployed to real hardware filled with unknown physical parameters, sensor noise, actuator latency, communication delays, and complex environmental interference. The lack of a systematic and reliable software approach in current technology to proactively bridge this gap makes it difficult to directly translate simulation results into practical applications.

[0010] 3. Outdated development paradigms lead to low R&D efficiency and high costs.

[0011] Due to the existence of the "simulation-reality gap," the development process of existing technologies inevitably degenerates into endless manual "trial and error" on expensive physical prototypes. Whether adjusting PID parameters or correcting MPC models, a lot of on-site debugging is required, which not only takes weeks or even months, but also requires professional engineers and expensive experimental equipment, making the R&D threshold and cost of high-performance control systems remain high. Summary of the Invention

[0012] The purpose of this invention is to overcome the above-mentioned technical deficiencies and provide a software control method and system for self-balancing bicycles with zero-sample transfer capability, thereby solving the technical problems of "simulation-reality gap", poor robustness and low development efficiency in existing self-balancing bicycle software control methods.

[0013] To achieve the above-mentioned technical objectives, in a first aspect, the present invention provides a software control method for a self-balancing bicycle with zero-sample transfer capability, comprising:

[0014] It can acquire the posture information of the self-balancing bicycle and the motion commands from the outside in real time.

[0015] The trained self-balancing neural controller receives vehicle posture information and motion commands, as well as the current steering motor position and vehicle linear velocity from the control layer. It performs a forward inference calculation, and the neural network directly outputs two control variables: the target steering angle command and the drive throttle command.

[0016] Based on the target steering angle command and according to the servo motor communication protocol, a steering control signal is generated. The steering control signal is used to drive the steering servo motor to rotate precisely to the target angle.

[0017] Based on the drive throttle command, it is converted into a throttle control command for the hub brushless motor, and the throttle control command adjusts the vehicle's forward speed.

[0018] Secondly, the technical solution of the present invention provides a self-balancing bicycle software control system with zero-sample transfer capability, comprising:

[0019] The input layer is used to acquire the vehicle posture information of the self-balancing bicycle and motion commands from the outside in real time.

[0020] The decision layer, which is communicatively connected to the input layer, includes a trained self-balancing neural controller. The input to the decision layer is the vehicle posture information and motion command from the input layer, as well as the current steering motor position and vehicle linear velocity from the control layer. The self-balancing neural controller performs a forward inference calculation based on the input of the decision layer, and the neural network directly outputs two control variables: the target steering angle command and the drive throttle command.

[0021] The control layer, which is communicatively connected to the decision layer, includes:

[0022] The servo motor control process receives the target steering angle command and generates a steering control signal according to the servo motor communication protocol. The steering control signal is used to drive the steering servo motor to rotate precisely to the target angle.

[0023] The brushless motor control process receives the drive throttle command and converts it into a throttle control command for the hub brushless motor, which adjusts the vehicle's forward speed.

[0024] Compared with the prior art, the beneficial effects of the present invention include:

[0025] 1. Solved the problem of the "simulation-reality gap" and achieved "zero-sample" migration and deployment of control strategies.

[0026] The core of this invention is an innovative software training method—Large-scale Domain Randomization. Instead of attempting to precisely simulate the real world, this method takes the opposite approach, creating a far more diverse and uncertain "meta-universe" within the simulation environment. During training, this method performs large-scale randomization on all parameters that may affect the bicycle's dynamics, including but not limited to: dynamic parameters such as the vehicle's mass, center of gravity, dimensions, and friction; sensor characteristics such as IMU noise and drift; actuator characteristics such as motor response delay and torque limitations; and external terrain conditions such as slopes and bumps.

[0027] By training with deep reinforcement learning in such an extremely diverse environment, the neural network controller is forced to abandon its dependence on any single model and instead learn a universal, intrinsic, and highly adaptable dynamic equilibrium law to various uncertainties. Therefore, when this trained software strategy is deployed on any specific physical bicycle with unknown parameters, the real world is merely a typical special case among countless random instances it has already "seen" in simulation training. This fundamentally bridges the gap between simulation and reality, achieving successful "zero-shot" migration and deployment without any code modification or parameter fine-tuning.

[0028] 2. It revolutionized the development paradigm of control software, reducing the development cycle from months to hours.

[0029] This invention proposes a novel software development paradigm of "full offline training and direct online deployment." All complex and time-consuming algorithm iterations and optimizations are completed automatically offline within the simulation environment. This completely eliminates the high-risk, high-cost, and long-cycle manual parameter tuning process on physical prototypes, which relies on expert experience in traditional methods. This improves the development efficiency of control systems by several orders of magnitude and significantly reduces R&D costs and technical barriers.

[0030] 3. It provides a complete, high-performance, and lightweight software control system, resolving the contradiction between high performance and low-cost deployment.

[0031] The final output of this invention is a concrete and efficient software system. The system architecture includes:

[0032] (1) Input layer: responsible for acquiring vehicle body attitude information provided by IMU and motion commands from the outside in real time.

[0033] (2) Policy layer: Its core is a lightweight neural network controller trained by domain randomization.

[0034] (3) Output layer: responsible for sending the calculation results of the neural network to the underlying motor controller.

[0035] The key advantage of this software system lies in the fact that its core neural network model, after offline training, requires minimal computation during online execution, enabling millisecond-level real-time response on any low-cost, low-power embedded computing board (such as ESP32, Raspberry Pi, Jetson boards, etc.). This completely solves the problem that traditional high-performance algorithms, represented by MPC, are difficult to deploy on low-cost hardware due to their excessively high computing power requirements, achieving the ideal effect of running high-performance self-balancing control software on any hardware platform.

[0036] According to some embodiments of the present invention, the posture information of the self-balancing bicycle includes: lateral tilt angle and lateral angular velocity; the external motion commands include: linear velocity command and steering command.

[0037] According to some embodiments of the present invention, the input layer includes a digital filter and an IMU module mounted on the bicycle frame. The IMU module includes an accelerometer and a gyroscope. The accelerometer is used to collect triaxial acceleration data, and the gyroscope is used to collect angular velocity data. The digital filter is used to fuse the data from the accelerometer and the gyroscope to output stable and accurate lateral tilt angle and lateral angular velocity.

[0038] According to some embodiments of the present invention, the digital filter is a complementary filter or a Kalman filter.

[0039] According to some embodiments of the present invention, the training process of the self-balancing neural controller includes the following steps:

[0040] A digital twin model of a bicycle is constructed in a physical simulation environment. The digital twin model is a parameterized model that can be randomized on a large scale. All key physical properties that affect the dynamic behavior of the bicycle are designed as programmable and randomizable physical parameters.

[0041] Using a proximal policy optimization algorithm, a self-balancing neural controller is trained in a simulation environment on a virtual bicycle digital twin model with a large-scale parallel domain randomized control policy.

[0042] The training process is guided by a multi-objective reward function, which includes a balance maintenance reward sub-function, an instruction tracking reward sub-function, and a motion smoothness penalty, resulting in a trained self-balancing neural controller.

[0043] According to some embodiments of the present invention, after obtaining the trained self-balancing neural controller, the method further includes the following steps:

[0044] Real-vehicle deployment and verification of self-balancing and steering control strategies:

[0045] The trained single neural network model file of the self-balancing neural controller is directly copied and loaded into the strategy layer of the software system running on the embedded board of a real bicycle.

[0046] The self-balancing control of the bicycle was verified using a software system running on an embedded board on a real bicycle.

[0047] According to some embodiments of the present invention, training a control policy with large-scale parallel domain randomization includes the following steps:

[0048] Dynamics parameter randomization: Randomize all the physical parameters defined so that the controller is independent of any specific vehicle model;

[0049] State and instruction randomization: Randomize the bicycle's initial speed and posture, as well as the target speed and steering instructions, to improve the generalization ability of the strategy;

[0050] Sensor and actuator randomization: Randomize the noise, bias, and drift of IMU sensors in the simulation; randomize the response delay, torque dead zone, and maximum output limit of motor steering and drive;

[0051] Environment randomization: Allow bicycles to train on virtual terrain such as flat ground, slopes of varying gradients, and bumpy roads.

[0052] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0053] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, wherein the abstract drawings are to be completely consistent with one of the drawings in the specification:

[0054] Figure 1 A flowchart illustrating the overall process of a software control method for a self-balancing bicycle with zero-sample transfer capability, as provided in an embodiment of the present invention.

[0055] Figure 2 A control software architecture diagram of a zero-sample transfer-enabled self-balancing bicycle software control method provided in an embodiment of the present invention;

[0056] Figure 3 The image shows a real vehicle test result provided for one embodiment of the present invention. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.

[0058] It should be noted that although functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0059] Reference Figures 1 to 3 , Figure 1 A flowchart illustrating the overall process of a software control method for a self-balancing bicycle with zero-sample transfer capability, as provided in an embodiment of the present invention. Figure 2 A control software architecture diagram of a zero-sample transfer-enabled self-balancing bicycle software control method provided in an embodiment of the present invention; Figure 3 The image shows a real vehicle test result provided for one embodiment of the present invention.

[0060] In one embodiment, the zero-sample transferable software control method for a self-balancing bicycle includes: acquiring the bicycle's posture information and motion commands from external sources in real time; receiving the bicycle's posture information and motion commands, as well as the current steering motor position and bicycle linear velocity fed back from the control layer, a trained self-balancing neural controller performs a forward inference calculation, and the neural network directly outputs two control variables: a target steering angle command and a drive throttle command; generating a steering control signal based on the target steering angle command and according to the servo motor communication protocol, the steering control signal being used to drive the steering servo motor to precisely rotate to the target angle; and converting the drive throttle command into a throttle control command for the hub brushless motor, the throttle control command adjusting the vehicle's forward speed.

[0061] In one embodiment, a zero-sample transfer-capable self-balancing bicycle software control system includes: an input layer for real-time acquisition of the bicycle's posture information and motion commands from external sources; a decision layer, communicatively connected to the input layer, including a trained self-balancing neural controller, wherein the decision layer receives the bicycle posture information and motion commands from the input layer, as well as the current steering motor position and bicycle linear velocity fed back from the control layer; the self-balancing neural controller performs a forward inference calculation based on the input from the decision layer, and the neural network directly outputs two control variables: a target steering angle command and a drive throttle command; and a control layer, communicatively connected to the decision layer, including: a servo motor control process that receives the target steering angle command and generates a steering control signal according to a servo motor communication protocol, the steering control signal being used to drive the steering servo motor to precisely rotate to the target angle; and a brushless motor control process that receives the drive throttle command and converts it into a throttle control command for the hub brushless motor, the throttle control command adjusting the vehicle's forward speed.

[0062] This invention proposes a software control method and system for a self-balancing bicycle with zero-sample transfer capability. Its core lies in solving the huge gap in the transfer of traditional control methods from simulation to real-world applications through a new paradigm of "sufficient offline training and direct online deployment".

[0063] 1. Bicycle Physical Simulation Modeling and Parameter Setting: To achieve rapid, safe, and low-cost iteration of control strategies, this method first constructs a "digital twin" model of the bicycle in a physical simulation environment (such as NVIDIA Isaac Sim). The key objective of this step is not to pursue absolute accuracy of a single model, but to create a parameterized model that can be stochastically applied on a large scale. This model structurally reproduces the core rigid body components of the bicycle and their joint relationships. The core rigid body components include: the frame, handlebars, and front and rear wheels. All key physical properties affecting the bicycle's dynamic behavior are designed as programmable, stochastic variables, rather than fixed constants. These parameters include, but are not limited to: the mass, inertia tensor, and center of mass position of each component of the frame; the radius and friction coefficient of the front and rear wheels; and the geometric parameters of the frame, such as wheelbase, fork loft angle, and front wheel wake.

[0064] By parameterizing the physical model, this method fundamentally eliminates the over-reliance on a single, precise model in traditional control methods. This lays the software foundation for subsequent domain randomization training, enabling the controller to learn to adapt to model uncertainties.

[0065] 2. Domain randomization and control strategy reinforcement learning training for bicycle and steering tasks.

[0066] This step is the core methodology that enables the "zero-sample transfer" of this invention. In this stage, we employ deep reinforcement learning algorithms to train the control strategy of a virtual bicycle agent in a large-scale parallel environment.

[0067] The key to successful training lies in the introduction of a large-scale "domain randomization" strategy. This strategy, at the start of each training iteration, randomly selects a completely new set of parameters from an extremely wide range to configure the simulation environment, proactively creating a training scenario in the simulation that is more diverse and uncertain than the real world. The scope of randomization covers all factors that may lead to the "simulation-reality gap":

[0068] (1) Randomization of dynamic parameters: Randomize all physical parameters defined in the previous step so that the controller is independent of any specific vehicle model.

[0069] (2) Randomization of state and command: Randomize the initial speed and attitude of the vehicle, as well as the target speed and steering command issued, to improve the generalization ability of the strategy.

[0070] (3) Sensor and actuator randomization: simulate the noise, bias and drift of IMU sensors in the simulation; simulate the response delay, torque dead zone and maximum output limit of motor.

[0071] (4) Environment randomization: The bicycle is trained on various virtual terrains such as flat ground, slopes with different inclines, and bumpy roads.

[0072] By learning in such an extremely diverse environment, the neural network controller is forced to abandon the "shortcut" of learning for any specific model and instead master a more fundamental, universal, and highly robust dynamic equilibrium and steering control law that is robust to all kinds of uncertainties.

[0073] The training process is guided by a multi-objective reward function that quantifies the complex control task into explicit optimization objectives:

[0074] (1) Balance maintenance reward: As long as the bicycle does not fall over, a positive reward is continuously given.

[0075] (2) Instruction tracking reward: Rewards are given based on the degree of matching between the vehicle's actual speed and heading and the instructions to encourage precise execution.

[0076] (3) Action smoothness penalty: negative rewards are given for excessive or fast steering and acceleration actions to encourage the controller to learn a smooth, efficient and human-like control mode.

[0077] The final output of this step is a fully trained, single, lightweight neural network model file that encapsulates all the learned control knowledge and forms the core of the subsequent software system.

[0078] 3. Design of self-balancing bicycle control software with zero-sample transfer capability.

[0079] This step involves designing a real-time software system that runs on a real bicycle embedded computing board and hosts a neural network model. The system employs a layered architecture, such as... Figure 2 As shown, this ensures a clear data flow and modular functionality.

[0080] (1) Input layer: This layer is responsible for obtaining raw data from the physical world and preprocessing it.

[0081] Command input: Receives "linear speed and steering commands" from the remote control or the upper-level autonomous navigation module via wireless communication.

[0082] State awareness: Real-time reading of triaxial acceleration and angular velocity data from an IMU module mounted on the vehicle body. Since the raw sensor data contains noise, the software integrates a digital filter to fuse the accelerometer and gyroscope data, thereby outputting stable and accurate "tilt angle" and "lateral angular velocity" as effective state feedback.

[0083] (2) Decision layer: This layer is the "brain" of the entire software system, and its core is only the "self-balancing neural controller" trained in step 2.

[0084] Input: The neural network receives "lateral tilt angle", "lateral angular velocity", "linear velocity and steering command" from the input layer, and also receives the current "steering motor position" and "vehicle linear velocity" from the control layer, forming a complete input vector containing the target, state and feedback.

[0085] Output: After one forward inference calculation, the neural network directly outputs two control variables: the target "steering angle" and the drive "throttle".

[0086] (3) Control layer: This layer serves as the hardware abstraction layer and is responsible for translating the logical instructions output by the strategy layer into electrical signals that can be executed by the underlying hardware.

[0087] Servo motor control process: Receives the "steering angle" command and generates control signals according to the servo motor communication protocol to drive the "steering servo motor" to rotate precisely to the target position.

[0088] Brushless motor control process: Receives the "throttle" command and converts it into a control command for the FOC driver of the "hubless motor in the wheel hub" to adjust the vehicle's forward speed.

[0089] 4. Real-vehicle deployment and verification of self-balancing and steering control strategies

[0090] This step is the final verification of the "zero-sample migration" effect of the present invention, demonstrating its fundamental difference from traditional methods.

[0091] The deployment process is extremely simple: the single neural network model file generated from the training is directly copied and loaded into the strategy layer of the software system running on the embedded board of a real bicycle. The entire process requires no modification to the model or code, nor any tedious parameter tuning or secondary training on the actual bicycle.

[0092] Once deployed, the software system forms a high-speed, real-time closed loop on the actual hardware:

[0093] The IMU senses the vehicle's attitude, and the data is filtered by the input layer before being sent to the strategy layer.

[0094] The neural network controller performs a forward inference and outputs a control decision, with a measured latency of approximately 1ms on a low-cost embedded board. The control layer immediately translates the decision into motor action. The "perception-decision-execution" loop runs continuously at an extremely high frequency, thereby responding quickly to various disturbances and achieving robust self-balancing and steering control.

[0095] Ultimately, through this "simulation training-direct deployment" process, the present invention successfully and seamlessly transferred the high-performance control strategy obtained in simulation to a real low-cost bicycle with unknown physical parameters and full of uncertainties, fundamentally solving the "simulation-reality gap" bottleneck faced by existing technologies.

[0096] This invention employs a large-scale "domain randomization" training method in simulation, resulting in a neural network controller with extremely high robustness and environmental generalization ability. It treats uncertainties in the real world, such as unknown physical parameters, sensor noise, and actuator delays, as just one of countless random instances that it has already learned and adapted to during the simulation training phase. Therefore, when this trained strategy is deployed to the software system designed in this invention, it can achieve "zero-shot" transfer without any code modification, secondary compilation, or parameter fine-tuning on a real vehicle. Stable and reliable control performance is directly obtained on the physical hardware, fundamentally solving the deployment failure problem caused by model mismatch in traditional methods.

[0097] The three-layer software architecture proposed in this invention—input layer, policy layer, and control layer—provides crucial assurance for achieving robust real-time control. This framework clearly decouples data preprocessing, policy decision-making, and hardware driving. The policy layer, as the core, has a stable interface and a single function, specifically designed for loading and executing pre-trained neural network models. This design results in extremely short inference paths throughout the software system, efficient data flow between layers, and ultimately, millisecond-level end-to-end control latency on low-cost embedded hardware. This software architecture is not only a "running container" for policies, but its high efficiency and real-time performance are also the foundation for the stable reproduction of high-performance control effects in the physical world, successfully resolving the contradiction that traditional high-performance algorithms, such as MPC, are difficult to deploy on low-cost hardware due to their high computational requirements.

[0098] This invention represents a novel software development paradigm of "full offline training and direct online deployment," revolutionizing the development process of traditional control systems. It completely replaces the most expensive, time-consuming, and expert-experience-dependent step in traditional methods—manual parameter tuning on physical prototypes—with large-scale, automated offline parallel computing. All algorithm iterations and strategy optimizations are efficiently completed in a simulation environment. This not only shortens the physical debugging cycle, which could previously take weeks or even months, to hours of offline computing, but also significantly reduces reliance on expensive testing equipment and professional debugging personnel, thus revolutionarily lowering the development threshold and overall cost of high-performance control systems.

[0099] The self-balancing bicycle's posture information includes: lateral tilt angle and lateral angular velocity; external motion commands include: linear velocity command and steering command.

[0100] The input layer includes a digital filter and an IMU module mounted on the bicycle frame. The IMU module includes an accelerometer and a gyroscope. The accelerometer is used to collect triaxial acceleration data, and the gyroscope is used to collect angular velocity data. The digital filter fuses the data from the accelerometer and gyroscope to output stable and accurate lateral tilt angle and lateral angular velocity. The digital filter is either a complementary filter or a Kalman filter.

[0101] Furthermore, the training process of the self-balancing neural controller includes the following steps: constructing a digital twin model of a bicycle in a physical simulation environment, wherein the digital twin model is a parameterized model that can be massively randomized, and all key physical attributes affecting the dynamic behavior of the bicycle are designed as programmable, randomized physical parameters; using a proximal policy optimization algorithm, the self-balancing neural controller performs large-scale parallel domain randomized control policy training on a virtual bicycle digital twin model in the simulation environment; the training process is guided by a multi-objective reward function, which includes: a balance maintenance reward sub-function, an instruction tracking reward sub-function, and a motion smoothness penalty, to obtain the trained self-balancing neural controller.

[0102] Furthermore, after obtaining the trained self-balancing neural controller, the process includes the following steps: real-vehicle deployment verification of the self-balancing and steering control strategy: directly copying and loading the single neural network model file of the trained self-balancing neural controller into the strategy layer of the software system running on the embedded board of a real bicycle; and using the software system running on the embedded board of a real bicycle to verify the self-balancing control of the bicycle.

[0103] The training of the control strategy using large-scale parallel domain randomization includes the following steps: randomization of dynamic parameters: randomizing all defined physical parameters so that the controller is independent of any specific vehicle model; randomization of state and command: randomizing the bicycle's initial speed, attitude, and the issued target speed and steering commands to improve the generalization ability of the strategy; randomization of sensors and actuators: randomizing the noise, bias, and drift of the IMU sensors in the simulation; randomizing the response delay, torque dead zone, and maximum output limit of the motor steering and drive; and randomization of the environment: training the bicycle on virtual terrain such as flat ground, slopes of different gradients, and bumpy roads.

[0104] Furthermore, one embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions that are executed by a processor or controller, for example, by a processor in the above-described terminal embodiment, such that the processor performs the zero-sample transferable self-balancing bicycle software control method described in the above-described embodiment.

[0105] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0106] The above is a detailed description of the preferred embodiments of the present invention. However, the present invention is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention. All such equivalent modifications or substitutions are included within the scope defined by the claims of the present invention.

[0107] The specific embodiments of the present invention described above do not constitute a limitation on the scope of protection of the present invention. Any other corresponding changes and modifications made in accordance with the technical concept of the present invention should be included within the scope of protection of the claims of the present invention.

Claims

1. A software control method for a self-balancing bicycle with zero-sample transfer capability, characterized in that, include: It can acquire the posture information of the self-balancing bicycle and the motion commands from the outside in real time. The trained self-balancing neural controller receives vehicle posture information and motion commands, as well as the current steering motor position and vehicle linear velocity from the control layer. It performs a forward inference calculation, and the neural network directly outputs two control variables: the target steering angle command and the drive throttle command. Based on the target steering angle command and according to the servo motor communication protocol, a steering control signal is generated. The steering control signal is used to drive the steering servo motor to rotate precisely to the target angle. Based on the drive throttle command, it is converted into a throttle control command for the hub brushless motor, and the throttle control command adjusts the vehicle's forward speed.

2. A software control system for a self-balancing bicycle with zero-sample transfer capability, characterized in that, include: The input layer is used to acquire the vehicle posture information of the self-balancing bicycle and motion commands from the outside in real time. The decision layer, which is communicatively connected to the input layer, includes a trained self-balancing neural controller. The input to the decision layer is the vehicle posture information and motion command from the input layer, as well as the current steering motor position and vehicle linear velocity from the control layer. The self-balancing neural controller performs a forward inference calculation based on the input of the decision layer, and the neural network directly outputs two control variables: the target steering angle command and the drive throttle command. The control layer, which is communicatively connected to the decision layer, includes: The servo motor control process receives the target steering angle command and generates a steering control signal according to the servo motor communication protocol. The steering control signal is used to drive the steering servo motor to rotate precisely to the target angle. The brushless motor control process receives the drive throttle command and converts it into a throttle control command for the hub brushless motor, which adjusts the vehicle's forward speed.

3. The zero-sample transferable self-balancing bicycle software control system according to claim 2, characterized in that, The input layer includes: The system includes a digital filter, an IMU module mounted on the bicycle frame, and an external command input device. The IMU module includes an accelerometer and a gyroscope. The accelerometer is used to collect triaxial acceleration data, and the gyroscope is used to collect angular velocity data. The digital filter is used to fuse the data from the accelerometer and gyroscope to output stable and accurate lateral tilt angle and lateral angular velocity.

4. The zero-sample transferable self-balancing bicycle software control system according to claim 3, characterized in that, The digital filter is either a complementary filter or a Kalman filter.

5. The zero-sample transferable self-balancing bicycle software control system according to claim 3, characterized in that, The external command input device includes: a handle or a keyboard.

6. The zero-sample transferable self-balancing bicycle software control system according to claim 2, characterized in that, The training process for a self-balancing neural controller includes the following steps: A digital twin model of a bicycle is constructed in a physical simulation environment. The digital twin model is a parameterized model that can be randomized on a large scale. All key physical properties that affect the dynamic behavior of the bicycle are designed as programmable and randomizable physical parameters. Using a proximal policy optimization algorithm, a self-balancing neural controller is trained in a simulation environment on a virtual bicycle digital twin model with a large-scale parallel domain randomized control policy. The training process is guided by a multi-objective reward function, which includes a balance maintenance reward sub-function, an instruction tracking reward sub-function, and a motion smoothness penalty, resulting in a trained self-balancing neural controller.

7. The zero-sample transferable self-balancing bicycle software control system according to claim 6, characterized in that, After obtaining the trained self-balancing neural controller, the following steps are also included: Real-vehicle deployment and verification of self-balancing and steering control strategies: The trained single neural network model file of the self-balancing neural controller is directly copied and loaded into the strategy layer of the software system running on the embedded board of a real bicycle. The self-balancing control of the bicycle was verified using a software system running on an embedded board on a real bicycle.

8. The zero-sample-transfer self-balancing bicycle software control system according to claim 4, characterized in that, Training a control policy using large-scale parallel domain randomization includes the following steps: Dynamics parameter randomization: Randomize all defined physical parameters so that the controller is independent of any specific vehicle model; State and instruction randomization: Randomize the bicycle's initial speed and posture, as well as the target speed and steering instructions, to improve the generalization ability of the strategy; Sensor and actuator randomization: Randomize the noise, bias, and drift of IMU sensors in the simulation; randomize the response delay, torque dead zone, and maximum output limit of motor steering and drive; Environment randomization: Allow bicycles to train on virtual terrain such as flat ground, slopes of varying gradients, and bumpy roads.

9. The zero-sample transferable self-balancing bicycle software control system according to claim 2, characterized in that, The posture information of a self-balancing bicycle includes: lateral tilt angle and lateral angular velocity; external motion commands include: linear velocity command and steering command.