Spherical robot control method and device based on mini-host and single-chip microcomputer

By using a mini-host to communicate with a microcontroller via serial port, combined with a gravity pendulum and flywheel device, and utilizing the model predictive control algorithm of the mini-host, the problem of the microcontroller's inability to achieve smooth control of a spherical robot was solved, thus realizing predictive motion control of the spherical robot.

CN120909275APending Publication Date: 2025-11-07林丽雯
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411509299.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-11-07

AI Technical Summary

Technical Problem

In existing technologies, single-chip microcomputers lack efficient central processing units (CPUs), making it impossible to implement model predictive control algorithms, resulting in unstable and unreliable motion of spherical robots.

Method used

By using a mini-host and a microcontroller for serial communication, combined with a gravity pendulum and flywheel device, the target deflection angle of the gravity pendulum is calculated using the model predictive control algorithm of the mini-host, and the motor movement is controlled through serial communication to achieve stable control of the spherical robot.

Benefits of technology

By combining the control of a miniature host computer and a microcontroller, predictive motion of the spherical robot was achieved, making its motion smoother and more controllable, thus overcoming the limitations of existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909275A_ABST
    Figure CN120909275A_ABST
Patent Text Reader

Abstract

The invention discloses a spherical robot control method and device based on a mini-host and a single chip microcomputer, and belongs to the technical field of spherical robot control. The spherical robot control device comprises the mini-host, an accelerometer, a gravity pendulum, a flywheel, a gravity pendulum motor, a flywheel motor, the single chip microcomputer, a CAN signal transmission line, a PS2 handle and a PS2 receiver, the system is used for straight movement control of the spherical robot, signal transmission between the accelerometer and the mini-host and receiving and transmitting of relevant parameters between the mini-host and the single chip microcomputer are achieved through serial port communication, the single chip microcomputer controls the gravity pendulum motor and the flywheel motor, and steering and straight movement of the spherical robot are achieved through conservation of rotational inertia. Finally, the required stable motion state is achieved, motion control over the spherical robot is achieved, motion control over the spherical robot under the actual condition is optimized through a model predictive control algorithm, and motion of the spherical robot is more stable and controllable.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application belongs to the technical field of spherical robot control, and particularly relates to a spherical robot control method and device based on a mini host and a single-chip microcomputer. BACKGROUND

[0002] In recent years, computer control and embedded systems have been widely applied in various engineering fields. Among them, computer control is a system in which a computer is applied to participate in control, auxiliary control objects and controlled objects are contacted to obtain a certain control purpose. The single-chip microcomputer, as a high-integration and powerful microcomputer, is widely used in various intelligent devices and control systems. The spherical robot is a robot with a spherical shell, which realizes linear motion through the rotation of the gravity pendulum inside the sphere and realizes steering through the rotation of the flywheel.

[0003] The existing robot control method mainly uses a single-chip microcomputer controller to receive and transmit signals to realize the motion of the robot. However, the single-chip microcomputer lacks an efficient central processing unit (CPU) and cannot implement model predictive control algorithm (MPC), which is not convenient for predictive control of the spherical robot, so that the motion of the spherical robot is more stable and reliable. With the development of the computer field, the mini host has become a new portable computer host. The mini host has the advantages of light weight, small size, space saving, portability and high-level central processing unit (CPU), which can be placed in the robot to replace the computer host to implement the model predictive control algorithm (MPC) and communicate with the single-chip microcomputer through the serial port. However, the prior art has not provided a method for fully utilizing the efficient central processing unit (CPU) of the mini host and its serial communication function to control the spherical robot.

[0004] Therefore, how to use the mini host and the single-chip microcomputer to realize serial communication joint control of the spherical robot to realize predictive control of its motion and make its motion more stable and controllable has become a problem to be studied. SUMMARY

[0005] The purpose of the present application is to solve the above-mentioned problems, and to provide a spherical robot control method and device based on a mini host and a single-chip microcomputer.

[0006] The technical solution adopted by the present application is as follows: a spherical robot control device based on a mini host and a single-chip microcomputer, the device comprising:

