1 Overall hardware and software structure and ideas
This intelligent vehicle positioning system uses a camera to shoot the track in front of the vehicle, and samples the video signal through MC9S12XS128 to obtain image data. Then use a suitable algorithm, such as tracking edge detection algorithm, to analyze the image data and extract the target guide line. Then, the system applies appropriate control to the servo and motor according to the position information of the target guide line. The structural diagram of this intelligent vehicle motion system is shown in Figure 1.
Because the system is an organic whole, it is necessary to coordinate the system's camera, control microcontroller, motor (including DC servo motor, photoelectric encoder), steering gear and auxiliary circuit (power board, motor drive board) and other parts. The steering gear controls the steering of the car model in real time and is the key to the speed and stability of the competition. There are many control algorithms for steering gear control, such as: PID classic control algorithm, fuzzy algorithm, artificial intelligence algorithm, etc.
2 System program overall control flow
The basic software flow of the system is: first, initialize each functional module and control parameter; then, obtain the image data of the front track through the image acquisition module, and obtain the speed of the car through the speed sensor module. Use PID to feedback control the servo. In addition, according to the detected speed, combined with the speed control strategy, the speed of the car is continuously adjusted appropriately, so that the car can run quickly along the track while complying with the rules of the game. The basic software structure flow chart of the system is shown in Figure 2.
The system software requires control accuracy and stability. Sampling and extracting black lines is the basis for controlling input, which requires accurate and stable sampling. After the input is given to the servo, the servo output is required to be fast responsive, stable and accurate. After many experiments and nearly a semester of adjustment experience, the classic PID controller was selected and improved to control and adjust the servo of the car model.
3 Image Recognition
Use CCD camera to collect black lines within a certain distance in front of the car model, extract relevant quantities from them, and use them to control the steering of the servo to realize automatic tracking of the smart car. Due to the limited data processing capacity and speed of the single-chip microcomputer, the entire image cannot be processed in a short time of 20 ms. This system sets the camera forward look to 1.2 m. Under the premise of not affecting the accuracy of road detection, this system uses interlaced acquisition to compress image data, that is, one line of data is collected at different intervals of effective lines (less near, more far), and a total of 44 lines of data can be collected. In addition, in order to further improve the speed of A/D conversion, this system also appropriately overclocks the CPU of XS12 and sets the precision of A/D converter to 8 bits, so that each line can sample 67 points, forming a plane array, and the black line occupies some points in it. Since we collect 67 points in one line, the median value is 33. The image is the bottom layer of the smart car. The correctness of image acquisition is particularly important in future control. Therefore, we must ensure the authenticity and validity of the collected black lines, and add filtering algorithms. For example, when the effective look-ahead is very small, it is enough to judge the direction of the black line and give the steering gear an extreme turning angle to make the car turn sharply. However, when there are very few effective lines, if no special filtering method is used, as long as one line of black lines is wrong, the car may turn wrong, and even turn out of bounds.
4-segment PID control
4.1 Amount of image information extracted
The control quantity is extracted from the collected images to control the steering of the servo and realize the automatic tracking of the smart car. This system uses the black line offset even_diff and the slope of a certain section of the black line D_diff-erent to control the servo, which can be called a PD controller. Since the car model is a follow-up system, the black lines covered within the 1.2 m forward range of the camera may not have the set 44 lines, especially when the curve ahead is particularly sharp, the black lines covered within the forward viewing angle of the camera will be particularly few, such as 13 lines or less. According to this feature, an effective forward-looking quantity valid_line can be set as a response to the smoothness of the curve ahead.
The offset of the row is obtained by subtracting the black line position value of each row from the middle value. The middle value 33 is the center position point of the track. The offset represents the position value of the black line in the track from the perspective of the car model. The sum of the offsets of each row is divided by the number of black line rows extracted within the camera's forward-looking range to obtain the overall offset of the black line relative to the center of the car model, even_diff. The difference between the offsets of some distant rows and some nearby rows (such as the first half and the second half) in the valid row is used to obtain the slope D_differen of the black line in the valid row.
In this way, from the black line position data of a field, the system extracts three quantities: valid_line, even_diff, and D_different to control the servo. In actual situations, D_different can be very flexible, because the slope of the black line in front can be obtained in different segments, and the slope values of different segments can be obtained according to actual requirements. For example, when the speed is fast, the slope of the black line farther away from the vehicle can be appropriately taken to achieve advanced control.
When debugging parameters for smart cars , it is very important to understand these three quantities. Specifically, valid_line represents the effective foresight of the car model, that is, how far it can see. For smart cars driving on the road, if they can see far, it means that the black lines are all in front, and if they can't see far, it means that the black lines in front of the smart car have deviated to the left or right. The size of this quantity can just represent the gentleness and urgency of the curve. In addition, if you can see far, the camera will collect more black lines and the system will have a large amount of information. Then how to process this large amount of information for our use becomes very critical. For example, if you can see 1.2 m, it means that the car must be on a long straight road, otherwise it is a small S-bend. With a little processing, the small S-bend can be filtered out, making the car seem to be running on a straight road; if you can see very close, it means that the bend is very sharp. At this time, as long as you can judge which direction the bend turns, you can give the servo an extreme sharp turn. even_diff represents the degree of deviation between the car and the black line in a certain field of view. This quantity allows the smart car to decide how big the turning angle is for the servo in a certain field of view. D_different is particularly important when looking far ahead effectively, because it can predict the bend ahead and make the turn ahead of time.
[page]
4.2 PD controller form
The system processes these three quantities into the form of a PD controller:
Where a is the different valid rows determined based on the effective foresight of the track. Centre is the control intermediate value of the servo in a straight line. Steer is the input of the PD controller to the servo. Since the steering control of the car model servo is a nonlinear system, the entry condition "valid row judgment" is set, which can just divide this nonlinear system into different segments. In each segment, the steering control system can be approximately considered to be linear. That is, within a small range, the obtained black line position and the corresponding servo PID reference angle are processed into a linear relationship. Finally, simple segmented PID control is achieved .
5. Segmented PID control parameter rules
In the actual shunting process, we concluded that the parameters Kp and Kd of the PD controller are related to the effective look-ahead valid_line and the speed of the car model. In simple terms, the faster the car speed is, the earlier the car model should turn in advance when encountering a curve. In summary, there is the following relationship:
Among them, A is the basic value of Kp, valid_line is the effective look-ahead of the car model running to a certain state (estimated by the number of extracted black lines), and speed is the pulse value of the car within a period of time, which represents the speed of the car model running at all times. At low speed, speed/C can be approximately considered to be zero, and the value of A can be determined by experimental method. After determining the basic value of Kp, you can accelerate, and debug to get the appropriate B value and C value when the car speed is slightly higher, so that the car can finally tangent and follow the track smoothly and accurately. From this relationship, it can be seen that the change of effective look-ahead is the quantity that has the greatest and most direct impact on the Kp value. We know from our usual experience in adjusting cars that the B parameter should be much more sensitive than C. The reduction of one effective line has a much greater impact on the steering angle of the servo than the impact of the car speed on Kp. The effect of speed on the rapidity of the servo's sharp turn is very obvious when the car model is at high speed.
In order to increase the robustness of the system and better solve the nonlinear problem of the system, we divide the car's look-ahead into segments. In our 1.2 m look-ahead, there are a total of 44 black lines. All of them are extracted on the straight road and can be divided into 7 segments: less than 37 valid lines, more than 30 valid lines, more than 24 valid lines, more than 18 valid lines, more than 13 valid lines and less than 13 valid lines.
The control program is processed as follows:
Although it is divided into 7 sections, each section is controlled separately, and the parameters are adjusted separately, but the negative correlation between Kp value and effective row (effective look-ahead) still holds true. Therefore, Kp, Kp1, Kp2, Kp3, Kp4, and Kp5 still generally follow the negative correlation with the effective row, that is, Kp increases linearly with the decrease of effective rows.
Adjust the parameters of the PD controller in each section so that the car can navigate curves of different types and radii. This forms segmented PD control, which can solve the nonlinear problem of the car and enhance the robustness of the system. At the same time, in order to protect the servo from being turned too hard to the left or right, the left and right limit values of the servo can be limited:
by debugging parameters A, B, and C and adjusting different Kp values, practice has proved that the car can move forward smoothly and quickly while automatically patrolling the line.
6 Conclusion
The algorithm relates the steering Kp coefficient of the servo to the vehicle speed, which can coordinate the vehicle speed and the servo steering well. It proposes a rule for segmenting PD parameters with specific smart car parameters, which is very helpful for the actual production of smart cars and has a wide promotion value in smart car competitions.
Practice has proved that when the parameters are adjusted appropriately, the smart car can adapt well to the track and run the best path desired. In order to participate in the fifth "Freescale" Cup National College Student Smart Car Competition, this control algorithm performed perfectly in the school-level representative team qualification selection, and finally ran a good score of 2.5 m/s, successfully selected to participate in the North China Division. Practice has proved that the segmented PID control steering of the smart car servo is feasible and practical.
2011/3/19 20:55:57
Previous article:Fault Monitoring in Imperfect Battery Management Systems
Next article:Application of power devices in hybrid electric vehicles (HEV)
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- FPGA design solutions for various EDA tools
- I need help~What is the interface level standard of DAC8812ICPW?
- [FS-IR02 + D1CS-D54] - 0: Study two PDFs
- Peak Detection
- Analog Discovery 2 Review (2) Frequency Sweep Function Test
- An error occurred in the simulation of the multisim function signal generator. Please help me
- 【IoT indoor environment monitor based on ESP32-S2-Kaluga-1】Bluetooth notification data
- This is my first time drawing a PCB. (IR2184 driver) I would like to ask the experts to give me some suggestions on how to improve it.
- The semiconductor industry after the epidemic
- Which boost solution is better? For example, considering efficiency, reliability, controllability, etc.