Unmanned aerial vehicle sensor attack detection and dual recovery method and system
By combining a lightweight feedforward neural network and a machine learning model, dual recovery after a drone sensor attack is achieved, solving the problem of unstable sensor data and controller status, and ensuring stable flight and efficient recovery of the drone.
Patent Information
- Application Number
- CN202510946021.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-11-18
AI Technical Summary
Existing technologies cannot effectively restore the internal state of the controller when drone sensors are attacked, leading to unstable or oscillating drone flight. Furthermore, sensor data recovery methods are not capable of identifying different attack types, affecting the stability and flexibility of drones.
A lightweight feedforward neural network is used for attack detection, and four independent decision trees and a small regression model are combined for sensor recovery. By adjusting the internal parameters of the controller in real time, dual recovery of sensor data and controller state is achieved.
It enables stable flight of drones after sensor attacks, avoiding transient instability and continuous performance degradation during the recovery process, ensuring the system's high efficiency and robustness, and enabling targeted recovery strategies for different types of sensor attacks.
Smart Images

Figure CN120974482A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of unmanned aerial vehicle safety, in particular to a method for dual recovery of unmanned aerial vehicle sensor data and internal state of controller, which can be used to effectively resist the negative impact on unmanned aerial vehicle when the sensors are attacked. BACKGROUND
[0002] The external environment perception of the unmanned aerial vehicle flight control system highly depends on the on-board sensors. Sensors are the only way for the flight control system to obtain information about the external world and its own motion state. However, these sensors themselves are vulnerable to various physical attacks and electronic interference, such as GPS (Global Positioning System) spoofing, inertial measurement unit data injection attacks, magnetometer interference, barometer spoofing, etc. Once the sensor data is tampered with or contaminated, the flight control system will make state estimation and decision based on the wrong information, which will lead to serious consequences.
[0003] The document "SpecGuard: Specification Aware Recovery for Robotic Autonomous Vehicles from Physical Attacks, CCS'24: Proceedings of the 2024 on ACM SIGSAC Conference on Computer and Communications Security, 2024" proposes to mitigate sensor data pollution by state reconstruction, and uses a recovery controller based on task specification trained by deep reinforcement learning, so that the unmanned aerial vehicle can continuously follow the established task specification, thereby achieving safe and effective attack recovery. However, this method emphasizes recovery based on task content, and the recovery controller is trained by deep reinforcement learning, which will lead to the high dependence of the unmanned aerial vehicle on specific task content. In actual use, if the task specification changes or faces new task types, complex training needs to be performed again, which will limit the flexibility of the unmanned aerial vehicle in multi-task or unknown task scenarios. Secondly, the deep reinforcement learning used in this method usually requires a large number of environment interactions and complex reward function design, and the training process is complex and time-consuming, with high training cost.
[0004] The patent document with publication number "CN116151325A" discloses a method for real-time detection and recovery of unmanned aerial vehicle sensor attacks based on machine learning. The method uses a neural network trained by locally collected data to predict sensor data and calculate the difference between the predicted data and the measured sensor data of the unmanned aerial vehicle. It then determines whether the unmanned aerial vehicle sensor has been attacked, performs real-time isolation after detecting the attack, and uses the predicted value of the neural network to replace the sensor measurement value to recover the attacked sensor. However, this method has three shortcomings: first, the attack detection part of the method is based on the difference between the predicted value and the measured value, which leads to insufficient identification ability for specific disturbance-induced controller internal state abnormality attack types. Second, the method only recovers the sensor data and does not mention the recovery of the controller internal state. This will cause the controller to remain in an unstable working state even if the sensor data is recovered, affecting the long-term stable flight of the unmanned aerial vehicle. Third, the method only replaces the sensor data as the entire recovery part without calibrating the controller internal state, which may cause temporary instability or even oscillation of the unmanned aerial vehicle during sensor recovery.
[0005] The patent document with publication number "CN117349628A" discloses a method and device for detecting and recovering unmanned aerial vehicle physical attacks based on machine learning. The method acquires and preprocesses unmanned aerial vehicle flight data, constructs and trains a machine learning model that can determine whether the unmanned aerial vehicle has been attacked based on predicted output values. After detecting an attack, the system generates motor instructions using the predicted output values at the previous time step to avoid the influence of contaminated current actual measurement data. However, this method does not actively intervene or adjust the integral term of the unmanned aerial vehicle controller, so during the attack, the controller will accumulate errors caused by incorrect inputs. Even if the incorrect sensor data is recovered, the controller itself still has a persistent deviation that affects the stable flight of the unmanned aerial vehicle. SUMMARY
[0006] The present invention aims to address the shortcomings of the existing technology and provides a method and system for detecting and double-recovering unmanned aerial vehicle sensor attacks. This method can accurately calibrate the internal state of the flight control controller and the abnormal state of the sensor data in real time, avoid the impact of recovery on the subsequent stable flight ability of the unmanned aerial vehicle system, and achieve high-performance stable flight after attack recovery.
[0007] To achieve the above-mentioned purposes, the technical solution of the present invention includes:
[0008] 1. A method for detecting and double-recovering unmanned aerial vehicle sensor attacks, characterized by comprising:
[0009] (1) Collect sensor data and unmanned aerial vehicle internal data in normal situation and sensor attack situation during real-time flight of unmanned aerial vehicle, and respectively generate different data sets by preprocessing these data;
[0010] (2) Select a lightweight feedforward neural network as an attack detection deep learning model, select four independent decision trees as a first machine learning model for sensor recovery, and select a small regression model as a second machine learning model for controller recovery;
[0011] (3) Input the preprocessed sensor data and unmanned aerial vehicle internal data in normal situation and sensor attack situation to the attack detection deep learning model, input the preprocessed sensor data and unmanned aerial vehicle internal data in normal situation to the first machine learning model, and input the preprocessed unmanned aerial vehicle internal data during flight of unmanned aerial vehicle to the second machine learning model, and respectively train them;
[0012] (4) Deploy these trained models to the unmanned aerial vehicle respectively;
[0013] (5) During real-time flight of unmanned aerial vehicle, input the dimensionality reduction feature vector of sensor measurement value of unmanned aerial vehicle to the attack detection deep learning model, the model outputs the prediction result of whether the unmanned aerial vehicle is currently attacked, if attacked, the type of sensor attack is output, and (6) is executed;
[0014] (6) Delete the measurement value of the attacked sensor from the combined vector of the measurement values of gyroscopes, accelerometers, GPS, barometers and other sensors in the last 20 time points, and input these combined vectors to the first machine learning model, the model outputs the predicted value of the attacked sensor and replaces the measurement value of the sensor;
[0015] (7) Input the error ΔX v (t) between the expected speed and the actual speed of unmanned aerial vehicle at the current time and the error ΔX att (t) between the expected attitude angle and the actual attitude angle to the second machine learning model, the model outputs the controller parameter value required for recovery controller to adjust and adjusts the internal parameters of the controller in real time;
[0016] (8) During the recovery process, if the prediction result of the attack detection deep learning model is normal situation after inputting the dimensionality reduction feature vector of sensor measurement value of unmanned aerial vehicle at 10 consecutive time points, the recovery state of unmanned aerial vehicle is released, and step (5) is returned.
[0017] Further, the light-weight feed-forward neural network selected in (2) is a multi-layer perceptron, which includes an input layer, two hidden layers and an output layer connected in series, the input layer contains 60 neurons and uses ReLU activation function, the two hidden layers each contain 60 neurons and both use ReLU activation function, and the output layer uses softmax activation function and Adam optimizer.
[0018] Further, the four independent decision trees selected in (2) are four times of calling the decision tree model function in the Sklearn library to constitute the recovery models of the gyroscope, accelerometer, GPS and barometer.
[0019] Further, the small regression model selected in (2) is a random forest regression model, which is constructed by using the random forest model function in the Sklearn library, that is, an instance model of the random forest regression category is created by calling the function.
[0020] 2. An unmanned aerial vehicle sensor attack detection and double recovery system, characterized in that it comprises:
[0021] A sensor data acquisition and preprocessing module is used to collect real-time unmanned aerial vehicle sensor data, including GPS, gyroscope, accelerometer, barometer, and to perform timestamp alignment, synchronization preprocessing, feature selection on the aligned sensor data, and form input data for the attack detection module analysis.
[0022] An attack detection module is used to receive and analyze feature data from the sensor data acquisition and preprocessing module, and to detect whether the unmanned aerial vehicle is currently under sensor attack and the type of attack through a pre-trained deep learning model.
[0023] A sensor recovery module is used to output the predicted value of the attacked sensor based on the data of other unattacked sensors using a pre-trained first machine learning model, and to replace the actual measurement value of the attacked sensor with the predicted value, thereby realizing the recovery of sensor data.
[0024] A guidance and control module is used to calculate and output the control instructions of the unmanned aerial vehicle based on the corrected sensor data from the sensor recovery module and the adjusted internal parameters from the controller recovery module, to realize position control and attitude control, and to feedback the flight state error of the unmanned aerial vehicle to the controller recovery module.
[0025] A controller recovery module is configured to receive flight state errors of the UAV from the feedback of the guidance and control module when the attack detection module detects an attack, including errors of expected and actual attitude angles and speeds, and to use a second pre-trained machine learning model to predict and calibrate an integral item error accumulated inside the flight control controller, so as to eliminate internal bias caused by the attack.
[0026] A UAV body is configured to carry all sensors and actuators, receive specific control signals from the guidance and control module, and convert the electrical signals into actual mechanical movements through the motors carried thereby, to generate required lift, thrust and torque, and drive the UAV to accurately complete flight tasks of attitude adjustment and position control according to the control instructions.
[0027] Compared with the prior art, the present application has the following advantages:
[0028] Firstly, the present application can actively and finely intervene in the key parameters inside the UAV controller, and adjust the current value of the controller integral item in real time based on the error of the UAV flight state, so as to eliminate the internal error accumulation caused by the attack.
[0029] Secondly, the present application uses the synergy of sensor data repair and controller recovery to ensure the smoothness and high-performance continuity of the attack recovery process, so that no transient instability or continuous performance degradation will occur due to recovery.
[0030] Thirdly, the present application improves the depth of recovery from sensor data repair to precise adjustment of the internal logic parameters of the controller, so that the controller can recover its normal control accuracy and response ability after the attack, not only avoiding crashing, but also flying normally and stably.
[0031] Fourthly, the present application can take more targeted recovery strategies for different types of sensor attacks by distinguishing the current attack type.
[0032] Fifthly, the present application can realize autonomous recovery and state management of the UAV after suffering from sensor attacks by deploying all trained models to the UAV, avoiding excessive intervention or unnecessary long recovery, and ensuring the efficiency and robustness of the system. BRIEF DESCRIPTION OF DRAWINGS
[0033] Figure 1 is a flowchart of the UAV sensor attack detection and dual recovery method of the present application;
[0034] Figure 2 is a schematic diagram of the attack detection neural network constructed in the method of the present application;
[0035] Figure 3is a structure block diagram of an unmanned aerial vehicle sensor attack detection and double recovery system. DETAILED DESCRIPTION
[0036] The embodiments of the present method are further described in detail below with reference to the accompanying drawings.
[0037] The present method is applicable to the scenario where the unmanned aerial vehicle equipped with an accelerometer, a gyroscope, a GPS, a barometer, and a magnetometer is under normal flight or is attacked by external sensors during flight. The sensors obtain the environmental data of the unmanned aerial vehicle. The unmanned aerial vehicle obtains the sensor data and performs internal calculation according to the target and actual attitude angle error and speed error of the unmanned aerial vehicle to obtain the thrust instruction of the actuator motor and send it to the actuator for execution.
[0038] Embodiment 1: Unmanned aerial vehicle sensor attack detection and double recovery method.
[0039] Reference Figure 1 The implementation steps of the present example include the following:
[0040] Step 1: Collection and preprocessing of unmanned aerial vehicle flight data, and construction of three data sets.
[0041] During flight, the unmanned aerial vehicle collects the environmental data of the current situation through the multiple sensors deployed by itself. The flight control system inside the unmanned aerial vehicle calculates the internal state of the unmanned aerial vehicle according to the sensor data fusion;
[0042] After the flight task is completed, the flight log data of the unmanned aerial vehicle during normal flight and under sensor attack is collected. The log contains the environmental data collected by the sensors during flight and the internal state of the unmanned aerial vehicle;
[0043] The sensor data and the internal state of the unmanned aerial vehicle are extracted from the flight log data, including the measurement values of the accelerometer, the gyroscope, the GPS, the barometer, and the magnetometer, and the target and actual attitude angle error and speed error of the unmanned aerial vehicle;
[0044] The sensor data is time-stamped, aligned, and synchronized. The aligned sensor data is combined into a combined vector, which is used as the first data set;
[0045] The aligned sensor data and the attitude angle error and speed error are selected according to the importance of the features to generate a reduced dimension feature vector;
[0046] According to the current situation of the sample, including normal situation, accelerometer attack situation, gyroscope attack situation, GPS attack situation, and barometer attack situation, the target label of the current sample is set to the corresponding class number of the situation;
[0047] Merge the dimension-reduced feature vectors and the target labels of the samples as a second data set;
[0048] According to the attitude angle error and the speed error at each time, the adjustment amount of the internal integral term of the single controller of the unmanned aerial vehicle is calculated, so that the motor instruction output by the controller after the internal state of the unmanned aerial vehicle is calculated can make the unmanned aerial vehicle reach the expected state.
[0049] The attitude angle error, the speed error and the adjustment amount of the internal integral term of the controller at each time are taken as a third data set.
[0050] Step 2, build an attack detection multilayer perception model.
[0051] Referring to Figure 2 This step builds a multilayer perception neural network composed of an input layer, two hidden layers and an output layer in series, wherein:
[0052] The input layer includes 60 neurons, and uses a ReLU activation function to perform nonlinear transformation on the preliminary calculation results of the neurons, so that the results less than 0 are mapped to 0, and the results greater than 0 remain unchanged.
[0053] The two hidden layers have the same structure, each hidden layer includes 60 neurons, and also uses a ReLU activation function to perform nonlinear transformation on the preliminary calculation results of the neurons, so that the results less than 0 are mapped to 0, and the results greater than 0 remain unchanged.
[0054] The number of neurons in the output layer is the same as the number of types to be predicted, including normal type, accelerometer attack type, gyroscope attack type, GPS attack type and barometer attack type, and a softmax activation function is used to convert the preliminary calculation results of the neurons into a probability distribution, so that the sum of the activation values of all output neurons is 1, and an Adam optimizer is used to adjust the weights and biases in the network to minimize the loss function, optimize the learning efficiency and convergence speed of the model.
[0055] Step 3, build four independent decision tree sensor recovery models.
[0056] This step uses functions in the Sklearn library to directly build models;
[0057] The Sklearn library includes decision tree model related functions, random forest regression model related functions, linear regression model related functions, etc.
[0058] This step uses the decision tree model related function DecisionTreeRegressor in the library to create an instance model of the decision tree regression category;
[0059] The decision tree model related functions also include fit, which is responsible for training the built decision tree model;
[0060] The decision tree model creation function in the Sklearn library is called four times to build the recovery model of the gyroscope, accelerometer, GPS, and barometer, respectively, that is, four instance models of the decision tree regression category are created by calling the function four times.
[0061] Step 4, build a random forest regression controller recovery model.
[0062] This step uses the random forest regression model related function RandomForestRegressor in the Sklearn library, which is responsible for creating an instance model of the random forest regression category;
[0063] The random forest regression model related functions also include fit, which is responsible for training the built random forest regression model.
[0064] Step 5, train the attack detection multi-layer perception model.
[0065] 5.1) input the second training set data into the multi-layer perception network in batches for forward propagation to obtain the predicted output of the model;
[0066] 5.2) use the multi-class cross-entropy loss function to calculate the cross-entropy loss between the predicted output and the true label;
[0067] 5.3) use the gradient descent algorithm to calculate the gradient of the cross-entropy loss with respect to each parameter in the network, and update the parameters of each layer in the neural network;
[0068] 5.4) repeat 5.1) to 5.3) until the objective function of each neural network converges, obtaining the trained attack detection multi-layer perception model.
[0069] Step 6, train four independent decision tree sensor recovery models.
[0070] 6.1) use the multi-sensor combined feature vector in the first data set and the true measurement value of the current pending recovery sensor as the input feature and target value of the sensor recovery model, respectively;
[0071] 6.2) set the training parameters of the decision tree sensor recovery model, including the criterion as mean squared error, the maximum depth as 10, the minimum leaf node sample size as 5, and the minimum sample split size as 4;
[0072] 6.3) select the split point that can minimize the variance of the target value within the node of the model, and optimize the structure and split point of the tree based on the training parameters set in 6.2);
[0073] 6.4) Repeat 6.3) until each individual decision tree model converges, making it able to accurately predict the value of the corresponding sensor from the input features, forming the trained decision tree sensor recovery model.
[0074] Step 7, Train the Random Forest Regression Controller Recovery Model.
[0075] 7.1) Set the training parameters of the Random Forest Regression Controller Recovery Model, including the number of decision trees as 200, the maximum depth of each decision tree as 7, the minimum leaf node sample size as 4, and the minimum sample split size as 3;
[0076] 7.2) Take the error vector of the third data set and the controller internal integral term adjustment as the input features and target values of the Random Forest Regression Controller Recovery Model, respectively;
[0077] 7.3) The training function fit of this model performs random sampling with replacement on the input samples, generating a subset of the same size but different content as the original data set, and randomly selecting features from this subset, so that each tree in the forest has a slightly different training perspective, significantly increasing the diversity of each decision tree in the forest, effectively reducing the variance of the model, and enhancing its robustness to noise or outliers in the training data;
[0078] 7.4) The training function fit of this model finds the best split point from the selected features to grow and build a decision tree, and optimizes the decision tree to accurately predict the required controller integral term adjustment value from the flight state error;
[0079] 7.5) The decision tree independently grows according to the parameters set in step 7.1) until the growth stopping condition is met, including meeting the current maximum depth and minimum leaf node sample size;
[0080] 7.6) Repeat steps 7.3) to 7.5) until all decision tree models are trained, then combine these decision tree models to obtain the trained Random Forest Regression Model.
[0081] Step 8, Real-time attack detection during UAV flight.
[0082] 8.1) During the actual flight of the UAV, real-time acquisition and recording of the sensor measurement values and internal state quantities of the UAV are performed;
[0083] 8.2) Integrate and calculate these measurements to extract multi-sensor data and flight state error dimensionality reduction features as input to the trained attack detection multi-layer perception model;
[0084] 8.3) The attack detection multi-layer perception model calculates the features of the input in real time to obtain a predicted classification, and determines whether there is a sensor attack at present;
[0085] If there is a sensor attack, step 9 is performed, and the attack detection multi-layer perception model predicts the attack type to the sensor recovery model;
[0086] Otherwise, return to step 8.1) until the UAV safely lands and the throttle is released.
[0087] Step 9, restore the attacked sensor data.
[0088] According to the attack type passed in step 8, select the corresponding decision tree sensor recovery model;
[0089] Delete the measurement value of the attacked sensor from the combined vector of the measurements of the gyroscope, accelerometer, GPS, and barometer sensors in the last 20 time points, and input these combined vectors into the decision tree sensor recovery model. The model outputs the predicted value of the attacked sensor, and replaces the actual measurement value of the attacked sensor with the predicted output value of the model.
[0090] Step 10, restore the controller with error accumulation due to attack.
[0091] This step of recovery refers to adjusting the internal integral term parameters of the controller, which includes the following:
[0092] 10.1) Calculate the error ΔX between the expected speed of the UAV at the current time and the actual speed v ;
[0093] 10.2) Calculate the error ΔX between the expected attitude angle and the actual attitude angle att ;
[0094] 10.3) Input ΔX v and ΔX att calculated in steps 10.1) and 10.2) into the random forest regression controller recovery model, which outputs the controller parameter value, and replaces the existing internal parameters of the controller with the output controller parameter value of the model.
[0095] Step 11, continuous monitoring and recovery state management.
[0096] Input the next 10 input vectors into the attack detection multi-layer perception model to determine whether the UAV needs to continue recovery;
[0097] If the model outputs that the last 10 time points are all normal, return to step 8 to continue attack detection;
[0098] Otherwise, go to step 9 for dual recovery.
[0099] The flowchart representation or method representation of the above embodiments can be understood as representing code, fragments or portions comprising one or a set of steps configured to implement a certain logic function or process. The present application is not limited to the disclosed preferred embodiments, and its implementation can not follow the order shown or discussed, i.e. the step numbers in the specification and claims of the present application are only for the purpose of clearly describing the embodiments of the present application, facilitating understanding, and the order of the numbers is not limited.
[0100] Embodiment 2, UAV sensor attack detection and dual recovery system.
[0101] With reference to Figure 3 The present example includes a sensor data acquisition and preprocessing module 1, an attack detection module 2, a sensor recovery module 3, a guidance and control module 4, a controller recovery module 5 and a UAV body 6. The guidance and control module 4 includes a position data input submodule 41, a position control operation submodule 42, a position instruction output submodule 43, an attitude instruction input submodule 44, an attitude control operation submodule 45, and a motor instruction driving submodule 46.
[0102] The working principle of the whole system is as follows:
[0103] The sensor data acquisition and preprocessing module 1 is used to collect the raw sensor data of the UAV in real time, including the measurement values of GPS, gyroscope, accelerometer and barometer, and to perform preprocessing such as timestamp alignment, synchronization and feature selection, and to transmit the preprocessed feature data to the attack detection module 2 in real time;
[0104] The attack detection module 2 receives and analyzes the feature data from the sensor data acquisition and preprocessing module 1, and detects in real time whether the UAV is currently under sensor attack through a pre-trained deep learning model, and outputs the prediction result that the UAV is under attack to the sensor recovery module 3 once an attack is detected;
[0105] The sensor recovery module 3 uses a pre-trained first machine learning model to predict the attacked sensor data based on the combined measurement data from other unattacked sensors of the sensor data acquisition and preprocessing module 1, outputs the predicted value of the attacked sensor, and replaces the actual measurement value of the attacked sensor with the predicted value to realize real-time recovery of the sensor data, and generates corrected sensor data to be transmitted to the guidance and control module 4;
[0106] The guidance and control module 4 is used to calculate and output the expected attitude angle, thrust instruction and flight state error of the UAV, wherein:
[0107] The position data input sub-module 41 receives the corrected UAV position and velocity data from the sensor recovery module 3 and the original UAV position and velocity data from the sensor data acquisition and preprocessing module 1 when there is no attack, and transmits them to the position control operator module 42;
[0108] The position control operator module 42 uses these position and velocity data and combines them with the adjusted internal parameters from the controller recovery module 5 to calculate the expected attitude angle of the UAV in the horizontal direction that needs to be tilted and turned, the total thrust or throttle amount required to control the UAV to ascend or descend in the vertical direction, and the flight state error of the UAV according to the deviation between the current position of the UAV and the target position, the height error, and the vertical velocity error, and transmits these calculated parameters to the position command output sub-module 43 through the output;
[0109] The position command output sub-module 43 is used to send the expected attitude angle and thrust command in all the received calculated parameters to the attitude command input sub-module 44, and send the flight state error to the controller recovery module 5;
[0110] The attitude command input sub-module 44 is used to receive the expected attitude angle and thrust command from the position command output sub-module 43 and transmit them to the attitude control operator module 45;
[0111] The attitude control operator module 45 calculates the specific control signal for each propeller or motor according to the expected command obtained from the attitude command input sub-module 44 and the actual attitude of the UAV, and transmits it to the motor command driving sub-module 46;
[0112] The motor command driving sub-module 46 transmits the specific control signal calculated by the attitude control operator module 45 to the actuators of the UAV body 6 to drive the propellers to generate thrust, so that the UAV can accurately achieve the required attitude and thrust to realize position control and attitude control;
[0113] The controller recovery module 5 is used to receive the UAV flight state error feedback from the guidance and control module 4, use the pre-trained second machine learning model to predict the adjustment amount of the calibration flight control controller internal integral item error, and return this adjustment amount to the guidance and control module 4 to eliminate the internal deviation caused by the attack;
[0114] The UAV body 6 is the physical carrier of all sensors and actuators, receives the specific control signal from the motor command driving sub-module 46, and converts these electrical signals into actual mechanical movements through the motors mounted on it to generate the required lift, thrust, and torque to drive the UAV to accurately complete the attitude adjustment and position control flight tasks according to the control command.
[0115] It should be noted that the above-mentioned functional modules can be realized by software, hardware, firmware or any combination thereof, in whole or in part. When realized by software, the program instruction product can be realized in whole or in part. The program instruction product includes one or a group of program instructions. When the program instructions are loaded and executed on a computer, the flow or function is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable devices. The program instructions can be stored in a computer readable and writable storage medium or transferred from one computer readable and writable storage medium to another computer readable and writable storage medium.
[0116] The direct coupling or communication connection between the modules shown or discussed in the embodiments can be realized by indirect coupling or communication connection of some interfaces, devices or modules. The functional modules and sub-modules in the embodiments can be dynamically in one processing component, or each module can be physically present alone, or two or more modules can be dynamically in one processing component. When the above dynamic components are realized in the form of software functional modules and sold or used as independent products, they can also be stored in a computer readable and writable storage medium. The storage medium can be a memory, a magnetic disk or an optical disk, etc.
[0117] The above description is only two specific examples of the present application and does not constitute any limitation on the present application. Obviously, for those skilled in the art, after understanding the content and principles of the present application, various modifications and changes in form and details can be made without departing from the principles and structures of the present application. For example, when constructing the decision tree sensor recovery model and the random forest regression controller recovery model, the called construction function can be a function in other libraries or a custom function, but these modifications and changes based on the idea of the present application are still within the protection scope of the claims of the present application.
Claims
1. A method for detecting and dual-recovering unmanned aerial vehicle (UAV) sensor attacks, characterized in that, include: (1) Collect sensor data and internal data of the UAV during real-time flight under normal conditions and under sensor attack conditions, and preprocess these data to generate different datasets. (2) A lightweight feedforward neural network was selected as the attack detection deep learning model, four independent decision trees were selected as the first model of sensor recovery machine learning, and a small regression model was selected as the second model of controller recovery machine learning. (3) Input the sensor data and UAV internal data under the preprocessed normal situation and under the sensor attack situation into the attack detection deep learning model, input the sensor data and UAV internal data under the preprocessed normal situation into the first machine learning model, input the UAV internal data during the preprocessed UAV flight into the second machine learning model, and train them respectively. (4) Deploy these trained models into drones respectively; (5) During the real-time flight of the UAV, the dimensionality-reduced feature vector of the UAV sensor measurement value is input into the attack detection deep learning model. The model outputs the prediction result of whether the UAV is currently under attack. If it is under attack, the type of sensor attack is output and (6) is executed. (6) Remove the measurement values of the attacked sensor from the combined vector of measurement values of sensors including gyroscope, accelerometer, GPS and barometer in the last 20 time points, and input these combined vectors into the first machine learning model. The model outputs the predicted value of the attacked sensor and replaces the measurement value of that sensor. (7) Input the error between the expected speed and the actual speed of the UAV at the current moment and the error between the expected attitude angle and the actual attitude angle into the second machine learning model. The model outputs the controller parameter values that the recovery controller needs to adjust and adjusts the internal parameters of the controller in real time. (8) During the recovery process, if the dimensionality-reduced feature vector of the UAV sensor measurement values within 10 consecutive time points is input into the attack detection deep learning model and the prediction result is normal, then the UAV recovery state is lifted and the process returns to step (5).
2. The method according to claim 1, characterized in that, The preprocessing of the collected data to generate different datasets in step (1) includes: 1.1) Normal operation of the drone For the flight data of the UAV under normal conditions, extract sensor data and internal data of the UAV, including the three-dimensional rotation rate measurement of the gyroscope, the latitude, longitude and altitude measurement of the GPS, the three-dimensional measurement of the accelerometer, the three-dimensional velocity components after confusion by the extended Kalman filter, and the UAV's desired attitude angle and estimated attitude angle. The data extracted by the sensor is timestamped and synchronized. Use the aligned sensor feature vectors as the first dataset; The aligned sensor features and UAV internal data are used to generate a dimensionality-reduced feature vector F′ through feature selection, and the target label is set to 0 to represent the normal situation. The dimensionality-reduced feature vector F′ and the target label are merged to form the second dataset. 1.2) Attacks by drones For the flight data of the UAV under attack, sensor data and internal data of the UAV are extracted, including the three-dimensional rotation rate measurement of the gyroscope, the latitude, longitude and altitude measurement of the GPS, the three-dimensional measurement of the accelerometer, the three-dimensional velocity components after confusion by the extended Kalman filter, and the UAV's desired attitude angle and estimated attitude angle. The sensor data is timestamped and synchronized. The aligned sensor features and UAV internal data are used to generate a dimensionality-reduced feature vector through feature selection, while the target label is set to a number other than 0 to represent different sensor attack scenarios. The dimensionality-reduced feature vectors and target labels are merged and then incorporated into the second dataset; Calculate the error ΔX between the expected speed and the actual speed of the drone. v (t), calculate the error ΔX between the desired attitude angle and the actual attitude angle. att (t); Calculate in the ΔX v (t),ΔX att (t) Adjustment amount ΔI of the integral term within a single controller under error. PID (t) to bring the drone to the desired state; 1.3) Using the above ΔX v (t),ΔX att (t) and ΔI PID (t) forms the third dataset.
3. The method according to claim 1, characterized in that, The lightweight feedforward neural network selected in step (2) is a multilayer perceptron, which consists of an input layer, two hidden layers and an output layer connected in series. The input layer contains 60 neurons and uses the ReLU activation function. The two hidden layers each contain 60 neurons and both use the ReLU activation function. The output layer uses the softmax activation function and the Adam optimizer.
4. The method according to claim 1, characterized in that, The four independent decision trees selected in step (2) are constructed by calling the decision tree model function in the Sklearn library four times to form recovery models for the gyroscope, accelerometer, GPS and barometer respectively.
5. The method according to claim 1, characterized in that, The small regression model selected in step (2) is a random forest regression model. This model is constructed using the random forest model function in the Sklearn library, that is, by calling this function, an instance model of the random forest regression category is created.
6. The method according to claim 1, characterized in that, In step (3), the preprocessed sensor data under normal conditions and under sensor attack conditions, along with the internal data of the UAV, are input into the attack detection deep learning model for training. This includes: 3a) Input the second training set data into the network batch by batch for forward propagation to obtain the model's predicted output; 3b) Calculate the cross-entropy loss between these predicted outputs and the true labels using the multi-class cross-entropy loss function; 3c) Calculate the gradient of the cross-entropy loss with respect to each parameter in the network using the gradient descent algorithm, and update the parameters of each layer in the neural network; 3d) Repeat steps 3a) to 3c) until the objective function of each neural network converges.
7. The method according to claim 1, characterized in that, Step (3) involves inputting the preprocessed sensor data under normal conditions and the UAV's internal data into the first machine learning model for training, which includes: 4a) Use the multi-sensor combined feature vector in the first dataset and the real measurement value of the sensor to be recovered as the input feature and target value of the model, respectively; 4b) Set the training parameters of the model, including the discrimination criterion as mean squared error, the maximum depth as 10, the minimum number of leaf node samples as 5, and the minimum number of sample splits as 4; 4c) Select the split point that minimizes the variance of the target value within the model node, and optimize the tree structure and split point; 4d) Repeat 4c) until each independent decision tree model converges, enabling it to accurately predict the value of the corresponding sensor based on the input features.
8. The method according to claim 1, characterized in that, Step (3) involves inputting the preprocessed internal data of the UAV during its flight into the second machine learning model for training, which includes: 5a) Set the training parameters of the model, including the number of decision trees as 200, the maximum depth of each decision tree as 7, the minimum number of leaf node samples as 4, and the minimum number of sample splits as 3. 5b) Perform random sampling with replacement from the third dataset to generate a subset of the same size as the original dataset but with different content; 5c) Randomly select a subset of features; 5d) Find the optimal split point from these selected features to grow and construct a decision tree; 5e) The decision tree grows independently according to its preset parameters until it reaches the stopping condition; 5f) Repeat 5b) to 5e) until all decision tree models are built, and combine these built decision tree models into a random forest regression model.
9. A drone sensor attack detection and dual recovery system, characterized in that, include: The sensor data acquisition and preprocessing module is used to collect UAV sensor data in real time, including GPS, gyroscope, accelerometer, and barometer, and perform time stamp alignment and synchronization preprocessing on the data. The aligned sensor data is then used for feature selection to form input data for analysis by the attack detection module. The attack detection module is used to receive and analyze feature data from the sensor data acquisition and preprocessing module. Through a pre-trained deep learning model, it can detect in real time whether the drone is currently under sensor attack and the type of attack. The sensor recovery module is used to recover sensor data from sensor attacks detected by the attack detection module. It utilizes a pre-trained first machine learning model to output a predicted value for the attacked sensor based on data from other unattacked sensors, and replaces the actual measured value of the attacked sensor with this predicted value. The guidance and control module is used to calculate and output control commands for the UAV based on the sensor data corrected by the sensor recovery module and the internal parameters adjusted by the controller recovery module, so as to realize position control and attitude control, and at the same time feed back the flight status error of the UAV to the controller recovery module. The controller recovery module is used to receive the UAV flight state error fed back from the guidance and control module when the attack detection module detects an attack. This error includes the error between the expected and actual attitude angles and speeds. The module then uses a pre-trained second machine learning model to predict and calibrate the accumulated integral term error within the flight controller to eliminate internal deviations caused by the attack. The drone body is used to carry all sensors and actuators, receive specific control signals from the motor command drive submodule, and convert these electrical signals into actual mechanical motion through its onboard motors.
10. The system according to claim 9, characterized in that, The guidance and control module includes: The position data input submodule is used to receive the UAV position and velocity data output by the sensor recovery module after correction, as well as the UAV position and velocity data directly output by the sensor data acquisition and preprocessing module. The position control calculation submodule is used to combine the internal parameters adjusted by the controller recovery module, and calculate the desired attitude angles for the UAV to tilt and turn in the horizontal direction and the total thrust or throttle required to control the UAV to ascend or descend in the vertical direction, based on the deviation between the current position and the target position, as well as the altitude error and vertical speed error. It also calculates the flight state error of the UAV, including the speed error and attitude error between the desired and actual values. The position command output submodule is used to output the UAV's flight state error to the controller recovery module and to output the UAV's desired attitude angle and thrust command to the attitude command input submodule. The attitude command input submodule is used to receive the desired attitude angle and thrust command output by the position command output submodule; The attitude control calculation submodule is used to calculate the specific control signal for each motor based on the desired attitude angle and thrust command output by the position command output submodule. The motor command drive submodule is used to transmit specific control signals for each motor to the actuators of the drone body, enabling the drone to achieve the required attitude and thrust.
Citation Information
Patent Citations
Unmanned aerial vehicle sensor attack real-time detection and recovery method based on machine learning
CN116151325A
Unmanned aerial vehicle physical attack detection and recovery method and device based on machine learning
CN117349628A