Disclosure of Invention
In view of the above, it is necessary to provide a method and a device for positioning an unmanned aerial vehicle based on kalman filtering, so as to solve the technical problem in the prior art that the positioning of the unmanned aerial vehicle is inaccurate.
In order to solve the technical problem, the invention provides an unmanned aerial vehicle positioning method based on Kalman filtering, which comprises the following steps:
sampling the current position value of the unmanned aerial vehicle based on a preset sampling method to obtain a plurality of sampling points;
determining a prior position value and a prior covariance matrix of the unmanned aerial vehicle at the next moment based on the plurality of sampling points;
determining the length of a next sliding window at the next moment according to the length of the current sliding window at the current moment;
determining an estimated system noise covariance matrix and an estimated measurement noise covariance matrix of the next time according to the length of the next sliding window;
and obtaining an observation position value at the next moment, and determining a posterior position value and a posterior covariance matrix at the next moment according to the observation position value, the estimation system noise covariance matrix, the estimation measurement noise covariance matrix, the prior position value and the prior covariance matrix so as to position the unmanned aerial vehicle.
In a possible implementation manner, the determining, based on the plurality of sampling points, an a priori position value and an a priori covariance matrix at a next time of the drone includes:
determining a first order statistical weight coefficient and a second order statistical weight coefficient of the plurality of sampling points;
determining a plurality of one-step predicted sampling points of the plurality of sampling points;
and determining the prior position value and the prior covariance matrix according to the first-order statistical weight coefficient, the second-order statistical weight coefficient and the plurality of one-step prediction sampling points.
In a possible implementation manner, the determining a next sliding window length of the next time according to the current sliding window length of the current time includes:
acquiring a current observation value at the current moment;
determining a current residual sequence of the current moment according to the current observation value, the current position value and the measurement equation;
determining historical average residual sequences of all historical moments;
and determining the length of the next sliding window according to the length of the current sliding window, the sequence of the current residual error and the sequence of the historical average residual error.
In one possible implementation, the determining the posterior position value and the posterior covariance matrix at the next time according to the observed position value, the estimated system noise covariance matrix, the estimated measured noise covariance matrix, the prior position value, and the prior covariance matrix includes:
determining an observation covariance matrix and a measurement covariance matrix according to the estimated system noise covariance matrix and the estimated measurement noise covariance matrix;
determining a Kalman gain matrix according to the observation covariance matrix and the measurement covariance matrix;
determining the posterior position value according to the prior position value, the observation position value and the Kalman gain matrix;
and determining the posterior covariance matrix according to the prior covariance matrix, the Kalman gain matrix and the observation covariance matrix.
In one possible implementation, the sampling points are:
in the formula (I), the compound is shown in the specification,
the sampling points are the sampling points;
is the prior location value;
is the dimension of the equation of state;
the distance between the sampling point and the current position value is a parameter; p
kIs the covariance matrix at time k.
In one possible implementation, the prior location value and the prior covariance matrix are respectively:
in the formula (I), the compound is shown in the specification,
is the prior location value;
is the prior covariance matrix;
is the first order statistical weight coefficient;
is the second order statistical weight coefficient;
predicting sampling points for the step;
a one-step prediction function for said sample points;
is a first white noise sequence;
is the current measured noise covariance matrix at time k.
In one possible implementation, the next sliding window length is:
in the formula (I), the compound is shown in the specification,
is the next sliding window length;
is the current sliding window length; l is the measurement dimension;
the current residual error sequence is obtained;
is the jth element in the current residual error sequence;
the j element in the historical average residual error sequence is obtained;
is the current observation;
is the current position value;
mapping relation between the measured position value and the observed position value; and | represents rounding.
In one possible implementation, the posterior position values and the posterior covariance matrix are respectively:
in the formula (I), the compound is shown in the specification,
is the posterior position value;
is the prior location value;
is the Kalman gain matrix;
is the observed position value;
is an estimated location value;
is the posterior covariance matrix;
an estimated covariance matrix for the prior covariance matrix;
a transposed matrix that is the Kalman gain matrix;
for the purpose of the observed covariance matrix,
is the measured covariance matrix;
is a second white noise sequence;
estimating a system noise covariance matrix;
to estimate a measured noise covariance matrix.
In a possible implementation manner, the estimated system noise covariance matrix and the estimated metrology noise covariance matrix are respectively:
in the formula (I), the compound is shown in the specification,
is an innovation sequence at the kth moment;
is an innovation sequence at the k-i time;
the residual error sequence at the k-i moment is obtained;
is the prior position value at the k-th time.
On the other hand, the invention also provides an unmanned aerial vehicle positioning device based on Kalman filtering, which comprises:
the sampling unit is used for sampling the current position value of the unmanned aerial vehicle based on a preset sampling method to obtain a plurality of sampling points;
the prior value determining unit is used for determining a prior position value and a prior covariance matrix of the unmanned aerial vehicle at the next moment based on the plurality of sampling points;
a window length updating unit, configured to determine a next sliding window length at the next time according to the current sliding window length at the current time;
a noise covariance matrix determining unit, configured to determine an estimated system noise covariance matrix and an estimated measured noise covariance matrix at the next time according to the length of the next sliding window;
and the positioning unit is used for acquiring an observation position value at the next moment, and determining a posterior position value and a posterior covariance matrix at the next moment according to the observation position value, the estimated system noise covariance matrix, the estimated measurement noise covariance matrix, the prior position value and the prior covariance matrix so as to position the unmanned aerial vehicle.
The beneficial effects of adopting the above embodiment are: according to the unmanned aerial vehicle positioning method based on Kalman filtering, the current position value is sampled through a preset sampling method, a state equation and a measurement equation do not need to be subjected to linear approximation, errors generated in the linearization process of a branching system are avoided, and the unmanned aerial vehicle positioning accuracy is improved. Furthermore, the invention determines the length of the sliding window at the next moment, determines the estimated system noise covariance matrix and the estimated measurement noise covariance matrix at the next moment through the length of the sliding window, and determines the posterior position value and the posterior covariance matrix at the next moment according to the estimated system noise covariance matrix and the estimated measurement noise covariance matrix, so that the noise can be more matched with the real noise, and the positioning accuracy of the unmanned aerial vehicle is further improved.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The invention provides a Kalman filtering-based unmanned aerial vehicle positioning method and a Kalman filtering-based unmanned aerial vehicle positioning device, which are respectively explained below.
Fig. 1 is a schematic flow chart of an embodiment of the method for positioning an unmanned aerial vehicle based on kalman filtering, shown in fig. 1, the method includes:
s101, sampling the current position value of the unmanned aerial vehicle based on a preset sampling method to obtain a plurality of sampling points;
s102, determining a prior position value and a prior covariance matrix of the unmanned aerial vehicle at the next moment based on a plurality of sampling points;
s103, determining the length of a next sliding window at the next moment according to the length of the current sliding window at the current moment;
s104, determining an estimated system noise covariance matrix and an estimated measurement noise covariance matrix at the next moment according to the length of a next sliding window;
and S105, acquiring an observation position value at the next moment, and determining a posterior position value and a posterior covariance matrix at the next moment according to the observation position value, the estimated system noise covariance matrix, the estimated measurement noise covariance matrix, the prior position value and the prior covariance matrix so as to position the unmanned aerial vehicle.
Compared with the prior art, the unmanned aerial vehicle positioning method based on Kalman filtering provided by the embodiment of the invention samples the current position value by a preset sampling method, and does not need to carry out linear approximation on a state equation and a measurement equation, so that errors generated in the linearization process of a branching linear system are avoided, and the positioning accuracy of the unmanned aerial vehicle is improved. Furthermore, the invention determines the length of the sliding window at the next moment, determines the estimated system noise covariance matrix and the estimated measurement noise covariance matrix at the next moment through the length of the sliding window, and determines the posterior position value and the posterior covariance matrix at the next moment according to the estimated system noise covariance matrix and the estimated measurement noise covariance matrix, so that the noise can be more matched with the real noise, and the positioning accuracy of the unmanned aerial vehicle is further improved.
In some embodiments of the present invention, the current position value of the drone is obtained through a state equation and a measurement equation of the drone, specifically, the state equation of the drone is:
in the formula (I), the compound is shown in the specification,
measuring a position value at the k +1 th moment of the unmanned aerial vehicle;
the measured value at the kth moment of the unmanned aerial vehicle is obtained;
is a transition matrix;
is a noise matrix;
is the time difference between the kth time and the (k + 1) th time;
is an identity matrix.
In some embodiments of the invention, the measurement equation is:
in the formula (I), the compound is shown in the specification,
the observed position value at the kth moment is;
the measured position value at the kth moment;
mapping relation between the observation position value and the measurement position value;
is the azimuth of the drone;
is the altitude angle of the unmanned aerial vehicle; t is t
x,t
y,t
zObserving the position of the unmanned aerial vehicle for the camera at the kth moment; p is a radical of
x,p
y,p
zIs the self position of the unmanned plane.
Wherein, measuration position value accessible is installed the gyroscope on the unmanned aerial vehicle and is obtained.
It should be noted that: t is tx,ty,tz,px,py,pzAll are coordinate values under the self three-dimensional coordinate system of the unmanned aerial vehicle, then tx,ty,tzCan be obtained from the following coordinate transformation:
in the formula, t
pThe coordinate of the central point of the camera view field in the three-dimensional coordinate system of the camera is shown,
is a rotation matrix from a three-dimensional coordinate system of the unmanned plane to a geographic coordinate system,
the rotation matrix from the three-dimensional coordinate system where the camera is located to the three-dimensional coordinate system of the unmanned aerial vehicle.
In particular, tpIs (0,0, f), where f is the focal length of the camera.
The measurement equation can be constructed by observing the position coordinate of the unmanned aerial vehicle and the position coordinate of the unmanned aerial vehicle through the camera in the same three-dimensional coordinate system.
In some embodiments of the present invention, as shown in fig. 2, step S102 comprises:
s201, determining a first-order statistical weight coefficient and a second-order statistical weight coefficient of a plurality of sampling points;
s202, determining a plurality of one-step prediction sampling points of a plurality of sampling points;
s203, determining a prior position value and a prior covariance matrix according to the first-order statistical weight coefficient, the second-order statistical weight coefficient and the plurality of one-step prediction sampling points.
It should be noted that, in the embodiment of the present invention, the preset sampling method is Sigma sampling.
Specifically, the sample points after sampling by Sigma are:
in the formula (I), the compound is shown in the specification,
sampling points are obtained;
is a priori position value;
is the dimension of the equation of state;
is a parameter of the distance between the sampling point and the current position value; p
kIs the covariance matrix at time k.
Wherein, the first order statistical weight coefficient and the second order statistical weight coefficient are respectively:
in the formula (I), the compound is shown in the specification,
is a first order statistical weight coefficient;
is a second order statistical weight coefficient.
Wherein, the one-step prediction sampling point is as follows:
in the formula (I), the compound is shown in the specification,
predicting sampling points for one step;
is a one-step predictive function of the sample points.
After the sampling point, the first order statistical weight coefficient, the second order statistical weight coefficient and the one-step prediction sampling point are obtained through the formula calculation, the prior position value and the prior covariance matrix are respectively as follows:
in the formula (I), the compound is shown in the specification,
is a priori position value;
is a prior covariance matrix;
is a first white noise sequence;
is the current measured noise covariance matrix at time k.
In some embodiments of the present invention, as shown in fig. 3, step S103 comprises:
s301, acquiring a current observation value at the current moment;
s302, determining a current residual sequence at the current moment according to the current observation value and the current position value;
s303, determining historical average residual sequences of all historical moments;
and S304, determining the length of the next sliding window according to the length of the current sliding window, the current residual sequence and the historical average residual sequence.
Specifically, the next sliding window length is:
in the formula (I), the compound is shown in the specification,
is the next sliding window length;
is the current sliding window length; l is the measurement dimension;
is the current residual error sequence;
is the jth element in the current residual error sequence;
is the jth element in the historical average residual error sequence;
is the current observed value;
is the current position value;
mapping relation between the measured position value and the observed position value; and | represents rounding.
It should be noted that: to further improve the positioning accuracy, in some embodiments of the present invention, | | | represents rounding up.
Further, the estimated system noise covariance matrix and the estimated metrology noise covariance matrix are respectively:
in the formula (I), the compound is shown in the specification,
estimating a system noise covariance matrix;
estimating a measured noise covariance matrix;
is an innovation sequence at the kth moment;
the prior position value at the kth moment;
is an innovation sequence at the k-i time;
is the residual sequence at time k-i.
It should be understood that: by dynamically adjusting the length of the next window at the next moment, the value of the residual sequence is small and changes stably, the width of the next sliding window is increased at the moment, and the frequency of the self-adaptive adjustment of the measurement noise and the system noise is reduced; when the change of the system noise is large, the width of the next sliding window is shortened, and the Sigma sampling frequency is increased, so that the estimated system noise matrix and the estimated measurement noise matrix can be closer to the characteristic of real noise.
In some embodiments of the present invention, as shown in fig. 4, step S105 comprises:
s401, determining an observation covariance matrix and a measurement covariance matrix according to the estimated system noise covariance matrix and the estimated measurement noise covariance matrix;
s402, determining a Kalman gain matrix according to the observation covariance matrix and the measurement covariance matrix;
s403, determining a posterior position value according to the prior position value, the observation position value and the Kalman gain matrix;
s404, determining a posterior covariance matrix according to the prior covariance matrix, the Kalman gain matrix and the observation covariance matrix.
Specifically, the posterior position value and the posterior covariance matrix are respectively:
in the formula (I), the compound is shown in the specification,
is a posterior position value;
is a priori position value;
is a Kalman gain matrix;
is an observed position value;
is an estimated location value;
is a posterior covariance matrix;
an estimated covariance matrix that is a prior covariance matrix;
a transposed matrix that is a Kalman gain matrix;
in order to observe the covariance matrix,
for measuring covariance matrixArraying;
is a second white noise sequence;
estimating a system noise covariance matrix;
to estimate a measured noise covariance matrix.
Wherein, obtain posterior position value and can fix a position unmanned aerial vehicle.
In order to better implement the kalman filter-based unmanned aerial vehicle positioning method in the embodiment of the present invention, on the basis of the kalman filter-based unmanned aerial vehicle positioning method, as shown in fig. 5, correspondingly, an embodiment of the present invention further provides an unmanned aerial vehicle positioning apparatus 500 based on the kalman filter, including:
the sampling unit 501 is configured to sample a current position value of the unmanned aerial vehicle based on a preset sampling method to obtain a plurality of sampling points;
a priori value determining unit 502, configured to determine a priori position value and a priori covariance matrix at a next moment of the unmanned aerial vehicle based on the multiple sampling points;
a window length updating unit 503, configured to determine a next sliding window length at a next time according to the current sliding window length at the current time;
a noise covariance matrix determination unit 504, configured to determine an estimated system noise covariance matrix and an estimated measured noise covariance matrix at a next time according to a next sliding window length;
and a positioning unit 505, configured to obtain an observed position value at a next time, and determine a posterior position value and a posterior covariance matrix at the next time according to the observed position value, the estimated system noise covariance matrix, the estimated measurement noise covariance matrix, the prior position value, and the prior covariance matrix, so as to position the unmanned aerial vehicle.
The kalman filtering-based unmanned aerial vehicle positioning apparatus 500 provided in the above-mentioned embodiment may implement the technical solution described in the above-mentioned kalman filtering-based unmanned aerial vehicle positioning method embodiment, and the principle of specifically implementing each module or unit may refer to the corresponding content in the above-mentioned kalman filtering-based unmanned aerial vehicle positioning method embodiment, and is not described here any more.
As shown in fig. 6, the present invention further provides an electronic device 600. The electronic device 600 comprises a processor 601, a memory 602 and a display 603. Fig. 6 shows only some of the components of the electronic device 600, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
The storage 602 may be an internal storage unit of the electronic device 600 in some embodiments, such as a hard disk or a memory of the electronic device 600. The memory 602 may also be an external storage device of the electronic device 600 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the electronic device 600.
Further, the memory 602 may also include both internal storage units and external storage devices of the electronic device 600. The memory 602 is used for storing application software and various types of data for installing the electronic device 600.
Processor 601, which in some embodiments may be a Central Processing Unit (CPU), microprocessor or other data Processing chip, is configured to run program code stored in memory 602 or process data, such as the kalman filter-based drone positioning method of the present invention.
The display 603 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch panel, or the like in some embodiments. The display 603 is used for displaying information at the electronic device 600 and for displaying a visual user interface. The components 601 and 603 of the electronic device 600 communicate with each other via a system bus.
In an embodiment, when processor 601 executes a kalman filter based drone positioning program in memory 602, the following steps may be implemented:
sampling the current position value of the unmanned aerial vehicle based on a preset sampling method to obtain a plurality of sampling points;
determining a prior position value and a prior covariance matrix of the unmanned aerial vehicle at the next moment based on the plurality of sampling points;
determining the length of a next sliding window at the next moment according to the length of the current sliding window at the current moment;
determining an estimated system noise covariance matrix and an estimated measurement noise covariance matrix at the next moment according to the length of the next sliding window;
and acquiring an observation position value at the next moment, and determining a posterior position value and a posterior covariance matrix at the next moment according to the observation position value, the estimated system noise covariance matrix, the estimated measurement noise covariance matrix, the prior position value and the prior covariance matrix so as to position the unmanned aerial vehicle.
It should be understood that: when the processor 601 executes the kalman filter-based drone positioning program in the memory 602, in addition to the above functions, other functions may be implemented, as specifically described above with reference to the corresponding method embodiments.
Further, the type of the electronic device 600 is not particularly limited in the embodiment of the present invention, and the electronic device 600 may be a portable electronic device such as a mobile phone, a tablet computer, a Personal Digital Assistant (PDA), a wearable device, and a laptop computer (laptop). Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices that carry an IOS, android, microsoft, or other operating system. The portable electronic device may also be other portable electronic devices such as laptop computers (laptop) with touch sensitive surfaces (e.g., touch panels), etc. It should also be understood that in other embodiments of the present invention, the electronic device 600 may not be a portable electronic device, but may be a desktop computer having a touch-sensitive surface (e.g., a touch panel).
Accordingly, the present application also provides a computer-readable storage medium, which is used for storing a computer-readable program or instruction, and when the program or instruction is executed by a processor, the method steps or functions provided by the above method embodiments can be implemented.
Those skilled in the art will appreciate that all or part of the flow of the method implementing the above embodiments may be implemented by a computer program instructing associated hardware, and the program may be stored in a computer-readable storage medium. The computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory.
The method and the device for positioning the unmanned aerial vehicle based on the kalman filter are described in detail, and a specific example is applied in the method to explain the principle and the implementation mode of the method, and the description of the embodiment is only used for helping to understand the method and the core idea of the method; meanwhile, for those skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.