[0007] A gravity pendulum device utilizes the conservation of rotational inertia to control the straight motion of the spherical robot through the rotation of the gravity pendulum;

[0008] A flywheel device utilizes the conservation of rotational inertia to control the steering of the spherical robot through the accelerated rotation of the flywheel;

[0009] The spherical shell device is installed outside the spherical robot to serve as a shell, facilitating smooth rotation of the spherical robot.

[0010] The mini host module calculates the target deflection angle value of the gravity pendulum in real time through a model predictive control algorithm (MPC).

[0011] The STM32-based MicroPython single-chip module controls the rotation of the motor.

[0012] The CAN signal transmission line module is used to read various values of the motor through the electronic speed controller and convert the single-chip module signal into a CAN signal to send to the motor.

[0013] The PS2 handle and PS2 handle receiver module are used to switch between different motion modes of the spherical robot.

[0014] In a preferred embodiment, the gravity pendulum device is installed in the center of the spherical shell and connected to the spherical shell through a connecting rod, and the flywheel device is installed below the gravity pendulum device and connected to the gravity pendulum device through a connecting rod.

[0015] The gravity pendulum device and the flywheel device are controlled by a gravity pendulum motor and a flywheel motor. Both motors are connected to a distribution board through an electronic speed controller, and the distribution board is connected to the main power supply to power the motors. Meanwhile, the CAN signal transmission line is connected to the distribution board to send CAN signals to the gravity pendulum motor and the flywheel motor for control.

[0016] In a preferred embodiment, the gravity pendulum motor is installed on the connecting rod connecting the gravity pendulum to the spherical shell to control the rotation of the gravity pendulum.

[0017] In a preferred embodiment, the flywheel motor is installed on the connecting rod connecting the flywheel to the gravity pendulum to control the rotation of the flywheel. The mini host module is installed above the flywheel device and connected to the distribution board, powered by the main power supply.

[0018] In a preferred embodiment, the single-chip module is installed above the flywheel device, connected to the CAN signal transmission line through the distribution board, and connected to the PS2 receiver through serial communication for Bluetooth communication with the PS2 handle. The gravity pendulum motor and the flywheel motor are connected to the distribution board through the CAN distribution line, receive the CAN signals sent by the CAN signal transmission line, and rotate at a fixed angle or speed to realize the straight movement or turning movement of the spherical robot.

[0019] In a preferred embodiment, the control method of the spherical robot control device based on the mini host and the single-chip module includes the following steps:

[0020] S1: the accelerometer device performs initialization setting of the Bluetooth module; wherein the accelerometer Bluetooth receiving module is run on the mini host device, and the real-time deflection angle value of the gravity pendulum is obtained by analyzing the data packet sent by the accelerometer to the mini host in real time

[0021] S2: the CAN signal transmission line reads the rotation speed value of the gravity pendulum motor, and the motion angular velocity value of the spherical robot is calculated according to the reduction ratio of the motor and transmitted to the MicroPython single-chip microcomputer based on stm32;

[0022] S3: the MicroPython single-chip microcomputer based on stm32 receives the transmitted angular velocity value of the spherical robot and transmits the angular velocity value of the spherical robot to the mini host through serial communication;

[0023] S4: the mini host receives the angular velocity value of the spherical robot and the deflection angle value of the gravity pendulum, calculates the target deflection angle value of the gravity pendulum at the next time and the angle value that the gravity pendulum needs to deflect at the current time through the nonlinear constrained model prediction algorithm (MPC), and sends it to the MicroPython single-chip microcomputer based on stm32 through serial communication;

[0024] S5: the MicroPython single-chip microcomputer based on stm32 receives the deflection angle value of the gravity pendulum and sends it to the motor through the CAN signal transmission line to control the deflection of the gravity pendulum motor.

