diff --git a/include/gnss_utils/observations.h b/include/gnss_utils/observations.h index 852b35d646caed9d0d7967d2181158bb68f3ee8f..db2efc751470a5d37c781c243747a4193058968c 100644 --- a/include/gnss_utils/observations.h +++ b/include/gnss_utils/observations.h @@ -5,7 +5,6 @@ namespace GnssUtils { - class Observations { public: @@ -15,34 +14,26 @@ public: ~Observations(); void clearObservations(); - void addObservation(const obsd_t& obs); - void - loadFromRinex(const std::string& rnx_file, gtime_t t_start, gtime_t t_end, double dt = 0.0, const char* opt = ""); - void removeObservationByIdx(const int& _idx); void removeObservationBySat(const int& _sat); - std::vector<obsd_t>& getObservations(); const std::vector<obsd_t>& getObservations() const; - obsd_t& getObservationBySat(const unsigned char& sat_number); const obsd_t& getObservationBySat(const unsigned char& sat_number) const; - obsd_t& getObservationByIdx(const int& idx); const obsd_t& getObservationByIdx(const int& idx) const; obsd_t* data(); const obsd_t* data() const; - size_t size() const; bool hasSatellite(const unsigned char& i) const; static void print(obsd_t& _obs); - void printBySat(const int& _sat); - void printByIdx(const int& _idx); - void print(); + void printBySat(const int& _sat); + void printByIdx(const int& _idx); + void print(); // Filter observations std::set<int> filterByEphemeris(const SatellitesPositions& sats_pos); @@ -50,38 +41,35 @@ public: std::set<int> filterByCode(); std::set<int> filterByCarrierPhase(); std::set<int> filterByConstellations(const int& navsys); - std::set<int> filterByElevationSnr(const Eigen::Vector3d& x_r, + std::set<int> filterByElevationSnr(const Eigen::Vector3d& x_r, const SatellitesPositions& sats_pos, - const snrmask_t& snrmask, - const double& elmin); - std::set<int> filter(const SatellitesPositions& sats_pos, - const std::set<int>& discarded_sats, - const Eigen::Vector3d& x_r, - const bool& check_code, - const bool& check_carrier_phase, - const prcopt_t& opt); - std::set<int> filter(const SatellitesPositions& sats_pos, - const std::set<int>& discarded_sats, - const Eigen::Vector3d& x_r, - const bool& check_code, - const bool& check_carrier_phase, - const int& navsys, - const snrmask_t& snrmask, - const double& elmin); - - static std::set<int> findCommonObservations(const Observations& obs_1, - const Observations& obs_2); + const snrmask_t& snrmask, + const double& elmin); + std::set<int> filter(const SatellitesPositions& sats_pos, + const std::set<int>& discarded_sats, + const Eigen::Vector3d& x_r, + const bool& check_code, + const bool& check_carrier_phase, + const prcopt_t& opt); + std::set<int> filter(const SatellitesPositions& sats_pos, + const std::set<int>& discarded_sats, + const Eigen::Vector3d& x_r, + const bool& check_code, + const bool& check_carrier_phase, + const int& navsys, + const snrmask_t& snrmask, + const double& elmin); + + static std::set<int> findCommonObservations(const Observations& obs_1, const Observations& obs_2); bool operator==(const Observations& other_obs) const; - bool operator !=(const Observations &other_obs) const; + bool operator!=(const Observations& other_obs) const; private: // Private objects std::map<unsigned char, int> sat_2_idx_; //< key: corresponding sat number, value: idx in obs_ vector std::vector<unsigned char> idx_2_sat_; //< key: idx in obs_ vector, value: corresponding sat number std::vector<obsd_t> obs_; //< vector of RTKLIB observations for a given epoch - - // Private methods }; } // namespace GnssUtils @@ -92,7 +80,6 @@ private: namespace GnssUtils { - inline const std::vector<obsd_t>& Observations::getObservations() const { return this->obs_; @@ -147,9 +134,9 @@ inline bool Observations::hasSatellite(const unsigned char& i) const return sat_2_idx_.count(i) != 0; } -inline bool Observations::operator !=(const Observations &other_obs) const +inline bool Observations::operator!=(const Observations& other_obs) const { - return !(*this == other_obs); + return !(*this == other_obs); } } // namespace GnssUtils diff --git a/src/observations.cpp b/src/observations.cpp index 0ca80fd9e9612ec569a9e295375a40cbb3e76748..a90ea7084d576746ccf7fb1ba746447fcc6af09a 100644 --- a/src/observations.cpp +++ b/src/observations.cpp @@ -74,41 +74,6 @@ void Observations::addObservation(const obsd_t& obs) assert(sat_2_idx_.size() == obs_.size()); } -void Observations::loadFromRinex(const std::string& rnx_file, - gtime_t t_start, - gtime_t t_end, - double dt, - const char* opt) -{ - obs_t obs; - obs.data = (obsd_t*)malloc(sizeof(obsd_t) * MAXSAT); - obs.n = 0; - obs.nmax = MAXSAT; - - // const char* opt = ""; - auto stat = readrnxt(rnx_file.c_str(), 1, t_start, t_end, dt, opt, &obs, NULL, NULL); - if (stat == 1) - sortobs(&obs); - else - { - std::cout << "Observation: couldn't load provided observation file, reason: " << (stat == 0 ? "no data" : "error") << stat << std::endl; - return; - } - - for (int i = 0; i < obs.n; i++) - { - // std::cout << "time: " << time_str(obs.data[i].time, 3) << " | sat: " << int(obs.data[i].sat) << " | rcv: " << - // int(obs.data[i].rcv) << - // " | SNR: " << int(obs.data[i].SNR[0]) << " | LLI: " << int(obs.data[i].LLI[0]) << " | code: " << - // int(obs.data[i].code[0]) << - // " | L: " << obs.data[i].L[0] << " | P: " << obs.data[i].P[0] << " | D: " << obs.data[i].D[0] << - // std::endl; - addObservation(obs.data[i]); - } - - free(obs.data); -} - void Observations::removeObservationByIdx(const int& _idx) { // std::cout << "removing observation of idx " << _idx << std::endl;