28
28
#include < AP_Math/AP_Math.h>
29
29
#include < AP_Math/vectorN.h>
30
30
#include < AP_NavEKF/AP_NavEKF_core_common.h>
31
- #include < AP_NavEKF2/AP_NavEKF2_Buffer .h>
31
+ #include < AP_NavEKF/EKF_Buffer .h>
32
32
#include < GCS_MAVLink/GCS_MAVLink.h>
33
33
#include < AP_DAL/AP_DAL.h>
34
34
@@ -462,57 +462,49 @@ class NavEKF2_core : public NavEKF_core_common
462
462
uint8_t accel_index;
463
463
};
464
464
465
- struct gps_elements {
466
- Vector2f pos; // 0..1
467
- float hgt; // 2
468
- Vector3f vel; // 3..5
469
- uint32_t time_ms; // 6
470
- uint8_t sensor_idx; // 7..9
465
+ struct gps_elements : EKF_obs_element_t {
466
+ Vector2f pos;
467
+ float hgt;
468
+ Vector3f vel;
469
+ uint8_t sensor_idx;
471
470
};
472
471
473
- struct mag_elements {
474
- Vector3f mag; // 0..2
475
- uint32_t time_ms; // 3
472
+ struct mag_elements : EKF_obs_element_t {
473
+ Vector3f mag;
476
474
};
477
475
478
- struct baro_elements {
479
- float hgt; // 0
480
- uint32_t time_ms; // 1
476
+ struct baro_elements : EKF_obs_element_t {
477
+ float hgt;
481
478
};
482
479
483
- struct range_elements {
484
- float rng; // 0
485
- uint32_t time_ms; // 1
486
- uint8_t sensor_idx; // 2
480
+ struct range_elements : EKF_obs_element_t {
481
+ float rng;
482
+ uint8_t sensor_idx;
487
483
};
488
484
489
- struct rng_bcn_elements {
485
+ struct rng_bcn_elements : EKF_obs_element_t {
490
486
float rng; // range measurement to each beacon (m)
491
487
Vector3f beacon_posNED; // NED position of the beacon (m)
492
488
float rngErr; // range measurement error 1-std (m)
493
489
uint8_t beacon_ID; // beacon identification number
494
- uint32_t time_ms; // measurement timestamp (msec)
495
490
};
496
491
497
- struct tas_elements {
498
- float tas; // 0
499
- uint32_t time_ms; // 1
492
+ struct tas_elements : EKF_obs_element_t {
493
+ float tas;
500
494
};
501
495
502
- struct of_elements {
496
+ struct of_elements : EKF_obs_element_t {
503
497
Vector2f flowRadXY;
504
498
Vector2f flowRadXYcomp;
505
- uint32_t time_ms;
506
499
Vector3f bodyRadXYZ;
507
500
Vector3f body_offset;
508
501
};
509
502
510
- struct ext_nav_elements {
503
+ struct ext_nav_elements : EKF_obs_element_t {
511
504
Vector3f pos; // XYZ position measured in a RH navigation frame (m)
512
505
Quaternion quat; // quaternion describing the rotation from navigation to body frame
513
506
float posErr; // spherical poition measurement error 1-std (m)
514
507
float angErr; // spherical angular measurement error 1-std (rad)
515
- uint32_t time_ms; // measurement timestamp (msec)
516
508
bool posReset; // true when the position measurement has been reset
517
509
};
518
510
@@ -524,10 +516,9 @@ class NavEKF2_core : public NavEKF_core_common
524
516
float accel_zbias;
525
517
} inactiveBias[INS_MAX_INSTANCES];
526
518
527
- struct ext_nav_vel_elements {
519
+ struct ext_nav_vel_elements : EKF_obs_element_t {
528
520
Vector3f vel; // velocity in NED (m)
529
521
float err; // velocity measurement error (m/s)
530
- uint32_t time_ms; // measurement timestamp (msec)
531
522
};
532
523
533
524
// update the navigation filter status
@@ -841,13 +832,13 @@ class NavEKF2_core : public NavEKF_core_common
841
832
842
833
float gpsNoiseScaler; // Used to scale the GPS measurement noise and consistency gates to compensate for operation with small satellite counts
843
834
Matrix24 P; // covariance matrix
844
- imu_ring_buffer_t <imu_elements> storedIMU; // IMU data buffer
845
- obs_ring_buffer_t <gps_elements> storedGPS; // GPS data buffer
846
- obs_ring_buffer_t <mag_elements> storedMag; // Magnetometer data buffer
847
- obs_ring_buffer_t <baro_elements> storedBaro; // Baro data buffer
848
- obs_ring_buffer_t <tas_elements> storedTAS; // TAS data buffer
849
- obs_ring_buffer_t <range_elements> storedRange; // Range finder data buffer
850
- imu_ring_buffer_t <output_elements> storedOutput;// output state buffer
835
+ EKF_IMU_buffer_t <imu_elements> storedIMU; // IMU data buffer
836
+ EKF_obs_buffer_t <gps_elements> storedGPS; // GPS data buffer
837
+ EKF_obs_buffer_t <mag_elements> storedMag; // Magnetometer data buffer
838
+ EKF_obs_buffer_t <baro_elements> storedBaro; // Baro data buffer
839
+ EKF_obs_buffer_t <tas_elements> storedTAS; // TAS data buffer
840
+ EKF_obs_buffer_t <range_elements> storedRange; // Range finder data buffer
841
+ EKF_IMU_buffer_t <output_elements> storedOutput;// output state buffer
851
842
Matrix3f prevTnb; // previous nav to body transformation used for INS earth rotation compensation
852
843
ftype accNavMag; // magnitude of navigation accel - used to adjust GPS obs variance (m/s^2)
853
844
ftype accNavMagHoriz; // magnitude of navigation accel in horizontal plane (m/s^2)
@@ -1015,7 +1006,7 @@ class NavEKF2_core : public NavEKF_core_common
1015
1006
bool gpsAccuracyGood; // true when the GPS accuracy is considered to be good enough for safe flight.
1016
1007
1017
1008
// variables added for optical flow fusion
1018
- obs_ring_buffer_t <of_elements> storedOF; // OF data buffer
1009
+ EKF_obs_buffer_t <of_elements> storedOF; // OF data buffer
1019
1010
of_elements ofDataNew; // OF data at the current time horizon
1020
1011
of_elements ofDataDelayed; // OF data at the fusion time horizon
1021
1012
bool flowDataToFuse; // true when optical flow data is ready for fusion
@@ -1069,7 +1060,7 @@ class NavEKF2_core : public NavEKF_core_common
1069
1060
bool terrainHgtStable; // true when the terrain height is stable enough to be used as a height reference
1070
1061
1071
1062
// Range Beacon Sensor Fusion
1072
- obs_ring_buffer_t <rng_bcn_elements> storedRangeBeacon; // Beacon range buffer
1063
+ EKF_obs_buffer_t <rng_bcn_elements> storedRangeBeacon; // Beacon range buffer
1073
1064
rng_bcn_elements rngBcnDataNew; // Range beacon data at the current time horizon
1074
1065
rng_bcn_elements rngBcnDataDelayed; // Range beacon data at the fusion time horizon
1075
1066
uint32_t lastRngBcnPassTime_ms; // time stamp when the range beacon measurement last passed innvovation consistency checks (msec)
@@ -1143,7 +1134,7 @@ class NavEKF2_core : public NavEKF_core_common
1143
1134
uint8_t magYawAnomallyCount; // Number of times the yaw has been reset due to a magnetic anomaly during initial ascent
1144
1135
1145
1136
// external navigation fusion
1146
- obs_ring_buffer_t <ext_nav_elements> storedExtNav; // external navigation data buffer
1137
+ EKF_obs_buffer_t <ext_nav_elements> storedExtNav; // external navigation data buffer
1147
1138
ext_nav_elements extNavDataNew; // External nav data at the current time horizon
1148
1139
ext_nav_elements extNavDataDelayed; // External nav at the fusion time horizon
1149
1140
uint32_t extNavMeasTime_ms; // time external measurements were accepted for input to the data buffer (msec)
@@ -1154,7 +1145,7 @@ class NavEKF2_core : public NavEKF_core_common
1154
1145
bool extNavUsedForPos; // true when the external nav data is being used as a position reference.
1155
1146
bool extNavYawResetRequest; // true when a reset of vehicle yaw using the external nav data is requested
1156
1147
1157
- obs_ring_buffer_t <ext_nav_vel_elements> storedExtNavVel; // external navigation velocity data buffer
1148
+ EKF_obs_buffer_t <ext_nav_vel_elements> storedExtNavVel; // external navigation velocity data buffer
1158
1149
ext_nav_vel_elements extNavVelNew; // external navigation velocity data at the current time horizon
1159
1150
ext_nav_vel_elements extNavVelDelayed; // external navigation velocity data at the fusion time horizon
1160
1151
uint32_t extNavVelMeasTime_ms; // time external navigation velocity measurements were accepted for input to the data buffer (msec)
0 commit comments