1 Introduction:
This participation is my first time participating in the national e-sports competition as the captain, and it is also my last time, because I am already a junior in college. Our experience in this e-sports competition was very poor, mainly because the competition time was delayed again and again. We originally prepared for a month during the summer vacation, but were informed of the postponement the night before the competition (8.3), and finally decided on the 11.4 online evaluation. But the delay also gave us more preparation time. We originally only did the drone part of the 2017-2019 e-sports competition, but due to the two-month delay, we almost did all the drone questions from previous years. After going through it again, the gains are not small (mainly because I have accumulated different codes, which can be used directly later). For online competitions, the venue is set up by our own school, so we don’t have to worry about the difference between the test venue and the competition venue being too big, causing abnormal performance. Generally speaking, there are advantages and disadvantages to the postponement of this year’s e-sports competition.
2. Team introduction:
I have participated in many activities held by Lichuang before, so I am familiar with Lichuang EDA. In this competition, I am mainly responsible for the flight control part of the drone and aircraft debugging.
Team member A is responsible for aircraft debugging and report writing, and member B is responsible for aircraft vision and report writing.
3. Project analysis:
Let’s take a look at the requirements of question G first.
1. Basic requirements
(1) The aircraft takes off vertically at the "cross" take-off and landing point and lifts to a cruising altitude of 150 ± 10cm.
This is simple. Just use the laser module to set the height at 1.5M for takeoff, and then increase the height ring to keep the height at about 1.5M throughout the entire process.
(2) Find the starting point of the spreading operation and start the "spreading" operation from the block where "A" is located.
This requires vision to enter from point A, so use our old friend OPENMV, which can use color blocks or template matching methods.
(3) All green blocks in Figure 1 must be completely covered within 360 seconds.
This is also simple, just set the flying speed yourself. Our moving speed is 25CM per second throughout the whole journey, and the entire flight takes one and a half minutes.
(4) After the operation is completed, land stably and accurately at the take-off and landing points; the deviation between the geometric center point of the aircraft and the center of the take-off and landing points shall not be greater than ± 10cm.
This is not difficult but you must use vision and OPENMV. First identify the circle, then find the black block from the circle area, and use the center coordinates to confirm that the aircraft is above the take-off and landing point.
2. Play part
(1) Change the 3~4 continuous sowing blocks at any position in the working area to be covered with the color of the non-sowing area, and repeat the basic requirements (1)~(3).
If you want to check whether you are in the sowing area, you need to check whether the bottom of the aircraft is green. However, we directly set the timer and did not check this. Therefore, points will be deducted, but points will not be lost.
(2) Place a black tower with a height of 150cm and a diameter of 3.5 ± 0.5cm in the operation area. The tower is covered with a circular barcode (the height of the barcode is 120~140cm); during operation or on the way back, the aircraft will identify the The number represented by the barcode is displayed by the number of LED flashes, and then flashes again after an interval of several seconds.
We have tried this with OPENMV, but it can hardly be recognized, so it depends on luck, because we don’t know where to put the pole before the competition. At the same time, it is difficult for OPENMV to recognize the barcode during flight. I heard others say that a special scanner is needed. The LED display can be controlled directly with OPENMV.
(3) Taking the "X" center of the take-off and landing point as the center of the circle, and taking the number identified in (2) above multiplied by 10cm as the radius, the aircraft will land stably on the circle; the deviation between the geometric center point of the aircraft and the closest distance to the circle shall not be greater than ±10cm.
The barcode number we selected at the competition site was 2, so the radius was 20CM. Then our plane landed very accurately. As long as it is within the circle and within the error, this part will be won.
(4) Randomly select an item at the test site, complete the programming and debugging of a set of flight action tasks on site within 30 minutes, and complete the flight action.
Originally this part was very simple and we were well prepared, but this part was cancelled, and this part was not available across the country.
(5) Others.
Honey juice and other things, don’t worry.
The 2021 G question is the aircraft question. The more difficult points in the question are how to position the aircraft and identify the barcode on the vertical pole during flight.
Because we only have optical flow and OPENMV, it is difficult to locate the aircraft by detecting the ground. Especially the optical flow is easy to fail on this solid color ground. Only point A and the circle of takeoff and landing can be recognized by OPENMV, so we The flight after entering the field is an open-loop flight. Follow the step-by-step steps such as advancing 50CM, flying at a speed of 25CM per second, and ticking once every second. Then start ticking after recognizing A's entry, and stop ticking when exiting, and in OPENMV When a circle is recognized, the aircraft enters a closed loop and flies above the circle before landing. In this way, the whole flight can be completed in less than two minutes, and you can get as many points as possible.
5. Schematic circuit analysis:
As a rule, for aircraft problems, you basically don’t need to draw the PCB yourself. You just stack modules and write programs. However, our team drew the flight control baseboard and OPENMV base by ourselves, using the anonymous IMU and the corresponding TM4C123G core board.
So let’s talk about the hardware components. The first is the flight control, laser module (for measuring altitude), and optical flow module (for measuring aircraft speed). These three are purchased from Anonymous Kechuang, and the corresponding wiring needs to be according to Anonymous official wiring. Diagram connection.
There are only two OPENMVs that we purchased ourselves and connected to the flight control through the serial port (one on the side of the aircraft is used to scan barcodes, and one on the bottom is used to identify A and circles), which are connected to UART2 and UART3 on the PCB respectively.
Here is the power supply baseboard we designed based on the peripheral diagram of the anonymous Lingxiao IMU. The flight control master we use is TI's TM4C123G.
The key point is this power supply, and the others are some SH1.0 UART interfaces and the like.
The TI TPS5430 used in the BUCK circuit IIC can output 3A current, which is enough to carry the flight control and two OPENMVs.
6. PCB design analysis:
The flight control baseboard we drew is to supply power to the anonymous IMU and main control. There are no high-speed lines. Just wire them according to the baseboard schematic diagram. The power line is thicker because when we designed the board
It is designed according to the F330 rack fixing control, so it can be directly fixed on the F330, and the board is large enough to be painted in two layers.
You can see that in addition to power supply, the flight control board is full of interfaces, including various serial port interfaces, receiver interfaces, power supply interfaces, TM4C123G core board interfaces, IMU interfaces, etc.
7. Physical display:
After the flight control board is welded, it is as follows:
Then there is the picture of the whole machine. This is before the competition. The ultrasonic wave on the side is what we use to wrap around the pole (2019 UAV question)
You can see that the flight control board can be installed just above the fixing hole of the F330.
8. Work assembly:
The rack we use is an F330 rack. Just install the flight control board on the top layer and fix it with screws. Other motors and propellers can be installed according to regulations. Things like propeller steering are the foundation of the foundation.
Then there are the optical flow, digital transmission, and ultrasonic accessories provided by Anonymous. They can be installed according to the Anonymous manual. You can refer to our installation method. OPENMV is connected to serial port 2 and serial port 3.
9.Programming:
The key codes are all in USER_TASK.C, and other files are anonymous supporting programs, so you basically don't need to worry about them.
The forced landing of the aircraft is channel 5, the program selection is channel 7 and 8, and the take-off is channel 9. The main parts of the program are annotated, but there are also other useless parts, such as line following and pole winding, which we use when preparing for the competition. , not used in official competitions, but can be used for reference.
Before executing the flight program, please set channels 5, 7, and 8 to the low position, channel 6 to the middle position, and finally set channel 9 to the high position to run the main program of the plant protection aircraft pointed by the arrow.
Then the following part of the program code for open-loop flight is actually very simple. It means flying a few centimeters in a certain direction and then flying in another direction. This is the open-loop method. See the summary section for specific routes.
For example, Horizontal_Move(100, 100, 0); the first parameter 100 is the moving distance, the second parameter 100 is the moving speed 100cm/s, the third parameter 0 is the moving direction, and the head is 0 clockwise.
Then the function of time_cnt - 3000 is to wait for three seconds. The unit of 3000 is ms, which is to reserve enough time for each step of the aircraft's movement.
10. Summary:
After reading the G question, we decided to use the open-loop method, because this year's aircraft question is very special. It is difficult to use OPENMV to determine the position of the aircraft itself, and then the ground is green, causing the optical flow to fail from time to time, and then causing the aircraft to fly in the wrong direction. Therefore, we choose the simplest method, just open the loop directly and fly according to the preset path to maximize our score. At the same time, I have also heard that other teams have talked about positioning methods, such as UWB, SLAM, etc. Those things are too far away for our team. First, we have never been exposed to them at all. Second, there is no time to prepare for 4 days and 3 nights. Third, It's just too expensive.
Our set path is like this (as shown below), so that there is enough redundancy to maximize our score.

