Open fnoble opened 10 years ago
Related to #22
@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);
}
@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.
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.