Balance vehicle control method, balance vehicle, and balance vehicle obstacle avoidance and following operation method
By obtaining the inclination angle and inclination speed of the model of the balancing car, combined with proportional differential or proportional integral differential control, and using PWM duty cycle to control the motor, the problem of balance control of the balancing car under complex conditions is solved, and a stable and robust balancing car is achieved. control system.
Patent Information
- Application Number
- CN202011383592.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-12-01
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-12-01
AI Technical Summary
Existing technology makes it difficult to stably control a balancing car and maintain its balance under various complex conditions, especially in acceleration and deceleration, following and obstacle avoidance scenarios.
By obtaining the inclination angle and inclination speed of the balance car model, the target acceleration is determined, and the PWM duty cycle is used to control the motor running speed, and a restoring force proportional to the inclination angle and a damping force proportional to the angular velocity are applied to achieve balance control. Specific methods include using MPU6050 to detect angular velocity and acceleration, performing integral operations and filtering fusion, and combining proportional differential or proportional integral differential control methods to optimize the acceleration control of the balancing vehicle.
It achieves stable balance control of the balancing car under complex conditions, improves the robustness and accuracy of the control system, avoids the influence of sensor errors and external interference, and ensures the effective and stable operation of the balancing car.
Smart Images

Figure CN112298428B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automatic control technology, and in particular to a control method for a balance vehicle, a balance vehicle, and an obstacle avoidance and following operation method for a balance vehicle. Background Art
[0002] With the rapid development of science and technology, more and more balancing cars have entered people's daily lives. Due to the characteristics of small size, flexible movement, zero turning radius, etc., the two-wheeled self-balancing car will have a wide range of application prospects in the civil and military fields. At the same time, it has also opened up a new direction for the research of mobile robots. Compared with traditional mobile robots, the two-wheeled self-balancing car system is a two-wheeled coaxial, independently driven robot device that maintains balance through movement. At the same time, it can move upright and stationary, and has the advantages of high balance, tracking, and strong adaptability.
[0003] How to stably control the balancing vehicle so that it can maintain stable balance under various conditions (such as acceleration and deceleration, following, obstacle avoidance, etc.) is a problem that needs to be further solved in this field. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a control method for a balancing vehicle, a balancing vehicle, and an obstacle avoidance and following operation method for a balancing vehicle, so that the balancing vehicle can maintain a stable balance under various complex conditions.
[0005] In order to achieve the above purpose, the embodiments of the present application are implemented in the following manner:
[0006] In a first aspect, an embodiment of the present application provides a control method for a balance vehicle, which is applied to a balance vehicle, and the method comprises: obtaining a current vehicle model tilt angle and tilt speed of the balance vehicle, wherein the vehicle model tilt angle represents the current tilt angle of the balance vehicle, and the tilt speed represents the angular speed of the balance vehicle; determining a target acceleration for maintaining the balance of the balance vehicle based on the vehicle model tilt angle and the tilt speed; determining a PWM duty cycle for controlling the motor output of the balance vehicle based on the target acceleration, so as to control the operating speed of the motor of the balance vehicle, thereby controlling the balance vehicle to maintain balance.
[0007] In the embodiment of the present application, by obtaining the current car model inclination angle and inclination velocity of the balance car, the current state of the balance car can be accurately judged. In order to maintain the balance of the balance car, it is necessary not only to apply a restoring force proportional to the inclination angle (i.e., the car model inclination angle) to the balance car, but also to apply a damping force proportional to the angular velocity (i.e., the inclination velocity), and the damping force is opposite to the direction of movement. Therefore, the balance control (i.e., upright control) of the balance car can be achieved by controlling the acceleration of the balance car. Therefore, according to the car model inclination angle and the inclination velocity, the target acceleration for maintaining the balance of the balance car can be determined, thereby further determining the PWM duty cycle of the motor output to control the operating speed of the motor of the balance car and achieve the balance control of the balance car. This method can simply and efficiently control the balance (upright control) of the balance car, and this control method has concentrated control elements, which is conducive to maintaining the robustness of the control system.
[0008] In combination with the first aspect, in a first possible implementation of the first aspect, the balance car includes a posture detection module, and the posture detection module is an MPU6050 that integrates a three-axis accelerometer and a three-axis gyroscope. The obtaining of the current vehicle model inclination angle and inclination velocity of the balance car includes: obtaining the angular velocity parameter detected by the MPU6050 to determine the inclination velocity; obtaining the Y-axis acceleration measurement value detected by the MPU6050, and the current linear acceleration of the balance car; determining a first inclination angle of the balance car according to the Y-axis acceleration measurement value, the inclination velocity, and the current linear acceleration of the balance car; integrating the inclination velocity according to the inclination velocity to determine a second inclination angle of the balance car; filtering and fusing the first inclination angle and the second inclination angle to determine the vehicle model inclination angle.
[0009] In this implementation, the angular velocity parameters of the balance car are detected by using MPU6050 (integrated with a three-axis accelerometer and a three-axis gyroscope) (for determining the inclination velocity of the balance car), as well as the Y-axis acceleration measurement value of the balance car and the current linear acceleration of the balance car. The first inclination angle of the balance car is further determined based on the Y-axis acceleration measurement value, the inclination velocity and the linear acceleration. The inclination velocity is integrated to determine the second inclination angle of the balance car based on the inclination velocity, thereby filtering and fusion the first inclination angle and the second inclination angle to determine the inclination angle of the vehicle model. This approach can avoid the accumulated error after integration due to slight deviations and drifts in the angular velocity signal (for example, when the sensor is stationary, the output is not zero) (which will gradually increase over time and fail to output the correct angle signal), and the problem that the angle obtained by the gyroscope integration gradually increases with time due to the error caused by its own zero point drift; it can also avoid the problem that the angle signal measured by the accelerometer will have large glitches when it is disturbed by the outside world, thereby obtaining a stable and accurate car model inclination angle, which is conducive to ensuring that the control method of the balance car maintains the balance effect of the balance car.
[0010] In combination with the first possible implementation manner of the first aspect, in a second possible implementation manner of the first aspect, the Y-axis acceleration measurement value is Accel_Y=g·sinβ+a·cosβ, Accel_Y represents the Y-axis acceleration measurement value, g represents the gravitational acceleration, β represents the first inclination angle, a represents the current acceleration of the balance vehicle, and α represents the inclination velocity. The first inclination angle of the balance vehicle is determined according to the Y-axis acceleration measurement value, the inclination velocity, and the current linear acceleration of the balance vehicle, including: obtaining a distance h from the installation position of the MPU6050 to the motor shaft of the balance vehicle; according to the distance h, the inclination velocity α, the current linear acceleration a1 of the balance vehicle, combined with the formula: a=hα+a1, the current acceleration a of the balance vehicle is determined; according to the determined current acceleration a of the balance vehicle, the Y-axis acceleration measurement value Accel_Y, and the gravitational acceleration g, combined with the formula: Accel_Y=g·sinβ+a·cosβ, the first inclination angle β of the balance vehicle is determined.
[0011] In this implementation, the linear acceleration sensor of the MPU6050 can be used to accurately calculate the first inclination angle of the balancing vehicle, which is beneficial to the stability of the balancing vehicle control method for the balancing vehicle.
[0012] In combination with the first possible implementation manner of the first aspect, in a third possible implementation manner of the first aspect, filtering and fusing the first inclination angle and the second inclination angle to determine the inclination angle of the vehicle model includes: substituting the first inclination angle and the second inclination angle into a complementary filtering relationship: angle = N angle m +(1-N)·(angle+gyro m ·dt), determine the inclination angle of the car model, where angle represents the angle after filtering and fusion, that is, the inclination angle of the car model, angle m represents the first inclination angle, (angle+gyro m ·dt) represents the second inclination angle, dt represents the sampling period, and N represents the filter coefficient.
[0013] In this implementation, the first inclination angle and the second inclination angle can be simply and effectively filtered and fused in this way, thereby ensuring the accuracy and reliability of the determined vehicle model inclination angle, which is beneficial to the balance control of the balancing vehicle.
[0014] In combination with the first aspect, in a fourth possible implementation of the first aspect, a proportional differential control method is used to control the acceleration of the balancing vehicle, and the target acceleration for maintaining the balance of the balancing vehicle is determined according to the inclination angle of the vehicle model and the inclination velocity, including: obtaining a preset first relationship: a 目标 represents the target acceleration, k1 represents the proportional control parameter, k2 represents the differential control parameter, θ represents the inclination angle, i.e. the inclination angle of the vehicle model, represents angular velocity, namely, the tilt angle velocity; according to the tilt angle of the vehicle model and the tilt angle velocity, combined with the first relationship, the target acceleration is determined.
[0015] In this implementation, by controlling the acceleration of the balance vehicle using a proportional differential control method, the control strategy of the balance vehicle can be simplified, so that the control of the balance vehicle can have simple, effective, stable and reliable control characteristics, thereby controlling the balance vehicle to maintain balance, and also realizing balance control of the balance vehicle in various complex scenarios.
[0016] In combination with the first aspect, in a fifth possible implementation of the first aspect, a proportional-integral-differential control method is adopted to control the acceleration of the balancing vehicle, and the target acceleration for maintaining the balance of the balancing vehicle is determined according to the inclination angle of the vehicle model and the inclination velocity, including: obtaining the current running speed of the balancing vehicle; determining the adjustment acceleration of the balancing vehicle according to the running speed and the speed setting value of the balancing vehicle; converting the adjustment acceleration into the adjustment inclination angle of the balancing vehicle; and determining the target acceleration for maintaining the balance of the balancing vehicle under speed control according to the adjustment inclination angle, the vehicle model inclination angle and the inclination velocity.
[0017] In this implementation, the acceleration of the balancing vehicle is controlled by using a proportional-integral-differential control method, and the speed control of the balancing vehicle is used as the input of the balancing control (i.e., the current running speed of the balancing vehicle is obtained, and the adjustment acceleration of the balancing vehicle is determined in combination with the speed setting value of the balancing vehicle, thereby converting it into the adjustment inclination angle of the balancing vehicle). In addition, the speed is controlled by a proportional-integral method, which can avoid the situation where the noise that may exist in the encoder is amplified, eliminate the static error of the system, optimize the control effect and ensure the stability of the control. Using the speed control of the balancing vehicle as the input of the balancing control can avoid the instability caused by the speed control (adding speed negative feedback to the balancing control part will not achieve the purpose of the speed closed loop, and will also destroy the stability of the balancing control. The balancing control in the embodiment of the present application represents the upright control of the balancing vehicle), thereby ensuring the effectiveness and stability of the control method of the balancing vehicle.
[0018] In a second aspect, an embodiment of the present application provides a balancing vehicle, comprising a first wheel and a second wheel, a base plate, a first motor and a second motor, a first transmission mechanism and a second transmission mechanism, and a main board of the balancing vehicle, wherein the main board is arranged on the base plate, and the ultrasonic obstacle avoidance module and the linear CCD tracking module connected in the main board face the same direction; the first motor and the second motor are arranged on the base plate, the output end of the driving module in the main board is connected to the first motor and the second motor, and the first motor is connected to the first wheel through the first transmission mechanism, and the second motor is connected to the second wheel through the second transmission mechanism; the main board is preset with a control program of the control method of the balancing vehicle described in any one of the first aspect or the possible implementation methods of the first aspect, which is used to control the operation of the balancing vehicle and maintain balance.
[0019] In a third aspect, an embodiment of the present application provides an ultrasonic obstacle avoidance operation method for a balancing vehicle, which is applied to the balancing vehicle described in the second aspect, and the method includes: obtaining an ultrasonic signal detected by the ultrasonic obstacle avoidance module, and determining the obstacle distance between the balancing vehicle and the obstacle corresponding to the ultrasonic signal; judging whether the obstacle distance is less than a first preset distance value; if the obstacle distance is less than the first preset distance value, controlling the balancing vehicle to accelerate and retreat while maintaining balance until the obstacle distance corresponding to the ultrasonic signal most recently detected by the ultrasonic obstacle avoidance module is not less than the first preset distance value.
[0020] In the embodiment of the present application, the ultrasonic signal detected by the ultrasonic obstacle avoidance module can be used to determine the distance of the obstacle, thereby achieving obstacle avoidance operation of the balancing vehicle while maintaining the balance of the balancing vehicle.
[0021] In a fourth aspect, an embodiment of the present application provides a linear CCD tracking and following method for a balancing vehicle, which is applied to the balancing vehicle described in the second aspect, and the method includes: obtaining a linear image signal detected by the linear CCD tracking module, and determining a following distance between the balancing vehicle and a followed object corresponding to the linear image signal; judging whether the following distance is less than a second preset distance value; if the following distance is not less than the second preset distance value, controlling the balancing vehicle to accelerate while maintaining balance until the following distance corresponding to the linear image signal most recently detected by the linear CCD tracking module is less than the second preset distance value.
[0022] In the embodiment of the present application, the linear image signal detected by the linear CCD tracking module can be used to determine the following distance, thereby achieving the following operation of the balancing vehicle while maintaining the balance of the balancing vehicle.
[0023] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0025] Figure 1 A schematic diagram of an obstacle avoidance and following system for a balancing vehicle provided in an embodiment of the present application.
[0026] Figure 2 A circuit diagram of the main control module provided in an embodiment of the present application.
[0027] Figure 3 A circuit diagram of a power module provided in an embodiment of the present application.
[0028] Figure 4 A circuit diagram of a power detection module provided in an embodiment of the present application.
[0029] Figure 5 A circuit diagram of a posture detection module provided in an embodiment of the present application.
[0030] Figure 6 A circuit diagram of a display module provided in an embodiment of the present application.
[0031] Figure 7 A circuit diagram of a driving module provided in an embodiment of the present application.
[0032] Figure 8 A schematic diagram of the structure of a balancing vehicle provided in an embodiment of the present application.
[0033] Fig. 9 A flow chart of a control method for a balancing vehicle provided in an embodiment of the present application.
[0034] Fig.10 A schematic diagram of proportional differential control of a balancing vehicle provided in an embodiment of the present application.
[0035] Fig.11 A schematic diagram of proportional-integral-derivative control of a balancing vehicle provided in an embodiment of the present application.
[0036] Fig.12 A control schematic diagram of an evolved balancing vehicle provided in an embodiment of the present application.
[0037] Fig.13 A flowchart of an ultrasonic obstacle avoidance operation method for a balancing vehicle provided in an embodiment of the present application.
[0038] Fig.14 A flow chart of a linear CCD tracking and following method for a balancing vehicle provided in an embodiment of the present application.
[0039] Fig.15 A control algorithm flow chart of a balancing vehicle provided in an embodiment of the present application.
[0040] Icons: 100-balance car obstacle avoidance and following system; 110-main control module; 120-power module; 130-power detection module; 140-ultrasonic obstacle avoidance module; 150-linear CCD tracking module; 160-posture detection module; 170-display module; 180-drive module; 191-wireless communication module; 192-serial port debugging module; 200-balance car; 210-bottom plate; 220-main board; 230-first wheel; 240-second wheel; 250-first motor; 260-second motor; 270-first transmission mechanism; 280-second transmission mechanism. DETAILED DESCRIPTION
[0041] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0042] See also Figure 1 , Figure 1 A schematic diagram of an obstacle avoidance and following system 100 for a balancing vehicle provided in an embodiment of the present application.
[0043] In the embodiment of the present application, the balancing vehicle obstacle avoidance and following system 100 may include a main control module 110, a display module 170, a power module 120, a driving module 180, an ultrasonic obstacle avoidance module 140, a posture detection module 160, and a linear CCD tracking module 150. In addition, it may also include a wireless communication module, a power detection module 130, a serial port debugging module 192, etc., which are not limited here.
[0044] Exemplarily, the main control module 110 may be STM32F405RG. Of course, other types of single-chip microcomputers may also be used, such as 51 series single-chip microcomputers. In this embodiment, STM32F405RG is taken as an example, but this is not limited here.
[0045] See also Figure 2 , Figure 2 1 is a circuit diagram of the main control module 110 provided in the embodiment of the present application. Since multiple modules are connected to the main control module 110, and the pin numbers of the main control module 110 are already in Figure 2 Therefore, the specific connection lines are shown in Figure 2 The detailed description is not given here.
[0046] Exemplarily, the power supply module 120 can be respectively connected to other modules in the balance vehicle obstacle avoidance and following system 100 (such as the main control module 110, the display module 170, the drive module 180, the ultrasonic obstacle avoidance module 140, the posture detection module 160, the linear CCD tracking module 150, etc.) to provide power for its normal operation.
[0047] The power module 120 may include a power supply, a first transformer module, and a second transformer module. After the first transformer module is connected to the power supply, the power supply voltage is converted to 5V and then output. The second transformer module is connected to the first transformer module and converts the 5V voltage to 3.3V and then outputs. The power supply may be provided by multiple batteries connected in series, for example, 3 batteries are connected in series to provide a 12V power supply voltage.
[0048] See also Figure 2 and Figure 3 , Figure 3 The circuit diagram of the power module 120 provided in the embodiment of the present application. The LM2596T chip can be used to convert the 12V voltage into the 5V voltage, and the AMS1117 chip can be used to convert the 5V voltage into the 3.3V voltage and output it to power the balance vehicle obstacle avoidance and following system 100. The specific connection circuit is shown in Figure 2 and Figure 3 The details are not described here.
[0049] By setting up a first transformer module and a second transformer module, the power supply voltage can be converted into a required stable voltage. For example, the first transformer module can convert it into a 5V voltage, and the second transformer module can convert the 5V voltage into a 3.3V voltage. This can facilitate providing a stable power supply for the balance vehicle obstacle avoidance and following system 100.
[0050] For example, when the power supply is fully charged, the voltage is 12.6V. Over-discharge (voltage lower than 9.6V) will inevitably lead to permanent over-discharge of the battery. Therefore, it is necessary to monitor the changes in the battery voltage to approximately indicate the battery power so as to remind charging when the battery power is relatively low.
[0051] Exemplarily, the power detection module 130 of the self-balancing vehicle obstacle avoidance and following system 100 can measure the battery voltage by using a high-precision resistor voltage divider. Specifically, the power detection module 130 can be connected between the power module 120 and the main control module 110 to detect the power supply voltage value, and the power detection module 130 can also be connected to the input end of the main control module 110 to transmit the detected power supply voltage value to the main control module 110.
[0052] See also Figure 2 and Figure 4 , Figure 4 1 is a circuit diagram of the power detection module 130 provided in an embodiment of the present application. For example, the power detection module 130 can measure the source voltage by using a high-precision resistor voltage divider. The specific connection circuit of the power detection module 130 is shown in FIG. Figure 2 and Figure 4The power detection module 130 can detect the voltage of the power supply, thereby inferring the remaining power of the power supply, which is helpful to remind the user of the remaining power of the power supply, charge in time, and avoid the problem of over-discharge.
[0053] Exemplarily, the ultrasonic obstacle avoidance module 140 is connected to the power module 120 and to the input port of the main control module 110 , so that the detected ultrasonic signal can be sent to the main control module 110 .
[0054] For example, the operation mode of the self-balancing vehicle preset in the self-balancing vehicle obstacle avoidance and following system 100 may include an ultrasonic obstacle avoidance mode, and the self-balancing vehicle may enter the ultrasonic obstacle avoidance mode by pressing and holding the user key for 2 seconds. At this time, the self-balancing vehicle obstacle avoidance and following system 100 may use the ultrasonic obstacle avoidance module 140 to perform ultrasonic detection on the environment in which the self-balancing vehicle is running, thereby sending the detected ultrasonic signal to the main control module 110.
[0055] Exemplarily, the linear CCD tracking module 150 is connected to the power module 120, and the linear CCD tracking module 150 is also connected to the input port of the main control module 110 after being connected to the filtering circuit, so as to send the detected linear image signal to the main control module 110. The peripheral components of the linear CCD tracking module 150 can be very few, for example, the output signal of the linear CCD tracking module 150 can be directly connected to the AD port of the main control chip after being processed by filtering, so as to provide the main control chip with the detected linear image signal.
[0056] Exemplarily, the posture detection module 160 is connected to the power module 120 and to the input port of the main control module 110 , so as to send the detected real-time posture signal of the balancing vehicle to the main control module 110 .
[0057] See also Figure 2 and Figure 5 , Figure 5 The circuit diagram of the posture detection module 160 provided in the embodiment of the present application. The specific connection circuit of the posture detection module 160 is shown in Figure 2 and Figure 5The MPU6050 is the world's first integrated 6-axis motion processor that integrates a 3-axis gyroscope and a 3-axis accelerometer, and can accurately detect the posture of the car in real time. The angular velocity sensing range of the MPU6050 is ±250, ±500, ±1000 and ±2 000° / s, and the acceleration sensing range is ±2g, ±4g, ±8g and ±16g. The acceleration sensing range can be controlled by programming. The MPU6050 can operate at different voltages, and the VDD supply voltage is (2.5±0.125)V, (3.0±0.15)V or (3.3±0.165)V. The balance car obstacle avoidance and following system 100 can provide a 3.3V DC power supply for the MPU6050. And MPU6050 can be used as a slave, using SDA and SCL ports to communicate with the host STM32 (i.e., the main control module 110). The data detected by MPU6050 is converted by the built-in 16-bit AD converter, and then the 16-bit digital quantity is sent to the main control module 110 through the I2C bus interface.
[0058] Exemplarily, the display module 170 is connected to the power module 120, and the display module 170 is also connected to the output port of the main control module 110, so as to receive the display information sent by the main control module 110 for display, and display it through the screen. The display module 170 can use an OLED display screen, so that more information can be displayed at the same time, so that the user can view various information of the balance car in real time. Of course, in some other possible implementations, the display module 170 can also use other types of display screens, such as LCD display screens, LED display screens, etc., which are not limited here.
[0059] See also Figure 2 and Figure 6 , Figure 6 A circuit diagram of a display module 170 provided in an embodiment of the present application. Among them, pin 1 of the display module 170 can be grounded, pin 2 can be connected to a power supply, and pins 3 to 6 can be connected to output ports (i.e., pins PC13, PC14, PC15, PC0) of a main control module 110 (taking STM32F405RG as an example), respectively, thereby realizing a circuit connection between the display module 170 and the main control module 110. Of course, depending on the different components such as the main control module 110 and the display module 170, there can be different circuit designs, which are not limited here.
[0060] The OLED liquid crystal display screen is selected as the display module 170, which can display six lines of data. For example, the first line of the display module 170 can display the operation mode of the filter and the car; the second line can display the current temperature and ultrasonic measurement value; the third line can display the left wheel encoder speed; the fourth line can display the right wheel encoder speed; the fifth line can display the battery voltage (i.e., the remaining power); and the sixth line can display the balance inclination angle of the car. Of course, this is only an exemplary way of displaying information. There are other display methods, such as different numbers of displayed lines, different types of displayed information, etc., which are not limited here.
[0061] Exemplarily, the drive module 180 can be connected to the power module 120, and to the output port of the main control module 110, so that the drive module 180 can receive the control instructions sent by the main control module 110 to control the drive motor, thereby controlling the movement, posture, movement mode and other aspects of the balance vehicle.
[0062] See also Figure 2 and Figure 7 , Figure 7 The circuit diagram of the driving module 180 provided in the embodiment of the present application. The specific connection circuit of the driving module 180 is shown in Figure 2 and Figure 7 The drive module 180 can be TB6612FNG, which is a DC motor driver produced by Toshiba Semiconductor. It has a high-current MOSFET-H bridge structure and dual-channel circuit output, and can drive two motors at the same time. This is conducive to simplifying the overall design of the balance car obstacle avoidance and following system 100, and there is no need to use two drivers to drive different motors (corresponding to the two wheels of the balance car). TB6612FNG outputs a maximum continuous drive current of 1.2A per channel, and the starting peak current reaches 2A / 3.2A (continuous pulse / single pulse); 4 motor control modes: forward / reverse / brake / stop; PWM supports a frequency of up to 100kHz; standby state: on-chip low-voltage detection circuit and thermal shutdown protection circuit; operating temperature: -20~85℃; SSOP24 small chip package. TB6612FNG is a MOSFET-based H-bridge integrated circuit, which is more efficient than a transistor H-bridge driver. Compared with the average 600mA driving current and 1.2A pulse peak current per channel of L293D, its output load capacity has doubled. Compared with the heat dissipation and peripheral diode freewheeling circuit of L298N, it does not require an external heat sink, the peripheral circuit is simple, and it can directly drive the motor with only an external power filter capacitor, which is conducive to reducing the size of the system. For PWM signals, it supports frequencies up to 100kHz, which is also a big advantage over the 5kHz and 40kHz of the above two chips.
[0063] The balance car obstacle avoidance following system 100 in this embodiment uses a small 12V DC motor as an example, and its speed is determined by the voltage applied to the motor, and the steering is by changing the positive and negative polarity of the motor power supply. The drive module 180 outputs two PWM signals, and during use, the duty cycle of one of them is zero, and the other is not zero to control the forward and reverse rotation of the motor. The set value of the motor voltage is not directly used to control the motor, but is converted into a PWM duty cycle, and the acceleration and deceleration control of the motor is realized by increasing or decreasing the PWM duty cycle. The PWM signal after the PID control algorithm is sent directly to the DC motor drive module 180 by the STM32 controller (i.e., the main control module 110), so as to control the speed and direction of the DC motor (the turning process of the balance car can be realized by controlling the speed difference of the two motors).
[0064] Exemplarily, the wireless communication module 191 is connected to the power module 120, and the wireless communication module 191 is connected to the data communication port of the main control module 110. By setting the wireless communication module 191, wireless data communication between the self-balancing vehicle obstacle avoidance and following system 100 and other intelligent terminals (such as host computers, smart phones, tablet computers and other intelligent control terminals) can be realized, which is conducive to realizing remote control and function expansion of the self-balancing vehicle, thereby improving the performance of the self-balancing vehicle.
[0065] For example, the wireless communication module 191 may be a Bluetooth module, which can ensure the communication quality while controlling the cost. Of course, the wireless communication module 191 may also be other modules, such as a WIFI module, which is not limited here.
[0066] In addition, the serial port debugging module 192 can be used as an interface for debugging the self-balancing vehicle obstacle avoidance and following system 100 , which facilitates the debugging of the self-balancing vehicle obstacle avoidance and following system 100 .
[0067] Of course, the self-balancing vehicle obstacle avoidance and following system 100 may also include some other modules, such as a voltage stabilization module, so as to expand the functions of the self-balancing vehicle obstacle avoidance and following system 100, which is not specifically limited here.
[0068] The obstacle avoidance and following system 100 of the balancing vehicle can be preset with different modes, such as following mode, obstacle avoidance mode, etc., which can be controlled by buttons or by a host computer, which is not limited here. For example, you can enter the ultrasonic obstacle avoidance mode by pressing and holding the button for 2 seconds. The OLED display can show that the car has entered the obstacle avoidance mode and display the distance ahead in real time. If you need to switch to the following function, you only need to customize the button on the host computer to switch from the obstacle avoidance mode to the following mode.
[0069] Since the obstacle avoidance and following system 100 of the balancing vehicle can perform real-time detection and feedback of environmental information through the ultrasonic obstacle avoidance module 140, the posture detection module 160, the linear CCD tracking module 150, etc., the obstacle avoidance and following system 100 of the balancing vehicle can use this information in a variety of ways to control the balancing vehicle, so that the balancing vehicle can realize functions such as ultrasonic obstacle avoidance and linear CCD tracking and following, and can display key information in real time through the display screen (such as the operating mode of the filter and the vehicle, the current temperature, the ultrasonic measurement value, the left wheel encoder speed, the right wheel encoder speed, the battery voltage, the balance inclination angle of the vehicle, and other important information), so that the user can directly understand this information through the display screen of the display module 170 instead of through the host computer or wireless terminal, thereby improving the practicality of the balancing vehicle.
[0070] In addition, the balancing car obstacle avoidance and following system 100 can monitor the balancing car in all directions. For example, it is equipped with a battery monitoring function. When the battery is less than 20%, the host computer will notify the user to charge. It can display the speed information of the two wheels of the car in real time. It can also display the balance inclination of the car in real time. It can also display the received instructions of the lower computer of the car in real time. Multi-channel waveform display: supports waveform display of up to 5 channels, and the name of each waveform channel can be customized. You can choose to open or close any channel. The coordinate axis can be adaptively changed according to the input value. The numerical display of each point can be opened or closed in real time, and the waveform details can be enlarged or reduced.
[0071] See also Figure 8 , Figure 8 A schematic diagram of the structure of a balancing vehicle 200 provided in an embodiment of the present application.
[0072] In this embodiment, the balance vehicle 200 may include a first wheel 230 and a second wheel 240 (i.e., the left wheel and the right wheel of the balance vehicle), a base plate 210, a first motor 250 and a second motor 260 (i.e., the left wheel motor and the right wheel motor of the balance vehicle), a first transmission mechanism 270 and a second transmission mechanism 280 (i.e., the left wheel transmission and the right wheel transmission of the balance vehicle), and a mainboard 220 integrated with the balance vehicle obstacle avoidance and following system 100 in this embodiment.
[0073] Exemplarily, the main board 220 can be set on the base plate 210, wherein the ultrasonic obstacle avoidance module 140 and the linear CCD tracking module 150 connected in the main board 220 can face the same direction, and the first motor 250 and the second motor 260 are set on the base plate 210, and the output end of the driving module 180 in the main board 220 is connected to the first motor 250 and the second motor 260, and the first motor 250 is connected to the first wheel 230 through the first transmission mechanism 270, and the second motor 260 is connected to the second wheel 240 through the second transmission mechanism 280, so that the balance vehicle obstacle avoidance and following system 100 of the main board 220 controls the operation of the balance vehicle 200.
[0074] The above is an introduction to the balancing vehicle provided in the embodiment of the present application. The following is an introduction to a control method for a balancing vehicle provided in the embodiment of the present application. The control method for a balancing vehicle can be applied to a balancing vehicle (or a mainboard of a balancing vehicle). Therefore, a control program of the control method for a balancing vehicle can be preset in the mainboard of the balancing vehicle to realize balance control of the balancing vehicle.
[0075] See also Fig. 9 , Fig. 9 A flowchart of a control method for a self-balancing vehicle provided in an embodiment of the present application. In this embodiment, the control method for a self-balancing vehicle may include step S10, step S20 and step S30.
[0076] In order to facilitate the understanding of this scheme, the balance control principle of the balance car is briefly introduced here. Since the balance control of the balance car is achieved through negative feedback, and the balance car has two wheels on the ground, the body will tilt in the direction of the wheel rolling. Therefore, controlling the rotation of the wheels and offsetting the tendency to tilt in one dimension can keep the body balanced. The angle at which the balance car deviates from the equilibrium position is taken as the deviation, and the control goal is to make this deviation close to zero through negative feedback control. In order to maintain the balance of the balance car, it is necessary not only to apply a restoring force proportional to the inclination angle (i.e. the inclination angle of the car model) to the balance car, but also to apply a damping force proportional to the angular velocity (i.e. the inclination velocity), and the damping force is opposite to the direction of movement, and the corresponding restoring force and damping force can be provided through the acceleration control of the balance car. Therefore, the balance control (i.e. upright control) of the balance car can be achieved through the acceleration control of the balance car.
[0077] In order to achieve control of the self-balancing vehicle (in this embodiment, it refers to upright control and balance control, which means control performed to maintain the balance of the self-balancing vehicle), step S10 may be executed.
[0078] Step S10: obtaining the current vehicle model tilt angle and tilt speed of the balancing vehicle, wherein the vehicle model tilt angle represents the current tilt angle of the balancing vehicle, and the tilt speed represents the angular speed of the balancing vehicle.
[0079] In this embodiment, in order to obtain the balance deviation of the balance vehicle, the balance vehicle (the executor of the control method may be the balance vehicle or the main board, which is not limited here and will not be described in detail later) may obtain the current vehicle model inclination angle and inclination speed of the balance vehicle.
[0080] In order to ensure the simplicity and reliability of obtaining the vehicle model inclination angle and inclination speed, the balance car in the embodiment of the present application adopts the MPU6050 integrated with a three-axis accelerometer and a three-axis gyroscope as the posture detection module of the balance car, so as to accurately obtain the vehicle model inclination angle and inclination speed of the balance car. In addition, the parameters detected by the three-axis accelerometer and the three-axis gyroscope can be obtained by a single module of MPU6050, which is also conducive to streamlining the structure of the balance car.
[0081] By measuring the inclination angle and inclination speed of the balancing car model, the acceleration of the wheels of the balancing car is controlled to eliminate the inclination of the balancing car, thereby maintaining the balance of the balancing car (i.e. keeping the balancing car upright). Therefore, the measurement of the inclination angle and inclination speed of the car model is a key factor in controlling the balance of the balancing car. The measurement of the inclination angle and inclination speed of the car model can be achieved by the acceleration sensor and gyroscope installed on the car model, and the MPU6050 integrates a three-axis accelerometer and a three-axis gyroscope. Therefore, after obtaining the parameters of the MPU6050 and performing corresponding processing, the inclination angle and inclination speed of the balancing car model can be detected.
[0082] The tilt velocity of the balancing car can be measured by an angular velocity sensor (i.e., a gyroscope), and the angular velocity sensor outputs the angular velocity, which is not affected by the movement of the car, so the accuracy and reliability can meet the requirements. The tilt angle of the balancing car model can be measured by an acceleration sensor or an angular velocity sensor, but the angle signal measured by the acceleration sensor will have a large burr when it is disturbed by the outside world; and the method of integrating the angular velocity to obtain the angle (i.e., the method of using the angular velocity sensor to measure the tilt angle of the balancing car model) requires an integral operation. If there is a slight deviation and drift in the angular velocity signal, for example, when the sensor is stationary, the output is not zero, then after the integral operation, the change forms an accumulated error, which will gradually increase with the extension of time, so that the correct angle signal cannot be output, and the angle obtained by integrating the angular velocity will gradually increase with time due to the zero drift of the angular velocity sensor itself, and the error will become larger and larger. Therefore, for the measurement of the tilt angle of the car model, calibration is required to ensure the accuracy and reliability of the tilt angle of the car model.
[0083] For example, the self-balancing vehicle can obtain the angular velocity parameters detected by the MPU6050 to determine the tilt angle velocity, and obtain the Y-axis acceleration measurement value detected by the MPU6050, the current linear acceleration of the self-balancing vehicle and other parameters. Then, the balance can determine the first tilt angle of the self-balancing vehicle (i.e., the tilt angle of the vehicle model measured by the acceleration sensor) according to the Y-axis acceleration measurement value, the tilt angle velocity, and the current linear acceleration of the self-balancing vehicle; and according to the tilt angle velocity, the tilt angle velocity is integrated to determine the second tilt angle of the self-balancing vehicle (i.e., the tilt angle of the vehicle model measured by the angular velocity sensor), thereby filtering and fusing the first tilt angle and the second tilt angle (i.e., calibrating the tilt angle of the vehicle model) to determine the tilt angle of the vehicle model.
[0084] By using MPU6050 (with integrated three-axis accelerometer and three-axis gyroscope), the angular velocity parameters of the balance car are detected (for determining the inclination velocity of the balance car), as well as the Y-axis acceleration measurement value of the balance car and the current linear acceleration of the balance car. The first inclination angle of the balance car is further determined according to the Y-axis acceleration measurement value, the inclination velocity and the linear acceleration. The inclination velocity is integrated according to the inclination velocity to determine the second inclination angle of the balance car, thereby filtering and fusing the first inclination angle and the second inclination angle to determine the inclination angle of the vehicle model. This approach can avoid the accumulated error after integration due to slight deviations and drifts in the angular velocity signal (for example, when the sensor is stationary, the output is not zero) (which will gradually increase over time and fail to output the correct angle signal), and the problem that the angle obtained by the gyroscope integration gradually increases with time due to the error caused by its own zero point drift; it can also avoid the problem that the angle signal measured by the accelerometer will have large glitches when it is disturbed by the outside world, thereby obtaining a stable and accurate car model inclination angle, which is conducive to ensuring that the control method of the balance car maintains the balance effect of the balance car.
[0085] In this embodiment, the Y-axis acceleration measurement value obtained is Accel_Y, and
[0086] Accel_Y=g·sinβ+a·cosβ, (1)
[0087] Wherein, g represents the acceleration due to gravity, β represents the first inclination angle, and a represents the current acceleration of the balancing vehicle.
[0088] Then, according to the Y-axis acceleration measurement value, the inclination velocity, and the current linear acceleration of the self-balancing vehicle, the specific method of determining the first inclination angle of the self-balancing vehicle can be: obtain the distance h from the installation position of the MPU6050 to the motor shaft of the self-balancing vehicle; then according to the distance h, the inclination velocity α, and the current linear acceleration a1 of the self-balancing vehicle, combined with formula (2):
[0089] a=hα+a1, (2)
[0090] The current acceleration a of the self-balancing vehicle can be determined, and then the first inclination angle β of the self-balancing vehicle can be determined according to the current acceleration a of the self-balancing vehicle, the inclination velocity α, the Y-axis acceleration measurement value Accel_Y, and the gravity acceleration g, combined with formula (1).
[0091] In this way, the linear acceleration sensor of the MPU6050 can be used to accurately calculate the first inclination angle of the balancing vehicle, which is beneficial to the stability of the balancing vehicle control method for the balancing vehicle.
[0092] It should be noted that the distance h from the installation position of the MPU6050 to the motor shaft of the balancing car, in theory, the MPU6050 should be installed as close to the motor shaft as possible to reduce the influence of the angular acceleration of the balancing car on the angle measurement. However, in engineering practice, installing the MPU6050 too close to the motor shaft will make the sensor (MPU6050) susceptible to the influence of the motor, resulting in reduced stability. Moreover, even if the angular acceleration of the movement is avoided, the linear acceleration is unavoidable, so it is impossible to completely eliminate the influence of the movement acceleration on the angle measurement. Therefore, illustratively, h can be 30 to 90% of the overall height of the balancing car, and the motor shaft is usually installed in the bottom area of the balancing car, but this is not limited here.
[0093] Exemplarily, the inclination angle velocity is determined by acquiring the angular velocity parameters detected by MPU6050, and then further integrated to obtain the second inclination angle. The specific method may be: by reading the angular velocity parameters detected by the angular velocity sensor (MPU6050), performing corresponding transformation to obtain the inclination angle velocity of the balancing vehicle and then integrating it.
[0094] For example, in a 5ms timer interrupt service function, execute the following statement: Angel_X = Angel_X-Gyro_X*0.005, where Angel_X represents the second inclination angle, and Gyro_X is the output of the angular velocity sensor, and the unit at this time is ° / s (degrees per second).
[0095] The raw data of the angular velocity sensor output by MPU6050 is -32768~32768. To convert it into data in ° / s, it can be converted according to the following statement: Gyro_X=Gyro_X / k. Among them, k is related to the range at the time of initialization. When it is initialized to ±2000° / s, k=16.4 can be taken here. Therefore, the inclination velocity can be determined based on the angular velocity parameters detected by the angular velocity sensor, so as to further determine the second inclination angle.
[0096] In order to ensure the accuracy and reliability of the inclination angle of the vehicle model, the first inclination angle and the second inclination angle can be filtered and fused. For example, the balancing vehicle can substitute the first inclination angle and the second inclination angle into the complementary filtering relationship:
[0097] angle=N·angle m +(1-N)·(angle+gyro m ·dt), (3)
[0098] Among them, angle represents the angle after filtering and fusion, that is, the inclination angle of the car model, angle m Indicates the first inclination angle, (angle+gyro m ·dt) represents the second inclination angle, dt represents the sampling period, and N represents the filter coefficient. Here, the filter coefficient N can be selected as 0.02, thereby accurately determining the inclination angle of the vehicle model.
[0099] In this way, the first inclination angle and the second inclination angle can be simply and effectively filtered and fused, thereby ensuring the accuracy and reliability of the determined vehicle model inclination angle, which is beneficial to the balance control of the balancing vehicle.
[0100] Of course, in some other possible implementations, other filtering fusion methods can also be used to filter and fuse the first inclination angle and the second inclination angle to obtain an accurate, stable and reliable car model inclination angle. For example, by using the Kalman filtering method, by presetting the relevant function in the filter.c file in the code, the function can be directly called in the interrupt service function to realize the Kalman filtering fusion of the first inclination angle and the second inclination angle, which is not limited here.
[0101] After obtaining the current vehicle model inclination angle and inclination speed of the balancing vehicle, the balancing vehicle may execute step S20.
[0102] Step S20: determining a target acceleration for maintaining the balance of the balancing vehicle according to the inclination angle of the vehicle model and the inclination velocity.
[0103] In this embodiment, the target acceleration for maintaining the balance of the self-balancing vehicle is determined according to the inclination angle and the inclination velocity of the vehicle model, that is, the specific method for controlling the self-balancing vehicle to maintain balance.
[0104] In order to make the balance car remain stationary near the equilibrium position, it is necessary not only to apply a restoring force proportional to the inclination angle to the motor, but also to add a damping force proportional to the angle. The damping force is opposite to the direction of movement. Therefore, the control of the balance car can use a proportional differential control method to control the acceleration of the balance car.
[0105] Exemplarily, the balancing vehicle can obtain a preset first relationship:
[0106]
[0107] a 目标 represents the target acceleration, k1 represents the proportional control parameter, k2 represents the differential control parameter, which is equivalent to the damping force and can effectively suppress the vibration of the car model, θ represents the inclination angle, that is, the inclination angle of the car model. It indicates the angular velocity, i.e. the inclination velocity.
[0108] Then, the balancing vehicle can determine the target acceleration according to the detected vehicle model inclination angle and inclination velocity in combination with the first relational expression. The proportional control parameter k1 and the differential control parameter k2 can be obtained by on-site adjustment or can be preset, which is not limited here.
[0109] For example, see Fig.10 , Fig.10 A schematic diagram of proportional differential control of a balancing vehicle provided in an embodiment of the present application.
[0110] In this embodiment, the control principle of the balance car can be abstracted as a simple proportional differential control system: by obtaining the inclination angle and inclination speed of the car model detected by the balance car system (i.e., the balance car), and feeding back the inclination angle and inclination speed of the car model as the input of the upright PD controller, so as to perform upright control (i.e., balance control) on the balance car. The PD parameters here (i.e., proportional control parameters and differential control parameters) are generally obtained by on-site adjustment. Proportional control introduces a restoring force, and differential control introduces a damping force. The differential coefficient is related to the moment of inertia. When the mass of the balance car is constant, the center of gravity position increases, and the required restoring force decreases, so the proportional control decreases, the moment of inertia increases, and the differential control coefficient increases; when the center of gravity position of the balance car is constant, the mass of the balance car increases, the required restoring force increases, so the proportional control coefficient increases, the moment of inertia increases, and the differential control coefficient increases.
[0111] By using a proportional differential control method to control the acceleration of the balance vehicle, the control strategy of the balance vehicle can be simplified, so that the control of the balance vehicle can have simple, effective, stable and reliable control characteristics, thereby controlling the balance vehicle to maintain balance, and also realizing balance control of the balance vehicle in various complex scenarios.
[0112] Of course, the above-mentioned proportional differential control method is the basic control method for controlling the balance car to maintain balance. In practice, the control of the balance car not only involves the basic balance control, but also involves the speed control and steering control of the balance car. While realizing these controls, the stability of the balance control of the balance car may be affected.
[0113] Adding speed negative feedback to the upright control system (i.e., the proportional differential control method that controls the balance car to maintain balance) cannot achieve the purpose of speed closed loop, and will also destroy the upright control system. In order to ensure the priority of upright control, speed control can be placed before upright control, that is, the result of speed control adjustment is only to change the target value of upright control. That is, the output of speed control is used as the input of upright control (of course, the output result of the speed controller needs to be converted once, the acceleration is converted into angle, and then used as the effective input data of the upright controller. The conversion process is not limited here), and the output of the upright controller is used as the output of the entire control system. In this way, Fig.11 The system further evolved into Fig.12 system to achieve independent control.
[0114] The running speed of the balance car is related to the inclination angle of the balance car. To increase the forward speed of the balance car, it is necessary to increase the forward inclination angle of the balance car. After the inclination angle increases, the wheels move forward under the action of upright control to keep the balance of the balance car, provide forward acceleration, and increase the speed of the balance car. If you want to reduce the forward speed of the balance car, it is necessary to reduce the forward inclination angle of the balance car. After the inclination angle decreases, the wheels provide backward acceleration under the action of upright control to keep the balance of the balance car, thereby reducing the speed of the balance car.
[0115] Based on this, in this embodiment, for the situation where speed control exists, a proportional-integral-differential control method is adopted to control the acceleration of the balancing vehicle.
[0116] Exemplarily, the balance car can obtain the current running speed of the balance car, and further determine the adjustment acceleration of the balance car based on the running speed and the speed setting value of the balance car; then convert the adjustment acceleration into the adjustment inclination angle of the balance car, and then determine the target acceleration used to maintain the balance of the balance car under speed control based on the adjustment inclination angle, the inclination angle and the inclination speed of the car model.
[0117] The acceleration of the balancing vehicle is controlled by using a proportional-integral-differential control method, and the speed control of the balancing vehicle is used as the input of the balance control (i.e., the current running speed of the balancing vehicle is obtained, and the adjustment acceleration of the balancing vehicle is determined in combination with the speed setting value of the balancing vehicle, thereby converting it into the adjustment inclination angle of the balancing vehicle). In addition, the speed is controlled by a proportional-integral method, which can avoid the situation where the noise that may exist in the encoder is amplified, eliminate the static error of the system, optimize the control effect and ensure the stability of the control. Using the speed control of the balancing vehicle as the input of the balance control can avoid the instability caused by the speed control (adding speed negative feedback to the balance control part will not achieve the purpose of the speed closed loop, and will also destroy the stability of the balance control. The balance control in the embodiment of the present application represents the upright control of the balancing vehicle), thereby ensuring the effectiveness and stability of the control method of the balancing vehicle.
[0118] For example, see Fig.11 , Fig.11 A schematic diagram of proportional-integral-derivative control of a balancing vehicle provided in an embodiment of the present application.
[0119] In this embodiment, the principle of proportional-integral-differential control can be abstracted as a proportional-integral-differential control system, which can be understood as connecting the speed controller and the upright controller in series, wherein the output of the speed control (the amount of acceleration, i.e., adjusting the acceleration) can be used as the input of the upright control (after transformation, as the input of the upright control, because the input of the upright control is the inclination angle and inclination velocity of the vehicle model, which are angles and angular velocities, and under the condition of maintaining the balance of the balancing vehicle, the acceleration can correspond to the angle, therefore, the output of the speed control can be transformed and used as the input of the upright control, i.e., adjusting the inclination angle), and the output of the upright control (output acceleration) is used as the output of the system, which is actually a cascade control system.
[0120] The vertical control has been introduced in the previous article, using PD control (i.e. proportional differential control). Because of the noise that may exist in the encoder, in order to prevent the noise from being amplified and eliminate the static error of the system, the speed control here can use PI control (i.e. proportional integral control). Then, for formula (4), we have:
[0121]
[0122] Among them, a 目标 represents the target acceleration, k p represents the proportional control parameter, k d represents the differential control parameter, θ represents the inclination angle of the vehicle model, represents the inclination velocity, and f(a1) represents the conversion of the adjustment acceleration a1 into the adjustment inclination angle. The conversion of the adjustment acceleration a1 into the adjustment inclination angle f(a1) can be performed by a preset corresponding relationship (such as a table lookup), or by establishing a corresponding function, which is not limited here.
[0123] The acceleration a1 is adjusted as the output of the speed controller (PI control), and we have:
[0124] a1=k p1 ·e(k)+k i1 ·∑e(k), (6)
[0125] Among them, a1 represents the adjustment acceleration, k p1 represents the proportional control parameter of the speed controller, k i1 represents the integral control parameter of the speed controller, and k represents the kth sampling.
[0126] Then, integrating formula (5) and formula (6), we can get:
[0127]
[0128] Thus, the control algorithm for keeping the car upright and at a given speed is obtained, which consists of a negative feedback upright PD controller and a positive feedback speed PI controller. The control schematic has evolved, as shown in Fig.12 shown.
[0129] It should be noted that the integrated control of speed and upright control is carried out. After experiments, it is found that it is also possible to directly use the cascade PID control system to control the uprightness and speed of the balancing car. Moreover, in the cascade PID control system, the speed control is negative feedback. Therefore, the above control method should not be regarded as a limitation of this application.
[0130] In addition, the steering control part of the balance car will not be described in detail here, because the steering control of the balance car can be achieved by controlling the wheel speed of the left and right wheels of the balance car. The Z-axis gyroscope can be combined for PD control, which is mainly about speed control. It has little effect on the stability of the overall control system and control method of the balance car, so it will not be explained in detail here.
[0131] After determining the target acceleration, the balancing vehicle may execute step S30.
[0132] Step S30: According to the target acceleration, a PWM duty cycle for controlling the motor output of the self-balancing vehicle is determined to control the operating speed of the motor of the self-balancing vehicle, thereby controlling the self-balancing vehicle to maintain balance.
[0133] In this embodiment, in order to simplify the control of the self-balancing vehicle, the voltage applied to the motor can be used instead of the acceleration, that is, the duty cycle of the PWM that controls the motor can be directly adjusted. Therefore, the self-balancing vehicle can determine the PWM duty cycle used to control the motor output of the self-balancing vehicle according to the target acceleration to control the operating speed of the motor of the self-balancing vehicle, thereby controlling the self-balancing vehicle to maintain balance.
[0134] See also Fig.13 , Fig.13 A flowchart of an ultrasonic obstacle avoidance operation method for a balancing vehicle provided in an embodiment of the present application. In this embodiment, the ultrasonic obstacle avoidance operation method for a balancing vehicle can be applied to a balancing vehicle and can include step S41, step S42 and step S43.
[0135] Step S41: Acquire the ultrasonic signal detected by the ultrasonic obstacle avoidance module, and determine the obstacle distance between the balancing vehicle and the obstacle corresponding to the ultrasonic signal.
[0136] Step S42: Determine whether the obstacle distance is less than a first preset distance value.
[0137] Step S43: If the obstacle distance is less than the first preset distance value, the self-balancing vehicle is controlled to accelerate and move backward while maintaining balance until the obstacle distance corresponding to the ultrasonic signal most recently detected by the ultrasonic obstacle avoidance module is not less than the first preset distance value.
[0138] By executing the above steps, the balancing car can use the ultrasonic signal detected by the ultrasonic obstacle avoidance module to determine the distance of the obstacle, thereby achieving obstacle avoidance operation of the balancing car while maintaining the balance of the balancing car.
[0139] See also Fig.14 , Fig.14 A flow chart of a linear CCD tracking and following method for a self-balancing vehicle provided in an embodiment of the present application. In this embodiment, the linear CCD tracking and following method for a self-balancing vehicle can be applied to a self-balancing vehicle, and can include step S51, step S52 and step S53.
[0140] Step S51: obtaining a linear image signal detected by the linear CCD tracking module, and determining a following distance between the balancing vehicle and a following object corresponding to the linear image signal.
[0141] Step S52: determining whether the following distance is less than a second preset distance value.
[0142] Step S53: If the following distance is not less than the second preset distance value, the balancing vehicle is controlled to accelerate while maintaining balance until the following distance corresponding to the linear image signal most recently detected by the linear CCD tracking module is less than the second preset distance value.
[0143] By executing the above steps, the balancing car can use the linear image signal detected by the linear CCD tracking module to determine the following distance, thereby achieving the following operation of the balancing car while maintaining the balance of the balancing car.
[0144] Exemplarily, in combination with the balance vehicle equipped with the balance vehicle obstacle avoidance and following system provided in the embodiment of the present application, the mode can be switched by pressing a button or a host computer to change the mode of the balance vehicle during operation (for example, ultrasonic obstacle avoidance mode, linear CCD tracking and following mode, etc.), thereby realizing the obstacle avoidance and following functions of the balance vehicle, and using the control method of the balance vehicle in real time to perform balance control, so that the balance vehicle can maintain a stable balance during operation while realizing a variety of functions.
[0145] For example, see Fig.15 , Fig.15 This is a control algorithm process of a self-balancing vehicle in an example. The self-balancing vehicle can realize functions such as following and obstacle avoidance based on this process, and can maintain stable balance during operation.
[0146] In summary, the embodiments of the present application provide a control method for a balancing car, a balancing car, and a balancing car obstacle avoidance and following operation method. By obtaining the current car model inclination angle and inclination velocity of the balancing car, the current state of the balancing car can be accurately judged. In order to maintain the balance of the balancing car, it is necessary not only to apply a restoring force proportional to the inclination angle (i.e., the car model inclination angle) to the balancing car, but also to apply a damping force proportional to the angular velocity (i.e., the inclination velocity), and the damping force is opposite to the direction of movement. Therefore, the balance control (i.e., upright control) of the balancing car can be achieved by controlling the acceleration of the balancing car. Therefore, according to the car model inclination angle and inclination velocity, the target acceleration for maintaining the balance of the balancing car can be determined, thereby further determining the PWM duty cycle of the motor output to control the operating speed of the motor of the balancing car and achieve the balance control of the balancing car. This method can simply and efficiently control the balance (upright control) of the balancing car, and this control method has concentrated control elements, which is conducive to maintaining the robustness of the control system.
[0147] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0148] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for controlling a balancing vehicle, characterized in that: Applied to a balancing vehicle, the method comprises: Obtaining the current vehicle model inclination angle and inclination speed of the self-balancing vehicle, wherein the vehicle model inclination angle represents the current inclination angle of the self-balancing vehicle, and the inclination speed represents the angular speed of the self-balancing vehicle; Determining a target acceleration for maintaining the balance of the balancing vehicle according to the inclination angle of the vehicle model and the inclination velocity; According to the target acceleration, a PWM duty cycle for controlling the output of the motor of the self-balancing vehicle is determined to control the operating speed of the motor of the self-balancing vehicle, thereby controlling the self-balancing vehicle to maintain balance; The self-balancing vehicle includes a posture detection module, which is an MPU6050 integrated with a three-axis accelerometer and a three-axis gyroscope. The method of obtaining the current inclination angle and inclination speed of the self-balancing vehicle includes: Obtaining the angular velocity parameter detected by the MPU6050 to determine the tilt angle velocity; Obtain the Y-axis acceleration measurement value detected by the MPU6050 and the current linear acceleration of the balancing vehicle; Determine a first inclination angle of the self-balancing vehicle according to the Y-axis acceleration measurement value, the inclination velocity, and the current linear acceleration of the self-balancing vehicle; According to the inclination velocity, integrating the inclination velocity to determine a second inclination angle of the balancing vehicle; Filtering and fusing the first inclination angle and the second inclination angle to determine the inclination angle of the vehicle model; The Y-axis acceleration measurement value is Accel_Y=g·sinβ+a·cosβ, Accel_Y represents the Y-axis acceleration measurement value, g represents gravity acceleration, β represents the first inclination angle, a represents the current acceleration of the self-balancing vehicle, α represents the inclination velocity, and the first inclination angle of the self-balancing vehicle is determined according to the Y-axis acceleration measurement value, the inclination velocity, and the current linear acceleration of the self-balancing vehicle, including: Obtain the distance h from the installation position of the MPU6050 to the motor shaft of the balancing vehicle; According to the distance h, the inclination velocity α, the current linear acceleration a1 of the self-balancing vehicle, and the formula: a=hα+a1, the current acceleration a of the self-balancing vehicle is determined; According to the determined current acceleration a of the self-balancing vehicle, the Y-axis acceleration measurement value Accel_Y, and the gravity acceleration g, the first inclination angle β of the self-balancing vehicle is determined in combination with the formula: Accel_Y=g·sinβ+a·cosβ; The filtering and fusing the first inclination angle and the second inclination angle to determine the inclination angle of the vehicle model includes: Substituting the first inclination angle and the second inclination angle into the complementary filtering relationship: angle=N·angle m +(1-N)·(angle+gyro m ·dt), Determine the inclination angle of the car model, where angle represents the angle after filtering and fusion, that is, the inclination angle of the car model, angle m represents the first inclination angle, (angle+gyyro m ·dt) represents the second inclination angle, dt represents the sampling period, and N represents the filter coefficient.
2. The control method of the balancing vehicle according to claim 1, characterized in that: The acceleration of the self-balancing vehicle is controlled by a proportional differential control method, and the target acceleration for maintaining the balance of the self-balancing vehicle is determined according to the inclination angle of the vehicle model and the inclination velocity, including: Get the preset first relation: a 目标 represents the target acceleration, k1 represents the proportional control parameter, k2 represents the differential control parameter, θ represents the inclination angle, i.e. the inclination angle of the vehicle model, represents the angular velocity, i.e. the inclination velocity; The target acceleration is determined according to the inclination angle of the vehicle model and the inclination velocity in combination with the first relationship.
3. The control method of the balancing vehicle according to claim 1, characterized in that: The acceleration of the self-balancing vehicle is controlled by a proportional-integral-differential control method, and the target acceleration for maintaining the balance of the self-balancing vehicle is determined according to the inclination angle of the vehicle model and the inclination velocity, including: Obtain the current running speed of the balancing vehicle; Determining the adjustment acceleration of the self-balancing vehicle according to the running speed and the speed setting value of the self-balancing vehicle; Converting the adjusted acceleration into an adjusted inclination angle of the balancing vehicle; According to the adjusted inclination angle, the inclination angle of the vehicle model and the inclination speed, a target acceleration for maintaining the balance of the balancing vehicle under speed control is determined.
4. A balancing vehicle, characterized in that: The vehicle comprises a first wheel and a second wheel, a bottom plate, a first motor and a second motor, a first transmission mechanism and a second transmission mechanism, and a mainboard of the balancing vehicle. The main board is arranged on the bottom board, and the ultrasonic obstacle avoidance module and the linear CCD tracking module connected in the main board face the same direction; The first motor and the second motor are arranged on the bottom plate, the output end of the driving module in the main board is connected to the first motor and the second motor, and the first motor is connected to the first wheel through the first transmission mechanism, and the second motor is connected to the second wheel through the second transmission mechanism; The mainboard is preset with a control program of the control method of the balance vehicle according to any one of claims 1 to 3, which is used to control the operation of the balance vehicle and maintain balance.
5. An ultrasonic obstacle avoidance operation method for a balancing vehicle, characterized in that: Applied to the balancing vehicle of claim 4, the method comprises: Acquire the ultrasonic signal detected by the ultrasonic obstacle avoidance module, and determine the obstacle distance between the balancing vehicle and the obstacle corresponding to the ultrasonic signal; Determining whether the obstacle distance is less than a first preset distance value; If the obstacle distance is less than the first preset distance value, the balancing vehicle is controlled to accelerate and move backward while maintaining balance until the obstacle distance corresponding to the ultrasonic signal most recently detected by the ultrasonic obstacle avoidance module is not less than the first preset distance value.
6. A linear CCD tracking and following operation method for a balancing vehicle, characterized in that: Applied to the balancing vehicle of claim 4, the method comprises: Acquire a linear image signal detected by the linear CCD tracking module, and determine a following distance between the balancing vehicle and the following object corresponding to the linear image signal; Determining whether the following distance is less than a second preset distance value; If the following distance is not less than the second preset distance value, the balancing vehicle is controlled to accelerate while maintaining balance until the following distance corresponding to the linear image signal most recently detected by the linear CCD tracking module is less than the second preset distance value.
Citation Information
Patent Citations
Motor-driven self-balancing single-wheel scooter
CN103191558A