[0025] In a preferred embodiment, in step S4, the accelerometer reads the deflection angle value of the gravity pendulum at the current time, transmits the data packet to the mini host, the mini host analyzes the data packet transmitted by the accelerometer and obtains the deflection angle value of the gravity pendulum, at the same time, the mini host reads the initial angular velocity value of the spherical robot through the MicroPython single-chip microcomputer based on stm32 and the CAN signal transmission line and transmits the initial angular velocity value and the deflection angle value of the gravity pendulum to the MPC control algorithm.

[0026] In a preferred embodiment, in step S4, the model prediction algorithm (MPC) in the mini host discretizes the time parameter to predict the target deflection value of the gravity pendulum at the next time point, the time of signal transmission and the time required for the deflection of the gravity pendulum motor.

[0027] In a preferred embodiment, in step S4, the model prediction algorithm (MPC) in the mini host is based on the dynamics equation of the spherical robot,

[0028] Wherein, g is the value of gravity acceleration, m1 is the weight of the spherical shell, m2 is the weight of the gravity pendulum, R is the radius of the spherical shell, r is the radius of the flywheel, l is the length of the gravity pendulum, that is, the distance from the center of the sphere to the center of the flywheel, a is the deflection angle of the gravity pendulum relative to the vertical axis, b is the rotation angle value of the flywheel, q is the slope value of the spherical robot climbing, and f is the angle value of the rotation of the spherical robot shell, and The angular acceleration value of the spherical robot motion is

[0029] The dynamics equation of the spherical robot is converted into the state equation of the spherical robot motion,

[0030]

[0031] Wherein, And the variable u represents the variable that needs to be optimized in the model predictive control algorithm (MPC), which is the deflection angle a of the gravity pendulum, since m2, g, and l are known constants, a can be represented by m2glsin a in this algorithm;

[0032] The constraint condition is added to the model predictive control algorithm (MPC) running on the mini host, and the dynamics equation of the spherical robot is It can be known from the dynamics equation of the spherical robot that the deflection angle value f of the spherical shell needs to be between -90° and 90°, and the optimized variable m2glsin a can be calculated to be between -3.42 and 3.41.

[0033] In a preferred embodiment, the linearly constrained model predictive control algorithm (MPC) in step S4 is combined with the optimization of the actual spherical robot motion, including: defining the time interval, controlling the calculation of the model predictive control algorithm (MPC) once, leaving sufficient swing time for the motor and signal transmission time, setting the prediction period to reduce the time complexity of the algorithm while realizing the accuracy of the algorithm, and setting the penalty coefficient of the cost function to best realize the stability of the straight motion of the spherical robot.

[0034] As described above, due to the adoption of the above technical solutions, the present application has the following advantages:

[0035] In this invention, a scheme is implemented whereby a model predictive control algorithm (MPC) is run in a mini-host and communicates with a microcontroller via serial port. This enables the mini-host and microcontroller to jointly control the motion of a spherical robot. Specifically, the program in the mini-host can make real-time predictions of the spherical robot's motion, providing the target deflection angle value for the next moment, and sending it to the microcontroller via serial communication. The microcontroller then controls the motors of each device, thereby achieving serial communication between the mini-host and the microcontroller to control the spherical robot. This overcomes the limitations of existing technologies and optimizes the motion control of the spherical robot under actual conditions through the model predictive control algorithm, making the motion of the spherical robot more stable and controllable. Attached Figure Description

[0036] Figure 1 This is a general flowchart summarizing the invention.

[0037] Figure 2 This is a flowchart illustrating the specific implementation of the modules in this invention;

[0038] Figure 3 This is a hardware block diagram of the control device for the spherical robot in this invention;

[0039] Figure 4 This is a flowchart illustrating the specific implementation of the spherical robot straight-line motion model prediction algorithm in this invention.

[0040] Figure 5 This is a schematic diagram of the spherical robot in this invention;

[0041] Figure 6 This is a schematic diagram of the motion pendulum structure of the spherical robot in this invention;

[0042] Figure 7 This is a schematic diagram of the gravity pendulum and flywheel side structure of the spherical robot in this invention;

[0043] Figure 8 This shows the real-time effect of the spherical robot control method in this invention. Detailed Implementation

[0044] 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.

[0045] Reference Figures 1-8 ,

[0046] Example:

[0047] A control method for a spherical robot based on serial communication between a mini-host and a microcontroller, such as... Figure 1 As shown, it includes:

[0048] S1, the accelerometer device initializes the Bluetooth module;

[0049] S2, the CAN signal transmission line reads the rotation speed value of the gravity pendulum motor, and calculates the angular velocity value of the spherical robot according to the reduction ratio of the motor, and transmits it to the MicroPython single-chip microcomputer based on stm32;

[0050] S3, the MicroPython single-chip microcomputer based on stm32 receives the transmitted angular velocity value of the spherical robot and transmits the angular velocity value of the spherical robot to the mini host through serial communication;

[0051] S4, the mini host receives the angular velocity value of the spherical robot and the deflection angle value of the gravity pendulum, calculates the target deflection angle value of the gravity pendulum at the next moment and the angle value that the gravity pendulum needs to deflect at the current moment through a non-linear constrained model prediction algorithm (MPC), and sends it to the MicroPython single-chip microcomputer based on stm32 through serial communication;

[0052] S5, the MicroPython single-chip microcomputer based on stm32 receives the deflection angle value of the gravity pendulum and sends it to the motor through the CAN signal transmission line to control the deflection of the gravity pendulum motor.

[0053] Specifically as Figure 2 , 3 , a control device for a spherical robot based on serial communication between a mini host and a single-chip microcomputer, comprising a gravity pendulum, a flywheel, a gravity pendulum motor, a flywheel motor, a MicroPython single-chip microcomputer based on stm32, a mini host, a CAN signal transmission line, a PS2 handle, a PS2 handle receiver, and a electronic speed controller module;

[0054] The controlled object of the present example is a spherical robot, i.e. the gravity pendulum motor and flywheel motor required to control the straight movement and steering of the spherical robot;

[0055] As shown in Figure 4 , the gravity pendulum and the spherical shell are connected by a connecting rod, the flywheel is connected to the gravity pendulum through a connecting rod, the gravity pendulum motor is located on the connecting rod between the gravity pendulum and the spherical shell, and controls the swing of the gravity pendulum, thereby controlling the straight movement of the spherical robot, and the flywheel motor is located on the connecting rod between the flywheel and the gravity pendulum, controls the rotation of the flywheel, and thereby controls the steering movement of the spherical robot, the gravity pendulum motor and the flywheel motor are connected by the CAN signal transmission line, and are connected with the MicroPython single-chip microcomputer based on stm32, the MicroPython single-chip microcomputer based on stm32 sends instructions to the CAN signal transmission line, and then the CAN signal transmission line sends instructions to control the rotation of the motor to complete the straight movement and steering movement of the spherical robot;

[0056] The straight motion trajectory of the spherical robot is planned by a nonlinear constrained model prediction control algorithm (MPC) in the mini host, and the rotation angle of the gravity swing motor at the next moment is sent to the MicroPython single-chip microcomputer based on stm32.

[0057] Specifically, the program design of the MicroPython single-chip microcomputer based on stm32 includes: receiving the key information transmitted by the PS2 handle to the PS2 receiver, reading the target deflection angle value of the motor at the next moment from the mini host through serial communication according to the key information, and transmitting the target deflection angle value to the CAN signal transmission line to control the rotation of the motor.

[0058] The nonlinear constrained model prediction control algorithm (MPC) of the mini host includes:

[0059] S1, measure the motion angular velocity value of the spherical robot at the current moment;

[0060] S2, the value of the optimal parameter in a control period is calculated by inputting into the MPC algorithm, that is, the target deflection angle value of the gravity swing;

[0061] S3, only the optimal parameter value at the nearest moment is used, that is, the angle value that the gravity swing should be deflected at the next moment;

[0062] S4, sliding optimization control.

