CN105700540A - FPGA-based unmanned plane flight control circuit - Google Patents
FPGA-based unmanned plane flight control circuit Download PDFInfo
- Publication number
- CN105700540A CN105700540A CN201610132773.4A CN201610132773A CN105700540A CN 105700540 A CN105700540 A CN 105700540A CN 201610132773 A CN201610132773 A CN 201610132773A CN 105700540 A CN105700540 A CN 105700540A
- Authority
- CN
- China
- Prior art keywords
- circuit
- data
- module
- control
- attitude
- 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.)
- Granted
Links
- RZVHIXYEVGDQDX-UHFFFAOYSA-N 9,10-anthraquinone Chemical compound C1=CC=C2C(=O)C3=CC=CC=C3C(=O)C2=C1 RZVHIXYEVGDQDX-UHFFFAOYSA-N 0.000 title claims abstract description 50
- 238000005259 measurement Methods 0.000 claims abstract description 141
- 238000004364 calculation method Methods 0.000 claims abstract description 52
- 238000012545 processing Methods 0.000 claims description 52
- 238000006243 chemical reaction Methods 0.000 claims description 42
- 238000010606 normalization Methods 0.000 claims description 25
- 238000009499 grossing Methods 0.000 claims description 24
- 238000001914 filtration Methods 0.000 claims description 16
- 239000011159 matrix material Substances 0.000 claims description 16
- 230000004927 fusion Effects 0.000 claims description 12
- 238000003379 elimination reaction Methods 0.000 claims description 10
- 230000001360 synchronised effect Effects 0.000 claims description 10
- 230000000295 complement effect Effects 0.000 claims description 8
- 238000012937 correction Methods 0.000 claims description 6
- 230000002093 peripheral effect Effects 0.000 claims description 4
- 230000009466 transformation Effects 0.000 claims description 4
- 238000004891 communication Methods 0.000 claims description 2
- 238000010586 diagram Methods 0.000 description 8
- 238000012795 verification Methods 0.000 description 8
- 238000000034 method Methods 0.000 description 7
- 230000008030 elimination Effects 0.000 description 6
- 238000007781 pre-processing Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 6
- 230000033001 locomotion Effects 0.000 description 3
- 230000035945 sensitivity Effects 0.000 description 3
- 230000001133 acceleration Effects 0.000 description 1
- 230000035559 beat frequency Effects 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003672 processing method Methods 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
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/08—Control of attitude, i.e. control of roll, pitch, or yaw
- G05D1/0808—Control of attitude, i.e. control of roll, pitch, or yaw specially adapted for aircraft
Landscapes
- Engineering & Computer Science (AREA)
- Aviation & Aerospace Engineering (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Automation & Control Theory (AREA)
- Control Of Position, Course, Altitude, Or Attitude Of Moving Bodies (AREA)
Abstract
本发明提供了一种基于FPGA的无人机飞行控制电路,包括:控制器模块、九轴测量模块、姿态解算模块、PID控制模块和遥控舵机模块,其中,九轴测量模块、姿态解算模块、PID控制模块以及遥控舵机模块依次电连接;九轴测量模块用于根据加速度计、陀螺仪和所述磁力计传送的测量数据生成并输出九轴数据;姿态解算模块用于根据九轴数据生成并输出飞行姿态数据;PID控制模块用于根据九轴数据以及飞行姿态数据计算生成电机控制数据,遥控舵机模块用于根据遥控信号、电机控制数据生成用以控制电子调速器的控制信号。本发明的基于FPGA的无人机飞行控制电路,通过采用FPGA作为微控制器,实现对无人机的各个电机的并行控制,提高了电机控制的精确度和实时性。
The invention provides an FPGA-based UAV flight control circuit, including: a controller module, a nine-axis measurement module, an attitude calculation module, a PID control module, and a remote control servo module, wherein the nine-axis measurement module, the attitude solution The calculation module, the PID control module and the remote control servo module are electrically connected in turn; the nine-axis measurement module is used to generate and output nine-axis data according to the measurement data transmitted by the accelerometer, gyroscope and the magnetometer; the attitude calculation module is used to generate and output nine-axis data according to the The nine-axis data generates and outputs flight attitude data; the PID control module is used to calculate and generate motor control data based on the nine-axis data and flight attitude data, and the remote control servo module is used to control the electronic governor based on remote control signals and motor control data. control signal. The FPGA-based UAV flight control circuit of the present invention realizes parallel control of each motor of the UAV by using the FPGA as a microcontroller, thereby improving the accuracy and real-time performance of motor control.
Description
技术领域technical field
本发明涉及无人机技术领域,特别是涉及一种基于FPGA的无人机飞行控制电路。The invention relates to the technical field of unmanned aerial vehicles, in particular to an FPGA-based flight control circuit for unmanned aerial vehicles.
背景技术Background technique
一般多旋翼无人机的飞行控制电路包括控制芯片、惯性测量电路、电子罗盘、气压计、PWM输入信号模块、PWM输出信号模块、GPS模块以及串口RS232或I2C等接口。其中,控制芯片多采用MCU(MicrocontrollerUnit,微控制电路)或DSP(DigitalSignalProcessor,数字信号处理器),即使有些使用了FPGA,FPGA也仅仅用以扩展IO接口。也就是说,目前的多旋翼无人机中飞行控制算法均是采用串行的方式,不能够精确并行的控制多旋翼无人机的电机,对电机控制的精度以及实时性较差。The flight control circuit of a general multi-rotor UAV includes a control chip, an inertial measurement circuit, an electronic compass, a barometer, a PWM input signal module, a PWM output signal module, a GPS module, and serial RS232 or I2C interfaces. Among them, the control chip mostly adopts MCU (Microcontroller Unit, micro-control circuit) or DSP (Digital Signal Processor, digital signal processor), even if some use FPGA, FPGA is only used to expand the IO interface. That is to say, the current flight control algorithms in multi-rotor UAVs are all in a serial manner, which cannot accurately and parallelly control the motors of multi-rotor UAVs, and the accuracy and real-time performance of motor control are poor.
发明内容Contents of the invention
鉴于现有技术的现状,本发明的目的在于提供一种基于FPGA的无人机飞行控制电路,能够并行的控制无人机的各个电机,从而提高电机控制的精度以及实时性。In view of the status quo of the prior art, the purpose of the present invention is to provide an FPGA-based UAV flight control circuit, which can control the various motors of the UAV in parallel, thereby improving the accuracy and real-time performance of motor control.
为实现上述目的,本发明采用如下技术方案:To achieve the above object, the present invention adopts the following technical solutions:
一种基于FPGA的无人机飞行控制电路,包括:控制器模块以及分别与所述控制器模块电连接的九轴测量模块、姿态解算模块、PID控制模块和遥控舵机模块,其中,所述九轴测量模块、所述姿态解算模块、所述PID控制模块以及所述遥控舵机模块依次电连接;An FPGA-based UAV flight control circuit, comprising: a controller module and a nine-axis measurement module electrically connected to the controller module, an attitude calculation module, a PID control module and a remote steering gear module, wherein the The nine-axis measurement module, the attitude calculation module, the PID control module and the remote control servo module are electrically connected in sequence;
所述九轴测量模块连接至加速度计、陀螺仪和磁力计,用于根据所述加速度计、所述陀螺仪和所述磁力计传送的测量数据生成并输出九轴数据;The nine-axis measurement module is connected to an accelerometer, a gyroscope, and a magnetometer, and is used to generate and output nine-axis data according to measurement data transmitted by the accelerometer, the gyroscope, and the magnetometer;
所述姿态解算模块用于根据所述九轴数据生成并输出飞行姿态数据;The attitude calculation module is used to generate and output flight attitude data according to the nine-axis data;
所述PID控制模块连接所述九轴测量模块,所述PID控制模块包括至少三个并行设置的姿态角控制电路,用于根据所述九轴测量模块传送的九轴数据以及所述飞行姿态数据计算生成电机控制数据;The PID control module is connected to the nine-axis measurement module, and the PID control module includes at least three attitude angle control circuits arranged in parallel for transmitting the nine-axis data and the flight attitude data according to the nine-axis measurement module. Calculate and generate motor control data;
所述遥控舵机模块连接遥控器接收机以及与所述无人机的各个电机连接的电子调速器,所述遥控舵机模块用于根据所述遥控器发送的遥控信号、所述PID控制模块输出的电机控制数据生成用以控制所述电子调速器的控制信号,并将所述控制信号反馈至所述PID控制模块,以并行的控制所述无人机的各个电机运行。The remote control servo module is connected to the remote control receiver and the electronic governor connected to each motor of the drone, and the remote control servo module is used to control the The motor control data output by the module generates a control signal for controlling the electronic governor, and feeds back the control signal to the PID control module to control the operation of each motor of the drone in parallel.
在本发明的一个实施例中,所述九轴测量模块包括中断控制电路以及依次电连接的数据缓冲电路、数据处理电路、数据选通电路、数据还原电路和同步输出电路;In one embodiment of the present invention, the nine-axis measurement module includes an interrupt control circuit and a data buffer circuit, a data processing circuit, a data gating circuit, a data restoration circuit and a synchronous output circuit electrically connected in sequence;
其中,所述数据缓冲电路、所述数据处理电路和所述同步输出模块连接所述控制器模块;所述中断控制电路连接至所述数据选通电路和所述数据还原电路,用于控制所述数据选通电路的导通或关闭;Wherein, the data buffer circuit, the data processing circuit and the synchronous output module are connected to the controller module; the interrupt control circuit is connected to the data gating circuit and the data restoration circuit, and is used to control the Turn on or off of the data strobe circuit;
所述数据缓冲电路连接所述加速度计、所述陀螺仪和所述磁力计,用以获取所述加速度计、所述陀螺仪和所述磁力计的测量数据,所述数据处理电路用于对所述测量数据进行滤波处理,所述数据还原电路用于对所述测量数据进行数制转换以及归一化处理,所述同步输出模块连接所述姿态解算模块,所述同步输出电路用于同步生成所述九轴数据,并将所述九轴数据传送至所述姿态解算模块。The data buffer circuit is connected to the accelerometer, the gyroscope and the magnetometer to obtain the measurement data of the accelerometer, the gyroscope and the magnetometer, and the data processing circuit is used for The measurement data is filtered, the data restoration circuit is used to perform digital conversion and normalization processing on the measurement data, the synchronization output module is connected to the attitude calculation module, and the synchronization output circuit is used for Synchronously generate the nine-axis data, and transmit the nine-axis data to the attitude calculation module.
在本发明的一个实施例中,所述数据处理电路包括加速度计数据处理单元、陀螺仪数据处理单元和磁力计数据处理单元;In one embodiment of the present invention, the data processing circuit includes an accelerometer data processing unit, a gyroscope data processing unit and a magnetometer data processing unit;
所述加速度计数据处理单元包括依次电连接的第一平滑滤波器组和第一数据选通器,用于对所述加速度计的测量数据进行平滑滤波处理;The accelerometer data processing unit includes a first smoothing filter bank and a first data gate electrically connected in sequence, for smoothing and filtering the measurement data of the accelerometer;
所述陀螺仪数据处理单元包括依次电连接的第二平滑滤波器组、零偏值计算-消除电路以及第二数据选通器,用于对所述陀螺仪的测量数据进行平滑滤波、消除零偏值的处理;The gyroscope data processing unit includes a second smoothing filter bank, a zero bias value calculation-elimination circuit and a second data gate, which are electrically connected in sequence, for smoothing and filtering the measured data of the gyroscope, eliminating zero Handling of partial values;
所述磁力计数据处理电路包括依次电连接的第三平滑滤波器组、校准-归一化电路以及第三数据选通器,用于对所述磁力计的测量数据进行平滑滤波、校准处理;The magnetometer data processing circuit includes a third smoothing filter bank, a calibration-normalization circuit and a third data gate that are electrically connected in sequence, and are used to smooth filter and calibrate the measurement data of the magnetometer;
其中,所述第一数据选通器、所述第二数据选通器以及所述第三数据选通器分别连接至所述控制器模块。Wherein, the first data strobe, the second data strobe and the third data strobe are respectively connected to the controller module.
在本发明的一个实施例中,所述姿态解算模块包括加速度计误差测量电路、磁力计误差测量电路、陀螺仪误差测量电路、四元数更新电路、姿态转换矩阵更新电路以及姿态角转换电路;In one embodiment of the present invention, the attitude calculation module includes an accelerometer error measurement circuit, a magnetometer error measurement circuit, a gyroscope error measurement circuit, a quaternion update circuit, an attitude transformation matrix update circuit, and an attitude angle conversion circuit ;
所述加速度计误差测量电路、所述磁力计误差测量电路均连接至所述陀螺仪误差测量电路,所述陀螺仪误差测量电路依次电连接所述四元数更新电路、所述姿态转换矩阵更新电路以及所述姿态角转换电路;Both the accelerometer error measurement circuit and the magnetometer error measurement circuit are connected to the gyroscope error measurement circuit, and the gyroscope error measurement circuit is electrically connected to the quaternion update circuit and the attitude conversion matrix update circuit in turn. circuit and the attitude angle conversion circuit;
所述陀螺仪误差测量电路用于根据所述加速度计误差测量电路生成的加速度计误差值、所述磁力计误差测量电路生成的磁力计误差值以及所述陀螺仪的测量数据通过互补滤波算法生成陀螺仪修正数据;The gyroscope error measurement circuit is used to generate the accelerometer error value generated by the accelerometer error measurement circuit, the magnetometer error value generated by the magnetometer error measurement circuit, and the measurement data of the gyroscope through a complementary filtering algorithm Gyroscope correction data;
所述四元数更新电路用于根据所述陀螺仪修正数据以及上一次的四元数值生成新的四元数值;所述姿态转换矩阵更新电路用于根据所述新的四元数值生成姿态矩阵,并将所述新的四元数值反馈至所述加速计误差测量电路及所述磁力计误差测量电路;所述姿态角转换电路用于根据所述姿态矩阵生成姿态角。The quaternion update circuit is used to generate a new quaternion value according to the gyroscope correction data and the last quaternion value; the attitude transformation matrix update circuit is used to generate an attitude matrix according to the new quaternion value , and feed back the new quaternion value to the accelerometer error measurement circuit and the magnetometer error measurement circuit; the attitude angle conversion circuit is used to generate an attitude angle according to the attitude matrix.
在本发明的一个实施例中,所述PID控制模块包括输出控制电路以及并行设置的三个所述姿态角控制电路,三个所述姿态角控制电路分别为俯仰角控制电路、翻滚角控制电路和航偏角控制电路;In one embodiment of the present invention, the PID control module includes an output control circuit and three attitude angle control circuits arranged in parallel, and the three attitude angle control circuits are respectively a pitch angle control circuit and a roll angle control circuit and yaw angle control circuit;
所述俯仰角控制电路、所述翻滚角控制电路和所述航偏角控制电路分别连接所述姿态解算模块、所述九轴测量模块和所述输出控制电路;所述输出控制电路输出所述电机控制数据,并将所述电机控制数据反馈给所述俯仰角控制电路、所述翻滚角控制电路以及所述航偏角控制电路。The pitch angle control circuit, the roll angle control circuit and the yaw angle control circuit are respectively connected to the attitude calculation module, the nine-axis measurement module and the output control circuit; the output control circuit outputs the The motor control data is fed back to the pitch angle control circuit, the roll angle control circuit and the yaw angle control circuit.
在本发明的一个实施例中,所述俯仰角控制电路、所述翻滚角控制电路以及所述航偏角控制电路均采用双环结构。In one embodiment of the present invention, the pitch angle control circuit, the roll angle control circuit and the yaw angle control circuit all adopt a double-loop structure.
在本发明的一个实施例中,所述遥控舵机模块包括接收电路、电机控制电路以及通道编码电路;所述接收电路连接所述电机控制电路和所述通道编码电路,所述电机控制电路、所述通道编码电路连接所述控制器模块;In one embodiment of the present invention, the remote control servo module includes a receiving circuit, a motor control circuit, and a channel encoding circuit; the receiving circuit is connected to the motor control circuit and the channel encoding circuit, and the motor control circuit, The channel encoding circuit is connected to the controller module;
所述接收电路连接所述遥控器接收机,用于接收遥控器发送的包含多个通道数据的遥控信号,并分别对所述遥控信号的多个通道数据进行处理;所述通道编码电路用于根据所述遥控信号生成无人机工作模式控制信号,并将所述无人机工作模式信号传送至所述控制器模块;The receiving circuit is connected to the remote controller receiver, and is used for receiving the remote control signal sent by the remote controller and including multiple channel data, and respectively processing the multiple channel data of the remote control signal; the channel encoding circuit is used for Generate a control signal for the UAV working mode according to the remote control signal, and transmit the UAV working mode signal to the controller module;
所述电机控制电路连接所述PID控制模块,所述电机控制电路根据所述PID控制模块输出的电机控制数据以及所述无人机工作模式信号生成所述电机的通道数值,并将所述电机的通道数值转换为用以控制所述电子调速器的控制信号。The motor control circuit is connected to the PID control module, and the motor control circuit generates the channel value of the motor according to the motor control data output by the PID control module and the UAV working mode signal, and sends the motor The numerical value of the channel is converted into a control signal for controlling the electronic governor.
在本发明的一个实施例中,还包括与气压计连接的气压计读取-补偿模块;In one embodiment of the present invention, it also includes a barometer reading-compensation module connected with the barometer;
所述气压计读取-补偿模块包括分别与所述控制器模块电连接的初始化电路、数据读取电路、第四数据选通器、温度补偿电路、AD系数归一化电路以及数制转换电路;The barometer reading-compensation module includes an initialization circuit, a data reading circuit, a fourth data strobe, a temperature compensation circuit, an AD coefficient normalization circuit and a digital conversion circuit electrically connected to the controller module respectively ;
所述第四数据选通器连接所述气压计,所述初始化电路、所述数据读取电路均连接至所述第四数据选通器,所述数据读取电路、所述温度补偿电路、所述AD系数归一化电路以及所述数制转换电路依次电连接,所述数制转换电路用于输出气压值和温度值。The fourth data strobe is connected to the barometer, the initialization circuit and the data reading circuit are connected to the fourth data strobe, the data reading circuit, the temperature compensation circuit, The AD coefficient normalization circuit and the digital system conversion circuit are electrically connected in sequence, and the digital system conversion circuit is used to output air pressure value and temperature value.
在本发明的一个实施例中,还包括GPS模块和数据融合模块;In one embodiment of the present invention, it also includes a GPS module and a data fusion module;
所述气压计读取-补偿模块、所述GPS模块均连接至所述数据融合模块,所述数据融合模块与所述遥控舵机模块、所述姿态解算模块电连接;The barometer reading-compensation module and the GPS module are all connected to the data fusion module, and the data fusion module is electrically connected to the remote steering gear module and the attitude calculation module;
所述GPS模块用于获取所述无人机的定位信息,所述数据融合模块用于根据所述气压计读取-补偿模块输出的气压值、温度值、所述GPS模块输出的定位信息以及所述姿态解算模块生成的飞行姿态数据生成所述电机控制数据。The GPS module is used to obtain the positioning information of the drone, and the data fusion module is used to read the air pressure value, the temperature value output by the compensation module according to the barometer, the positioning information output by the GPS module, and The flight attitude data generated by the attitude calculation module generates the motor control data.
在本发明的一个实施例中,还包括与所述控制器模块电连接的定时器模块、复位模块以及按键模块;In one embodiment of the present invention, it also includes a timer module, a reset module and a button module electrically connected to the controller module;
所述按键模块与外设的控制按键和显示灯连接,所述显示灯用于指示所述无人机的工作状态。The button module is connected with the control buttons and display lights of the peripherals, and the display lights are used to indicate the working status of the drone.
在本发明的一个实施例中,所述基于FPGA的无人机飞行控制电路与上位机通信连接。In one embodiment of the present invention, the FPGA-based flight control circuit of the UAV is connected with the upper computer in communication.
本发明的有益效果是:The beneficial effects of the present invention are:
本发明的基于FPGA的无人机飞行控制电路,通过采用FPGA作为微控制器,并设置有姿态解算模块实时获得无人机的飞行姿态数据,PID控制模块用于根据飞行姿态数据和九轴测量模块传送的九轴数据计算生成电机控制数据,遥控舵机模块根据电机控制数据生成控制信号,以实现对无人机的各个电机的并行控制,同时,由于FPGA的并行处理速度远高于微控制器的串行处理速度,因此,通过FPGA的控制平台,缩短了飞行控制电路的计算时间,从而提高了电机控制的精确度和实时性,为无人机飞控芯片的开发奠定了基础。The unmanned aerial vehicle flight control circuit based on FPGA of the present invention, by adopting FPGA as micro-controller, and is provided with the attitude solving module and obtains the flight attitude data of unmanned aerial vehicle in real time, and the PID control module is used for according to flight attitude data and nine axis The nine-axis data transmitted by the measurement module is calculated to generate motor control data, and the remote control servo module generates control signals according to the motor control data to realize parallel control of each motor of the drone. At the same time, because the parallel processing speed of FPGA is much higher than that of micro The serial processing speed of the controller, therefore, through the FPGA control platform, shortens the calculation time of the flight control circuit, thereby improving the accuracy and real-time performance of the motor control, and laying the foundation for the development of the UAV flight control chip.
附图说明Description of drawings
图1为本发明的基于FPGA的无人机飞行控制电路一实施例的原理框图;Fig. 1 is the functional block diagram of an embodiment of the unmanned aerial vehicle flight control circuit based on FPGA of the present invention;
图2为本发明的飞行控制电路中九轴测量模块一实施例的原理框图;Fig. 2 is the functional block diagram of an embodiment of the nine-axis measurement module in the flight control circuit of the present invention;
图3为本发明的飞行控制电路中九轴测量模块一实施例的读取测量数据的操作示意图;Fig. 3 is a schematic diagram of the operation of reading measurement data of an embodiment of the nine-axis measurement module in the flight control circuit of the present invention;
图4为本发明的飞行控制电路中姿态解算模块一实施例的原理框图;Fig. 4 is the functional block diagram of an embodiment of the attitude calculation module in the flight control circuit of the present invention;
图5为本发明的飞行控制电路中PID控制模块一实施例的原理框图;Fig. 5 is the functional block diagram of an embodiment of the PID control module in the flight control circuit of the present invention;
图6为本发明的飞行控制电路中PID控制模块一实施例的控制过程图;Fig. 6 is a control process diagram of an embodiment of the PID control module in the flight control circuit of the present invention;
图7为本发明的飞行控制电路中遥控舵机模块一实施例的原理框图;Fig. 7 is the functional block diagram of an embodiment of the remote steering gear module in the flight control circuit of the present invention;
图8为本发明的飞行控制电路中气压计读取-补偿模块一实施例的原理框图;Fig. 8 is a functional block diagram of an embodiment of the barometer reading-compensation module in the flight control circuit of the present invention;
图9为本发明的飞行控制电路中气压计读取-补偿模块的初始化及数据读取的操作流程图。FIG. 9 is a flow chart of the initialization of the barometer reading-compensation module and the operation of data reading in the flight control circuit of the present invention.
具体实施方式detailed description
为了使本发明的技术方案更加清楚,以下结合附图,对本发明的基于FPGA的无人机飞行控制电路作进一步详细的说明。应当理解,此处所描述的具体实施例仅用以解释本发明并不用于限定本发明。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。In order to make the technical solution of the present invention clearer, the FPGA-based UAV flight control circuit of the present invention will be further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described here are only used to explain the present invention and not to limit the present invention. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
如图1所示,本发明提供了一种基于FPGA的无人机飞行控制电路,可以用于多旋翼无人机或固定翼无人机等无人机的飞行控制。该基于FPGA的无人机飞行控制电路。本发明的飞行控制电路采用FPGA芯片作为主要微控制单元,包括控制器模块100、九轴测量模块200、姿态解算模块300、PID控制模块400、遥控舵机模块500、气压计读取-补偿模块600、GPS模块700、数据融合模块800、定时器模块110、复位模块120以及按键模块900。As shown in FIG. 1 , the present invention provides an FPGA-based UAV flight control circuit, which can be used for flight control of UAVs such as multi-rotor UAVs or fixed-wing UAVs. The FPGA-based UAV flight control circuit. The flight control circuit of the present invention adopts the FPGA chip as the main micro-control unit, including a controller module 100, a nine-axis measurement module 200, an attitude calculation module 300, a PID control module 400, a remote steering gear module 500, and a barometer reading-compensation Module 600 , GPS module 700 , data fusion module 800 , timer module 110 , reset module 120 and key module 900 .
其中,定时器模块110、复位模块120以及按键模块900均连接至控制器模块100;本实施例中,定时器模块110的节拍频率可以为5ms,以提供稳定的定时节拍。复位模块120用于为该飞行控制电路的各个电路模块提供稳定的复位信号和时钟信号,其中,时钟信号的频率可以达到100MHz。GPS模块700用于获取该无人机的实时定位信息。控制器模块100作为该飞行控制电路的顶层模块,用于在定时器模块110的节拍下调控所有模块的输入输出,控制各个模块的初始化。Wherein, the timer module 110, the reset module 120 and the button module 900 are all connected to the controller module 100; in this embodiment, the beat frequency of the timer module 110 can be 5ms to provide a stable timing beat. The reset module 120 is used to provide a stable reset signal and a clock signal for each circuit module of the flight control circuit, wherein the frequency of the clock signal can reach 100 MHz. The GPS module 700 is used to obtain the real-time positioning information of the drone. The controller module 100 is used as the top-level module of the flight control circuit, and is used to regulate the input and output of all modules under the beat of the timer module 110 and control the initialization of each module.
九轴测量模块200、姿态解算模块300、PID控制模块400与控制器模块100电连接,控制器模块100用于控制上述各个模块的初始化等操作,九轴测量模块200、姿态解算模块300、PID控制模块400能够将其输出的测量数据反馈至控制器模块100,以便于控制器模块100根据无人机的飞行参数实时控制其飞行姿态。具体地,九轴测量模块200、姿态解算模块300、PID控制模块400以及遥控舵机模块500依次电连接,九轴测量模块200连接至加速度计、陀螺仪和磁力计,用于根据加速度计、陀螺仪和磁力计传送的测量数据生成并输出九轴数据。The nine-axis measurement module 200, the attitude calculation module 300, and the PID control module 400 are electrically connected to the controller module 100. The controller module 100 is used to control the initialization and other operations of the above-mentioned modules. The nine-axis measurement module 200 and the attitude calculation module 300 . The PID control module 400 can feed back the output measurement data to the controller module 100, so that the controller module 100 can control its flight attitude in real time according to the flight parameters of the drone. Specifically, the nine-axis measurement module 200, the attitude calculation module 300, the PID control module 400, and the remote control servo module 500 are electrically connected in sequence, and the nine-axis measurement module 200 is connected to an accelerometer, a gyroscope, and a magnetometer for use in accordance with the accelerometer. , gyroscope, and magnetometer transmit measurement data to generate and output nine-axis data.
本实施例中,加速度计为三轴加速度计,陀螺仪为三轴陀螺仪,磁力计为三轴磁力计,因此,九轴测量模块200输出的为九轴数据。其中,三轴加速度计用于感知无人机在机体坐标系的三轴方向上的加速度,主要用于检测无人机的三轴运动情况。三轴陀螺仪用于根据其内部的陀螺转子的垂直轴与无人机之间的夹角,计算无人机在机体坐标系的三轴方向上的角速度,以判别无人机在三轴方向的运动状态,三轴加速度计和三轴陀螺仪主要用于确定无人机的俯仰角和翻滚角。三轴磁力计用以修正因陀螺仪零漂而产生的自旋,主要用于修正陀螺仪的Z轴测量数据,即航偏角的测量数据,因此,三轴磁力计主要用于确定无人机的指向方向。九轴测量模块200通过I2C总线连接加速度计、陀螺仪以及磁力计,用以读取加速计、陀螺仪和磁力计等传感器的测量数据。In this embodiment, the accelerometer is a three-axis accelerometer, the gyroscope is a three-axis gyroscope, and the magnetometer is a three-axis magnetometer. Therefore, the nine-axis measurement module 200 outputs nine-axis data. Among them, the three-axis accelerometer is used to sense the acceleration of the UAV in the three-axis direction of the body coordinate system, and is mainly used to detect the three-axis movement of the UAV. The three-axis gyroscope is used to calculate the angular velocity of the drone in the three-axis direction of the body coordinate system according to the angle between the vertical axis of the internal gyro rotor and the drone, so as to distinguish the drone in the three-axis direction The motion state of the drone, the three-axis accelerometer and the three-axis gyroscope are mainly used to determine the pitch angle and roll angle of the drone. The three-axis magnetometer is used to correct the spin caused by the zero drift of the gyroscope. It is mainly used to correct the Z-axis measurement data of the gyroscope, that is, the measurement data of the yaw angle. Therefore, the three-axis magnetometer is mainly used to determine the machine's pointing direction. The nine-axis measurement module 200 is connected to the accelerometer, gyroscope and magnetometer through the I2C bus to read the measurement data of sensors such as the accelerometer, gyroscope and magnetometer.
本实施例中,在采集测量数据之前,需要对加速度计、陀螺仪和磁力计等传感器进行初始化配置,如预设传感器的电源参数、复位参数或传感器的采集频率等。由于本实施例中的加速度计、陀螺仪以及磁力计均连接在I2C总线上,因此,九轴测量模块200读取测量数据的操作与传感器的初始化操作共用一个I2C接口,读取测量数据的操作和传感器的初始化操作需要串行执行。如图3所示,九轴测量模块200首先通过I2C总线将相应的初始化参数写入各个传感器中,以实现各个传感器的初始化,之后开始循环读取各个传感器的测量数据。In this embodiment, before collecting measurement data, it is necessary to initialize the configuration of sensors such as accelerometers, gyroscopes, and magnetometers, such as presetting the power parameters of the sensors, reset parameters, or the acquisition frequency of the sensors. Since the accelerometer, gyroscope and magnetometer in this embodiment are all connected on the I2C bus, therefore, the operation of the nine-axis measurement module 200 to read the measurement data shares an I2C interface with the initialization operation of the sensor, and the operation of reading the measurement data and sensor initialization operations need to be performed serially. As shown in FIG. 3 , the nine-axis measurement module 200 first writes corresponding initialization parameters into each sensor through the I2C bus to realize the initialization of each sensor, and then starts to read the measurement data of each sensor cyclically.
姿态解算模块300用于根据九轴测量模块200传送的九轴数据,利用导航原理生成并输出飞行姿态数据,并将飞行姿态数据传送至PID控制模块400。这里的飞行姿态数据用于记录飞行器的三轴在空中相对于某条参考线、或某个参考平面、或某固定的坐标系统间的状态。PID控制模块400连接九轴测量模块200和姿态解算模块300,包括至少三个并行设置的姿态角控制电路,用于根据九轴测量模块200传送的九轴数据以及姿态解算模块300传送的飞行姿态数据计算生成电机控制数据,并将电机控制数据传送至遥控舵机模块500。其中,每个姿态角控制电路对应控制一个姿态角,该无人机的姿态角包括俯仰角、翻滚角以及航偏角等等。至少三个姿态角控制电路相互独立、并行工作,以缩短该飞行控制电路的计算时间,通过采用FPGA的并行处理方式,可以提高控制数据的精度。PID控制模块400输出的电机控制数据用于控制各个电机的运行,包括油门系数、俯仰角、翻滚角、航偏角等等。The attitude calculation module 300 is used to generate and output flight attitude data according to the nine-axis data transmitted by the nine-axis measurement module 200 using the navigation principle, and transmit the flight attitude data to the PID control module 400 . The flight attitude data here is used to record the state of the three-axis of the aircraft relative to a certain reference line, or a certain reference plane, or a certain fixed coordinate system in the air. The PID control module 400 is connected to the nine-axis measurement module 200 and the attitude calculation module 300, and includes at least three attitude angle control circuits arranged in parallel for the nine-axis data transmitted by the nine-axis measurement module 200 and the attitude calculation module 300. The flight attitude data is calculated to generate motor control data, and the motor control data is sent to the remote control servo module 500 . Wherein, each attitude angle control circuit controls an attitude angle correspondingly, and the attitude angle of the UAV includes a pitch angle, a roll angle, a yaw angle, and the like. At least three attitude angle control circuits work independently and in parallel to shorten the calculation time of the flight control circuit, and the accuracy of control data can be improved by adopting the parallel processing method of FPGA. The motor control data output by the PID control module 400 is used to control the operation of each motor, including throttle coefficient, pitch angle, roll angle, yaw angle and so on.
遥控舵机模块500作为无人机的控制信号的输入和输出执行设备,连接遥控器以及与无人机的各个电机连接的电子调速器,遥控舵机模块500通过电子调速器控制各个电机的运行。具体地,遥控舵机模块500通过I/O接口连接接收机,遥控器与接收机对应设置。操控者通过遥控器将控制信息编码后以电磁波的形式将遥控信号发送出去,接收机对遥控信号进行解调后,将解调后的遥控信号传送至遥控舵机模块500,遥控舵机模块500用于根据接收的遥控信号、PID控制模块400输出的电机控制数据生成用以控制电子调速器的控制信号,并将控制信号反馈至PID控制模块400,以并行的控制无人机的各个电机的运行。The remote control servo module 500 is used as the input and output execution equipment of the control signal of the drone, and is connected with the remote controller and the electronic governor connected with each motor of the drone, and the remote control servo module 500 controls each motor through the electronic governor running. Specifically, the remote control servo module 500 is connected to the receiver through an I/O interface, and the remote control is set correspondingly to the receiver. The operator encodes the control information through the remote controller and sends out the remote control signal in the form of electromagnetic waves. After the receiver demodulates the remote control signal, it transmits the demodulated remote control signal to the remote control servo module 500, and the remote control servo module 500 It is used to generate a control signal for controlling the electronic governor according to the received remote control signal and the motor control data output by the PID control module 400, and feed back the control signal to the PID control module 400 to control each motor of the drone in parallel running.
在本发明的一个实施例中,如图2所示,九轴测量模块200包括中断控制电路260以及依次电连接的数据缓冲电路210、数据处理电路220、数据选通电路230、数据还原电路240和同步输出电路250,同步输出模块250连接姿态解算模块300,同步输出电路250用于同步生成九轴数据,并将九轴数据传送至姿态解算模块300,用于计算无人机的飞行姿态数据。In one embodiment of the present invention, as shown in FIG. 2, the nine-axis measurement module 200 includes an interrupt control circuit 260 and a data buffer circuit 210, a data processing circuit 220, a data gating circuit 230, and a data restoration circuit 240 that are electrically connected in sequence. And the synchronous output circuit 250, the synchronous output module 250 is connected to the attitude calculation module 300, the synchronous output circuit 250 is used to synchronously generate nine-axis data, and the nine-axis data is sent to the attitude calculation module 300 for calculating the flight of the unmanned aerial vehicle pose data.
其中,数据缓冲电路210、数据处理电路220和同步输出电路250连接控制器模块100,控制器模块100用于选通数据处理电路220并控制同步输出电路250的输出。中断控制电路260连接至数据选通电路230和数据还原电路240,中断控制电路260用于通过输出的中断信号控制数据选通电路230的选通或关闭以及数据还原电路240的执行顺序。本实施例中,数据选通电路230可以是数据选通器。Wherein, the data buffer circuit 210 , the data processing circuit 220 and the synchronous output circuit 250 are connected to the controller module 100 , and the controller module 100 is used for gating the data processing circuit 220 and controlling the output of the synchronous output circuit 250 . The interrupt control circuit 260 is connected to the data gating circuit 230 and the data restoration circuit 240 , and the interrupt control circuit 260 is used to control the gating or closing of the data gating circuit 230 and the execution order of the data restoration circuit 240 through the output interrupt signal. In this embodiment, the data gating circuit 230 may be a data gating device.
数据缓冲电路210连接三轴加速度计、三轴陀螺仪和三轴磁力计,用以读取并存储三轴加速度计、三轴陀螺仪和三轴磁力计的测量数据,并将上述传感器的原始测量数据传送至数据处理电路220。数据处理电路220用于对测量数据进行滤波处理、数据校准等操作,并将经过预处理的测量数据经数据选通电路230传送至数据还原电路240。The data buffer circuit 210 is connected with the three-axis accelerometer, the three-axis gyroscope and the three-axis magnetometer to read and store the measurement data of the three-axis accelerometer, the three-axis gyroscope and the three-axis magnetometer, and transfer the original data of the above-mentioned sensors to The measurement data is sent to the data processing circuit 220 . The data processing circuit 220 is used to perform operations such as filter processing and data calibration on the measurement data, and transmit the preprocessed measurement data to the data restoration circuit 240 through the data gating circuit 230 .
数据还原电路240用于对测量数据进行数制转换以及归一化处理,即根据各个传感器的AD转换系数,还原测量数据的实际值,其中,数据还原电路240为九轴数据的共用电路,包括依次电连接的系数归一化单元241和数制转换单元242。本实施例中,系数归一化单元241和数制转换单元242的串行执行顺序由中断控制电路260控制。系数归一化单元241可以用于测量数据的归一化处理,数制转换单元242可以用于计算机数制转换。The data restoration circuit 240 is used to perform digital conversion and normalization processing on the measurement data, that is, to restore the actual value of the measurement data according to the AD conversion coefficient of each sensor, wherein the data restoration circuit 240 is a common circuit for nine-axis data, including The coefficient normalization unit 241 and the digital conversion unit 242 are electrically connected in sequence. In this embodiment, the serial execution sequence of the coefficient normalization unit 241 and the digital conversion unit 242 is controlled by the interrupt control circuit 260 . The coefficient normalization unit 241 can be used for normalization processing of measurement data, and the number system conversion unit 242 can be used for computer number system conversion.
最后同步输出电路250根据姿态解算模块300对九轴数据的要求,等待缓冲一次完成的九轴数据(包括三轴加速度计测量数据、三轴陀螺仪测量数据和三轴磁力计测量数据)后,拉高指示信号,并输出九轴数据至姿态解算模块300。Finally, the synchronous output circuit 250 waits for the nine-axis data (including the three-axis accelerometer measurement data, the three-axis gyroscope measurement data and the three-axis magnetometer measurement data) to be buffered once, according to the requirements of the attitude calculation module 300 for the nine-axis data. , pull up the indication signal, and output the nine-axis data to the attitude calculation module 300 .
具体地,数据处理电路220包括并行设置的加速度计数据处理单元、陀螺仪数据处理单元和磁力计数据处理单元。其中,加速度计数据处理单元包括依次电连接的第一平滑滤波器组221和第一数据选通器222,用于对加速度计的测量数据进行平滑滤波处理。第一数据选通器222连接至控制器模块100和数据选通电路300,控制器模块100用于控制第一数据选通器的选通或关闭。当控制器模块100根据用户的需求向第一数据选通器222发送平滑度选通信号时,加速度计输出的三轴测量数据经过第一平滑滤波器组221的平滑滤波后,直接通过数据选通电路300进入数据还原电路240。Specifically, the data processing circuit 220 includes an accelerometer data processing unit, a gyroscope data processing unit and a magnetometer data processing unit arranged in parallel. Wherein, the accelerometer data processing unit includes a first smoothing filter bank 221 and a first data selector 222 electrically connected in sequence, for smoothing and filtering the measurement data of the accelerometer. The first data strobe 222 is connected to the controller module 100 and the data strobe circuit 300, and the controller module 100 is used to control the first data strobe to be turned on or off. When the controller module 100 sends a smoothness strobe signal to the first data strobe 222 according to the needs of the user, the three-axis measurement data output by the accelerometer is smoothed by the first smoothing filter bank 221, and then directly passed through the data strobe. The pass circuit 300 enters the data restoration circuit 240.
陀螺仪数据处理单元包括依次电连接的第二平滑滤波器组223、零偏值计算-消除电路以及第二数据选通器229,用于对陀螺仪的测量数据进行平滑滤波、消除零偏值的处理。其中第二数据选通器229连接至控制器模块100以及数据选通电路230,控制器模块100用于控制第二数据选通器229的选通或关闭。更进一步的,在一个实施例中,零偏值计算-消除电路包括零偏值计算单元224和零偏值消除单元225,第二平滑滤波器组223同时连接至零偏值计算单元224和零偏值消除单元225,且零偏值计算单元224连接零偏值消除单元225,零偏值消除单元225的输出连接第二数据选通器229的输入,用于消除陀螺仪的零偏值,保证飞行控制的精确度。The gyroscope data processing unit includes a second smoothing filter bank 223, a zero bias calculation-elimination circuit and a second data gate 229 electrically connected in sequence, for smoothing and filtering the measured data of the gyroscope and eliminating the zero bias value processing. The second data gating unit 229 is connected to the controller module 100 and the data gating circuit 230 , and the controller module 100 is used to control the second data gating unit 229 to be turned on or off. Furthermore, in one embodiment, the zero bias value calculation-elimination circuit includes a zero bias value calculation unit 224 and a zero bias value elimination unit 225, and the second smoothing filter bank 223 is simultaneously connected to the zero bias value calculation unit 224 and the zero bias value calculation unit 224 Offset value elimination unit 225, and zero offset value calculation unit 224 is connected to zero offset value elimination unit 225, and the output of zero offset value elimination unit 225 is connected to the input of the second data gate 229 for eliminating the zero offset value of the gyroscope, Ensure the accuracy of flight control.
当控制器模块100根据用户的需求向第二数据选通器229发送平滑度选通信号时,陀螺仪输出的陀螺仪三轴测量数据首先经过第二平滑滤波器组223的平滑滤波后,进入零偏值计算单元224计算陀螺仪的出零偏值,之后通过零偏值消除单元225消除陀螺仪的三轴测量数据的零偏值,最后通过数据选通电路230进入数据还原电路240。或者,陀螺仪输出的陀螺仪三轴测量数据首先经过第二平滑滤波器组223的平滑滤波后,直接通过零偏值消除单元225消除陀螺仪的三轴测量数据的零偏值,最后通过数据选通电路230进入数据还原电路240。When the controller module 100 sends a smoothness gating signal to the second data gating device 229 according to the needs of the user, the three-axis measurement data of the gyroscope output by the gyroscope first passes through the smoothing filter of the second smoothing filter bank 223, and then enters The zero bias value calculation unit 224 calculates the zero bias value of the gyroscope, and then eliminates the zero bias value of the three-axis measurement data of the gyroscope through the zero bias value elimination unit 225 , and finally enters the data restoration circuit 240 through the data gating circuit 230 . Alternatively, the gyroscope three-axis measurement data output by the gyroscope is firstly smoothed by the second smoothing filter bank 223, and then the zero offset value of the gyroscope's three-axis measurement data is directly eliminated by the zero offset value elimination unit 225, and finally passed through the data The gating circuit 230 enters the data restoration circuit 240 .
磁力计数据处理电路包括依次电连接的第三平滑滤波器组226、校准-归一化电路以及第三数据选通器201,用于对磁力计的测量数据进行平滑滤波、校准处理。其中,第三数据选通器201分别连接至控制器模块100和数据选通电路230,控制器模块100用于控制第三数据选通器201的选通或关闭。更进一步的,在一个实施例中,校准-归一化电路包括数据校准单元227和数据归一化单元228,第三平滑滤波器组226同时连接至数据校准单元227和数据归一化单元228,且数据校准单元227与数据归一化单元228电连接,数据归一化单元228的输出连接第三数据选通器201的输入,用于磁力计三轴测量数据的校准,保证飞行控制的精确性。The magnetometer data processing circuit includes a third smoothing filter bank 226 , a calibration-normalization circuit and a third data gate 201 electrically connected in sequence, for smoothing and calibrating the measurement data of the magnetometer. Wherein, the third data gating unit 201 is respectively connected to the controller module 100 and the data gating circuit 230 , and the controller module 100 is used for controlling the third data gating unit 201 to be turned on or off. Further, in one embodiment, the calibration-normalization circuit includes a data calibration unit 227 and a data normalization unit 228, and the third smoothing filter bank 226 is simultaneously connected to the data calibration unit 227 and the data normalization unit 228 , and the data calibration unit 227 is electrically connected to the data normalization unit 228, and the output of the data normalization unit 228 is connected to the input of the third data gate 201, which is used for the calibration of the three-axis measurement data of the magnetometer to ensure the flight control. precision.
即当控制器模块100根据用户的需求向第三数据选通器201发送平滑度选通信号时,磁力计输出的磁力计三轴测量数据首先经过第三平滑滤波器组226的平滑滤波后,进入数据校准单元227进行校准,之后通过数据归一化单元228对磁力计的三轴测量数据的系数进行归一化处理,最后通过数据选通电路230进入数据还原电路240。或者,磁力计输出的磁力计三轴测量数据首先经过第三平滑滤波器组226的平滑滤波后,直接通过数据归一化单元228进行磁力计的三轴测量数据进行系数归一化,最后通过数据选通电路230进入数据还原电路240。That is, when the controller module 100 sends a smoothness gating signal to the third data gating device 201 according to the needs of the user, the three-axis measurement data of the magnetometer output by the magnetometer is firstly smoothed by the third smoothing filter bank 226, and then Enter the data calibration unit 227 for calibration, then normalize the coefficients of the three-axis measurement data of the magnetometer through the data normalization unit 228 , and finally enter the data restoration circuit 240 through the data gating circuit 230 . Or, after the three-axis measurement data of the magnetometer output by the magnetometer is smoothed and filtered by the third smoothing filter bank 226, the three-axis measurement data of the magnetometer is directly passed through the data normalization unit 228 for coefficient normalization, and finally passed Data gating circuit 230 enters data restoration circuit 240 .
在本发明的一个实施例中,如图4所示,姿态解算模块300包括加速度计误差测量电路310、磁力计误差测量电路320、陀螺仪误差测量电路330、四元数更新电路340、姿态转换矩阵更新电路350以及姿态角转换电路360。其中,加速度计误差测量电路310、磁力计误差测量电路320均连接至陀螺仪误差测量电路330,陀螺仪误差测量电路330依次电连接四元数更新电路340、姿态转换矩阵更新电路350以及姿态角转换电路360,姿态角转换电路360连接至PID控制模块400,用于将无人机的飞行姿态数据传送至PID控制模块400。In one embodiment of the present invention, as shown in FIG. 4 , the attitude calculation module 300 includes an accelerometer error measurement circuit 310, a magnetometer error measurement circuit 320, a gyroscope error measurement circuit 330, a quaternion update circuit 340, an attitude Transformation matrix update circuit 350 and attitude angle conversion circuit 360 . Wherein, the accelerometer error measurement circuit 310 and the magnetometer error measurement circuit 320 are all connected to the gyroscope error measurement circuit 330, and the gyroscope error measurement circuit 330 is electrically connected to the quaternion update circuit 340, the attitude conversion matrix update circuit 350 and the attitude angle in turn. The conversion circuit 360 and the attitude angle conversion circuit 360 are connected to the PID control module 400 for transmitting the flight attitude data of the drone to the PID control module 400 .
由于在实际的环境中,MEMS传感器输出的数据通常存在一定的误差,所以为保证后续计算的准确性,应该对MEMS传感器输出的测量数据进行去噪滤波等处理,以保证系统的运算精度。本实施例中,采用互补滤波算法对各个传感器的测量数据进行去噪滤波等处理。其中,加速度计误差测量电路310连接至九轴测量模块200,用于根据九轴数据中的加速度计的测量数据计算其与预设的参考比力之间的相对误差,生成加速度计误差值。磁力计误差测量电路320连接至九轴测量模块200,用于根据九轴数据中的磁力计的测量数据计算其与预设的参考磁力之间的相对误差,生成磁力计误差值。In the actual environment, the data output by the MEMS sensor usually has certain errors, so in order to ensure the accuracy of subsequent calculations, the measurement data output by the MEMS sensor should be processed by denoising and filtering to ensure the calculation accuracy of the system. In this embodiment, a complementary filtering algorithm is used to perform processing such as denoising filtering on the measurement data of each sensor. Wherein, the accelerometer error measurement circuit 310 is connected to the nine-axis measurement module 200, and is used to calculate the relative error between the accelerometer and the preset reference ratio according to the measurement data of the accelerometer in the nine-axis data, and generate an accelerometer error value. The magnetometer error measurement circuit 320 is connected to the nine-axis measurement module 200, and is used to calculate the relative error between it and the preset reference magnetic force according to the measurement data of the magnetometer in the nine-axis data, and generate a magnetometer error value.
陀螺仪误差测量电路300也连接至九轴测量模块200,用于根据加速度计误差测量电路310生成的加速度计误差值、磁力计误差测量电路320生成的磁力计误差值以及九轴数据中的陀螺仪的测量数据通过互补滤波算法生成陀螺仪修正数据。本实施例中的陀螺仪误差测量电路可以采用互补滤波器等实现。由于陀螺仪存在一定的漂移,会导致其测量的数据越来越不准确,本实施例中,采用互补滤波算法就是在短时间内较多的参考陀螺仪的测量数据,而随着时间的增加,通过加速度计和磁力计的测量数据对陀螺仪的测量数据进行补偿校正。也就是说,由于加速度计的动态响应较慢,因此在高频段存在误差,可以通过低通滤波器来抑制其高频误差,而陀螺仪由于常值零漂因而在低频段存在较大的误差,所以需要高频滤波器来抑制其低频误差,通过互补滤波器在其频域上的互补特性,以抑制干扰误差,以提高测量数据的精确性,满足后续电路的使用需求,从而提高该飞行控制电路的控制精度。The gyroscope error measurement circuit 300 is also connected to the nine-axis measurement module 200 for accelerometer error values generated by the accelerometer error measurement circuit 310, the magnetometer error values generated by the magnetometer error measurement circuit 320, and the gyroscope in the nine-axis data. The measurement data of the gyroscope is used to generate gyroscope correction data through a complementary filtering algorithm. The gyroscope error measurement circuit in this embodiment can be realized by using a complementary filter or the like. Since the gyroscope has a certain drift, the measured data will become more and more inaccurate. In this embodiment, the complementary filtering algorithm is used to refer to more measurement data of the gyroscope in a short period of time, and as time increases , the measurement data of the gyroscope is compensated and corrected by the measurement data of the accelerometer and the magnetometer. That is to say, due to the slow dynamic response of the accelerometer, there is an error in the high frequency band, which can be suppressed by a low-pass filter, and the gyroscope has a large error in the low frequency band due to the constant zero drift. , so a high-frequency filter is needed to suppress its low-frequency error, through the complementary characteristics of the complementary filter in its frequency domain, to suppress the interference error, to improve the accuracy of the measurement data, to meet the use requirements of the subsequent circuit, thereby improving the flight The control accuracy of the control circuit.
四元数更新电路340用于根据陀螺仪修正数据以及上一次的四元数值生成新的四元数值,本实施例中,四元数更新电路340使用一阶龙格-库塔算法(即欧拉算法)对四元数进行更新,并输出本次更新的新的四元数值。应当清楚的是,四元数是一种简单的超复数,四元数都是由实数加上三个复数组成,可以理解为一个实数和一个向量的组合,也可以理解为四维的向量。在组合旋转方面,四元数表示的效果最佳。当然,在其他实施例中,姿态解算模块300也可以通过矩阵表示、欧拉角表示或轴角表示等方式来表示旋转。The quaternion update circuit 340 is used to generate a new quaternion value according to the gyroscope correction data and the last quaternion value. In this embodiment, the quaternion update circuit 340 uses a first-order Runge-Kutta algorithm (i.e. Pull algorithm) to update the quaternion, and output the new quaternion value of this update. It should be clear that a quaternion is a simple hypercomplex number. A quaternion is composed of a real number plus three complex numbers. It can be understood as a combination of a real number and a vector, or as a four-dimensional vector. Quaternion representations work best when it comes to combining rotations. Of course, in other embodiments, the attitude calculation module 300 may also express the rotation by means of matrix representation, Euler angle representation, or axis angle representation.
姿态转换矩阵更新电路350用于根据四元数更新电路340输出的新的四元数值生成姿态矩阵,并将新的四元数值反馈至加速计误差测量电路310及磁力计误差测量电路320;姿态角转换电路360用于根据姿态矩阵生成姿态角,并将姿态角等飞行状态数据传送至PID控制模块400。Attitude conversion matrix update circuit 350 is used to generate an attitude matrix according to the new quaternion value output by quaternion update circuit 340, and feeds back the new quaternion value to accelerometer error measurement circuit 310 and magnetometer error measurement circuit 320; attitude The angle conversion circuit 360 is used to generate the attitude angle according to the attitude matrix, and transmit the flight state data such as the attitude angle to the PID control module 400 .
在本发明的一个实施例中,如图5所示,PID控制模块400包括输出控制电路440以及并行设置的三个姿态角控制电路,每一个姿态角控制电路对应控制一个姿态角,三个姿态角控制电路分为与输出控制电路440电连接的俯仰角控制电路410、翻滚角控制电路420和航偏角控制电路430,这样可以对姿态解算模块300输出的姿态角数据并行的进行处理,从而缩短了系统的运算时间,提高了运算效率。In one embodiment of the present invention, as shown in Figure 5, the PID control module 400 includes an output control circuit 440 and three attitude angle control circuits arranged in parallel, each attitude angle control circuit correspondingly controls an attitude angle, three attitude angles The angle control circuit is divided into a pitch angle control circuit 410 electrically connected to the output control circuit 440, a roll angle control circuit 420 and a yaw angle control circuit 430, so that the attitude angle data output by the attitude calculation module 300 can be processed in parallel, Thereby shortening the operation time of the system and improving the operation efficiency.
俯仰角控制电路410、翻滚角控制电路420和航偏角控制电路430分别连接至姿态解算模块300和九轴测量模块200,用于获取姿态解算模块300输出的飞行姿态数据(即无人机的姿态角数据)、九轴测量模块200输出的九轴测量数据以及遥控器传送的遥控信号等外部数据以及各个传感器的状态信号。输出控制电路440根据三个姿态角控制电路传送的信号生成并输出电机控制数据,以通过电子调速器分别控制各个电机的运行,实现各个电机的并行控制。同时,输出控制电路440将电机控制数据反馈给俯仰角控制电路410、翻滚角控制电路420以及航偏角控制电路430。The pitch angle control circuit 410, the roll angle control circuit 420 and the yaw angle control circuit 430 are respectively connected to the attitude calculation module 300 and the nine-axis measurement module 200, for obtaining the flight attitude data (that is, unmanned) that the attitude calculation module 300 outputs. Attitude angle data of the machine), nine-axis measurement data output by the nine-axis measurement module 200, external data such as remote control signals transmitted by the remote controller, and status signals of various sensors. The output control circuit 440 generates and outputs motor control data according to the signals transmitted by the three attitude angle control circuits, so as to separately control the operation of each motor through the electronic speed controller, and realize the parallel control of each motor. At the same time, the output control circuit 440 feeds back the motor control data to the pitch angle control circuit 410 , the roll angle control circuit 420 and the yaw angle control circuit 430 .
具体地,本实施例的俯仰角控制电路410、翻滚角控制电路420以及航偏角控制电路430均采用双环结构,其中外环用于控制角度,内环用于控制角速度。以下结合图6以翻滚角为例说明PID控制算法的具体过程:Specifically, the pitch angle control circuit 410, the roll angle control circuit 420, and the yaw angle control circuit 430 of this embodiment all adopt a double-loop structure, wherein the outer loop is used to control the angle, and the inner loop is used to control the angular velocity. The following describes the specific process of the PID control algorithm by taking the roll angle as an example in combination with Figure 6:
外环控制:将获取的陀螺仪的测量数据、遥控器的遥控信号进行锁定,以保证数据的准确性以及控制精度,并结合获取的陀螺仪和遥控器的状态信号对陀螺仪的测量数据以及遥控信号进行数据滤波等预处理,以减小噪声对系统的干扰。之后,对预处理后的陀螺仪的测量数据和遥控信号进行PID操作(还可以是PI操作、PD操作),生成并输出内环PID控制的期望值。Outer loop control: lock the acquired gyroscope measurement data and the remote control signal of the remote control to ensure data accuracy and control precision, and combine the acquired gyroscope and remote control status signals to control the gyroscope measurement data and The remote control signal is pre-processed such as data filtering to reduce the interference of noise to the system. After that, perform PID operation (or PI operation and PD operation) on the preprocessed gyroscope measurement data and remote control signal, and generate and output the expected value of the inner loop PID control.
内环控制:将获取的内环PID控制的期望值与姿态解算模块输出的飞行姿态数据进行锁定,以保证数据的准确性以及控制精度,并结合外环控制模块输出的状态信号以及姿态解算模块输出的状态信号对内环PID控制的期望值以及飞行姿态数据进行滤波等预处理,以减小噪声对系统的干扰。之后,对预处理后的飞行姿态数据和内环PID控制的期望值进行PID操作(还可以是PI操作、PD操作),生成并输出电机控制数据,以控制各个电机的翻滚角。此外,俯仰角和航偏角的PID控制与翻滚角的控制过程基本一致,此处不再赘述。Inner loop control: Lock the acquired expected value of the inner loop PID control with the flight attitude data output by the attitude calculation module to ensure the accuracy of the data and control precision, and combine the status signal output by the outer loop control module and the attitude calculation The state signal output by the module performs preprocessing such as filtering on the expected value of the inner loop PID control and the flight attitude data to reduce the interference of noise on the system. Afterwards, perform PID operation (PI operation, PD operation) on the preprocessed flight attitude data and the expected value of the inner loop PID control, generate and output motor control data to control the roll angle of each motor. In addition, the PID control of the pitch angle and the yaw angle is basically the same as the control process of the roll angle, and will not be repeated here.
在本发明的一个实施例中,如图7所示,遥控舵机模块500包括接收电路510、电机控制电路530以及通道编码电路520;接收电路510连接电机控制电路530和通道编码电路520,电机控制电路530、通道编码电路520连接控制器模块100,控制器模块100用于控制各个模块电路的初始化以及运行状态。In one embodiment of the present invention, as shown in Figure 7, the remote control servo module 500 includes a receiving circuit 510, a motor control circuit 530, and a channel encoding circuit 520; the receiving circuit 510 is connected to the motor control circuit 530 and the channel encoding circuit 520, and the motor The control circuit 530 and the channel encoding circuit 520 are connected to the controller module 100, and the controller module 100 is used to control the initialization and running status of each module circuit.
其中,接收电路510包括依次电连接的接收校验单元511和预处理单元512,其中,接收校验单元511通过外设的接收机连接至遥控器,用于接收遥控器发送的包含多个通道数据的遥控信号,接收校验单元511分别对其接收的遥控信号的各个通道数据进行滤波处理后,将处理后的遥控信号传送至预处理单元512。预处理单元512连接至PID控制模块400,用于根据PID算法对通道数据的要求将滤波处理后的遥控信号进行线性约束和格式转换等操作,之后,将预处理之后的遥控信号等数据反馈至PID控制模块400,即预处理单元512连接PID控制模块400的输入端。Wherein, the receiving circuit 510 includes a receiving verification unit 511 and a preprocessing unit 512 that are electrically connected in sequence, wherein the receiving verification unit 511 is connected to the remote controller through an external receiver, and is used to receive the information sent by the remote controller that contains multiple channels. For the remote control signal of the data, the receiving verification unit 511 performs filter processing on the data of each channel of the received remote control signal, and then transmits the processed remote control signal to the preprocessing unit 512 . The preprocessing unit 512 is connected to the PID control module 400, and is used to perform operations such as linear constraint and format conversion on the filtered remote control signal according to the requirements of the PID algorithm for channel data, and then feed back the preprocessed remote control signal and other data to The PID control module 400 , that is, the preprocessing unit 512 is connected to the input end of the PID control module 400 .
本实施例中,遥控器通过接收机向接收电路输入具有7个通道数据的遥控信号,相应的,接收校验单元也设置有7个校验通道,分别针对7个通道数据进行滤波处理,以提高数据处理的效率。之后,将滤波处理后的遥控信号传送至通用的预处理单元512,完成遥控信号的初步处理。最后,根据各个通道的功能,采用相应的处理机制。其中,遥控信号的7个通道数据可以是飞行高度、俯仰角、航偏角、翻滚角、飞行速度、油门系数以及飞行状态等等。例如:In this embodiment, the remote controller inputs remote control signals with 7 channel data to the receiving circuit through the receiver, and correspondingly, the receiving verification unit is also provided with 7 verification channels, and filtering processing is performed on the data of the 7 channels respectively, so as to Improve the efficiency of data processing. Afterwards, the filtered remote control signal is sent to the general preprocessing unit 512 to complete the preliminary processing of the remote control signal. Finally, according to the function of each channel, adopt the corresponding processing mechanism. Among them, the data of the 7 channels of the remote control signal can be flight altitude, pitch angle, yaw angle, roll angle, flight speed, throttle coefficient, flight status and so on. For example:
遥控信号的其中一个通道数据用于控制无人机的俯仰角,则通过接收校验单元511中相应的俯仰角校验通道进行滤波处理,然后,将滤波处理后的俯仰角通道数据经预处理单元后输出至PID控制模块400的俯仰角控制电路410的输入端,俯仰角控制电路410根据俯仰角通道数据、陀螺仪的测量数据以及加速度计的测量数据进行PID操作(PI/PD/PID运算),输出用于控制无人机的俯仰角的电机控制数据。One of the channel data of the remote control signal is used to control the pitch angle of the unmanned aerial vehicle, then filter processing is performed through the corresponding pitch angle verification channel in the receiving verification unit 511, and then the filtered pitch angle channel data is preprocessed After the unit is output to the input end of the pitch angle control circuit 410 of the PID control module 400, the pitch angle control circuit 410 performs the PID operation (PI/PD/PID calculation) according to the pitch angle channel data, the measurement data of the gyroscope and the measurement data of the accelerometer. ), output the motor control data used to control the pitch angle of the UAV.
通道编码电路520作为遥控信号等数据的编码电路,用于根据遥控信号生成无人机工作模式控制信号,并将无人机工作模式信号传送至控制器模块100,以控制无人机运行在不同的工作模式。本实施例中,无人机的工作模式包括调试模式、锁定模式和PID控制模式。The channel encoding circuit 520 is used as an encoding circuit for data such as remote control signals, and is used to generate control signals for UAV operating modes according to the remote control signals, and transmit the UAV operating mode signals to the controller module 100 to control the UAV to operate in different working mode. In this embodiment, the working modes of the drone include a debugging mode, a locking mode and a PID control mode.
本实施例中,无人机在启动飞行前,一般需要对遥控器进行油门校准或电气编程等操作,在系统上电启动时,遥控器必须锁定,以防发生误触操作。在空中飞行时,若遇见突发状况,必须立刻锁定机体,暂停无人机系统的工作,以保证无人机的飞行安全。通道编码电路520用于根据上述不同的工作模式,根据接收的遥控信号进行通道编码处理,并发出相应的工作模式信号至控制器模块,使得无人机能够安全的飞行或调试。In this embodiment, before the UAV starts to fly, it generally needs to perform operations such as throttle calibration or electrical programming on the remote control. When the system is powered on and started, the remote control must be locked to prevent accidental touch operations. When flying in the air, if you encounter an emergency, you must immediately lock the body and suspend the work of the UAV system to ensure the flight safety of the UAV. The channel coding circuit 520 is used to perform channel coding processing according to the received remote control signal according to the above different working modes, and send a corresponding working mode signal to the controller module, so that the UAV can fly or debug safely.
电机控制电路530连接PID控制模块400,电机控制电路530根据PID控制模块400输出的电机控制数据以及控制器模块100输出的无人机工作模式信号生成电机的通道数值,并将电机的通道数值转换为用以控制电子调速器的PWM控制信号。具体地,电机控制电路530包括依次电连接的转换单元531、第五数据选通器532和电调控制单元533。其中,转换单元531连接至PID控制模块400,具体地,转换单元531连接至PID控制模块400的输出端(即输出控制电路440),用于从PID控制模块读取电机控制数据,并将电机控制数据转换为舵机的通道信号。The motor control circuit 530 is connected to the PID control module 400, and the motor control circuit 530 generates the channel value of the motor according to the motor control data output by the PID control module 400 and the UAV operation mode signal output by the controller module 100, and converts the channel value of the motor It is the PWM control signal used to control the electronic governor. Specifically, the motor control circuit 530 includes a conversion unit 531 , a fifth data gate 532 and an electric regulation control unit 533 electrically connected in sequence. Wherein, the conversion unit 531 is connected to the PID control module 400, specifically, the conversion unit 531 is connected to the output terminal of the PID control module 400 (that is, the output control circuit 440), and is used to read the motor control data from the PID control module and convert the motor The control data is converted to the channel signal of the steering gear.
第五数据选通器532的输入端分别连接至转换单元531、接收电路510的接收校验单元511以及控制器模块100,第五数据选通器532的输出端连接至电调控制单元533,电调控制单元533连接控制器模块100以及外设的电子调速器。电调控制单元533用于根据舵机的通道信号以及控制器模块100传送的无人机工作模式信号生成电机的通道数值并将其转换为PWM信号输出给电子调速器,用以控制各个电机的运行。The input end of the fifth data strobe 532 is respectively connected to the conversion unit 531, the receiving verification unit 511 of the receiving circuit 510, and the controller module 100, and the output end of the fifth data strobe 532 is connected to the ESC control unit 533, The ESC control unit 533 is connected to the controller module 100 and the external ESC. The ESC control unit 533 is used to generate the channel value of the motor according to the channel signal of the steering gear and the UAV working mode signal transmitted by the controller module 100 and convert it into a PWM signal and output it to the electronic speed controller to control each motor running.
下面以四旋翼无人机为例说明电机控制电路的控制原理:The following takes the quadrotor UAV as an example to illustrate the control principle of the motor control circuit:
四旋翼无人机是由固连在刚性十字交叉结构上的四个电机驱动的无人机,无人机的运动通过控制四个电机的转速差进行控制,按照其旋翼布置方式可以分为“X”模式和“+”模式。The quadrotor UAV is a UAV driven by four motors fixed on the rigid cross structure. The movement of the UAV is controlled by controlling the speed difference of the four motors. According to the arrangement of the rotors, it can be divided into " X" mode and "+" mode.
若该四旋翼无人机为“X”模式,则PID控制模块400输出的电机控制数据与四个电机的通道值的转换关系为:If the quadrotor UAV is in "X" mode, the conversion relationship between the motor control data output by the PID control module 400 and the channel values of the four motors is:
其中,M1~M4分别用于表示四个电机的通道数值,Thr用于表示油门系数,Ptich用于表示俯仰角,Roll用于表示翻滚角,Yaw用于表示航偏角。Among them, M 1 ~ M 4 are used to represent the channel values of the four motors, Thr is used to represent the throttle coefficient, Ptich is used to represent the pitch angle, Roll is used to represent the roll angle, and Yaw is used to represent the yaw angle.
若该四旋翼无人机为“+”模式,则PID控制模块400输出的电机控制数据与四个电机的通道值的转换关系为:If the quadrotor UAV is in the "+" mode, the conversion relationship between the motor control data output by the PID control module 400 and the channel values of the four motors is:
其中,M1~M4分别用于表示四个电机的通道数值,Thr用于表示油门系数,Ptich用于表示俯仰角,Roll用于表示翻滚角,Yaw用于表示航偏角。Among them, M 1 ~ M 4 are used to represent the channel values of the four motors, Thr is used to represent the throttle coefficient, Ptich is used to represent the pitch angle, Roll is used to represent the roll angle, and Yaw is used to represent the yaw angle.
在本发明的一个实施例中,如图8所示,气压计读取-补偿模块600通过SPI接口外设的气压计连接,气压计用于实时测定无人机所处的环境高度的大气压,通过气压计测定的大气压可以计算出无人机的相对飞行高度等,从而可以修正无人机的导航数据,提高无人机的控制精度。In one embodiment of the present invention, as shown in Figure 8, the barometer reading-compensation module 600 is connected through the barometer of the SPI interface peripheral, and the barometer is used to measure the atmospheric pressure of the environment altitude where the drone is located in real time, The atmospheric pressure measured by the barometer can be used to calculate the relative flight altitude of the UAV, so that the navigation data of the UAV can be corrected and the control accuracy of the UAV can be improved.
气压计读取-补偿模块600包括分别与控制器模块100电连接的初始化电路610、数据读取电路630、第四数据选通器620、温度补偿电路640、AD系数归一化电路650以及数制转换电路660。第四数据选通器620连接气压计,初始化电路610、数据读取电路630均连接至第四数据选通器620,数据读取电路630、温度补偿电路640、AD系数归一化电路650以及数制转换电路660依次电连接,数制转换电路660用于输出气压值和温度值。The barometer reading-compensation module 600 includes an initialization circuit 610, a data reading circuit 630, a fourth data strobe 620, a temperature compensation circuit 640, an AD coefficient normalization circuit 650, and a data reading circuit 610 electrically connected to the controller module 100, respectively. System conversion circuit 660. The fourth data strobe 620 is connected to the barometer, the initialization circuit 610 and the data reading circuit 630 are connected to the fourth data strobe 620, the data reading circuit 630, the temperature compensation circuit 640, the AD coefficient normalization circuit 650 and The digital conversion circuit 660 is electrically connected in turn, and the digital conversion circuit 660 is used to output the air pressure value and the temperature value.
当系统复位后,控制器模块100首先启动初始化电路610,初始化电路610通过SPI接口向气压计发送复位命令以及气压计参数读取命令。当初始化电路610返回完成信号至控制器模块100时,控制器模块100控制数据读取电路630重复的读取气压计的气压值和温度值。每次读取的气压值和温度值依次经过温度补偿电路640、AD系数归一化电路650和数制转换电路660后输出。After the system is reset, the controller module 100 first starts the initialization circuit 610, and the initialization circuit 610 sends a reset command and a barometer parameter reading command to the barometer through the SPI interface. When the initialization circuit 610 returns a completion signal to the controller module 100 , the controller module 100 controls the data reading circuit 630 to repeatedly read the pressure value and the temperature value of the barometer. The pressure value and temperature value read each time pass through the temperature compensation circuit 640 , the AD coefficient normalization circuit 650 and the digital system conversion circuit 660 in sequence, and then output.
下面结合图9说明该气压计读取-补偿模块的初始化以及数据读取过程:The initialization and data reading process of the barometer reading-compensation module are described below in conjunction with Figure 9:
初始化电路610首先通过SPI接口向气压计发送复位命令(Reset命令),之后等待第一预设时间(可以为2.8ms)后,初始化电路610通过SPI接口向气压计发送气压计参数读取命令,读取气压计的主要参数。本实施例中,气压计的主要包括六个参数:压力灵敏度、压力抵消、温度压力灵敏系数、温度系数的压力抵消、参考温度、温度系数的敏感度等等。当初始化电路610完成上述操作,返回完成信号至控制器模块100。The initialization circuit 610 first sends a reset command (Reset command) to the barometer through the SPI interface, and after waiting for the first preset time (which can be 2.8ms), the initialization circuit 610 sends a barometer parameter reading command to the barometer through the SPI interface, Read the main parameters of the barometer. In this embodiment, the barometer mainly includes six parameters: pressure sensitivity, pressure offset, temperature and pressure sensitivity coefficient, pressure offset of temperature coefficient, reference temperature, sensitivity of temperature coefficient and so on. When the initialization circuit 610 completes the above operations, it returns a completion signal to the controller module 100 .
然后,控制器模块100首先向气压计发送AD1转换命令,等待第二预设时间(可以是8.22ms)后发送ADC读取命令,控制数据读取模块630读取气压值。温度值的读取过程与气压值的读取过程类似,控制器模块100向气压计发送AD2转换命令,等待第二预设时间(可以是8.22ms)后发送ADC读取命令,控制数据读取模块630读取温度值。本实施例中,气压值的读取操作与温度值的读取操作交替重复进行,以不断的读取新的气压值和温度值,实现对无人机飞行状态的实时控制。Then, the controller module 100 first sends the AD1 conversion command to the barometer, waits for a second preset time (may be 8.22ms), and then sends the ADC read command to control the data reading module 630 to read the barometric pressure value. The reading process of the temperature value is similar to the reading process of the air pressure value. The controller module 100 sends the AD2 conversion command to the barometer, waits for the second preset time (can be 8.22ms) and then sends the ADC reading command to control the data reading. Module 630 reads the temperature value. In this embodiment, the reading operation of the air pressure value and the reading operation of the temperature value are repeated alternately, so as to continuously read new air pressure values and temperature values to realize real-time control of the flying state of the drone.
进一步地,气压计读取-补偿模块600、GPS模块700均连接至数据融合模块800,数据融合模块800与遥控舵机模块500、姿态解算模块300电连接。GPS模块700用于获取无人机的定位信息,数据融合模块800用于根据气压计读取-补偿模块600输出的气压值、温度值,GPS模块700输出的定位信息以及姿态解算模块300生成的飞行姿态数据生成电机控制数据,并将生成的电机控制数据传送至遥控舵机模块500,以便更好的控制各个电机的运行,调整无人机的飞行状态。Further, the barometer reading-compensation module 600 and the GPS module 700 are both connected to the data fusion module 800 , and the data fusion module 800 is electrically connected to the remote control servo module 500 and the attitude calculation module 300 . The GPS module 700 is used to obtain the positioning information of the drone, and the data fusion module 800 is used to read the air pressure value and the temperature value output by the compensation module 600 according to the barometer, the positioning information output by the GPS module 700 and the attitude calculation module 300 to generate Generate motor control data from the flight attitude data, and transmit the generated motor control data to the remote control servo module 500, so as to better control the operation of each motor and adjust the flight state of the drone.
按键模块900与外设的控制按键和显示灯连接,用于接收外部输入的按键信号。控制按键可以用于设定该飞行控制电路的工作模式,也可以通过设置复位按键实现该飞行控制电路的复位。显示灯可以为LED显示灯等,用于指示无人机的工作状态,如,红灯表示无人机工作在调试模式,黄灯表示无人机工作在锁定模式,绿灯表示无人机工作在PID模式等等。The button module 900 is connected with the control button and the display lamp of the peripheral device, and is used for receiving the button signal input from the outside. The control button can be used to set the working mode of the flight control circuit, and the flight control circuit can also be reset by setting the reset button. The display light can be an LED display light, etc., used to indicate the working status of the drone. For example, a red light indicates that the drone is working in debugging mode, a yellow light indicates that the drone is working in lock mode, and a green light indicates that the drone is working in PID mode and so on.
本发明的一个实施例中,该基于FPGA的无人机飞行控制电路通过UART接口与上位机130通信连接,用于将该飞行控制电路的控制信息以及配置信息等传送至上位机。In one embodiment of the present invention, the FPGA-based UAV flight control circuit communicates with the host computer 130 through the UART interface, and is used to transmit the control information and configuration information of the flight control circuit to the host computer.
本发明的基于FPGA的无人机飞行控制电路,通过采用FPGA作为微控制器,并设置有姿态解算模块实时获得无人机的飞行姿态数据,PID控制模块用于根据飞行姿态数据和九轴测量模块传送的九轴数据计算生成电机控制数据,遥控舵机模块根据电机控制数据生成控制信号,以实现对无人机的各个电机的并行控制,同时,由于FPGA的并行处理速度远高于微控制器的串行处理速度,因此,通过FPGA的控制平台,缩短了飞行控制电路的计算时间,从而提高了电机控制的精确度和实时性,为无人机飞控芯片的生成奠定了基础。The unmanned aerial vehicle flight control circuit based on FPGA of the present invention, by adopting FPGA as micro-controller, and is provided with the attitude solving module and obtains the flight attitude data of unmanned aerial vehicle in real time, and the PID control module is used for according to flight attitude data and nine axis The nine-axis data transmitted by the measurement module is calculated to generate motor control data, and the remote control servo module generates control signals according to the motor control data to realize parallel control of each motor of the drone. At the same time, because the parallel processing speed of FPGA is much higher than that of micro The serial processing speed of the controller, therefore, shortens the calculation time of the flight control circuit through the FPGA control platform, thereby improving the accuracy and real-time performance of the motor control, and laying the foundation for the generation of the UAV flight control chip.
以上所述实施例仅表达了本发明的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干变形和改进,这些都属于本发明的保护范围。因此,本发明专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but should not be construed as limiting the patent scope of the present invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent for the present invention should be based on the appended claims.
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610132773.4A CN105700540B (en) | 2016-03-09 | 2016-03-09 | UAV Flight Control circuit based on FPGA |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610132773.4A CN105700540B (en) | 2016-03-09 | 2016-03-09 | UAV Flight Control circuit based on FPGA |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105700540A true CN105700540A (en) | 2016-06-22 |
CN105700540B CN105700540B (en) | 2019-02-01 |
Family
ID=56220217
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610132773.4A Expired - Fee Related CN105700540B (en) | 2016-03-09 | 2016-03-09 | UAV Flight Control circuit based on FPGA |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105700540B (en) |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106054909A (en) * | 2016-06-28 | 2016-10-26 | 江苏中科院智能科学技术应用研究院 | Flight control device suitable for miniature unmanned plane |
CN106394871A (en) * | 2016-09-29 | 2017-02-15 | 大连理工大学 | Fixed wing aircraft control device |
CN106444809A (en) * | 2016-10-12 | 2017-02-22 | 湖南绿野航空科技有限公司 | Flight controller for unmanned plane |
CN107807669A (en) * | 2017-12-01 | 2018-03-16 | 西华大学 | Control method and device based on enzyme numerical value membrane structure and readable storage medium |
CN108153325A (en) * | 2017-11-13 | 2018-06-12 | 上海顺砾智能科技有限公司 | The control method and device of Intelligent unattended machine |
CN108170154A (en) * | 2017-12-19 | 2018-06-15 | 广东省航空航天装备技术研究所 | A kind of unmanned plane multisensor forward direction photography, which tilts, flies control adjustment method |
CN108408054A (en) * | 2018-03-12 | 2018-08-17 | 广东翔龙航空技术有限公司 | Plant protection unmanned aerial vehicle spraying control device and method |
WO2018161193A1 (en) * | 2017-03-05 | 2018-09-13 | 肖丽芳 | Four-axis aerial vehicle provided with lights |
CN110501958A (en) * | 2019-09-06 | 2019-11-26 | 中国科学院长春光学精密机械与物理研究所 | A control system for a six-degree-of-freedom motion platform |
CN110582687A (en) * | 2017-05-02 | 2019-12-17 | 高通股份有限公司 | Interference mitigation in magnetometers |
CN111141283A (en) * | 2020-01-19 | 2020-05-12 | 杭州十域科技有限公司 | Method for judging advancing direction through geomagnetic data |
CN113268070A (en) * | 2021-05-18 | 2021-08-17 | 哈尔滨理工大学 | Unmanned aerial vehicle attitude angle tracking system based on multisensor |
CN113359867A (en) * | 2021-06-07 | 2021-09-07 | 合肥工业大学 | Unmanned aerial vehicle self-stabilizing cradle head and control method |
CN113785173A (en) * | 2019-04-04 | 2021-12-10 | 塔莱斯公司 | Inertial reference unit and system with enhanced integrity and associated integrity verification method |
CN114355965A (en) * | 2022-03-21 | 2022-04-15 | 华中科技大学 | A control system of a fixed-wing unmanned aerial vehicle and fixed-wing unmanned aerial vehicle equipment |
WO2022160436A1 (en) * | 2021-01-29 | 2022-08-04 | 航天科工微电子系统研究院有限公司 | Soc chip structure applied to gyroscope control system |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070069083A1 (en) * | 2005-06-20 | 2007-03-29 | United States Of America As Represented By The Administrator Of The National Aeronautics And Spac | Self-Contained Avionics Sensing And Flight Control System For Small Unmanned Aerial Vehicle |
CN102297694A (en) * | 2011-06-10 | 2011-12-28 | 北京航空航天大学 | Lightweight quick response aerial remote sensing inertial-stabilized platform controlling system |
CN102830708A (en) * | 2012-09-05 | 2012-12-19 | 北京理工大学 | ARM and FPGA (Field Programmable Gate Array) architecture based autopilot of fixed wing unmanned aerial vehicle |
CN104359481A (en) * | 2014-11-12 | 2015-02-18 | 中国兵器工业集团第二一四研究所苏州研发中心 | Miniature inertia measurement unit based on FPGA (field programmable gate array) |
-
2016
- 2016-03-09 CN CN201610132773.4A patent/CN105700540B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070069083A1 (en) * | 2005-06-20 | 2007-03-29 | United States Of America As Represented By The Administrator Of The National Aeronautics And Spac | Self-Contained Avionics Sensing And Flight Control System For Small Unmanned Aerial Vehicle |
CN102297694A (en) * | 2011-06-10 | 2011-12-28 | 北京航空航天大学 | Lightweight quick response aerial remote sensing inertial-stabilized platform controlling system |
CN102830708A (en) * | 2012-09-05 | 2012-12-19 | 北京理工大学 | ARM and FPGA (Field Programmable Gate Array) architecture based autopilot of fixed wing unmanned aerial vehicle |
CN104359481A (en) * | 2014-11-12 | 2015-02-18 | 中国兵器工业集团第二一四研究所苏州研发中心 | Miniature inertia measurement unit based on FPGA (field programmable gate array) |
Non-Patent Citations (1)
Title |
---|
翁新武: "基于SOPC的微型无人机飞行控制系统设计与实现", 《中国优秀硕士学位论文全文数据库 工程科技II辑》 * |
Cited By (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106054909A (en) * | 2016-06-28 | 2016-10-26 | 江苏中科院智能科学技术应用研究院 | Flight control device suitable for miniature unmanned plane |
CN106394871A (en) * | 2016-09-29 | 2017-02-15 | 大连理工大学 | Fixed wing aircraft control device |
CN106444809A (en) * | 2016-10-12 | 2017-02-22 | 湖南绿野航空科技有限公司 | Flight controller for unmanned plane |
CN106444809B (en) * | 2016-10-12 | 2024-04-16 | 湖南绿野航空科技有限公司 | Unmanned aerial vehicle flight controller |
WO2018161193A1 (en) * | 2017-03-05 | 2018-09-13 | 肖丽芳 | Four-axis aerial vehicle provided with lights |
CN110582687A (en) * | 2017-05-02 | 2019-12-17 | 高通股份有限公司 | Interference mitigation in magnetometers |
CN108153325A (en) * | 2017-11-13 | 2018-06-12 | 上海顺砾智能科技有限公司 | The control method and device of Intelligent unattended machine |
CN107807669A (en) * | 2017-12-01 | 2018-03-16 | 西华大学 | Control method and device based on enzyme numerical value membrane structure and readable storage medium |
CN107807669B (en) * | 2017-12-01 | 2020-07-07 | 西华大学 | Control method, device and readable storage medium based on enzyme numerical membrane structure |
CN108170154A (en) * | 2017-12-19 | 2018-06-15 | 广东省航空航天装备技术研究所 | A kind of unmanned plane multisensor forward direction photography, which tilts, flies control adjustment method |
CN108408054A (en) * | 2018-03-12 | 2018-08-17 | 广东翔龙航空技术有限公司 | Plant protection unmanned aerial vehicle spraying control device and method |
CN113785173A (en) * | 2019-04-04 | 2021-12-10 | 塔莱斯公司 | Inertial reference unit and system with enhanced integrity and associated integrity verification method |
CN110501958A (en) * | 2019-09-06 | 2019-11-26 | 中国科学院长春光学精密机械与物理研究所 | A control system for a six-degree-of-freedom motion platform |
CN111141283A (en) * | 2020-01-19 | 2020-05-12 | 杭州十域科技有限公司 | Method for judging advancing direction through geomagnetic data |
WO2022160436A1 (en) * | 2021-01-29 | 2022-08-04 | 航天科工微电子系统研究院有限公司 | Soc chip structure applied to gyroscope control system |
CN113268070A (en) * | 2021-05-18 | 2021-08-17 | 哈尔滨理工大学 | Unmanned aerial vehicle attitude angle tracking system based on multisensor |
CN113359867A (en) * | 2021-06-07 | 2021-09-07 | 合肥工业大学 | Unmanned aerial vehicle self-stabilizing cradle head and control method |
CN113359867B (en) * | 2021-06-07 | 2022-01-28 | 合肥工业大学 | Unmanned aerial vehicle self-stabilizing cradle head and control method |
CN114355965A (en) * | 2022-03-21 | 2022-04-15 | 华中科技大学 | A control system of a fixed-wing unmanned aerial vehicle and fixed-wing unmanned aerial vehicle equipment |
Also Published As
Publication number | Publication date |
---|---|
CN105700540B (en) | 2019-02-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105700540A (en) | FPGA-based unmanned plane flight control circuit | |
CN104914874B (en) | A kind of pose control system for unmanned plane and method based on adaptive Mutually fusion | |
Meier et al. | Pixhawk: A system for autonomous flight using onboard computer vision | |
CN105353762B (en) | The control method of six rotor wing unmanned aerial vehicles based on double remaining attitude transducers | |
CN104898681B (en) | A kind of quadrotor attitude acquisition method for approximately finishing card quaternary number using three ranks | |
CN112630813B (en) | Unmanned aerial vehicle attitude measurement method based on strapdown inertial navigation and Beidou satellite navigation system | |
CN103424115B (en) | Micro miniature aircraft ground test attitude recorder | |
CN106444804A (en) | Complementary filtering algorithm and cascade PID based four-rotor aircraft design method | |
CN107804474B (en) | Design method of complete machine system of multi-rotor flying robot with redundant mechanical arm | |
CN105955302A (en) | Multi-rotor unmanned aerial vehicle environment autonomous monitoring control system and method | |
CN105865453B (en) | A kind of navigation system and its fusion method of position sensor and attitude transducer | |
CN105589467A (en) | Low-cost expansion flight attitude sensor module | |
CN104850127A (en) | Method for dynamic control of quad-rotor aircraft | |
CN110209182A (en) | A kind of quadrotor based on AVR single chip | |
CN106325289A (en) | Renesas R5F100LEA master control-based four-rotor flight controller and control method thereof | |
CN1669874A (en) | An autopilot for an aircraft | |
CN106249744A (en) | A kind of small-sized rotor craft height control method based on two grades of complementary filters | |
CN204128560U (en) | A kind of quadrotor inertial measurement system | |
CN102331778B (en) | Handheld device and method for controlling unmanned vehicle by utilizing same | |
CN2681997Y (en) | Aircraft autopilot with dual processors | |
CN205880667U (en) | Fixed wing uavs automatic flight control system of two remaining sensors | |
CN100587644C (en) | An integrated single-loop controller for stable tracking of camera optical axis | |
CN113848780B (en) | A high-mobility platform attitude calculation device and method under a multi-core heterogeneous processor architecture | |
CN202583877U (en) | General autopilot of unmanned aerial vehicle | |
CN205353765U (en) | Six-rotor flight system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190201 Termination date: 20210309 |