Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 54ac147

Browse files
bkuengLorenzMeier
authored andcommitted
Ekf: add set_min_required_gps_health_time() to allow configure minimum GPS health time
This does not change the default of 10 seconds.
1 parent 770cd3c commit 54ac147

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

EKF/ekf.h

+4
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ class Ekf : public EstimatorInterface
261261
// use the latest IMU data at the current time horizon.
262262
Quatf calculate_quaternion() const;
263263

264+
// set minimum continuous period without GPS fail required to mark a healthy GPS status
265+
void set_min_required_gps_health_time(uint32_t time_us) { _min_gps_health_time_us = time_us; }
266+
264267
private:
265268

266269
static constexpr uint8_t _k_num_states{24}; ///< number of EKF states
@@ -408,6 +411,7 @@ class Ekf : public EstimatorInterface
408411
uint64_t _last_gps_fail_us{0}; ///< last system time in usec that the GPS failed it's checks
409412
uint64_t _last_gps_pass_us{0}; ///< last system time in usec that the GPS passed it's checks
410413
float _gps_error_norm{1.0f}; ///< normalised gps error
414+
uint32_t _min_gps_health_time_us{10000000}; ///< GPS is marked as healthy only after this amount of time
411415

412416
// Variables used to publish the WGS-84 location of the EKF local NED origin
413417
uint64_t _last_gps_origin_time_us{0}; ///< time the origin was last set (uSec)

EKF/gps_checks.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,6 @@ bool Ekf::gps_is_good(const gps_message &gps)
242242
_last_gps_pass_us = _time_last_imu;
243243
}
244244

245-
// continuous period without fail of 10 seconds required to return a healthy status
246-
return (_time_last_imu - _last_gps_fail_us > (uint64_t)1e7);
245+
// continuous period without fail of x seconds required to return a healthy status
246+
return _time_last_imu - _last_gps_fail_us > (uint64_t)_min_gps_health_time_us;
247247
}

0 commit comments

Comments
 (0)