A spherical robot and a control method of a spherical robot
By employing the four-point ball-fixing principle and a fuzzy adaptive PID controller inside the spherical robot, three closed-loop controllers were designed, which solved the problem of insufficient stability of the spherical robot under strong impacts or on steep surfaces, and achieved stable motion control.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU CITY UNIV OF TECH
- Filing Date
- 2022-08-15
- Publication Date
- 2026-04-21
AI Technical Summary
Existing spherical robots are prone to slipping when encountering strong impacts or steep surfaces, resulting in loss of power and insufficient stability.
By adopting the four-point fixed ball principle, four driving points not in the same plane are set inside the spherical shell. Combined with a fuzzy adaptive PID controller, three closed-loop controllers are designed to achieve stable control of the spherical robot. The calculation outputs of the balance loop, speed loop and steering loop control the forward, backward, emergency braking and steering of the spherical robot.
This improved the structural stability of the spherical robot, preventing the actuator from "flying off the sphere" during movement and achieving stable motion control.
Smart Images

Figure CN115848525B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of robotics, and more particularly to a spherical robot and a control method for the spherical robot. Background Technology
[0002] A spherical mobile robot is a special type of mobile robot. Its drive system is located inside a spherical shell, making it a robot that moves using internal propulsion. Its movement relies on the rotation of the sphere. Since a sphere is a natural, ideal rotating object, its biggest advantage over other mobile robots is its ability to rotate in all directions. Some spherical robots even possess zero-radius turning capabilities, separating translational and rotational motion for more flexible motion control. This unique movement method also allows spherical robots to traverse curved paths slightly larger than their radius, resulting in superior mobility. Compared to wheeled automated robots, their spherical shell eliminates the risk of tipping over during movement, providing excellent obstacle-crossing capabilities and making them suitable for complex terrain or field exploration. Compared to legged robots, spherical robots offer advantages such as higher speed, fewer actuators, and simpler control. Furthermore, because all mechanical mechanisms and electronic equipment are located inside the spherical shell, they are effectively buffered and protected, enabling them to adapt to complex external environments and offering broad application prospects in disaster relief, military reconnaissance, and geological exploration.
[0003] An existing spherical robot uses three Mecanum wheels as the drive wheels for its internal vehicle, and its trajectory tracking control algorithm has been proven using a Lagrangian dynamics model. However, it has the following drawbacks:
[0004] The design relies solely on the mutual resistance of three Mecanum wheels to maintain close contact with the inner wall of the ball. However, in the event of a strong impact or a steep surface, the wheels may slip, leading to a loss of power.
[0005] Therefore, improving the stability of spherical robots by addressing their structure and control is an important research topic. Summary of the Invention
[0006] The purpose of this invention is to address the deficiencies in the prior art by proposing a spherical robot and a control method for the spherical robot.
[0007] To solve the above problems, the present invention is implemented according to the following technical solution:
[0008] The present invention discloses a control method for a spherical robot, comprising the following steps:
[0009] Step A: Power on the main system used to control the spherical robot, initialize the spherical robot and all peripherals, simultaneously enable the external interrupt of the gyroscope, and enter the main system loop;
[0010] Step B: The main function of the main system constantly checks for external interrupt information from the gyroscope. If no interrupt information is detected, the main function opens the display screen and shows the set parameter data, while the main system performs a delay every preset time. If an interrupt information is detected, proceed to step C:
[0011] Step C: The main function jumps to the gyroscope interrupt function, clears the interrupt flag and inverts the frequency divider flag;
[0012] When the frequency division flag is 1, read the three-axis attitude angles, perform one handheld control operation, and return to the main function;
[0013] When the frequency division flag is 0, the PID calculation is performed and the main function is returned.
[0014] Preferably, in step C, the handle control operation is performed, including:
[0015] Read the key value code of the handle and determine the function corresponding to the key value code. The function corresponding to the key value code includes increasing or decreasing the steering ring KP, increasing or decreasing the steering ring Kd, turning the system on, turning the system off, increasing or decreasing the overall parameters of the speed ring, increasing or decreasing the balance ring KP, and increasing or decreasing the balance ring Kd.
[0016] Alternatively, it can read analog signals from the joystick and convert them into digital signals that the main system can recognize, including: reading digital information from the left joystick's Y-axis to set the spherical robot's movement speed and direction control, and reading digital information from the right joystick's X-axis to set the spherical robot's target yaw angle.
[0017] Preferably, in step C, performing PID calculation includes:
[0018] Step C1: Define the total ignition gain coefficient and PWM output value of the left and right motors of the spherical robot;
[0019] Step C2: Clear the three closed-loop output values of the previous PID calculation, and determine whether the three-axis attitude angles have been read. If not, exit the current PID calculation.
[0020] If the reading is obtained, the three-axis angular velocity of the gyroscope is acquired, and it is determined whether the main system operation flag is 1. If not, the current PID calculation is exited; if so, the encoder values of the left and right motors are read, the ignition gain of the left and right motors is adjusted, and the actual roll angle measurement value is obtained.
[0021] Step C3: Determine if the spherical robot's speed is 0. If it is, enable the output of the three-loop calculation: balance loop, speed loop, and steering loop; if not, enable the output of the speed loop and steering loop calculation.
[0022] Step C4: The calculation result of step C3 is used for speed limiting control and output to the left and right motors of the spherical robot to control the movement of the spherical robot.
[0023] Preferably, in step C3, enabling the output of the balance ring operation includes:
[0024] Read the roll angle and angular velocity of the spherical robot;
[0025] Compare the current roll angle with the set target angle to obtain the roll angle deviation, and obtain the balance ring ratio term based on the roll angle deviation;
[0026] The differential term of the balance loop is obtained based on the angular velocity of the current roll angle;
[0027] When the direction of the angular velocity is the same as the output direction of the proportional term of the balance ring, the current angle deviation increases, and the differential term of the balance ring outputs a PWM control signal that is the same as the output of the proportional term of the balance ring.
[0028] When the direction of the angular velocity is opposite to the output direction of the proportional term of the balance loop, the current angle deviation decreases, and the differential term of the balance loop outputs a PWM control signal that is opposite to the output of the proportional term of the balance loop.
[0029] The formula for calculating the balance ring is as follows:
[0030] balance=pid.Kp*(roll-pid.sv_roll)+gyrox*pid.Kd;
[0031] in:
[0032] balance represents the output value of the balance ring;
[0033] pid.Kp represents the proportional term parameter of the balance ring;
[0034] roll indicates the roll angle;
[0035] pid.sv_roll represents the target roll angle;
[0036] gyrox represents the roll angle angular velocity;
[0037] pid.Kd represents the differential parameter of the equilibrium loop.
[0038] Preferably, in step C3, enabling the velocity loop calculation output includes:
[0039] Read the encoder values of the left and right motors of the spherical robot and the set target speed;
[0040] The sum of the encoder values of the left and right motors is taken as the actual speed, and the difference between the actual speed and the target speed is used to obtain the speed deviation and the deviation integral.
[0041] The proportional and integral terms of the speed loop are calculated separately. Based on the proportional and integral terms of the speed loop, the output value of the speed loop is obtained to control the speed of the left and right motors, so as to maintain the self-balance of the spherical robot or give the spherical robot a forward or backward power output.
[0042] The formula for calculating the velocity loop is as follows:
[0043] velocity=
[0044] pid.Kp_speed*pid.EK_speed+pid.Ki_speed*pid.SEK_speed;
[0045] in:
[0046] velocity represents the output value of the velocity loop;
[0047] pid.Kp_speed represents the speed loop scaling parameter;
[0048] pid.EK_speed represents the speed difference between the left and right motors;
[0049] pid.Ki_speed represents the velocity loop integral term parameter;
[0050] pid.SEK_speed represents the total integration amount.
[0051] Preferably, in step C3, enabling the steering ring calculation output includes:
[0052] Read the yaw angle and angular velocity;
[0053] The difference between the current yaw angle and the target yaw angle is used to obtain the yaw angle deviation.
[0054] The steering ring proportional term is obtained based on the yaw angle deviation;
[0055] The steering loop differential term is obtained based on the angular velocity of the yaw angle;
[0056] When the direction of the angular velocity is the same as the output direction of the proportional term of the steering ring, the current angle deviation increases, and the differential term of the steering ring outputs a PWM control signal that is the same as the output of the proportional term of the steering ring.
[0057] When the direction of the angular velocity is opposite to the output direction of the proportional term of the steering ring, the current angle deviation decreases, and the differential term of the steering ring outputs a PWM control signal that is opposite to the output of the proportional term of the steering ring.
[0058] The formula for calculating the steering ring is as follows:
[0059] Turn=pid.Kp_turn*(yaw-pid.sv turn )+gyroz*pid.Kd_turn;
[0060] in:
[0061] Turn indicates the steering ring output value;
[0062] pid.Kp_turn represents the steering ring ratio parameter;
[0063] yaw represents the yaw angle;
[0064] pid.sv turn Indicates the target yaw angle;
[0065] gyroz represents the yaw angle and angular velocity;
[0066] pid.Kd_turn represents the differential parameter of the steering ring.
[0067] Preferably, step C includes:
[0068] Based on the actual motion information of the spherical robot, the calculation results of the balance loop, velocity loop and steering loop are output to the left and right motors respectively to control the posture and speed of the spherical robot in parallel.
[0069] The output of the left motor on the left wheel is:
[0070] Moto Left =Ignition_Left×(Balance_PWM+Velocity_PWM-Turn_PWM;
[0071] The output of the right motor's right wheel is:
[0072] Moto Right =Ignition_Rigth×(Balance_PWM+Velocity_PWM+Turn_PWM;
[0073] in:
[0074] Moto Left Indicates the output of the left wheel;
[0075] Moto Right Indicates the output of the right wheel;
[0076] Ignition_Left represents the ignition gain coefficient of the left wheel;
[0077] Ignition_Rigth represents the ignition gain coefficient of the right wheel;
[0078] Balance_PWM represents the PWM output value of the balance loop;
[0079] Velocity_PWM represents the PWM output value of the speed loop;
[0080] Turn_PWM represents the PWM output value of the steering loop.
[0081] Preferably, the forward and backward movement of the spherical robot is controlled by analog signals from the joystick.
[0082] The formulas for forward and backward movement are as follows:
[0083] pid.Set Speed =pid.Set Speed -(speed max ×(PS2 LY ÷127));
[0084] in:
[0085] pid.Set Speed This indicates the set speed of the spherical robot;
[0086] speed max Indicates the speed increment factor;
[0087] PS2 LY This indicates the digital value representing the Y-axis of the left joystick on the controller;
[0088] The braking system of the spherical robot is controlled by the following formula:
[0089] pid.SEK Speed =-pid.SEK Speed ÷10;
[0090] pid.Set Speed =0;
[0091] in:
[0092] pid.SEK Speed This represents the integral deviation in the velocity loop of the spherical robot.
[0093] Preferably, the control method further includes controlling the speed difference between the left wheel of the left motor and the right wheel of the right motor to achieve the steering of the spherical robot;
[0094] The formula for calculating steering is as follows:
[0095] pid.sv turn =pid.sv turn -(PS2 RX / 127);
[0096] in:
[0097] pid.sv turn Indicates the target yaw angle of the steering ring;
[0098] PS2 RX This indicates the digital value of the X-axis of the right joystick on the controller.
[0099] A spherical robot, which applies any of the control methods for the spherical robot described above;
[0100] The spherical robot includes a spherical shell and a drive and control device disposed inside the spherical shell;
[0101] The drive device includes a mounting platform and drive components;
[0102] The drive assembly includes a drive wheel, a driven wheel, and a drive motor;
[0103] The installation platform includes a stable base disposed below the interior of the spherical shell, and a drive motor is installed on each side of the stable base, with each drive motor having a drive wheel installed on it.
[0104] The stable base has support arms extending upwards on both sides, and each support arm is equipped with a driven wheel.
[0105] Each of the driving wheel and the driven wheel contacts the inner wall of the spherical shell to form four driving points that are not on the same plane;
[0106] The control device is installed in the middle of the stable base. The control device is used to receive instructions from the handle to drive the drive device to move the spherical shell.
[0107] Compared with the prior art, the beneficial effects of the present invention are:
[0108] 1. The present invention provides a control method for a spherical robot. Based on a fuzzy adaptive PID controller, three closed-loop controllers are designed to control the movement of the spherical robot. Based on the three closed-loop controllers, a motion control algorithm for the spherical robot is developed, which realizes the functions of forward and backward movement, emergency braking, self-balancing and turning, and achieves stable control of the spherical robot.
[0109] 2. The spherical robot of this invention utilizes the four-point spherical fixation principle. Four points, not on the same plane, are selected inside the spherical shell to define four driving points that contact the shell. These four driving points are in close contact with the shell. The active motion provided by the lower drive wheel provides a driving force to the internal drive system, causing the shell and the upper driven wheel to rotate. This alters the overall mass distribution of the spherical robot, driving the sphere to move. Simultaneously, the contact between the four points and the shell provides a fixing effect, preventing the robot from "flying out of the sphere" when the internal drive mechanism moves excessively, further improving structural stability. Attached Figure Description
[0110] in:
[0111] Figure 1 This is a front view structural diagram of a spherical robot according to an embodiment of the present invention;
[0112] Figure 2 This is a schematic diagram of the structure of a spherical robot according to an embodiment of the present invention;
[0113] Figure 3 This is a top view of a spherical robot according to an embodiment of the present invention;
[0114] Figure 4 This is a side view of a spherical robot according to an embodiment of the present invention;
[0115] Figure 5 This is a flowchart of the control process for a spherical robot according to an embodiment of the present invention;
[0116] Figure 6 This is a general block diagram of a spherical robot control system according to an embodiment of the present invention;
[0117] Figure 7 This is a flowchart of PID calculation according to an embodiment of the present invention;
[0118] Figure 8 This is a closed-loop control block diagram of one embodiment of the present invention;
[0119] Figure 9 This is a block diagram of the balance loop control according to an embodiment of the present invention;
[0120] Figure 10 This is a speed loop control block diagram according to an embodiment of the present invention;
[0121] Figure 11 This is a block diagram of a steering ring control according to an embodiment of the present invention;
[0122] Figure 12 This is a block diagram of the overall PID control according to an embodiment of the present invention;
[0123] Figure 13 This is a block diagram of a spherical robot movement algorithm according to an embodiment of the present invention.
[0124] The components include: spherical shell 1, driving wheel 2, driven wheel 3, drive motor 4, stable base 5, support arm 6, first support rod 61, and second support rod 62. Detailed Implementation
[0125] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and should not be construed as limiting the present invention.
[0126] In the description of this invention, it should be understood that the terms "upper," "lower," etc., indicating orientation or positional relationships are based on the orientation or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0127] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0128] The control method for a spherical robot described in this application can be applied to spherical robots with the following structures, specifically, such as... Figures 1 to 4 As shown, the spherical robot includes a spherical shell 1 and a drive device and a control device disposed inside the spherical shell 1;
[0129] The drive device includes a mounting platform and drive components;
[0130] The drive assembly includes a drive wheel 2, a driven wheel 3, and a drive motor 4;
[0131] The installation platform includes a stable base 5 disposed inside the lower part of the spherical shell 1. A drive motor 4 is installed on each side of the stable base 5, and each drive motor 4 is equipped with a drive wheel 2.
[0132] The stable base 5 has support arms 6 extending upward on both sides, and each support arm 6 is equipped with a driven wheel 3.
[0133] Each of the driving wheel 2 and the driven wheel 3 contacts the inner wall of the spherical shell 1 to form four driving points that are not on the same plane;
[0134] The control device is installed in the middle of the stable base 5. The control device is used to receive external commands to drive the drive device to move the spherical shell 1.
[0135] In this application, the drive wheel 2 is the left wheel and right wheel of the control method described in this application, and the drive motor 4 is the left motor and right motor of the control method described in this application.
[0136] Considering that the spherical robot needs to be in contact and fixed during movement to enhance friction and drive the spherical shell 1 to rotate, this embodiment uses the four-point fixation principle. Four points not on the same plane are selected inside the spherical shell 1 to determine four driving points that contact the shell 1. These four driving points are in close contact with the shell 1. The active motion provided by the lower drive wheel 2 provides a driving force to the internal drive system, driving the rotation of the shell 1 and the upper driven wheel 3. This changes the overall mass distribution of the spherical robot, driving the sphere to move. Simultaneously, the contact between the four points and the shell 1 also provides a fixing effect, preventing the robot from "flying out of the sphere" when the drive device moves actively, further improving structural stability.
[0137] Furthermore, considering the need for strong stability during the movement of the spherical robot, based on the principle of a roly-poly toy, the main mass of the internal driving body is concentrated at the bottom of the spherical shell 1 within the specific space inside the shell 1. The two points of contact at the top occupy a very small proportion of the mass, achieving a top-light and bottom-heavy effect. This effect perfectly matches the basic structure of a roly-poly toy: top-light and bottom-heavy, relatively stable. When in a balanced upright position, the distance between the center of gravity and the contact point is minimal, i.e., the center of gravity is at its lowest. After deviating from the equilibrium position, the center of gravity always rises. Therefore, this state of balance is a stable equilibrium. Based on this principle, this application sets up a stable base 5 and a support arm 6, and mounts the drive wheel 2, drive motor 4, and control device on the stable base 5, so that the weight of the stable base 5 is greater than the weight of the support arm 6 and the driven wheel 3, ensuring that the spherical robot possesses the natural stability of a roly-poly toy, while also providing shock resistance.
[0138] Furthermore, the control device involved in this embodiment (not shown in the figure) can be understood as hardware equipped with a main control circuit, such as conventional components like chips and signal receivers. The main control circuit has basic circuits and interface circuits. Each piece of hardware can be connected by plugging and unplugging. Through an external controller, such as a smart handle or a computer, instructions are sent to the control device so that the drive device drives and moves the ball shell 1 in the direction of the instruction. In terms of program control, the control device mentioned above refers to the control method of this application.
[0139] Preferably, the longitudinal section of the stable base 5 is a trapezoidal structure, and the outer wall of the base is designed to fit the arc surface structure of the inner wall of the spherical shell 1.
[0140] In this embodiment, the base of the stabilizing base 5 can be understood as an arc-shaped structure with a trapezoidal longitudinal cross section. This structure fits the inner wall of the spherical shell 1 to ensure that when the spherical shell 1 is driven by power to rotate, the stabilizing base 5 will not make hard contact with the spherical shell 1, thereby preventing the stabilizing base 5 from hindering the rotation of the spherical shell 1.
[0141] Preferably, the stabilizing base 5 has an installation channel and an installation notch on both sides, the drive motor 4 can be tilted in the installation channel, and the drive wheel 2 is tilted in the installation notch so that the wheel surface of the drive wheel 2 contacts the inner wall of the spherical shell 1 to form a driving point.
[0142] Preferably, the support arms 6 extend upward from both sides of the upper seat surface of the stabilizing base 5. The support arms 6 include a first support rod 61 and a second support rod 62. The lower ends of the first support rod 61 and the second support rod 62 are far apart from each other and fixed to the upper seat surface of the stabilizing base 5. The upper ends of the first support rod 61 and the second support rod 62 intersect each other and bend toward the inner wall of the spherical shell 1 to form a mounting reference surface. The mounting reference surface is used to mount the driven wheel 3 and make the driven wheel 3 contact the inner wall of the spherical shell 1 to form a driving point.
[0143] Preferably, the spherical shell 1 is a detachable transparent acrylic sphere structure.
[0144] The spherical shell 1 is a basic structure for the spherical robot to move. Due to the special structure of the spherical robot, the internal drive components are located inside the spherical shell 1. The internal drive device is the core of the spherical robot, and the spherical shell 1 must protect the internal drive device. Therefore, the spherical shell 1 must be hard, thick, and have a certain pressure resistance. At the same time, in order to adapt to the changing environment, the spherical shell 1 must be able to adapt to different environments, that is, it must have strong corrosion resistance. Considering the impact of the weight of the spherical shell 1 on the overall system, a lightweight spherical shell 1 should be selected. Since the spherical robot needs to perform movement and turning functions, the spherical shell 1 also needs to have a certain coefficient of friction with the ground. In order to meet the control requirements, the spherical robot will be equipped with a signal receiver to receive remote control commands. Therefore, the spherical shell 1 must be able to transmit radio waves. In order to allow for intuitive observation of the movement of the spherical robot, the spherical shell 1 should be transparent. In view of the above requirements, this embodiment designs the spherical shell 1 as a detachable acrylic transparent spherical structure.
[0145] Preferably, the drive motor 4 is a DC geared motor.
[0146] The present invention provides a control method for a spherical robot, comprising the following steps:
[0147] Step A: Power on the main system used to control the spherical robot, initialize the spherical robot and all peripherals, simultaneously enable the external interrupt of the gyroscope, and enter the main system loop;
[0148] Step B: The main function of the main system constantly checks for external interrupt information from the gyroscope. If no interrupt information is detected, the main function opens the display screen and shows the set parameter data, while the main system performs a delay every preset time. If an interrupt information is detected, proceed to step C:
[0149] Step C: The main function jumps to the gyroscope interrupt function, clears the interrupt flag and inverts the frequency divider flag;
[0150] When the frequency division flag is 1, read the three-axis attitude angles, perform one handheld control operation, and return to the main function;
[0151] When the frequency division flag is 0, the PID calculation is performed and the main function is returned.
[0152] like Figure 5As shown, the system first powers on, then initializes all peripherals and enables the gyroscope external interrupt. Next, it enters a system loop. Within this loop, the main function constantly monitors the external gyroscope interrupt information. If no interrupt is detected, the main function turns on the OLED display and shows the data set on the OLED, with a delay every 50 milliseconds. If the main function detects a gyroscope external interrupt, it jumps to the gyroscope interrupt function. By clearing the interrupt flag and inverting the frequency divider flag, the interrupt function loops, reading the controller's calculations once, then executing the PID calculations again, achieving a read-once-control-once effect. Finally, the changed data is fed back to the main function and displayed on the OLED screen.
[0153] Preferably, in step C, the handle control operation is performed, including:
[0154] Read the key value code of the handle and determine the function corresponding to the key value code. The function corresponding to the key value code includes increasing or decreasing the steering ring KP, increasing or decreasing the steering ring Kd, turning the system on, turning the system off, increasing or decreasing the overall parameters of the speed ring, increasing or decreasing the balance ring KP, and increasing or decreasing the balance ring Kd.
[0155] Alternatively, it can read analog signals from the joystick and convert them into digital signals that the main system can recognize, including: reading digital information from the left joystick's Y-axis to set the spherical robot's movement speed and direction control, and reading digital information from the right joystick's X-axis to set the spherical robot's target yaw angle.
[0156] like Figure 6 As shown, after receiving the information from the controller, the system determines whether the controller is transmitting a button value or a joystick analog signal. If the received information is a button value, it further determines the specific key code of the pressed button and uses the key code to access the function selection. There are 12 internally set button functions: increasing or decreasing steering loop KP, increasing or decreasing steering loop Kd, system on, system off, increasing or decreasing overall speed loop parameters, increasing or decreasing balance loop KP, and increasing or decreasing balance loop Kd. If the received information is a joystick value, the system converts the joystick's analog signal into a system-recognizable digital signal. Using the digital information on the left joystick's Y-axis, it sets the corresponding movement speed and direction control information; using the digital information on the joystick's X-axis, it sets the system's target yaw angle. Finally, the system parameters changed by the control system are processed and output by the next-level PID controller to control the movement of the spherical robot.
[0157] Preferably, in step C, performing PID calculation includes:
[0158] Step C1: Define the total ignition gain coefficient and PWM output value of the left and right motors of the spherical robot;
[0159] Step C2: Clear the three closed-loop output values of the previous PID calculation, and determine whether the three-axis attitude angles have been read. If not, exit the current PID calculation.
[0160] If the reading is obtained, the three-axis angular velocity of the gyroscope is acquired, and it is determined whether the main system operation flag is 1. If not, the current PID calculation is exited; if so, the encoder values of the left and right motors are read, the ignition gain of the left and right motors is adjusted, and the actual roll angle measurement value is obtained.
[0161] Step C3: Determine if the spherical robot's speed is 0. If it is, enable the output of the three-loop calculation: balance loop, speed loop, and steering loop; if not, enable the output of the speed loop and steering loop calculation.
[0162] Step C4: The calculation result of step C3 is used for speed limiting control and output to the left and right motors of the spherical robot to control the movement of the spherical robot.
[0163] like Figure 7 As shown, the program first enters the PID calculation function, defining the total ignition gain coefficient and PWM output value of the left and right motors. This coefficient is used to amplify the PWM during motor startup, quickly initiating the spherical robot's motion function. Next, it clears the three closed-loop calculation output control values from the previous calculation and performs a new round of reading. If the program does not read the three-axis attitude angle sent by the gyroscope, it shuts down the system and exits the PID calculation function directly. If the program reads the three-axis attitude angle sent by the gyroscope, it checks whether the system running flag is on. If the system flag is not on, it shuts down the system and exits the PID calculation function directly. Otherwise, it reads the encoder values of the left and right motors and saves them to memory. Then, it calculates the ignition gain of the left and right motors, which is used to quickly start the system upon first entry. Next, it saves the measured value of the actual roll angle and checks whether the set speed is 0. If the speed is 0, it activates the balance loop, speed loop, and steering loop calculation outputs; otherwise, it activates the speed loop and steering loop calculation outputs. Finally, the results of the three loop calculations are used for speed limiting control and output to the drive motor to control the specific movement of the spherical robot.
[0164] like Figure 8As shown in this application, three closed-loop controls are designed in the spherical robot. Closed-loop control involves applying the system's computational results to the spherical robot, and then feeding back the robot's current mechanical posture and speed—the actual parameters calculated by the system—based on the changes in the robot's output. The control system then issues new control commands based on this feedback to correct deviations. The spherical robot continuously performs this process while eliminating errors, forming a closed control loop that maintains a stable output, thus ensuring the system consistently achieves the expected target. This spherical robot employs three closed-loop control algorithms: a balance loop, a speed loop, and a steering loop. By setting parameters, the magnitude and proportion of the output of each loop are fuzzily controlled, which improves the system's computational speed and enhances control stability.
[0165] Preferably, in step C3, enabling the output of the balance ring operation includes:
[0166] Read the roll angle and angular velocity of the spherical robot;
[0167] Compare the current roll angle with the set target angle to obtain the roll angle deviation, and obtain the balance ring ratio term based on the roll angle deviation;
[0168] The differential term of the balance loop is obtained based on the angular velocity of the current roll angle;
[0169] When the direction of the angular velocity is the same as the output direction of the proportional term of the balance ring, the current angle deviation increases, and the differential term of the balance ring outputs a PWM control signal that is the same as the output of the proportional term of the balance ring.
[0170] When the direction of the angular velocity is opposite to the output direction of the proportional term of the balance loop, the current angle deviation decreases, and the differential term of the balance loop outputs a PWM control signal that is opposite to the output of the proportional term of the balance loop.
[0171] The formula for calculating the balance ring is as follows:
[0172] balance=pid.Kp*(roll-pid.sv_roll)+gyrox*pid.Kd;
[0173] in:
[0174] balance represents the output value of the balance ring;
[0175] pid.Kp represents the proportional term parameter of the balance ring;
[0176] roll indicates the roll angle;
[0177] pid.sv_roll represents the target roll angle;
[0178] gyrox represents the roll angle angular velocity;
[0179] pid.Kd represents the differential parameter of the equilibrium loop.
[0180] like Figure 9 As shown, the balance loop control operates based on the roll angle and speed of the spherical robot. In this embodiment, the roll angle and angular velocity of the spherical robot are read using the MPU6050 sensor. First, for the proportional term calculation, an angle deviation value is obtained by comparing the current roll angle with the set target angle. Based on the magnitude of this value, a PWM control quantity is calculated. This value, applied to the drive motor, can reduce the roll angle deviation of the spherical robot. However, because the proportional term control is real-time and the spherical robot's own motion has inertia, it may move up and down within the target value, specifically manifesting as low-frequency jittering of the spherical robot. Therefore, a differential term is needed to eliminate the low-frequency jitter of the spherical robot at the target position. This differential term is controlled by directly reading the angular velocity of the roll angle. The reason for choosing angular velocity instead of calculating the angle deviation from the last two measurements is that, in this control, the read angular velocity precisely represents the trend of the system angle change, meaning it can be determined whether the roll angle deviation is increasing or decreasing. Furthermore, the angular velocity is directly read from the MPU6050 sensor, offering higher accuracy and real-time performance, and does not consume the main control chip's computation time. When the direction of the angular velocity is the same as the proportional term's output direction, it indicates that the system's angle deviation is increasing. In this case, the differential term will output a PWM control signal in the same direction as the proportional term's output to help the system maintain balance. When the direction of the angular velocity is opposite to the proportional term's output direction, it indicates that the system's angle deviation is decreasing. In this case, the differential term will output a PWM control signal opposite to the proportional term's output direction to mitigate the change in the proportional term, thereby eliminating jitter.
[0181] Preferably, in step C3, enabling the velocity loop calculation output includes:
[0182] Read the encoder values of the left and right motors of the spherical robot and the set target speed;
[0183] The sum of the encoder values of the left and right motors is taken as the actual speed, and the difference between the actual speed and the target speed is used to obtain the speed deviation and the deviation integral.
[0184] The proportional and integral terms of the speed loop are calculated separately. Based on the proportional and integral terms of the speed loop, the output value of the speed loop is obtained to control the speed of the left and right motors, so as to maintain the self-balance of the spherical robot or give the spherical robot a forward or backward power output.
[0185] The formula for calculating the velocity loop is as follows:
[0186] velocity=
[0187] pid.Kp_speed*pid.EK_speed+pid.Ki_speed*pid.SEK_speed;
[0188] in:
[0189] velocity represents the output value of the velocity loop;
[0190] pid.Kp_speed represents the speed loop scaling parameter;
[0191] pid.EK_speed represents the speed difference between the left and right motors;
[0192] pid.Ki_speed represents the velocity loop integral term parameter;
[0193] pid.SEK_speed represents the total integration amount.
[0194] like Figure 10 As shown, the speed loop control operates based on the spherical robot's current speed. Its function is to maintain the robot's self-balancing or provide it with forward or backward power output. In a typical self-balancing robot speed loop, the speed loop calculates the actual speed value based on the sum of the encoder values of the two motors. Internally, this is subtracted from the system's set target speed to obtain the difference between the actual and target speeds. Here, the target speed set by the speed loop refers to the overall output speed of the self-balancing robot being 0. To achieve this target, the speed loop outputs positive feedback to help the robot quickly reach its balanced position. This makes the output of the self-balancing loop approximately 0. Through system feedback, the speed loop reduces its output to maintain the corresponding speed, thus keeping the self-balancing robot system upright and controlling its speed fluctuation within the range of 0. The principle behind the speed loop controlling the movement of the balancing trolley is to set a target speed. The speed loop controls the tilt angle of the trolley, which in turn triggers the control of the upright loop to achieve the purpose of balancing the movement of the trolley. The output of the upright loop is proportional to the tilt angle. When moving forward, the trolley tilts forward. The larger the angle, the greater the speed. The proportional control of the speed loop maintains the angle of the balancing trolley by outputting the corresponding value, thus achieving the effect of moving forward at a fixed speed.
[0195] The speed loop control algorithm for spherical robots differs from the principles described above. Because spherical robots are structurally similar to a roly-poly toy, they possess inherent stability and can maintain a high degree of stability even without external forces. Therefore, controlling the proportional output of the speed loop to maintain the balance ring at a specific position for forward movement is ineffective for spherical robots. Instead, this algorithm design utilizes the integral term of the speed loop to control the robot's movement and deceleration. The remotely controlled speed is integrated into the speed loop, mitigating the impact of sudden speed changes on upright control and thus providing a stable and continuous output control signal. Since the spherical robot needs to make frequent turning movements, the outputs of the two motors rotating in the same direction were reversed in this design. In this way, the actual speed input of the proportional term of the speed loop is transformed into a comparison of the encoder values of the two motors on the vehicle. The expected target is also changed to the output speed difference between the two motors of the spherical robot. Since the rotation of the spherical robot requires a speed difference between the two motors, there will also be a speed difference between the two motors when rotating. This will output a positive feedback to help the vehicle quickly reach a specific turning position to maintain the goal of equal speed between the two motors. In other words, the proportional term of the speed loop has the function of stabilizing the turning position.
[0196] Preferably, in step C3, enabling the steering ring calculation output includes:
[0197] Read the yaw angle and angular velocity;
[0198] The difference between the current yaw angle and the target yaw angle is used to obtain the yaw angle deviation.
[0199] The steering ring proportional term is obtained based on the yaw angle deviation;
[0200] The steering loop differential term is obtained based on the angular velocity of the yaw angle;
[0201] When the direction of the angular velocity is the same as the output direction of the proportional term of the steering ring, the current angle deviation increases, and the differential term of the steering ring outputs a PWM control signal that is the same as the output of the proportional term of the steering ring.
[0202] When the direction of the angular velocity is opposite to the output direction of the proportional term of the steering ring, the current angle deviation decreases, and the differential term of the steering ring outputs a PWM control signal that is opposite to the output of the proportional term of the steering ring.
[0203] The formula for calculating the steering ring is as follows:
[0204] Turn=pid.Kp_turn*(yaw-pid.sv turn )+gyroz*pid.Kd_turn;
[0205] in:
[0206] Turn indicates the steering ring output value;
[0207] pid.Kp_turn represents the steering ring ratio parameter;
[0208] yaw represents the yaw angle;
[0209] pid.sv turn Indicates the target yaw angle;
[0210] gyroz represents the yaw angle and angular velocity;
[0211] pid.Kd_turn represents the differential parameter of the steering ring.
[0212] like Figure 11 As shown, the steering loop control algorithm controls the spherical robot based on its yaw angle and angular velocity. In the proportional term of the steering loop, the difference between the actual yaw angle and the target yaw angle is used to obtain a deviation value from the target yaw angle. Based on this deviation, a PWM control output can be calculated. This output is applied to the motors, causing a speed difference between the two motors, thus achieving steering. Similar to the balance loop, a differential term needs to be added to the steering loop. This term uses the angular velocity value to determine whether the deviation of the spherical robot from the target yaw angle is increasing or decreasing. If the deviation is increasing, the differential term outputs a PWM output in the same direction as the proportional term to help the proportional term reach the target position; if the deviation is decreasing, the differential term outputs a PWM output in the opposite direction to the proportional term to slow down the proportional term's approach to the target position and eliminate low-frequency jitter.
[0213] The proportional term of the steering loop calculates the system's yaw angle deviation and multiplies it by a pid.Kp_turn coefficient to output a result that controls the system to move towards the target yaw angle. However, unlike the PWM of the balance loop, which provides equal benefits to both motors, the PWM of the steering loop achieves a speed difference by providing positive benefits to the left motor and negative benefits to the right motor, thus driving the spherical robot to rotate. Conversely, it rotates in the other direction. The differential term, on the other hand, obtains the system's yaw angle angular velocity and multiplies it by a pid.Kd_turn coefficient to either assist or suppress the proportional term.
[0214] Preferably, step C includes:
[0215] Based on the actual motion information of the spherical robot, the calculation results of the balance loop, velocity loop and steering loop are output to the left and right motors respectively to control the posture and speed of the spherical robot in parallel.
[0216] The output of the left motor on the left wheel is:
[0217] MotoLeft =Ignition_Left×(Balance_PWM+Velocity_PWM-Turn_PWM;
[0218] The output of the right motor's right wheel is:
[0219] Moto Right =Ignition_Rigth×(Balance_PWM+Velocity_PWM+Turn_PWM;
[0220] in:
[0221] Moto Left Indicates the output of the left wheel;
[0222] Moto Right Indicates the output of the right wheel;
[0223] Ignition_Left represents the ignition gain coefficient of the left wheel;
[0224] Ignition_Rigth represents the ignition gain coefficient of the right wheel;
[0225] Balance_PWM represents the PWM output value of the balance loop;
[0226] Velocity_PWM represents the PWM output value of the speed loop;
[0227] Turn_PWM represents the PWM output value of the steering loop.
[0228] like Figure 12 As shown, ignition_Left and ignition_Rigth represent the ignition gain coefficients of the left and right wheels, respectively. Their function is to amplify the motor power when the system starts up, enabling the spherical robot to start quickly. However, after the system begins to move, the ignition gain value will be internally set to 1, losing its amplification function. The three PWM output values in the formula are Balance_PWM, Velocity_PWM, and Turn_PWM. In this system, a direct control type controller is used. By directly outputting the calculation results, the spherical robot is controlled to achieve the corresponding function. Compared with the incremental controller, its structure is simple and the control is clear. Since the spherical robot is an unstable system, precise linear control would be very complex and difficult to implement. Therefore, a nonlinear control result is obtained by direct superposition. By acquiring the control value in real time and outputting the control, the spherical robot is controlled to achieve the expected function.
[0229] Preferably, the forward and backward movement of the spherical robot is controlled by analog signals from the joystick.
[0230] The formulas for forward and backward movement are as follows:
[0231] pid.Set Speed =pid.Set Speed -(speed max ×(PS2 LY ÷127));
[0232] in:
[0233] pid.Set Speed This indicates the set speed of the spherical robot;
[0234] speed max Indicates the speed increment factor;
[0235] PS2 LY This indicates the digital value representing the Y-axis of the left joystick on the controller;
[0236] The design concept of the spherical robot is to continuously increase the speed. The speed of the spherical robot is achieved by the superposition of integral terms in the speed loop. Therefore, the speed superposition will continue until it reaches the maximum value of the integral term and is then limited, thus maintaining the output at the maximum speed. By outputting the same amount of speed to the left and right wheels, the spherical robot is driven to move forward and backward.
[0237] The braking system of the spherical robot is controlled by the following formula:
[0238] pid.SEK Speed =-pid.SEK Speed ÷10;
[0239] pid.Set Speed =0;
[0240] in:
[0241] pid.SEK Speed This represents the integral deviation in the velocity loop of the spherical robot.
[0242] When a spherical robot is moving, if the controller wants it to stop, a reaction force opposite to the direction of movement needs to be applied to quickly decelerate and stop it. Without such a reaction force, the spherical robot will run forward a long distance due to inertia and the low coefficient of friction when the sphere is rolling. Therefore, when the controller wants it to stop, the system must output a reaction force to counteract the forward force and bring the spherical robot to a standstill.
[0243] By inverting the velocity integral of the handle, a PWM control signal opposite to the direction of motion is obtained. By outputting the PWM control signal in the opposite direction, the motor is driven to rotate in the opposite direction, providing a reaction force to suppress the inertial motion of the spherical robot and achieve the effect of emergency braking. At the same time, since the integral deviation is reduced by 10 times, it is insufficient to drive the system to move, thus enabling it to stop after emergency braking.
[0244] Preferably, the control method further includes controlling the speed difference between the left wheel of the left motor and the right wheel of the right motor to achieve the steering of the spherical robot;
[0245] The formula for calculating steering is as follows:
[0246] pid.sv turn =pid.sv turn -(PS2 RX / 127);
[0247] in:
[0248] pid.sv turn Indicates the target yaw angle of the steering ring;
[0249] PS2 RX This indicates the digital value of the X-axis of the right joystick on the controller.
[0250] In this application, the spherical robot's steering is achieved by giving the left and right wheel motors different speed outputs to form a speed difference. This speed difference drives the robot to turn left or right. The robot's steering is achieved by decreasing the speed of one wheel and increasing the speed of another wheel.
[0251] like Figure 13 As shown, this method first determines whether the spherical robot needs to move by reading the joystick value of the handle. If a movement command is received, the system's control variables will be changed according to the read joystick value, thereby realizing the movement requirements of omnidirectional movement or emergency braking.
[0252] The above method can significantly improve the stability of spherical robot control. Furthermore, by employing the four-point spherical fixation principle, four points not on the same plane are selected inside the spherical shell to define four driving points that contact the shell. These four driving points are in close contact with the shell, and the active motion provided by the lower drive wheel provides the internal drive system with the driving force to rotate, thus altering the overall mass distribution of the spherical robot and driving its movement. Simultaneously, the contact between the four points and the shell also provides a fixing effect, preventing the robot from "flying off the sphere" when the internal drive mechanism moves excessively, further enhancing structural stability.
[0253] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Therefore, any modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the scope of the present invention.
Claims
1. A control method for a spherical robot, characterized in that, Includes the following steps: Step A: Power on the main system used to control the spherical robot, initialize the spherical robot and all peripherals, simultaneously enable the external interrupt of the gyroscope, and enter the main system loop; Step B: The main function of the main system constantly checks for external interrupt information from the gyroscope. If no interrupt information is detected, the main function opens the display screen and shows the set parameter data, while the main system performs a delay every preset time. If an interrupt information is detected, proceed to step C: Step C: The main function jumps to the gyroscope interrupt function, clears the interrupt flag and inverts the frequency divider flag; When the frequency division flag is 1, read the three-axis attitude angles, perform one handheld control operation, and return to the main function; When the frequency division flag is 0, the PID calculation is executed and the main function is returned. In step C, the handle control operation is performed, including: Read the key value code of the handle and determine the function corresponding to the key value code. The function corresponding to the key value code includes increasing or decreasing the steering ring KP, increasing or decreasing the steering ring Kd, turning the system on, turning the system off, increasing or decreasing the overall parameters of the speed ring, increasing or decreasing the balance ring KP, and increasing or decreasing the balance ring Kd. Alternatively, it can read analog signals from the joystick and convert them into digital signals that the main system can recognize, including: reading digital information from the left joystick's Y-axis to set the spherical robot's movement speed and direction control, and reading digital information from the right joystick's X-axis to set the spherical robot's target yaw angle; In step C, PID calculation is performed, including: Step C1: Define the total ignition gain coefficient and PWM output value of the left and right motors of the spherical robot; Step C2: Clear the three closed-loop output values of the previous PID calculation, and determine whether the three-axis attitude angles have been read. If not, exit the current PID calculation. If the reading is obtained, the three-axis angular velocity of the gyroscope is acquired, and it is determined whether the main system running flag is 1. If not, the current PID calculation is exited; if so, the encoder values of the left and right motors are read, the ignition gain of the left and right motors is adjusted, and the actual roll angle measurement value is obtained. Step C3: Determine if the spherical robot's speed is 0. If it is, enable the output of the three-loop calculation: balance loop, speed loop, and steering loop; if not, enable the output of the speed loop and steering loop calculation. Step C4: The calculation result of step C3 is used for speed limiting control and output to the left and right motors of the spherical robot to control the movement of the spherical robot.
2. The control method for a spherical robot according to claim 1, characterized in that: In step C3, enabling the output of the balance ring operation includes: Read the roll angle and angular velocity of the spherical robot; Compare the current roll angle with the set target angle to obtain the roll angle deviation, and obtain the balance ring ratio term based on the roll angle deviation; The differential term of the balance loop is obtained based on the angular velocity of the current roll angle; When the direction of the angular velocity is the same as the output direction of the proportional term of the balance ring, the current angle deviation increases, and the differential term of the balance ring outputs a PWM control signal that is the same as the output of the proportional term of the balance ring. When the direction of the angular velocity is opposite to the output direction of the proportional term of the balance loop, the current angle deviation decreases, and the differential term of the balance loop outputs a PWM control signal that is opposite to the output of the proportional term of the balance loop. The formula for calculating the balance ring is as follows: ; in: This indicates the output value of the balance ring; This represents the proportional term parameter of the balance ring; Indicates the roll angle; Indicates the target roll angle; Indicates the roll angle angular velocity; This represents the differential parameters of the equilibrium ring.
3. The control method for a spherical robot according to claim 1, characterized in that: In step C3, enabling the velocity loop calculation output includes: Read the encoder values of the left and right motors of the spherical robot and the set target speed; The sum of the encoder values of the left and right motors is taken as the actual speed, and the difference between the actual speed and the target speed is used to obtain the speed deviation and the deviation integral. The proportional and integral terms of the speed loop are calculated separately. Based on the proportional and integral terms of the speed loop, the output value of the speed loop is obtained to control the speed of the left and right motors, so as to maintain the self-balance of the spherical robot or give the spherical robot a forward or backward power output. The formula for calculating the velocity loop is as follows: ; in: This indicates the speed loop output value; This represents the proportional parameter of the speed loop; This indicates the speed difference between the left and right motors; Indicates the parameters of the velocity loop integral term; This represents the total amount of the integral.
4. The control method for a spherical robot according to claim 1, characterized in that: In step C3, enabling the steering loop calculation output includes: Read the yaw angle and angular velocity; The difference between the current yaw angle and the target yaw angle is used to obtain the yaw angle deviation. The steering ring proportional term is obtained based on the yaw angle deviation; The steering loop differential term is obtained based on the angular velocity of the yaw angle; When the direction of the angular velocity is the same as the output direction of the proportional term of the steering ring, the current angle deviation increases, and the differential term of the steering ring outputs a PWM control signal that is the same as the output of the proportional term of the steering ring. When the direction of the angular velocity is opposite to the output direction of the proportional term of the steering ring, the current angle deviation decreases, and the differential term of the steering ring outputs a PWM control signal that is opposite to the output of the proportional term of the steering ring. The formula for calculating the steering ring is as follows: ; in: Indicates the steering ring output value; This indicates the steering ring proportional parameter; Indicates the yaw angle; Indicates the target yaw angle; Indicates yaw angle and angular velocity; This represents the differential parameters of the steering ring.
5. The control method for a spherical robot according to claim 1, characterized in that: Step C includes: Based on the actual motion information of the spherical robot, the calculation results of the balance loop, velocity loop and steering loop are output to the left and right motors respectively to control the posture and speed of the spherical robot in parallel. The output of the left motor on the left wheel is: ; The output of the right motor's right wheel is: ; in: Indicates the output of the left wheel; Indicates the output of the right wheel; This represents the ignition gain coefficient of the revolver; This represents the ignition gain coefficient of the right wheel; This represents the PWM output value of the balancing loop; This represents the PWM output value of the speed loop; This represents the PWM output value of the steering ring.
6. The control method for a spherical robot according to claim 1, characterized in that: The spherical robot's forward and backward movements are controlled by analog signals from the joystick. The formulas for forward and backward movement are as follows: ; in: This indicates the set speed of the spherical robot; Indicates the speed increment factor; This indicates the digital value representing the Y-axis of the left joystick on the controller; The braking system of the spherical robot is controlled by the following formula: ; ; in: This represents the integral deviation in the velocity loop of the spherical robot.
7. The control method for a spherical robot according to claim 6, characterized in that: The control method also includes controlling the speed difference between the left wheel of the left motor and the right wheel of the right motor to achieve the steering of the spherical robot; The formula for calculating steering is as follows: ; in: Indicates the target yaw angle of the steering ring; This indicates the digital value of the X-axis of the right joystick on the controller.
8. A spherical robot, characterized in that: The application includes the control method for the spherical robot as described in any one of claims 1-7; The spherical robot includes a spherical shell and a drive and control device disposed inside the spherical shell; The drive device includes a mounting platform and drive components; The drive assembly includes a drive wheel, a driven wheel, and a drive motor; The installation platform includes a stable base disposed below the interior of the spherical shell, and a drive motor is installed on each side of the stable base, with each drive motor having a drive wheel installed on it. The stable base has support arms extending upwards on both sides, and each support arm is equipped with a driven wheel. Each of the driving wheel and the driven wheel contacts the inner wall of the spherical shell to form four driving points that are not on the same plane; The control device is installed in the middle of the stable base. The control device is used to receive instructions from the handle to drive the drive device to move the spherical shell.
Citation Information
Patent Citations
Spherical robot
CN218907439U