However, during actual flight, due to the failure of optical flow, we flew slightly out of the edge. At the same time, the failure of optical flow also caused a deviation in the distance we moved.
As for taking pictures, we found at the competition site that the position of the pole was basically the same as the one in the picture. We didn’t know whether we got this part of the score, but we landed well.
During the 4 days and 3 nights of debugging before the competition, I accidentally missed the BREAK in the CASE statement when changing the code. Then the plane locked the motor and fell off from the landing point twice, breaking the tripod. Finally, I used In DEBUG mode, I discovered that BREAK was missing. Compared with other groups, we were slightly fried.
In general, before the electronic competition, you must practice with the questions from previous years, and then accumulate some modular codes that can be used directly. For example, I prepared one-click takeoff and altitude setting, one-click forced landing, etc. These are very useful when debugging, and can help you save practicality and reduce fried chicken. The plan must be confirmed within one hour after the competition question comes out. For example, we confirm that we will use the open-loop method to fly, close-loop landing, and then use OPENMV for visual processing. At the same time, you must do more on-site debugging during the 4 days and 3 nights, so that you can simulate the competition scene as much as possible. If you stay up late, see if your plan allows it. For example, our aircraft problem is greatly affected by light. The results of flying open loop in the morning and afternoon are completely different. It’s different, so we choose to rest at 11 o’clock at night, because we can’t adjust the plane at night, so we can only write reports and come early the next day to debug. If it is not affected by the venue, it is still necessary to debug all night, because you can have a lot more time. But remember your body comes first.
11. Attachments:
The video is too big, so I’ve attached a link with the flight control code and OPENMV code.