Building block programming for racing drones——Take the first prize of the 2022 TI electric competition delivery drone as an example to learn (July B question)

        Before learning this tutorial, please make sure you have studied the knowledge of UAV-related coordinate systems, basic flight control functions, indoor fixed-point control under the positioning conditions of lidar SLAM, automatic flight support functions, and navigation control functions in the first 4 lectures. introductory tutorial.

        At the same time, when users are doing secondary development and custom flight missions, they can refer to the programming ideas in the 2021 National Plant Protection UAV Problem G in Lecture 5 to understand the usage and actual effect of several key variables in the sub-thread execution process .

        After understanding the key points of the above-mentioned autonomous flight mission design, let's take the B-question delivery drone in the 2022 National College Electronic Design Competition as an example to write the automatic flight mission function to complete the basic part + play part of the competition. Innovation part and other requirements of all competition questions.

 

 

According to the requirements of the competition, we can disassemble the software part of the design into the following three parts:

  • Machine vision part: It is necessary to recognize the color and shape of the bottom target and realize the data interaction with the flight control through the SDK serial port;
  • Flight control man-machine interface part: buttons and display screen cooperate to realize the input of target waypoint coordinates, the input of learned target features, the input of coordinates and angle information of the ring, and store the set parameters in the flight control EEPROM;
  • UAV automatic flight task design: complete automatic take-off, perform operations according to the waypoints entered or learned on site (including operation height adjustment, automatic release/recovery device, buzzer alarm prompt, etc.), and automatically return to flight after execution.

2.1 Design of part of machine vision software

        The color of the feature points of the bottom target is red and blue, and the bottom target can be identified through the function find_blob() of the OPENMV machine vision module to find the color block. We can judge the density parameter of the recognized color block, which is blob.density( ) , you can easily distinguish rectangles, circles, and triangles .

         Finally, fill in the key parameters such as the identified color block coordinates and color block shape into the target class, and send them to the flight control SDK serial port through the serial port after encoding. The flight control can judge the shape and shape of the target point through the parsed data frame . Color is used to control decision making .

2.2 Software Design of Flight Control Human-Machine Interface

        Rely on the two independent buttons SW1 and SW2 on the core board of Tiva LaunchPad, and at the same time cooperate with the OLED display to modify and store the relevant parameters in the competition. The corresponding menu interface must be set to cooperate with the long press and short press response of the button to realize it.

 

 

 

 

         The menu interface includes line-wrapping parameter selection, parameter addition and subtraction adjustment. Due to the multiplexing of key functions, the operation is relatively cumbersome. The user can use the external ADC key to realize the key operation function in this example with the extended key. See the link below for the video tutorial on the operation of the computer interaction part.

 

TI electric competition B question delivery drone set coordinates and templates through buttons and menus

https://www.bilibili.com/video/BV1PB4y1t7y9/?vd_source=fa3e626a57e95e09ecf1b8f1627e58ac

2.3 Software Design of UAV Automatic Flight Mission

        Phase 1 - Automatic takeoff to cruising altitude

uint8_t Auto_Takeoff(float target)//automatically take off to a certain altitude

 

         The function input parameter target is the target height. The automatic take-off task is divided into two threads. The first step is to record the current 3D position information as the initial origin position of the navigation . And set the desired target height position through the navigation control function . The second step is to detect the altitude deviation value in real time. After 2 seconds to meet the position deviation within 10cm, the function return value is set to 1, and the task of automatically taking off to the target altitude is completed. For usage, refer to the usage of case 11 in Developer_Mode.c developer mode, autonomous takeoff After the task is completed, it will enter case 15/16/17 to execute the waypoint traversal task.

 

 

 

  1. The second stage - waypoint traversal task

