CN113641185A - Fixed-wing unmanned aerial vehicle communication algorithm - Google Patents
Fixed-wing unmanned aerial vehicle communication algorithm Download PDFInfo
- Publication number
- CN113641185A CN113641185A CN202110903855.5A CN202110903855A CN113641185A CN 113641185 A CN113641185 A CN 113641185A CN 202110903855 A CN202110903855 A CN 202110903855A CN 113641185 A CN113641185 A CN 113641185A
- Authority
- CN
- China
- Prior art keywords
- data
- transmitter
- fixed
- communication algorithm
- receiver
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000004891 communication Methods 0.000 title claims abstract description 21
- 230000005540 biological transmission Effects 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 4
- 230000002457 bidirectional effect Effects 0.000 claims description 3
- 239000011159 matrix material Substances 0.000 claims description 2
- 238000000034 method Methods 0.000 claims description 2
- 102100021688 Rho guanine nucleotide exchange factor 5 Human genes 0.000 claims 2
- 101001068136 Homo sapiens Hepatitis A virus cellular receptor 1 Proteins 0.000 claims 1
- 101000831286 Homo sapiens Protein timeless homolog Proteins 0.000 claims 1
- 101000752245 Homo sapiens Rho guanine nucleotide exchange factor 5 Proteins 0.000 claims 1
- 238000013480 data collection Methods 0.000 claims 1
- 230000006870 function Effects 0.000 description 14
- 230000002093 peripheral effect Effects 0.000 description 9
- 238000006243 chemical reaction Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000005070 sampling Methods 0.000 description 4
- 230000008571 general function Effects 0.000 description 2
- 238000009434 installation Methods 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 238000012937 correction Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 230000002618 waking effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G05—CONTROLLING; REGULATING
- G05D—SYSTEMS FOR CONTROLLING OR REGULATING NON-ELECTRIC VARIABLES
- G05D1/00—Control of position, course, altitude or attitude of land, water, air or space vehicles, e.g. using automatic pilots
- G05D1/10—Simultaneous control of position or course in three dimensions
- G05D1/101—Simultaneous control of position or course in three dimensions specially adapted for aircraft
- G05D1/106—Change initiated in response to external conditions, e.g. avoidance of elevated terrain or of no-fly zones
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04B—TRANSMISSION
- H04B1/00—Details of transmission systems, not covered by a single one of groups H04B3/00 - H04B13/00; Details of transmission systems not characterised by the medium used for transmission
- H04B1/38—Transceivers, i.e. devices in which transmitter and receiver form a structural unit and in which at least one part is used for functions of transmitting and receiving
- H04B1/40—Circuits
- H04B1/54—Circuits using the same frequency for two directions of communication
- H04B1/56—Circuits using the same frequency for two directions of communication with provision for simultaneous communication in two directions
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Aviation & Aerospace Engineering (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Circuits Of Receivers In General (AREA)
Abstract
A fixed-wing unmanned aerial vehicle communication algorithm is particularly applied to the control aspect of a fixed-wing aircraft, has the characteristics of small RAM and FLASH occupation, simple algorithm, high execution efficiency, strong real-time performance and the like, and belongs to the technical field of automatic control. The algorithm is specifically realized on a transmitter and a receiver respectively around a control mode for realizing duplex communication, and the half-duplex communication between the transmitter and the receiver is realized.
Description
Technical Field
The invention relates to a fixed-wing unmanned aerial vehicle communication algorithm, which is particularly applied to the control aspect of a fixed-wing aircraft and belongs to the technical field of automatic control.
Background
With the continuous change of the aircraft, the requirements on the control system also change, and meanwhile, the increasingly enhanced control requirements also put new technical requirements on the algorithm of the control system. In fact, any control field needs the support of the algorithm, and the stronger the system function is, the stronger the requirement on the algorithm is. However, the original communication algorithm is generally a simplex communication algorithm from a transmitter to a receiver, even a duplex communication algorithm can only run on a platform with strong hardware system performance, and for general occasions, especially in the field of embedded computing with rather limited hardware resources, the original performance of the algorithm can not be developed mostly.
Disclosure of Invention
In order to overcome the defect that the existing control equipment algorithm can only complete simplex communication from a transmitter to a receiver, the invention provides a high-efficiency fixed wing aircraft half-duplex communication algorithm realized on an embedded microcontroller MCU (microprogrammed control Unit), and the algorithm adopts a 'sending-waiting' mode when the transmitter looks at the receiver, so that the bidirectional transmission of data is more reliable.
The algorithm is specifically realized on a transmitter and a receiver respectively, and the algorithm on the transmitter mainly comprises the following steps: initializing a system, configuring the initial state of a peripheral register, acquiring ADC (analog to digital converter) data, processing the data, sending the data, delaying for 150ms, waiting for the data returned by a receiver, and the like; the algorithm on the receiver mainly comprises the following steps: initializing a system, configuring the initial state of a peripheral register, acquiring data of a radio frequency module, recovering the data, changing a PWM output signal, acquiring data of an attitude sensor, returning Euler angle data of the attitude sensor within 150ms after receiving data of a transmitter, and the like.
The algorithm can realize half-duplex communication between the transmitter and the receiver, so that bidirectional data transmission becomes practical.
The present invention will be described in detail below with reference to the accompanying drawings and embodiments.
Drawings
FIG. 1 is a block diagram of an algorithm flow for a transmitter system;
FIG. 2 is a block diagram of an algorithm flow for a receiver system;
FIG. 3 is a general algorithm flow diagram;
fig. 4 is an I2C bus timing diagram.
Detailed Description
The transmitter workflow is as described in fig. 1. The system is powered on, assembly codes in the system call SystemInit to initialize the clock system before a main function is executed, and the CPU clock frequency is 72MHz, the AHB clock frequency is 72MHz, the PCLK1 is 36MHz, the PCLK2 is 72MHz, and the PLL clock frequency is 72MHz as a result of initialization. After the configuration of the clock system is completed, the clock system can enter a normal working mode.
Configuring an interrupt priority packet to be 2, wherein data sampled by an ADC (analog-to-digital converter) is transmitted to a RAM through a DMA (direct memory access), and the DMA is configured when the ADC is configured, so that the transmission of the DMA is enabled to complete interrupt, so that the interrupt priority packet of a system must be configured, the preemption priority for determining the DMA transmission completion interrupt has 2 bits, and the response priority has 2 bits.
Starting to initialize the peripheral equipment of the MCU, wherein the peripheral equipment configured at the transmitter end is provided with: the system comprises a system tick timer, a control LED, a buzzer, a GPIO port for reading a channel fine tuning key and a switch, an ADC (analog to digital converter) and an SPI (serial peripheral interface) controller. The concrete description is as follows:
1) GPIO port without multiplexing function output/input: the control of the buzzer and the LED, the input of the KEYs and the switches initialize BEE _ Init, LED _ Init, KEY _ Init and Switch _ Init by using the following functions. The control and reading of the hardware only uses the general function of the IO port, and has no other multiplexing function. In particular, the IO ports controlling the buzzer and the LED are configured to commonly push-pull output at a rate of 50MHz, and the initial state of the IO ports is such that both the buzzer and the LED are in an inactive state by default. The input mode of the channel fine tuning key is in a 9 x 9 matrix keyboard form, and an IO port needs to be converted between input pull-up and input pull-down through a relevant register configured with GPIO. The switch input is configured to input floating, because the input state of the switch is necessarily at high level or low level, and the floating state can not occur.
2) Initialization of the SPI controller: the SPI bus is a channel for data exchange between the microcontroller MCU and the 2.4g wireless radio frequency module, and the SPI bus is configured into the following components according to the characteristics of the 2.4g wireless radio frequency module: the clock line defaults to low level, 8-bit data size, chip select software management, two-wire full duplex. The clock line frequency of the SPI is 18MHz, at which high-speed communication can be accomplished.
3) Initialization of the ADC: the channel of the ADC is used for collecting the analog voltage value of each channel, the ADC is configured to be in a scanning mode because the sampling channel is not unique, and in order to reduce the load of an MCU (microprogrammed control Unit) kernel, accelerate ADC data transmission and improve the real-time performance of a system, DMA (direct memory access) is adopted to transmit AD conversion data. The sampling time of the 6AD channels is 28.5 clock cycles, and when the conversion of the 6 channels is completed, a DMA transfer completion interrupt is generated, which notifies the CPU of completion of one ADC data transfer.
After the peripheral configuration of the microcontroller MCU is completed, starting to configure a 2.4g wireless radio frequency module, and the steps are as follows: write TX node address (transmitter address, needs to be equal to receiver channel address), write RX _ ADDR _ P0 channel address for receiving the automatic acknowledgement signal, and same TX node address, enable channel 0 automatic acknowledgement, receive data channel 0 grant, configure automatic retransmission parameters as: waiting 500+86us, maximum automatic retransmission 10 times, selecting radio frequency channel 40, setting TX transmission parameters as: 0dBm,2Mbps, turn on the low noise amplifier gain, enable 16 bit CRC, launch mode, pin level low at interrupt.
Through the configuration, the system function of the transmitter can be completed in the dead loop of while:
calling a Get _ ADC1_ Value acquisition function; collecting data of 6ADC channels, and setting reference voltage of ADC as VrefThe number of ADC bits is n, and the analog voltage to be measured is VanalogWhen the output conversion digital value is N, the following relationship is given:
for the microcontroller MCU we use, the ADC is externally provided with: vref=3.3V、n=12。
The voltage digital quantity converted by the ADC is calculated by using the following relation:
wherein Vanalog∈[0V,3.3V]。
The data of the ADC is transmitted to the RAM by adopting the DMA, so that the kernel burden is reduced, the data transmission rate is improved, and the real-time performance of the system is improved.
Channel trim keys and switch inputs are scanned and a trim switch is used to determine the trim value of the channel to accommodate errors caused in the mechanical installation. The switch inputs are used to determine whether the corresponding channel needs to be inverted, specifically: aileron channel, elevator channel, throttle channel, rudder channel, CH5 channel, CH6 channel. The reverse problem when servo steering wheel installation is reverse is solved in the reverse purpose in passageway.
Data processing, reading the analog value collected by the ADC, the key value of the fine-tuning switch, and the value of the channel reversing switch in the front, and calculating a value to be sent according to the three data, specifically as shown in the following formula:
data [ i ] is a defined array, and the prototype is u16ADC1_ Data [6], i.e., where i is 0-5. Tiny [ i ] is the value of the read fine-tuning key, UP _ LIMIT is 2000, DOWN _ LIMIT is 1000, Data [ i ] on the right side of the formula is the original value sampled by the ADC, and Data [ i ] on the left side is the converted output value. and a [ i ], b [ i ] are correction coefficients of each channel.
Data is sent, data can be sent out after a series of processing, because the transmission FIFO of the 2.4g radio frequency module is byte addressing, and the data obtained through conversion is between 1000 and 2000 and exceeds the range (0-255) of one byte, the data can be sent after being split: the resolution results were as follows: aileron data high/low byte, elevator data high/low byte, throttle data high/low byte, rudder data high/low byte, CH5 channel data high/low byte, CH6 channel data high/low byte.
And immediately setting the 2.4g module to be in an accepting state after the transmission is finished, waiting for the data return of the receiver within 150ms, re-entering an ADC (analog to digital converter) sampling stage after the return data is received as shown in FIG. 1, circulating and continuing, finishing the functions of transmitting the control command of the transmitter and accepting the data return of the receiver, and finishing the duplex communication. Secondly, the receiver side:
the receiver workflow is as described in figure 2. The system is powered on, assembly codes in the system call SystemInit to initialize the clock system before a main function is executed, and the CPU clock frequency is 72MHz, the AHB clock frequency is 72MHz, the PCLK1 is 36MHz, the PCLK2 is 72MHz, and the PLL clock frequency is 72MHz as a result of initialization. After the configuration of the clock system is completed, the clock system can enter a normal working mode.
Starting to initialize the peripheral of the MCU, wherein the peripheral configured at the receiving end is provided with: and controlling the LED, simulating the output comparison of a GPIO port of I2C time sequence, an SPI controller and a timer TIM. The concrete description is as follows:
1) GPIO port without multiplexing function output/input: the control of the LED, the simulation of the I2C time sequence uses the following functions to initialize the control and reading of the hardware by RI _ LED _ Init and IIC _ Init, only uses the general function of the IO port, and has no other multiplexing function. Specifically, the IO port controlling the LED is configured as a 50MHz rate general push-pull output, whereas for a GPIO port simulating I2C timing, where the clock line SCL is a 50MHz rate general push-pull output, the SDA data line needs to be converted between input and output by configuring the relevant registers of the GPIO.
2) The initialization of the SPI controller is consistent with the transmitter and will not be described in detail herein.
3) Configuration of timer TIM output comparison: the input clock of the timer time base unit is 72MHz, when the frequency division coefficient PSC is 71 and the value of the ARR register is set to 19999, the timing beat is obtained to be 1us, the timing duration is 20ms, the output is compared and configured to be high output polarity in the PWM1 mode, and when the value of the CCR register is 1000, the PWM wave with the high level of 1ms and the period of 20ms is obtained.
After the peripheral configuration of the microcontroller MCU is completed, starting to configure a 2.4g wireless radio frequency module and an attitude sensor, and specifically comprising the following steps:
1)2.4g wireless radio frequency module: writing an RX channel 0 node address, which needs to be the same as the address of the transmitter, enabling channel 0 auto-acknowledge, allowing to receive data channel 0, selecting radio frequency channel 40, setting channel 0 to receive valid data width, setting TX transmit parameters: 0dBm,2Mbps, turn on the low noise amplifier gain, enable 16 bits CRC, receive mode, pin level goes low when interrupted.
2) An attitude sensor: resetting MPU6050, waking up MPU6050, enabling the temperature sensor, setting a system clock source as PLL, using X-axis gyroscope as reference, closing all interrupts, closing I2C master mode, closing FIFO, setting digital low-pass filter (DLPF), setting gyroscope sampling rate as 50Hz, setting gyroscope full-scale range: plus or minus 2000dps, setting the full range of the accelerometer: 2g, enable gyroscopes and accelerometers, enable MPU6050 internal dmp.
Through the configuration, the receiver can enter into the dead loop of while to complete the system function of the receiver:
the microcontroller MCU polls 6 bits of the STATUS register bit through the SPI bus, if bit6 bits are reset, the data are not received, the inquiry is continued, and if bit6 bits are set, the data arrive. After the data arrives, the data split at the transmitting end is recovered, the recovered values are all distributed between 1000 and 2000 and represent that the duration time of the high level of the PWM signal is between 1000us and 2000us (the period is 20ms), and then the duty ratio of the PWM signal of each channel is changed by calling a TIM _ SetCompearX function, so that the size of an accelerator and the deflection angle of a steering engine are changed, and the flight attitude of the airplane is controlled. And 3, reading Euler angle data of the attitude sensor by GPIO simulation according to the I2C time sequence of figure 4, setting a 2.4g wireless radio frequency module as a transmitting mode, and preparing to return data such as Euler angles and the like to finish the duplex communication.
Since the transmitter waits for 150ms after the data transmission is completed, the receiver must complete the data backhaul within 150ms after receiving the data, otherwise the transmitting end cannot receive the data backhaul, resulting in failure of the duplex communication.
After the design of the whole duplex algorithm is completed, in order to improve the execution efficiency of the whole code and improve the real-time performance of the system, the-O2 optimization is adopted during compiling, so that the code execution efficiency is higher, and the method can be more suitable for the actual site.
Claims (5)
1. A fixed wing drone communication algorithm, comprising the steps of:
s1: the transmitter adopts a 'sending-waiting' mode to the receiver, and the bidirectional transmission of data is reliable.
S2: the transmitter terminal collects data, processes and sends the data, and waits for data to be transmitted back after the data is finished;
s3: the receiver waits for the data of the transmitter, firstly controls the flight attitude after receiving the data, and then collects the attitude sensor data;
s4: the receiver feeds back data to the transmitter, and continues to wait for the transmitter data after the data is finished;
s5: and after receiving the returned data, the transmitter reads the data again.
2. A fixed-wing drone communication algorithm according to claim 1, characterised in that in step 2: the fine tuning key for data collection adopts 9-9 matrix keyboard input, and is realized by switching the GPIO port between push-pull output and pull-up input.
4. A fixed-wing drone communication algorithm according to claim 1, characterised in that in step 3: the following logic is adopted to judge whether Get _ NRF _ RI _ Data is equal to zero to judge whether Data comes.
5. A fixed-wing drone communication algorithm according to claim 1, characterised in that in step 3: the PWM duty cycle is changed using the following logic:
the function is the argument TIM1, PWM _ CCR [ x ] inside TIM _ SetComplere 1; PWM _ CCR [ x ] is the CCR value of the corresponding PWM channel x.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110903855.5A CN113641185A (en) | 2021-08-06 | 2021-08-06 | Fixed-wing unmanned aerial vehicle communication algorithm |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110903855.5A CN113641185A (en) | 2021-08-06 | 2021-08-06 | Fixed-wing unmanned aerial vehicle communication algorithm |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113641185A true CN113641185A (en) | 2021-11-12 |
Family
ID=78419964
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110903855.5A Pending CN113641185A (en) | 2021-08-06 | 2021-08-06 | Fixed-wing unmanned aerial vehicle communication algorithm |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113641185A (en) |
-
2021
- 2021-08-06 CN CN202110903855.5A patent/CN113641185A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10198382B2 (en) | 12C bus controller slave address register and command FIFO buffer | |
US20170168966A1 (en) | Optimal latency packetizer finite state machine for messaging and input/output transfer interfaces | |
US20180357199A1 (en) | Slave-to-slave communication in i3c bus topology | |
CN107015927B (en) | SoC-based device for supporting multiple SPI interface standard groups | |
CN112639756A (en) | Mixed-mode radio frequency front-end interface | |
KR20160107247A (en) | Camera control interface extension with in-band interrupt | |
US20150103845A1 (en) | Synchronization time-division multiplexing bus communication method adopting serial communication interface | |
CN111277478B (en) | RS485 bus multiplexing control method based on slave devices with different baud rates | |
CN100498866C (en) | Method for receiving infrared remote control signal through serial port | |
CN101359425A (en) | Receiver and receiving method | |
US10733121B2 (en) | Latency optimized I3C virtual GPIO with configurable operating mode and device skip | |
CN109507934B (en) | Cascade self-adaptive digital I/O and analog signal acquisition circuit | |
JP2018528540A (en) | Unified system and method for inter-chip and intra-chip node communication | |
CN111627200B (en) | Signal modulation method and circuit based on infrared protocol and remote control terminal | |
US20010044862A1 (en) | Serializing and deserialing parallel information for communication between devices for communicating with peripheral buses | |
CN113641185A (en) | Fixed-wing unmanned aerial vehicle communication algorithm | |
CN110874339A (en) | Data transmission format conversion circuit and method for controlling operation thereof | |
CN106921480A (en) | A kind of algorithm for realizing Fixed Wing AirVehicle half-duplex operation | |
EP3298502B1 (en) | Serial bus embedded side band communications | |
CN113835366A (en) | Fixed-wing aircraft control system and method thereof | |
CN105005246A (en) | Portable data acquisition terminal | |
US12056069B2 (en) | Method and apparatus for optimizing input latency in a wireless human interface device system | |
CN221354315U (en) | MCU with built-in LIN transceiver | |
AU2018433605B2 (en) | A wireless lighting effect configuration data transmission system | |
KR101117315B1 (en) | Sensor node and Method for composing sensor node |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication |