pathfinder-for-autonomous-navigation / FlightSoftware

Flight software, test software, ground software, and mission control.
http://pan-software.readthedocs.io
MIT License
9 stars 6 forks source link

Orbit.valid is always false #856

Open fatimayousuf opened 2 years ago

fatimayousuf commented 2 years ago

We have been seeing that orbit.valid is always false, even though time.valid is sometimes true. I traced the issue this morning and found that it was related to the GPS issues regarding the GPS week number.

In FSW, we set orbit.valid in line 114 of OrbitEstimator.cpp: orbit_valid_f.set(_estimate.valid());

We define _estimate.valid() in Orbit_Estimate.hpp: bool valid() const { return _orbit.valid(); }

_orbit.valid() is defined in Orbit.h: bool valid() const{ return _valid; }

We set _valid in _check_validity() which is defined on line 135 of Orbit.h. Looking at this function, there is: //time check if (!(_ns_gps_time <= MAXGPSTIME_NS)) goto INVALID; if (!(_ns_gps_time >= MINGPSTIME_NS)) goto INVALID;

We defined: GNC_TRACKED_CONSTANT(const int64_t, MAXGPSTIME_NS, (20LL*52LL+(int64_t)gnc::constant::init_gps_week_number)*(int64_t)gnc::constant::NANOSECONDS_IN_WEEK); GNC_TRACKED_CONSTANT(const int64_t, MINGPSTIME_NS, (-20LL*52LL+(int64_t)gnc::constant::init_gps_week_number)*(int64_t)gnc::constant::NANOSECONDS_IN_WEEK); GNC_TRACKED_CONSTANT(unsigned short, init_gps_week_number, 2045);

Given the previous GPS week number issues we had, this could maybe explain why orbit.valid is always false.