void Deliver_UAV_Basic(void)

        The first step is to set the height expectation to the first operating height of 150cm, the horizontal position expectation to be the horizontal position at the initial takeoff, and set the laser pointer to flash continuously, so that the referee can judge the projected position of the center of the aircraft fuselage on the ground, above the takeoff point Hover time is set to 5S.

 After hovering above the take-off point for 5 seconds, the horizontal coordinates of the first operating point entered by the keyboard will be filled into the desired target position, and then the aircraft will fly from directly above the take-off point to the first operating point. The horizontal position error is detected in real time during the task. If the horizontal position error is less than a certain threshold for N consecutive times, it can be considered to be near the top of the first operation point. After meeting the conditions for reaching the first operation point, the height expectation will be set as the second operation. Altitude, the aircraft altitude will drop.

 

 The third step is to judge whether the UAV has reached the second operating height. The principle of detecting whether the height has been reached is the same as that of the horizontal direction. It is also to detect that the position error in the height direction continues to meet a certain threshold for N times.

         The fourth step is that the aircraft is located right above the first operating point, and the height has been adjusted to the second operating height. At this time, there will be a certain position error due to the positioning sensor. At this time, the horizontal position control will introduce the color block coordinate information recognized by OPENMV , the drone will make a secondary correction to the horizontal position , so that the central projection of the drone is in the central area of ​​the color block. It is equivalent to using the position information provided by SLAM positioning for rough alignment, and using machine vision to achieve further precise alignment when approaching the operating point .

         At the same time, the pod lowering action command will be executed, using the steering gear that rotates 360 degrees, and it will be implemented at a certain angular speed for a certain period of time. The specific time angular speed and time parameters are related to the selection of your own steering gear and the radius of the winch. These two parameters are relatively easy to determine in actual debugging . After the execution under the tower crane is completed, a high-decibel buzzer will be driven to give an alarm prompt. After hovering in situ for 5 seconds, the tower crane will be raised and returned to the first operating height.        

 

         The fifth step is that after the UAV completes the task of the first operating point and returns to the first operating height, it will post the position of the second operating point to the task thread. Similar to the first operating point, the UAV will go to the second operating point. Near the top, immediately descend to the second operating altitude, perform visual secondary alignment, lower/raise the tower crane, and buzzer alarm, and then return to the first operating altitude, ready to return.

 

 

         After the delivery of the two preset operations is completed, the UAV will perform the return action. First, the UAV will fly directly above the take-off point. If the horizontal position error is smaller than a certain threshold for N consecutive times, it can be considered to be near the top of the take-off point. After reaching the level, it will perform the task of landing on the ground in situ. After reaching the ground, the drone will automatically lock when it meets the ground detection conditions.

 

 

 

        It should be noted here that the program has a special processing part here for the SLAM map reset command. The reason why this operation is required is to reduce the positioning error. The NC360 competition drone platform uses 2D laser radar. In theory It is only suitable for SLAM mapping of planar motion robot platforms. The linear movement of drones in the air is 3-dimensional. At different heights, changes in the layout of the surrounding environment will cause a certain positioning error, usually between 3~ Within 5cm, this error range can meet the control accuracy requirements of drones in competitions . For the situation where the space environment changes greatly at different heights, the special processing form in this scheme can be used. This special processing method is not necessary . Users can decide whether to use it according to the actual situation in the secondary development process . At the same time, for the terminal landing process , It is still possible to use the method of precise alignment of the bottom visual features to achieve precise landing .

        For the automatic learning of the innovation + play part and the content of crossing the circle, the general process is similar to this routine, the difference is that the coordinates are entered through the template features recognized on site . The main workload of this processing process lies in the OPENMV part, the entire flight mission The execution process is basically the same as the basic part. At the same time, for the part of crossing the ring, after manually inputting the coordinates and approximate angle of the ring , the entire flight process is the process of traversing the waypoints, aligning the nose with the ring, and traversing. After the execution is completed, return to the flight Landing, compared with the first two items, the whole process is just one more heading control. Relatively speaking, the difficulty of implementation is not high, and it is still a routine inspection item. It is easier for users to understand it in combination with the program notes, so it will not be expanded here.

 

 

Introduction to Hardware Installation of Delivery Drones in July 2022

Introduction to Hardware Installation of Delivery Drones in July 2022 E-sports Question B - NC360 Deep Open Source Competition Drone Development Platform_哔哩哔哩_bilibili

