Disclosure of Invention
The invention aims to provide a method, a system and a storage medium for detecting the range specification error of an unmanned aerial vehicle configuration module, so as to realize high-efficiency verification and enable the adaptability and stability of the unmanned aerial vehicle to achieve the optimal balance.
In order to achieve the purpose, the invention has the following technical scheme:
in a first aspect, an embodiment of the present invention provides a method for detecting an error in a range specification of an unmanned aerial vehicle configuration module, including:
generating a log file by executing the flight mission of the unmanned aerial vehicle;
dividing data in the log file into two parts, wherein one part of data is used for extracting features and generating a state change predictor by using the extracted features, and the other part of data is clustered, and selecting a representative sample from each cluster;
using each representative sample to find out corresponding error configuration and sending the error configuration to a searcher;
iteratively changing the configuration and evaluating the configuration fitness using a searcher and a state change predictor;
merging the search results of each representative sample when the iteration stop condition is met, and generating a configuration set which is potentially incorrect;
performing simulation verification on the configuration in the configuration set which is potentially incorrect;
and generating an effective parameter range for each configuration by utilizing multi-objective optimization according to the simulation verification result.
Further, each log in the log file contains flight status, sensor data, configuration, and a timestamp.
Preferably, in the process of generating the state change predictor, one feature is composed of a state unit a with a timestamp, a sensor data unit s and a configuration unit x, the combination of a specific state unit and a sensor data unit is used as a context c ═ a, s }, and one feature is normalized into a feature vector v { c, x }; the state change predictor predicts the next reference state by adopting long-term and short-term memory, specifically:
for a preprocessed feature vector v with time stamp ti={ct,xtH consecutive time-stamped vectors V { V } preceding tt-h-1,...,vt-1,vtAs input and return the next referenceState cell at+1′Is predicted with the maximum conditional probability.
Further, training the state change predictor using a mean square error loss; in the training process of the state change predictor, the weight is updated through iteration to enable the predicted reference state at+1′With the true state at+1Reaches a set threshold range to ensure the predicted reference state at+1′Closer to the true state at+1。
Firstly, dividing data in a log file into a plurality of fragments Ci={ci,ci+1,...,ci+hI mod (h +1) ═ 0, where i is the number of data segments, clustering the above data segments and randomly extracting a representative sample m from each cluster for subsequent search;
in said step of using each representative sample to find a corresponding misconfiguration to send to the searcher: and (4) carrying out genetic algorithm search on each representative sample m, finding out corresponding error configuration through iterative mutation, intersection and selection, and sending the corresponding error configuration to a searcher.
Furthermore, in the process of carrying out genetic algorithm search, the fitness is adopted to quantify the deviation caused by the given configuration, and the deviation probability of the configuration is returned by the fitness evaluation function; in particular, assume that the current search is for context segment C { C }1,...ch,ch+1Selecting C' C by fitness evaluation function1,c2,...chAs input to the state change predictor, and selects ch+1A of (a)h+1Used as a ground truth for calculating deviations; in the evaluation configuration x { x1,...,xDD is the number of parameters, which the fitness evaluation function combines with the segments to create the feature V { { c { (c) }1,x},...,{chX } and then inputs these features to the state change predictor, returning a predicted reference state a'h+1(ii) a The evaluation of the configuration fitness depends on the L1 distance | a between the predicted state and the true stateh+1-a′h+1II, the goal of the search is to find incorrect configurations that are predicted to maximize fitnessMaximizing the probability of causing unstable states is obtained.
Preferably, the iteratively changing the configuration and evaluating the configuration fitness using the searcher and state change predictor comprises:
in the G-th iteration, G ∈ [1, G ]max],GmaxFor the maximum number of iterations, the current population is first subjected to variation popg{x1,g...,xNP,gAnd generating variant population popv{y1,g,...,yNP,g}; each configuration of the variant population is obtained as follows:
yi,g=xi,g+F*(xbest,g-xi,g)+F*(xr1,g-xr2,g)
in the formula, xr1,g、xr2,gIs a random configuration, xi,gIs a previous generation configuration, xbest,gIs the best fitness configuration, F is the scaling factor;
second, popgWith popvCross-producing a new experimental population pope{e1,g,...,eNP,gIs of the ith configuration ei,g{ei1,g,ei2,g,...,eij,gJ is e [1, D ]](ii) a Parameter value e for each configurationij,gCalculated as follows:
in the formula, jrandIs [1, D ]]Is a random integer of (1), CR is the crossover rate, xij,gIs popgThe jth parameter value, y, of the ith configurationij,gIs popvThe jth parameter value of the ith configuration;
then, the pop was evaluatedgAnd popeThe fitness of each configuration in (1): selecting some configurations from the population according to the fitness to obtain the next generation population popg+1{x1,g+1,...,xNP,g+1This process uses the following selection function:
wherein f is a fitness evaluation function;
finally, if the fitness of each configuration in the population no longer increases or reaches a maximum number GmaxThe search stops mutating.
Preferably, the step of generating a valid parameter range for each configuration by using multi-objective optimization comprises:
range guidance Range' is estimated based on the following optimization problem:
in the formula, RincorrectFor the wrong configuration of R range coverage, R is the reduced range to be sought, origin range is the original range, f1To optimize the objective 1, f2To optimize objective 2.
In a second aspect, an embodiment of the present invention provides an unmanned aerial vehicle configuration module range specification error detection system, including:
the log generation module is used for generating a log file by executing the flight mission of the unmanned aerial vehicle;
the predictor generation and cluster sampling module is used for dividing data in the log file into two parts, wherein one part of data is used for extracting features and generating a state change predictor by using the extracted features, and the other part of data is clustered and a representative sample is selected from each cluster;
the sample error configuration searching module is used for finding out corresponding error configuration by using each representative sample and sending the corresponding error configuration to the searcher;
a fitness evaluation module for iteratively changing the configuration and evaluating the configuration fitness using the searcher and the state change predictor;
a configuration set generation module which is used for merging the search results of each representative sample when the iteration stop condition is met and generating a configuration set which is potential incorrect;
a simulation verification module for performing simulation verification on the configuration in the potentially incorrect configuration set;
and the effective parameter range determining module is used for generating an effective parameter range for each configuration by utilizing multi-objective optimization according to the simulation verification result.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, where at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the method for detecting the error in the drone configuration module range specification according to the first aspect.
Compared with the prior art, the first aspect of the invention has at least the following beneficial effects:
the range specification error detection method first collects flight log files, each containing flight status, sensor data, configuration, and timestamp data. Using these log file data, a state change predictor is trained for estimating the state that the drone will arrive at the next timestamp, called the reference state. Meanwhile, unlike conventional configuration verification schemes that test configurations on flight simulators or real drones, the present invention uses a state change predictor to estimate a reference state and infers whether the configuration is correct or not according to the deviation of the reference state from an expected state, specifically, uses each representative sample to find out a corresponding incorrect configuration to send to the searcher, iteratively changes the configuration and uses the searcher and the state change predictor to evaluate the configuration fitness. Finally, the invention carries out simulation verification on the configuration in the configuration set which is potentially incorrect, verifies the configuration which is predicted to be incorrect, and utilizes multi-objective optimization to generate an effective parameter range for each configuration. By combining the characteristics, the invention can provide all possible parameter values with high coverage rate and carry out verification efficiently.
It is to be understood that, the beneficial effects of the second to third aspects may be referred to the related description of the first aspect, and are not described herein again.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing a relative importance or importance.
Referring to fig. 1, in the method for detecting the range specification error of the unmanned aerial vehicle configuration module according to the present invention, the system model mainly includes the following three components: a state change predictor, a module for predicting flight conditions and evaluating whether the configuration would result in an unstable condition; a learning-guided mutation searcher, a Genetic Algorithm (GA) search module for detecting misconfigurations; a range guidance estimator, a module for providing safety parameter range guidance.
The specific steps of the range specification error detection method shown in the figure comprise:
1) and generating a log file (i) by repeatedly executing the flight mission of the unmanned aerial vehicle.
2) The data in the log file is divided into two parts, one part is used by a state change predictor to generate features, and the other part is clustered and sampled by a variation searcher guided by learning.
3) These features generated from the log file are used to generate a state change predictor (c).
4) The searcher clusters the data in the log file and selects a representative sample from each cluster.
5) The searcher uses each representative sample to find the corresponding wrong configuration (c).
6) The searcher iteratively changes the configuration and uses a predictor to evaluate which configuration is more likely to result in the unstable state.
7) When the iteration stop condition is met, the searcher merges the search results for each sample and generates a set of potentially incorrect configurations.
8) These potentially incorrect configurations are verified by simulation
9) Using the validation results, the estimator uses multi-objective optimization to generate multiple feasible range guides to balance usability and stability under specific conditions
With respect to the state change predictor, since the flight control program estimates the next reference state from the current positioning state and sensor data, based on this input-output control process, a Machine Learning (ML) predictor is utilized to model this input-output relationship and evaluate the impact of the configuration. The present invention uses such ML predictors for several reasons. First, the diversity and flexibility of the ML predictor makes it suitable for modeling nonlinear input-output control processes. Second, the ML predictor can estimate the next reference state while accurately reflecting the bias caused by the misconfiguration. Specifically, for flight data, the learning algorithm trains a predictor that takes as input the positioning state, sensor data, and configuration to predict (estimate) the next reference state.
As with the control algorithm, large deviations between the predicted and actual reference states indicate that the flight state may become unstable.
Two steps are performed to train the predictor: feature extraction and predictor generation.
Firstly, feature extraction
The predictor is trained using a data set, extracting state, sensor data and configuration from raw logs, and represented according to a fixed feature vector format. The flight control program may specify hundreds of corresponding control parameters, and identifying range specification errors by validating all parameter values is time consuming because some parameters may not affect flight stability.
The method proposed by the invention therefore only concerns the parameters that may affect the angular position and the angular velocity state, since they directly affect the flight attitude and their erroneous values are more likely to lead to unstable states. Since only the unstable states that affect the angle (i.e., position and velocity) are of interest, the predictor of the inventive method considers: (i) angular position and angular velocity of the state; (ii) data obtained from gyroscopes and accelerometers. One feature consists of a status cell a, a sensor data cell s and a configuration cell x. For ease of description, the combination of a particular state element and sensor data element is referred to as the context c ═ a, s. Finally, a feature is composed of these three time-stamped units and is normalized to the vector v { c, x }.
Second, predictor generation
Long Short Term Memory (LSTM) techniques can efficiently fit the complex input/output of a nonlinear model, and therefore use LSTM as a predictor of the next reference state. In particular, for a preprocessed feature vector v with a time stamp ti={ct,xt}, LSTM takes as input h consecutive time-stamped vectors h before t (i.e., V { V })t-h-1,...,vt-1,vt}) and returns the next reference state element at+1′Is predicted with the maximum conditional probability. In the training phase, the weight of the predictor is iteratively updated to ensure the predicted reference state at+1′Closer to the true state at+1. The present invention uses Mean Square Error (MSE) loss for training.
In embodiments of the invention, a learning-guided mutation searcher is employed, and to search for incorrect configurations, the method of the invention uses a genetic algorithm, i.e., a meta-heuristic search that relies on operators of biological heuristics (e.g., mutation, intersection, and selection). Initially, the system of the inventive method searches a plurality of specific contexts to find an incorrect configuration, since an incorrect configuration may only result in unstable states in a specific context (i.e. states and sensor data). The method divides the data in the log into a plurality of segments Ci={ci,ci+1,...,ci+hI mod (h +1) ═ 0, where i is the number of data. But searching each segment yields a large number of repeated results, taking into account the similarity between segments. To address this problem, the method of the present invention clusters the segments and samples from the clusters to reduce redundancy while preserving diversity. The invention utilizes a meanshift algorithm, namely a nonparametric self-adaptive clustering algorithm based on probability density, to cluster the fragments, and randomly extract a representative sample m from each cluster for subsequent search. Then, for each sample segment, the searcher performs a Genetic Algorithm (GA) search through iterative mutation, crossover, and selection to explore incorrect configurations. When the searcher collects all incorrect configurations for each sample, it merges and deduplicates them as a unique set, called a set of potentially incorrect configurations. Detailed information about the fitness evaluation function (used to evaluate the configured fitness) and the search process is provided in the face.
A fitness evaluation function is introduced in the specific steps of the method, and a Genetic Algorithm (GA) search quantifies the deviation possibly caused by a given configuration by using a predictor and adopting the fitness. Intuitively, the fitness evaluation function returns a bias to the configurationThe difference probability. In particular, assume that the current search is for context segment C { C }1,...ch,ch+1The function selects C' { C }1,c2,...chIs used as input to the prediction model and selects ch+1A of (a)h+1Used as a ground truth for calculating deviations.
In the evaluation configuration x { x1,...,xDWhen (D is the number of parameters), the function merges it with the segment to create the feature V { { c { (C) }1,x},...,{chX } }. These features are then input to the predictor, which returns a predicted reference state a'h+1. The fitness is the L1 distance | a between the predicted and true statesh+1-a′h+1|. The goal of the search is then to find incorrect configurations that are predicted to maximize fitness, i.e., bias (and thus the probability of causing an unstable state).
The specific search process of the method of the invention is as follows:
for each context segment sample, the searcher first initializes an individual as a configured population, with the parameter value for each configuration set to its default value. In this embodiment, assume that the population size is NP and the maximum number of iterations is Gmax。
The search process iteratively mutates and updates populations as follows:
first iterate at the G < th > (G e [1, G)max]) In the method, a searcher firstly performs variation pop on a current populationg{x1,g...,xNP,g} generating variant populations popv{y1,g,...,yNP,g}. Each configuration of variant populations was obtained as follows:
yi,g=xi,g+F*(xbest,g-xi,g)+F*(xr1,g-xr2,g)
wherein x isr1,g、xr2,gIs a random configuration, xi,gIs a previous generation configuration, xbest,gIs the best fitness configuration and F is the scaling factor.
Second, popgAnd popvCross-producing a new experimental population pope{e1,g,...,eNP,gIs of the ith configuration ei,g{ei1,g,ei2,g,...,eij,gJ is e [1, D ]]. Parameter value e for each configurationij,gThe calculation formula is as follows:
wherein j israndIs [1, D ]]Is a random integer of (1), CR is the crossover rate, xij,gIs popgThe j parameter value, y, of the i-th configurationij,gIs popvThe jth parameter value of the ith configuration.
The searcher then evaluates the popgAnd popeThe fitness of each configuration. The searcher selects some configurations from the population according to their fitness to obtain the next generation population popg+1{x1,g+1,...,xNP,g+1Using the following selection function:
where f is a fitness evaluation function.
Finally, if the fitness of each configuration in the population no longer increases or reaches a maximum number GmaxThe search stops mutating.
The present embodiment selects the top 10 highest fitness configurations from the last generation population as incorrect configurations.
With respect to the range guidance estimator, the range guidance provided to the user should take into account stability and adaptability while eliminating discrete misconfigurations and preserving relatively complete space for each parameter. Meanwhile, because the method of the present invention cannot ensure the stability of the unverified configuration, the estimation of the range guidance should refer to the obtained verification result and avoid considering the incorrect configuration. Thus, the present invention utilizes multivariate optimization to determine the appropriate range guidance. The present invention considers a configuration to be covered if all parameter values in the configuration are within the guidelines. The present invention attempts to estimate the Range guidance (Range') based on the following optimization problem:
the optimization problem has two goals: (a) maximizing the number of local optimal range coverage verification configurations R; (b) minimizing misconfiguration RincorrectThe coverage of (c). If the allowable range is narrowed to avoid misconfigurations, the range of each parameter value is also narrowed, and vice versa. Thus, rather than defining a strict range for each parameter, the system solves this optimization problem using multiple constraints to obtain a different set of Pareto solutions. These pareto solutions form a boundary consisting of the best possible solutions, allowing the user to select the best configuration according to his own requirements. The system provides this range guidance based primarily on the following considerations: (1) as the number of parameters increases, it is difficult to completely exclude unsafe parameter values, since the safe parameter range may not be continuous. (2) While stability is the most important, users may be willing to take some minor risk to better control flexibility or usability.
Another embodiment of the present invention further provides a system for detecting an error in a range specification of an unmanned aerial vehicle configuration module, which specifically includes:
the log generation module is used for generating a log file by executing the flight mission of the unmanned aerial vehicle;
the predictor generation and cluster sampling module is used for dividing data in the log file into two parts, wherein one part of data is used for extracting features and generating a state change predictor by using the extracted features, and the other part of data is clustered and a representative sample is selected from each cluster;
the sample error configuration searching module is used for finding out corresponding error configuration by using each representative sample and sending the corresponding error configuration to the searcher;
a fitness evaluation module for iteratively changing the configuration and evaluating the configuration fitness using the searcher and the state change predictor;
a configuration set generation module which is used for merging the search results of each representative sample when the iteration stop condition is met and generating a configuration set which is potential incorrect;
a simulation verification module for performing simulation verification on the configuration in the potentially incorrect configuration set;
and the effective parameter range determining module is used for generating an effective parameter range for each configuration by utilizing multi-objective optimization according to the simulation verification result.
Another embodiment of the present invention provides a computer-readable storage medium having at least one instruction stored therein, the at least one instruction being executable by a processor in an electronic device to implement the drone configuration module range specification error detection method.
Illustratively, the computer program may be partitioned into one or more modules/units, which are stored in a computer readable storage medium and executed by the processor to perform the steps in the drone configuration module range specification error detection method of the present invention. The one or more modules/units may be a series of computer-readable instruction segments capable of performing certain functions, which are used to describe the execution of the computer program in the server.
The server can be a computing device such as a smart phone, a notebook, a palm computer and a cloud server. The server may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that the server may also include more or fewer components, or some components in combination, or different components, e.g., the server may also include input output devices, network access devices, buses, etc.
The Processor may be a CentraL Processing Unit (CPU), other general purpose Processor, a DigitaL SignaL Processor (DSP), an AppLication Specific Integrated Circuit (ASIC), an off-the-shelf ProgrammabLe Gate Array (FPGA) or other ProgrammabLe logic device, discrete Gate or transistor logic device, discrete hardware component, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage may be an internal storage unit of the server, such as a hard disk or a memory of the server. The memory may also be an external storage device of the server, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure DigitaL (SD) Card, a FLash memory Card (FLash Card), or the like provided on the server. Further, the memory may also include both an internal storage unit of the server and an external storage device. The memory is used to store the computer readable instructions and other programs and data needed by the server. The memory may also be used to temporarily store data that has been output or is to be output.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the method embodiment, and specific reference may be made to the part of the method embodiment, which is not described herein again.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.