[0063] Specifically, the accelerometer reads the deflection angle value of the gravity swing at the current moment, transmits the data packet to the mini host, and the mini host analyzes the data packet transmitted by the accelerometer and obtains the deflection angle value of the gravity swing. At the same time, the mini host reads the initial angular velocity value of the spherical robot through the MicroPython single-chip microcomputer based on stm32 and the CAN signal transmission line, and transmits the initial angular velocity value and the deflection angle value of the gravity swing to the MPC control algorithm;

[0064] Specifically, the do_mpc library in the python language is used to solve the MPC algorithm:

[0065] In the motion solving process of the spherical robot, two intermediate variables and one optimization variable are involved, therefore, the deflection angle value of the spherical shell φ and the angular velocity value of the spherical robot motion, that is, the deflection angular velocity value of the spherical shell , are set as the intermediate variable values, and u is set as the optimization variable, where u=m2glsinα.

[0066] In the motion solution of the spherical robot, five constant variables and one target optimization value are involved. Therefore, the constant variables are set as m1 (weight of the spherical shell) = 5.269 kg, m2 (weight of the flywheel) = 5.7 kg, gravitational acceleration g = 9.8 N / kg, radius of the spherical shell R = 0.255 m, length of the gravity pendulum l = 0.174 m, and target velocity value is set as 0.5 m / s.

[0067] According to the motion equations of the spherical robot:

[0068] Where m1 is the weight of the spherical shell, m2 is the weight of the gravity pendulum, R is the radius of the spherical shell, r is the radius of the flywheel, l is the length of the gravity pendulum (the distance from the center of the sphere to the center of the flywheel), α is the deflection angle of the gravity pendulum relative to the vertical axis, β is the rotation angle of the flywheel, θ is the slope of the spherical robot climbing the slope, and φ is the rotation angle of the spherical shell of the spherical robot. This is the angular acceleration value of the spherical robot's motion;

[0069] The state equations for the motion of the spherical robot can be obtained:

[0070] in, The variable u represents the variable that needs to be optimized in the Model Predictive Control (MPC) algorithm. In this algorithm, it is the deflection angle α of the gravity pendulum, which can be represented by m2glsinα.

[0071] Write out the cost function of the MPC algorithm, and use the algorithm running on the mini-host to find the minimum value achievable by the cost function and the corresponding values ​​of the optimization variables:

[0072] N|k) T Fx(k+N|k)), where Q and R are weight coefficient matrices and are both diagonal matrices, x(k+i|k) (i=0,1,...,N) represents the prediction of the system state at time k+i at time k, and u(k+i|k) (i=0,1,...,N) represents the prediction of the input at time k+i at time k;

[0073] In the practical application of this embodiment, the linear constrained model predictive control (MPC) algorithm was optimized in combination with the actual motion of the spherical robot. This includes: specifying the time interval, controlling the calculation of the model predictive control algorithm (MPC) to be performed once every 0.1s, allowing sufficient time for motor swing and signal transmission, setting the prediction period to 10, which reduces the time complexity of the algorithm while improving its accuracy, and setting the penalty coefficient of the cost function to 1.3, which can best achieve the smoothness of the spherical robot's straight-line motion.

[0074] Specifically, after the mini host calculates all the optimal variable values in the prediction period through the MPC algorithm, the optimal variable value at the latest time is selected, and a control command is sent to the motor through the CAN signal transmission line to realize the deflection of the motor and the movement of the spherical robot.

[0075] Specifically, based on the intermediate parameter value and the optimal parameter value at this time, sliding optimization control is realized to achieve the prediction and control of the movement of the spherical robot at the next time.

[0076] As Figure 8 , the spherical robot reaches the target effect using 0.2s under the control of the MPC algorithm, and moves at a constant linear speed value, where phi represents the deflection angle value of the spherical shell, d_phi represents the angular velocity value of the spherical shell, and t_1 represents the moment value of the gravity pendulum of the spherical robot.

