mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 03:03:34 +08:00
Ekf: add more useful methods to interface with the covariances (#543)
This commit is contained in:
committed by
Daniel Agar
parent
a85d3a43ed
commit
4e0e68e905
@@ -49,7 +49,7 @@ class Ekf : public EstimatorInterface
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
Ekf() = default;
|
Ekf() = default;
|
||||||
~Ekf() = default;
|
virtual ~Ekf() = default;
|
||||||
|
|
||||||
// initialise variables to sane values (also interface class)
|
// initialise variables to sane values (also interface class)
|
||||||
bool init(uint64_t timestamp);
|
bool init(uint64_t timestamp);
|
||||||
@@ -122,8 +122,20 @@ public:
|
|||||||
// get the true airspeed in m/s
|
// get the true airspeed in m/s
|
||||||
void get_true_airspeed(float *tas);
|
void get_true_airspeed(float *tas);
|
||||||
|
|
||||||
|
// get the full covariance matrix
|
||||||
|
matrix::SquareMatrix<float, 24> covariances() const { return matrix::SquareMatrix<float, _k_num_states>(P); }
|
||||||
|
|
||||||
// get the diagonal elements of the covariance matrix
|
// get the diagonal elements of the covariance matrix
|
||||||
void get_covariances(float *covariances);
|
matrix::Vector<float, 24> covariances_diagonal() const { return covariances().diag(); }
|
||||||
|
|
||||||
|
// get the orientation (quaterion) covariances
|
||||||
|
matrix::SquareMatrix<float, 4> orientation_covariances() const { return covariances().slice<4, 4>(0, 0); }
|
||||||
|
|
||||||
|
// get the linear velocity covariances
|
||||||
|
matrix::SquareMatrix<float, 3> velocity_covariances() const { return covariances().slice<3, 3>(4, 4); }
|
||||||
|
|
||||||
|
// get the position covariances
|
||||||
|
matrix::SquareMatrix<float, 3> position_covariances() const { return covariances().slice<3, 3>(7, 7); }
|
||||||
|
|
||||||
// ask estimator for sensor data collection decision and do any preprocessing if required, returns true if not defined
|
// ask estimator for sensor data collection decision and do any preprocessing if required, returns true if not defined
|
||||||
bool collect_gps(const gps_message &gps);
|
bool collect_gps(const gps_message &gps);
|
||||||
|
|||||||
@@ -982,14 +982,6 @@ void Ekf::get_gyro_bias(float bias[3])
|
|||||||
memcpy(bias, temp, 3 * sizeof(float));
|
memcpy(bias, temp, 3 * sizeof(float));
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the diagonal elements of the covariance matrix
|
|
||||||
void Ekf::get_covariances(float *covariances)
|
|
||||||
{
|
|
||||||
for (unsigned i = 0; i < _k_num_states; i++) {
|
|
||||||
covariances[i] = P[i][i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// get the position and height of the ekf origin in WGS-84 coordinates and time the origin was set
|
// get the position and height of the ekf origin in WGS-84 coordinates and time the origin was set
|
||||||
// return true if the origin is valid
|
// return true if the origin is valid
|
||||||
bool Ekf::get_ekf_origin(uint64_t *origin_time, map_projection_reference_s *origin_pos, float *origin_alt)
|
bool Ekf::get_ekf_origin(uint64_t *origin_time, map_projection_reference_s *origin_pos, float *origin_alt)
|
||||||
|
|||||||
@@ -104,8 +104,6 @@ public:
|
|||||||
|
|
||||||
virtual void get_true_airspeed(float *tas) = 0;
|
virtual void get_true_airspeed(float *tas) = 0;
|
||||||
|
|
||||||
virtual void get_covariances(float *covariances) = 0;
|
|
||||||
|
|
||||||
// gets the variances for the NED velocity states
|
// gets the variances for the NED velocity states
|
||||||
virtual void get_vel_var(Vector3f &vel_var) = 0;
|
virtual void get_vel_var(Vector3f &vel_var) = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user