swift-nav / piksi_firmware

Firmware for the Piksi GNSS receiver.
swift-nav.com
GNU General Public License v3.0
111 stars 111 forks source link

Better handling of ephemeris validity #74

Open fnoble opened 10 years ago

fnoble commented 10 years ago

Should be a function to check if the ephemeris is valid, healthy and not too old.

This function should be used consistently across the codebase.

soulcmdc-zz commented 9 years ago

Related to #22

cbeighley commented 9 years ago

@soulcmdc looks like there are still improvements to be made:

From libswiftnav/src/ephemeris.c:

/** Is this ephemeris usable?
 *
 * \todo This should actually be more than just the "valid" flag.
 *       When we write an is_usable() function, lets use that instead
 *       of just es[prn].valid.
 *
 * \param eph Ephemeris struct
 * \return 1 if the ephemeris is valid and not too old.
 *         0 otherwise.
 */
u8 ephemeris_good(ephemeris_t *eph, gps_time_t t)
{
  /* Seconds from the time from ephemeris reference epoch (toe) */
  double dt = gpsdifftime(t, eph->toe);

  /* TODO: this doesn't exclude ephemerides older than a week so could be made
   * better. */
  return (eph->valid && eph->healthy && fabs(dt) < 4*3600);
}
ljbade commented 8 years ago

@fnoble in https://github.com/swift-nav/libswiftnav/blob/master/src/ephemeris.c#L254 I decided to drop the "unhealthy" check here (due to edge case where before we happily use an unhealthy sat as a result).

Do you know what the remaining TODOs are about? I am particularly interested in older than a week comment, due to my work on fixing time bugs.