[0077] The application realizes the stable movement of the spherical robot by improving the method of controlling the spherical robot through serial communication between the mini host and the single-chip microcomputer, specifically, the MPC algorithm on the mini host can be used to calculate the deflection angle value of the gravity pendulum of the spherical robot at the next time, and the value is transmitted to the MicroPython single-chip microcomputer based on stm32 through serial communication, and the latter controls the deflection of the motor and the movement of the spherical robot through the CAN signal transmission line. The embodiment overcomes the limitations in the prior art, and realizes the smooth movement of the spherical robot by installing the mini host device in the spherical robot and using the powerful central processing unit CPU calculation model prediction algorithm MPC.

[0078] It should be noted that in this document, relational terms such as first and second and the like can only be used to distinguish one entity or action from another entity or action, without necessarily requiring or implying any such actual relationship or order between such entities or actions. Moreover, the terms "comprises" or "comprising" or any other variations thereof are intended to cover non-exclusive inclusions, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements, but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the statement "comprises a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus that includes the element.

[0079] The above examples are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that the technical solutions recorded in the foregoing examples can be modified, or some technical features can be replaced by equivalent features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A spherical robot control device based on a mini-host and a microcontroller, characterized in that: The device comprises: A gravity pendulum device controls the straight movement of the spherical robot by the rotation of the gravity pendulum through the conservation of rotational inertia; A flywheel device controls the turning of the spherical robot by the accelerated rotation of the flywheel through the conservation of rotational inertia; A spherical shell device is installed outside the spherical robot to serve as a shell, facilitating smooth rotation of the spherical robot; A mini host module calculates the target deflection angle value of the gravity pendulum in real time through a model predictive control algorithm; A single-chip microcomputer module based on stm32 MicroPython controls the rotation of the motor; A CAN signal transmission line module is used to read the values of the motor through the electronic speed controller and convert the single-chip microcomputer signal into a CAN signal to send to the motor; A PS2 handle and PS2 handle receiver module is used to switch between different movement modes of the spherical robot.

2. The mini-host and single-chip microcomputer-based spherical robot control device according to claim 1, characterized by: The gravity pendulum device is installed in the middle of the spherical shell and connected to the spherical shell through a connecting rod, and the flywheel device is installed below the gravity pendulum device and connected to the gravity pendulum device through a connecting rod; The gravity pendulum device and the flywheel device are controlled by a gravity pendulum motor and a flywheel motor, both of which are connected to a distribution board through an electronic speed controller, and the distribution board is connected to the total power supply to power the motor, while the CAN signal transmission line is connected to the distribution board to send CAN signals to the gravity pendulum motor and the flywheel motor for control.

3. The mini host and single chip microcomputer based spherical robot control device as claimed in claim 1, wherein: The gravity pendulum motor is installed on the connecting rod connecting the gravity pendulum and the spherical shell to control the rotation of the gravity pendulum.

4. The mini-host and single-chip microcomputer based spherical robot control device according to claim 1, characterized by: The flywheel motor is installed on the connecting rod connecting the flywheel and the gravity pendulum to control the rotation of the flywheel; the mini host module is installed above the flywheel device and connected to the distribution board, powered by the total power supply.

5. The mini host and single chip microcomputer based spherical robot control device according to claim 1, characterized by: The single-chip microcomputer module is installed above the flywheel device, connected to the CAN signal transmission line through the distribution board, and connected to the PS2 receiver through serial communication, and communicates with the PS2 handle through Bluetooth; the gravity pendulum motor and the flywheel motor are connected to the distribution board through the CAN distribution line, receive the CAN signals sent by the CAN signal transmission line, and rotate at a fixed angle or speed to realize the straight movement or turning movement of the spherical robot.