2022 TI Electric Competition Question B - Open source solution for delivery drones

2022 TI Electric Competition Question B - Delivery UAV Open Source Solution NC360 Deep Open Source Competition UAV Development Platform_哔哩哔哩_bilibili

Flying autonomously through the circle frame at any position and angle - 2022 TI Electric Competition Aircraft B Question Delivery Drone

Autonomous Flying Through the Circular Frame at Any Position and Angle - 2022 TI Electric Competition Aircraft B Question Delivery Drone_哔哩哔哩_bilibili

 

2021 Electric Contest G-question National Award Standard Program Study Example for Plant Protection UAVs

Study example of national award standard program for plant protection drones in the electric competition G-question - NC360 deep open source competition drone development platform_哔哩哔哩_bilibili

Question G of the 2021 Electronic Competition—Plant Protection UAV Realization Routine—NC360 Deep Open Source Competition UAV Development Platform_哔哩哔哩_bilibili

 

 

5_Building block programming for racing drones——Take the complete reproduction of the 2021 Electric Competition National Award Standard as an example to learn

5_ Building block programming for racing drones——Take the complete reproduction of the 2021 Electric Competition National Award Standard as an example to learn- 哔哩哔哩

NC360 deep open source racing drone development platform

 

 

  1. Delivery drones ( question B  in July ) 
    1. task

Design a delivery UAV based on multi-rotor aircraft, which can deliver goods to designated target locations according to different requirements. Figure 2 is a schematic diagram of the operation area, with takeoff and landing points and multiple target locations with different characteristics.

A liftable pod needs to be installed on the delivery drone. The weight of the pod is 50±5g, and the lifting range is 60±10cm. During take-off and flight, the pod is close to the belly of the drone; Descending and hovering, and lowering the pod to a certain height from the ground, and returning to the cruising altitude to fly after the delivery operation is completed. The drone needs to be equipped with a speaker to play voice prompts; the drone is equipped with a vertically downward laser pointer to mark the track.

 

Figure 2 Schematic diagram of delivery drone operation area

 

  1. request
  2. According to the target location information set on site, the UAV can complete the delivery operation to two designated target locations. The coordinates of the position information of the target location can be set by the keyboard carried on the drone.
  3. The UAV takes off vertically at the "ten" take-off and landing point, and lifts to a cruising altitude of 150±10cm; (5 points)
  4. According to the delivery target set on the spot, the drones will fly to the top of the target location one after another, and the drone will lower the flying height to 80±10cm; (16 points)
  5. The drone releases the pod, the pod drops to a height of 20±5cm from the ground, and keeps hovering steadily for 5 seconds to complete the delivery operation. During the period, a voice reminding the target point to receive the goods is played; during the hovering period, the position of the drone is marked The laser pointer spot falls in a circle with the center of the target as the center and a radius of 15cm; (20 points)
  6. After the operation is completed, fly to the take-off and landing point to land stably and accurately, and the deviation between the geometric center of the drone and the center of the take-off and landing point is not greater than ±10cm; (4 points)
  7. The delivery process must be completed within 180 seconds, the less time the better. (5 points)
  1. The drone learns to recognize a specified target feature (color, shape) outside the operating area, and then looks for two target locations with this feature to complete the delivery operation.
  2. The UAV takes off from the take-off and landing point to a cruising altitude of 150cm, searches for 2 above-mentioned identified targets successively, flies above the target location, and lowers the flying altitude to about 80±10cm; (20 points)
  3. Release the descending pod to a height of about 20±5cm above the ground, keep hovering steadily for 5 seconds to complete the delivery operation, and play a voice reminding the target point to receive the goods during the period; during delivery, the laser pointer spot marking the position of the drone falls on the following The center of the target is within a circle with a radius of 15cm; the cruising altitude will be restored upon completion of delivery; (10 points)
  4. After the delivery operation is completed, the drone lands at the take-off and landing point; the delivery process takes as little time as possible, and it needs to be completed within 270 seconds; (5 points)
    1. The drone finds the red circle box placed in the area near A, and passes through the circle box. (10 points)
      1. design report
      2. other independent play. (5 points)

