46 #include <mathlib/mathlib.h> 49 #define MASK_GPS_NSATS (1<<0) 50 #define MASK_GPS_PDOP (1<<1) 51 #define MASK_GPS_HACC (1<<2) 52 #define MASK_GPS_VACC (1<<3) 53 #define MASK_GPS_SACC (1<<4) 54 #define MASK_GPS_HDRIFT (1<<5) 55 #define MASK_GPS_VDRIFT (1<<6) 56 #define MASK_GPS_HSPD (1<<7) 57 #define MASK_GPS_VSPD (1<<8) 65 double lat = gps.
lat / 1.0e7;
66 double lon = gps.
lon / 1.0e7;
71 double est_lat, est_lon;
139 const float filt_time_const = 10.0f;
141 float filter_coef = dt / filt_time_const;
144 double lat = gps.
lat * 1.0e-7;
145 double lon = gps.
lon * 1.0e-7;
148 float delta_posN = 0.0f;
149 float delta_PosE = 0.0f;
164 float velN = fminf(fmaxf(delta_posN / dt, -vel_limit), vel_limit);
165 float velE = fminf(fmaxf(delta_PosE / dt, -vel_limit), vel_limit);
169 _gpsDriftVelE = velE * filter_coef + _gpsDriftVelE * (1.0f - filter_coef);
177 float gps_alt_m = 1e-3
f * (float)gps.
alt;
189 float gps_velN = fminf(fmaxf(gps.
vel_ned[0], -vxy_drift_limit), vxy_drift_limit);
190 float gps_velE = fminf(fmaxf(gps.
vel_ned[1], -vxy_drift_limit), vxy_drift_limit);
192 _gps_velE_filt = gps_velE * filter_coef + _gps_velE_filt * (1.0f - filter_coef);
218 float vertVel = fminf(fmaxf((gps.
vel_ned[2] -
_state.
vel(2)), -vz_diff_limit), vz_diff_limit);
float _gps_drift_metrics[3]
constexpr _Tp constrain(_Tp val, _Tp min_val, _Tp max_val)
struct estimator::filter_control_status_u::@60 flags
float eph
GPS horizontal position accuracy in m.
float req_hdrift
maximum acceptable horizontal drift speed (m/s)
Adapter / shim layer for system calls needed by ECL.
float _gpsDriftVelN
GPS north position derivative (m/sec)
stateSample _state
state struct of the ekf running at the delayed time horizon
float epv
GPS vertical position accuracy in m.
#define VDIST_SENSOR_GPS
Use GPS height.
uint8_t nsats
number of satellites used
uint16_t nsats
1 - true if number of satellites used is insufficient
bool _mag_yaw_reset_req
true when a reset of the yaw using the magnetometer data has been requested
float _gps_alt_ref
WGS-84 height (m)
uint32_t _min_gps_health_time_us
GPS is marked as healthy only after this amount of time.
uint64_t _last_gps_pass_us
last system time in usec that the GPS passed it's checks
float sacc
GPS speed accuracy in m/s.
float _hgt_sensor_offset
set as necessary if desired to maintain the same height after a height reset (m)
uint64_t _last_gps_origin_time_us
true when all active GPS checks have passed
uint16_t hdrift
6 - true if horizontal drift is excessive (can only be used when stationary on ground) ...
uint32_t rng_hgt
10 - true when range finder height is being fused as a primary height reference
uint8_t fix_type
0-1: no fix, 2: 2D fix, 3: 3D fix, 4: RTCM code differential, 5: Real-Time Kinematic ...
uint32_t baro_hgt
9 - true when baro height is being fused as a primary height reference
float _mag_inclination_gps
uint64_t _last_gps_fail_us
last system time in usec that the GPS failed it's checks
float pdop
position dilution of precision
uint16_t sacc
5 - true if reported speed accuracy is insufficient
bool gps_is_good(const gps_message &gps)
float _gps_velE_filt
GPS filtered East velocity (m/sec)
uint16_t vacc
4 - true if reported vertical accuracy is insufficient
float vel_ned[3]
GPS ground speed NED.
bool collect_gps(const gps_message &gps) override
uint16_t vspeed
9 - true if vertical speed error is excessive
float req_hacc
maximum acceptable horizontal position error (m)
int map_projection_init_timestamped(struct map_projection_reference_s *ref, double lat_0, double lon_0, uint64_t timestamp)
Initializes the map transformation given by the argument.
bool _NED_origin_initialised
float req_sacc
maximum acceptable speed error (m/s)
gps_check_fail_status_u _gps_check_fail_status
uint32_t ev_vel
24 - true when local earth frame velocity data from external vision measurements are being fused ...
uint16_t pdop
2 - true if position dilution of precision is insufficient
uint16_t vdrift
7 - true if vertical drift is excessive (can only be used when stationary on ground) ...
int _primary_hgt_source
specifies primary source of height data
int map_projection_reproject(const struct map_projection_reference_s *ref, float x, float y, double *lat, double *lon)
Transforms a point in the local azimuthal equidistant plane to the geographic coordinate system using...
constexpr T radians(T degrees)
Vector< float, 6 > f(float t, const Matrix< float, 6, 1 > &, const Matrix< float, 3, 1 > &)
uint16_t hspeed
8 - true if horizontal speed is excessive (can only be used when stationary on ground) ...
float req_vacc
maximum acceptable vertical position error (m)
filter_control_status_u _control_status
Vector3f vel
NED velocity in earth frame in m/s.
float _mag_declination_gps
int32_t lat
Latitude in 1E-7 degrees.
float _gps_drift_velD
GPS down position derivative (m/sec)
float req_vdrift
maximum acceptable vertical drift speed (m/s)
struct estimator::gps_check_fail_status_u::@59 flags
float req_pdop
maximum acceptable position dilution of precision
Calculation / lookup table for Earth's magnetic field declination, inclination and strength...
Vector3f pos
NED position in earth frame in m.
float get_mag_inclination(float lat, float lon)
uint32_t opt_flow
3 - true if optical flow measurements are being fused
float get_mag_strength(float lat, float lon)
uint16_t fix
0 - true if the fix type is insufficient (no 3D solution)
float _gps_velD_diff_filt
GPS filtered Down velocity (m/sec)
int map_projection_project(const struct map_projection_reference_s *ref, double lat, double lon, float *x, float *y)
uint32_t in_air
7 - true when the vehicle is airborne
uint16_t hacc
3 - true if reported horizontal accuracy is insufficient
int32_t alt
Altitude in 1E-3 meters (millimeters) above MSL.
uint32_t ev_pos
12 - true when local position data from external vision is being fused
uint32_t gps_hgt
11 - true when GPS height is being fused as a primary height reference
int32_t req_nsats
minimum acceptable satellite count
uint32_t gps
2 - true if GPS measurements are being fused
float _gpsDriftVelE
GPS east position derivative (m/sec)
float _gps_velN_filt
GPS filtered North velocity (m/sec)
float get_mag_declination(float lat, float lon)
Class for core functions for ekf attitude and position estimator.
#define ECL_INFO_TIMESTAMPED
float _gps_error_norm
normalised gps error
int32_t gps_check_mask
bitmask used to control which GPS quality checks are used
int32_t lon
Longitude in 1E-7 degrees.