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

add set_min_required_gps_health_time() to allow configure minimum GPS health time #603

Merged
merged 1 commit into from
May 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions EKF/ekf.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ class Ekf : public EstimatorInterface
// use the latest IMU data at the current time horizon.
Quatf calculate_quaternion() const;

// set minimum continuous period without GPS fail required to mark a healthy GPS status
void set_min_required_gps_health_time(uint32_t time_us) { _min_gps_health_time_us = time_us; }

private:

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

// Variables used to publish the WGS-84 location of the EKF local NED origin
uint64_t _last_gps_origin_time_us{0}; ///< time the origin was last set (uSec)
Expand Down
4 changes: 2 additions & 2 deletions EKF/gps_checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,6 @@ bool Ekf::gps_is_good(const gps_message &gps)
_last_gps_pass_us = _time_last_imu;
}

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