the project 

main content

full marks

System solutions

Technical route, system structure, scheme description, comparison and selection

3

Design and Calculation

Control method description and parameter calculation

5

Circuit and Program Design

System composition, principle block diagram and circuit diagram of each part

System software design and flowchart

7

Test plan and test results

Test plan and test conditions; integrity of test results; test results

analyze

3

Design report structure and standardization

Completeness and specification of the abstract, report text structure, formulas, figures and figures

sex

2

Subtotal

20

  1. Description Delivery job site instructions
    1. A round frame for the UAV to pass through can be placed in the area near the mark "A" in the operation area, as shown in Figure 3. The round frame can use an outer diameter of about 110cm
    2. The numbers in the delivery target are not for drone identification, but for the convenience of description and recording, and the color is similar to the background color of the target.
    3. The evaluation will prepare on-site characteristic samples of the six delivery targets shown in Figure 1, such as "red triangle", "blue square", etc., for recognition by drones.
    4. The matt inkjet cloth in the delivery operation area is light gray (R-240, G-240, B-240), and there are three shapes of the target location (circle, square, triangle, with a maximum side length or diameter of 25cm), and the colors are Two kinds of red and blue (red R-255, G-0, B-0, blue R-0, G-0, B-255); there are 1.8cm wide black marking lines on the upper and right sides of the working area; consideration should be given to The possibility of color differences due to materials and pigments.
    5. Teams are not allowed to change the test environment conditions without authorization in the field test provided by the competition area. The red hula hoop is fixed on the ground support, the height of the center of the circle is about 150cm, and the support is black.

 Figure 3 Schematic diagram of a circle frame

  1. The 400cm×500cm work area is surrounded by safety nets and on the top, and the safety net support is outside the safety net.
    1. The test site should avoid direct sunlight, but the top lighting and ambient light outside the window cannot be ruled out. Teams should consider that the test site will be affected by factors such as external lighting or uneven indoor lighting; no lighting conditions are required during the test.
    2. aircraft requirements
  2. Teams should abide by the relevant management regulations of the Civil Aviation Administration of China when using drones.
  3. The maximum axis distance of the UAV is not greater than 45cm.
  4. The UAV propeller must be fully protected, otherwise it cannot be tested.
  5. The laser pointer on the drone is installed vertically downwards and must not be moved or rotated.
  6. Before take-off, the UAV can be manually placed at the take-off and landing point; it can be started manually with one button and then take off, and no human intervention is allowed during the entire flight after takeoff; The unit must be handed over to personnel immediately after handling.
  7. Protective glasses and gloves must be worn during commissioning and testing.
    1. Test Requirements and Instructions
  8. The gondola can be simulated by suspending a 50g weight by a cord.
  9. The voice to remind the target point to receive the goods can be set by yourself, and the duration is 1~3 seconds.
  10. Requirement 1 Before delivery, the position information of two target locations can be continuously input; for example, if the take-off and landing point is taken as the origin, the position of No. 11 target can be (200, 275); the format of the target position information can be defined by yourself.
  11. Before Requirement 2 delivery, the on-site specified shape and color template (such as "red triangle") is hand-held outside the site for the drone to learn to identify the target features to be delivered.
  12. The delivery process of Requirement 1 must be completed within 180 seconds, and no points will be awarded for overtime.
  13. The delivery process of Requirement 2 must be completed within 270 seconds, no points for overtime.
  14. Requirement 1 (1)~(4) must be completed continuously without human intervention; Requirement 2 (1)~(3) must be completed continuously without human intervention.
  15. Batteries must not be replaced during the whole process of each test; batteries are allowed to be replaced between two tests, and the battery replacement time should not exceed 2 minutes.
  16. During the flight, if the UAV touches the ground and recovers by itself, 5 points will be deducted; if the drone fails to recover by itself within 5 seconds after touching the ground, it will be considered a failure, and the actions completed before the failure will still be scored. A smooth landing means that there is no obvious falling, bouncing, or sliding after landing during the landing process.

Guess you like

Origin blog.csdn.net/u011992534/article/details/129512176