Skip to content

Commit

Permalink
[ins] alt_float, bound dt and used fixed GPS_DT if defined
Browse files Browse the repository at this point in the history
  • Loading branch information
flixr committed Sep 9, 2014
1 parent 1f34049 commit 5ad33c5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sw/airborne/subsystems/ins/ins_alt_float.c
Expand Up @@ -144,6 +144,9 @@ static void baro_cb(uint8_t __attribute__((unused)) sender_id, const float *pres
float dt = now_ts - last_ts;
last_ts = now_ts;

// bound dt (assume baro freq 1Hz-500Hz
Bound(dt, 0.002, 1.0)

if (!ins_impl.baro_initialized) {
ins_impl.qfe = *pressure;
ins_impl.baro_initialized = TRUE;
Expand Down Expand Up @@ -181,6 +184,9 @@ void ins_update_gps(void) {
utm.zone = nav_utm_zone0;

#if !USE_BAROMETER
#ifdef GPS_DT
const float dt = GPS_DT;
#else
// timestamp when last callback was received
static float last_ts = 0.f;
// current timestamp
Expand All @@ -189,6 +195,10 @@ void ins_update_gps(void) {
float dt = now_ts - last_ts;
last_ts = now_ts;

// bound dt (assume GPS freq between 0.5Hz and 50Hz)
Bound(dt, 0.02, 2)
#endif

float falt = gps.hmsl / 1000.0f;
if (ins_impl.reset_alt_ref) {
ins_impl.reset_alt_ref = FALSE;
Expand Down

0 comments on commit 5ad33c5

Please sign in to comment.