6. The control method of the mini-host and single-chip microcomputer-based spherical robot control device according to claim 1, characterized by: The method comprises the following steps: S1: The accelerometer device initializes the Bluetooth module; wherein the mini host device runs an accelerometer Bluetooth receiver module, obtains the real-time deflection angle value of the gravity pendulum by analyzing the data packet sent by the accelerometer to the mini host in real time S2: The CAN signal transmission line reads the rotation speed value of the gravity pendulum motor, and calculates the angular velocity value of the spherical robot according to the reduction ratio of the motor to transmit to the single-chip microcomputer based on stm32 MicroPython; S3: The single-chip microcomputer based on stm32 MicroPython receives the transmitted angular velocity value of the spherical robot and transmits the angular velocity value of the spherical robot to the mini host through serial communication; S4: The mini host receives the angular velocity value of the spherical robot and the deflection angle value of the gravity pendulum, calculates the target deflection angle value of the gravity pendulum at the next time and the angle value that the gravity pendulum needs to deflect at the current time through a nonlinear constrained model prediction algorithm, and sends it to the MicroPython single-chip microcomputer based on stm32 through serial communication; S5: The MicroPython single-chip microcomputer based on stm32 receives the deflection angle value of the gravity pendulum and sends it to the motor through the CAN signal transmission line to control the deflection of the gravity pendulum motor.

7. The control method of the mini-host and single-chip microcomputer-based spherical robot control device according to claim 6, characterized by: In step S4, the accelerometer reads the deflection angle value of the gravity pendulum at the current time, transmits the data packet to the mini host, and the mini host analyzes the data packet transmitted by the accelerometer and obtains the deflection angle value of the gravity pendulum. At the same time, the mini host reads the initial angular velocity value of the spherical robot through the MicroPython single-chip microcomputer based on stm32 and the CAN signal transmission line and transmits the initial angular velocity value and the deflection angle value of the gravity pendulum to the MPC control algorithm.

8. The control method of the mini-host and single-chip microcomputer-based spherical robot control device according to claim 6, characterized by: In step S4, the model prediction algorithm in the mini host is discretized to predict the target deflection value of the gravity pendulum at the next time point, the signal transmission time and the time required for the gravity pendulum motor to deflect in order to adapt to the actual movement mode of the spherical robot.

9. The control method of the mini-host and single-chip microcomputer-based spherical robot control device according to claim 6, characterized by: In step S4, the model prediction algorithm in the mini host is based on the dynamics equation of the spherical robot, wherein g is the value of gravity acceleration, m1 is the weight of the spherical shell, m2 is the weight of the gravity pendulum, R is the radius of the spherical shell, r is the radius of the flywheel, l is the length of the gravity pendulum, i.e. the distance from the center of the sphere to the center of the flywheel, a is the deflection angle of the gravity pendulum relative to the vertical axis, β is the rotation angle value of the flywheel, θ is the slope value of the spherical robot climbing, and φ is the angle value of the rotation of the spherical robot spherical shell, and is the angular acceleration value of the motion of the spherical robot. The dynamics equation of the spherical robot is converted into the state equation of the spherical robot movement, wherein, And the variable u represents the variable that needs to be optimized in the model predictive control algorithm, which is the value of the deflection angle α of the gravity pendulum. Since m2, g, and l are known constants, α can be represented by m2glsinα in this algorithm. The constraint condition is added to a model predictive control algorithm run by a mini-host, and a ball robot is taken as an example From the dynamic equation of the ball robot, it is known that the deflection angle value φ of the spherical shell needs to be between -90° and 90°, and the optimal variable m2glsinα can be calculated to be between -3.42 and 3.

41. The cost function of the MPC algorithm is written, and the minimum value of the cost function and the value of the optimal variable corresponding to the minimum value can be solved by using the algorithm running in the mini host: where Q and R are weight coefficient matrices and are both diagonal matrices, x(k+i|k) (i=0, 1,..., N) represents the system state at k+i time predicted at k time, and u(k+i|k) (i=0, 1,..., N) represents the input at k+i time predicted at k time.

10. The control method of the mini-host and single-chip microcomputer-based spherical robot control device according to claim 6, characterized by: In step S4, the linear constrained model prediction control algorithm is optimized according to the actual movement of the spherical robot, including: the time interval is specified, the calculation of the model prediction control algorithm is controlled to be performed once, the motor is given sufficient swinging time and signal transmission time, the prediction period is set to, the time complexity of the algorithm is reduced while the accuracy of the algorithm is realized, the penalty coefficient of the cost function is set to, and the stability of the straight movement of the spherical robot is realized.