From 8f0c0cdd4c482e6512e728fa48275f98c4f7423d Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 25 May 2015 19:43:29 +0200 Subject: [PATCH] Keep the list of satellite's block in a single place --- src/core/system_parameters/gnss_satellite.cc | 185 +++++++++--------- src/core/system_parameters/gnss_satellite.h | 2 +- .../gps_cnav_navigation_message.cc | 55 ++---- 3 files changed, 108 insertions(+), 134 deletions(-) diff --git a/src/core/system_parameters/gnss_satellite.cc b/src/core/system_parameters/gnss_satellite.cc index bce7f6672..712b8af73 100644 --- a/src/core/system_parameters/gnss_satellite.cc +++ b/src/core/system_parameters/gnss_satellite.cc @@ -242,9 +242,9 @@ std::string Gnss_Satellite::get_block() const - -void Gnss_Satellite::set_block(const std::string& system_, unsigned int PRN_ ) +std::string Gnss_Satellite::what_block(const std::string& system_, unsigned int PRN_) { + std::string block_ = "Unknown"; if (system_.compare("GPS") == 0) { switch ( PRN_ ) @@ -252,103 +252,103 @@ void Gnss_Satellite::set_block(const std::string& system_, unsigned int PRN_ ) // info from http://www.navcen.uscg.gov/?Do=constellationStatus case 1 : - block = std::string("IIF"); //Plane D + block_ = std::string("IIF"); //Plane D break; case 2 : - block = std::string("IIR"); //Plane D + block_ = std::string("IIR"); //Plane D break; case 3 : - block = std::string("IIF"); //Plane E + block_ = std::string("IIF"); //Plane E break; case 4 : - block = std::string("IIA"); //Plane D + block_ = std::string("IIA"); //Plane D break; case 5 : - block = std::string("IIR-M"); //Plane E + block_ = std::string("IIR-M"); //Plane E break; case 6 : - block = std::string("IIF"); //Plane D + block_ = std::string("IIF"); //Plane D break; case 7 : - block = std::string("IIR-M"); //Plane A + block_ = std::string("IIR-M"); //Plane A break; case 8 : - block = std::string("IIA*"); // Decommissed + block_ = std::string("IIA*"); // Decommissed break; case 9 : - block = std::string("IIF"); //Plane F + block_ = std::string("IIF"); //Plane F break; case 10 : - block = std::string("IIA"); //Plane E + block_ = std::string("IIA"); //Plane E break; case 11 : - block = std::string("IIR"); //Plane D + block_ = std::string("IIR"); //Plane D break; case 12 : - block = std::string("IIR-M"); //Plane B + block_ = std::string("IIR-M"); //Plane B break; case 13 : - block = std::string("IIR"); //Plane F + block_ = std::string("IIR"); //Plane F break; case 14 : - block = std::string("IIR"); //Plane F + block_ = std::string("IIR"); //Plane F break; case 15 : - block = std::string("IIR-M"); //Plane F + block_ = std::string("IIR-M"); //Plane F break; case 16 : - block = std::string("IIR"); //Plane B + block_ = std::string("IIR"); //Plane B break; case 17 : - block = std::string("IIR-M"); //Plane C + block_ = std::string("IIR-M"); //Plane C break; case 18 : - block = std::string("IIR"); //Plane E + block_ = std::string("IIR"); //Plane E break; case 19 : - block = std::string("IIR"); //Plane D + block_ = std::string("IIR"); //Plane D break; case 20 : - block = std::string("IIR"); //Plane B + block_ = std::string("IIR"); //Plane B break; case 21 : - block = std::string("IIR"); //Plane D + block_ = std::string("IIR"); //Plane D break; case 22 : - block = std::string("IIR"); //Plane E + block_ = std::string("IIR"); //Plane E break; case 23 : - block = std::string("IIR"); //Plane F + block_ = std::string("IIR"); //Plane F break; case 24 : - block = std::string("IIF"); //Plane A + block_ = std::string("IIF"); //Plane A break; case 25 : - block = std::string("IIF"); //Plane B + block_ = std::string("IIF"); //Plane B break; case 26 : - block = std::string("IIF"); //Plane B + block_ = std::string("IIF"); //Plane B break; case 27 : - block = std::string("IIF"); //Plane C + block_ = std::string("IIF"); //Plane C break; case 28 : - block = std::string("IIR"); //Plane B + block_ = std::string("IIR"); //Plane B break; case 29 : - block = std::string("IIR-M"); //Plane C + block_ = std::string("IIR-M"); //Plane C break; case 30 : - block = std::string("IIF"); //Plane A + block_ = std::string("IIF"); //Plane A break; case 31 : - block = std::string("IIR-M"); //Plane A + block_ = std::string("IIR-M"); //Plane A break; case 32 : - block = std::string("IIA"); //Plane E + block_ = std::string("IIA"); //Plane E break; default : - block = std::string("Unknown"); + block_ = std::string("Unknown"); } } @@ -361,161 +361,168 @@ void Gnss_Satellite::set_block(const std::string& system_, unsigned int PRN_ ) // See also http://www.glonass-center.ru/en/GLONASS/ case 1 : - block = std::string("1"); //Plane 1 + block_ = std::string("1"); //Plane 1 rf_link = 1; break; case 2 : - block = std::string("-4"); //Plane 1 + block_ = std::string("-4"); //Plane 1 rf_link = -4; break; case 3 : - block = std::string("5"); //Plane 1 + block_ = std::string("5"); //Plane 1 rf_link = 5; break; case 4 : - block = std::string("6"); //Plane 1 + block_ = std::string("6"); //Plane 1 rf_link = 6; break; case 5 : - block = std::string("1"); //Plane 1 + block_ = std::string("1"); //Plane 1 rf_link = 1; break; case 6 : - block = std::string("-4"); //Plane 1 + block_ = std::string("-4"); //Plane 1 rf_link = -4; break; case 7 : - block = std::string("5"); //Plane 1 + block_ = std::string("5"); //Plane 1 rf_link = 5; break; case 8 : - block = std::string("6"); //Plane 1 + block_ = std::string("6"); //Plane 1 rf_link = 6; break; case 9 : - block = std::string("-2"); //Plane 2 + block_ = std::string("-2"); //Plane 2 rf_link = -2; break; case 10 : - block = std::string("-7"); //Plane 2 + block_ = std::string("-7"); //Plane 2 rf_link = -7; break; case 11 : - block = std::string("0"); //Plane 2 + block_ = std::string("0"); //Plane 2 rf_link = 0; break; case 12 : - block = std::string("-1"); //Plane 2 + block_ = std::string("-1"); //Plane 2 rf_link = -1; break; case 13 : - block = std::string("-2"); //Plane 2 + block_ = std::string("-2"); //Plane 2 rf_link = -2; break; case 14 : - block = std::string("-7"); //Plane 2 + block_ = std::string("-7"); //Plane 2 rf_link = -7; break; case 15 : - block = std::string("0"); //Plane 2 + block_ = std::string("0"); //Plane 2 rf_link = 0; break; case 16 : - block = std::string("-1"); //Plane 2 + block_ = std::string("-1"); //Plane 2 rf_link = -1; break; case 17 : - block = std::string("4"); //Plane 3 + block_ = std::string("4"); //Plane 3 rf_link = 4; break; case 18 : - block = std::string("-3"); //Plane 3 + block_ = std::string("-3"); //Plane 3 rf_link = -3; break; case 19 : - block = std::string("3"); //Plane 3 + block_ = std::string("3"); //Plane 3 rf_link = 3; break; case 20 : - block = std::string("2"); //Plane 3 + block_ = std::string("2"); //Plane 3 rf_link = 2; break; case 21 : - block = std::string("4"); //Plane 3 + block_ = std::string("4"); //Plane 3 rf_link = 4; break; case 22 : - block = std::string("-3"); //Plane 3 + block_ = std::string("-3"); //Plane 3 rf_link = -3; break; case 23 : - block = std::string("3"); //Plane 3 + block_ = std::string("3"); //Plane 3 rf_link = 3; break; case 24 : - block = std::string("2"); //Plane 3 + block_ = std::string("2"); //Plane 3 rf_link = 2; break; default : - block = std::string("Unknown"); + block_ = std::string("Unknown"); } } if (system_.compare("SBAS") == 0) + { + switch ( PRN_ ) { - switch ( PRN_ ) - { - case 122 : - block = std::string("WAAS"); // WAAS Inmarsat 3F4 (AOR-W) - break; - case 134 : - block = std::string("WAAS"); // WAAS Inmarsat 3F3 (POR) - break; - case 120 : - block = std::string("EGNOS"); // EGNOS AOR-E Broadcast satellite http://www.egnos-pro.esa.int/index.html - break; - case 124 : - block = std::string("EGNOS"); // EGNOS ESA ARTEMIS used for EGNOS Operations - break; - case 126 : - block = std::string("EGNOS"); // EGNOS IOR-W currently used by Industry to perform various tests on the system. - break; - default: - block = std::string("Unknown"); - } + case 122 : + block_ = std::string("WAAS"); // WAAS Inmarsat 3F4 (AOR-W) + break; + case 134 : + block_ = std::string("WAAS"); // WAAS Inmarsat 3F3 (POR) + break; + case 120 : + block_ = std::string("EGNOS"); // EGNOS AOR-E Broadcast satellite http://www.egnos-pro.esa.int/index.html + break; + case 124 : + block_ = std::string("EGNOS"); // EGNOS ESA ARTEMIS used for EGNOS Operations + break; + case 126 : + block_ = std::string("EGNOS"); // EGNOS IOR-W currently used by Industry to perform various tests on the system. + break; + default: + block_ = std::string("Unknown"); } + } if (system_.compare("Galileo") == 0) { // Check http://en.wikipedia.org/wiki/List_of_Galileo_satellites switch ( PRN_ ) { case 11 : - block = std::string("IOV-PFM"); // PFM, the ProtoFlight Model (GSAT0101), launched from French Guiana at 10:30 GMT on October 21, 2011 + block_ = std::string("IOV-PFM"); // PFM, the ProtoFlight Model (GSAT0101), launched from French Guiana at 10:30 GMT on October 21, 2011 break; case 12 : - block = std::string("IOV-FM2"); // Galileo In-Orbit Validation (IOV) satellite FM2 (Flight Model 2) also known as GSAT0102, from French Guiana at 10:30 GMT on October 21, 2011 + block_ = std::string("IOV-FM2"); // Galileo In-Orbit Validation (IOV) satellite FM2 (Flight Model 2) also known as GSAT0102, from French Guiana at 10:30 GMT on October 21, 2011 break; case 19 : - block = std::string("IOV-FM3"); // Galileo In-Orbit Validation (IOV) satellite FM3 (Flight Model 3), launched on October 12, 2012 + block_ = std::string("IOV-FM3"); // Galileo In-Orbit Validation (IOV) satellite FM3 (Flight Model 3), launched on October 12, 2012 break; case 20 : - block = std::string("IOV-FM4"); // Galileo In-Orbit Validation (IOV) satellite FM4 (Flight Model 4), launched on October 12, 2012. Unavailable. + block_ = std::string("IOV-FM4"); // Galileo In-Orbit Validation (IOV) satellite FM4 (Flight Model 4), launched on October 12, 2012. Unavailable. break; case 18 : - block = std::string("FOC-FM1"); // Galileo Full Operational Capability (FOC) satellite FM1, launched into incorrect orbit on August 22, 2014. + block_ = std::string("FOC-FM1"); // Galileo Full Operational Capability (FOC) satellite FM1, launched into incorrect orbit on August 22, 2014. break; case 14 : - block = std::string("FOC-FM2"); // Galileo Full Operational Capability (FOC) satellite FM2, launched into incorrect orbit on August 22, 2014. + block_ = std::string("FOC-FM2"); // Galileo Full Operational Capability (FOC) satellite FM2, launched into incorrect orbit on August 22, 2014. break; case 26 : - block = std::string("FOC-FM3"); // Galileo Full Operational Capability (FOC) satellite FM3, launched on March 27, 2015. + block_ = std::string("FOC-FM3"); // Galileo Full Operational Capability (FOC) satellite FM3, launched on March 27, 2015. break; case 22 : - block = std::string("FOC-FM4"); // Galileo Full Operational Capability (FOC) satellite FM4, launched on March 27, 2015. + block_ = std::string("FOC-FM4"); // Galileo Full Operational Capability (FOC) satellite FM4, launched on March 27, 2015. break; default: - block = std::string("Unknown(Simulated)"); + block_ = std::string("Unknown(Simulated)"); } } + return block_; +} + + +void Gnss_Satellite::set_block(const std::string& system_, unsigned int PRN_) +{ + block = what_block(system_, PRN_); } diff --git a/src/core/system_parameters/gnss_satellite.h b/src/core/system_parameters/gnss_satellite.h index a3ec17e1b..cfdf1369f 100644 --- a/src/core/system_parameters/gnss_satellite.h +++ b/src/core/system_parameters/gnss_satellite.h @@ -54,6 +54,7 @@ public: std::string get_system() const; //!< Gets the satellite system {"GPS", "GLONASS", "SBAS", "Galileo", "Beidou"} std::string get_system_short() const; //!< Gets the satellite system {"G", "R", "SBAS", "E", "C"} std::string get_block() const; //!< Gets the satellite block. If GPS, returns {"IIA", "IIR", "IIR-M", "IIF"} + std::string what_block(const std::string& system_, unsigned int PRN_); //!< Gets the block of a given satellite friend bool operator== (const Gnss_Satellite &, const Gnss_Satellite &); //!< operator== for comparison friend std::ostream& operator<<(std::ostream &, const Gnss_Satellite &); //!< operator<< for pretty printing //Gnss_Satellite& operator=(const Gnss_Satellite &); @@ -68,6 +69,5 @@ private: void set_block(const std::string& system_, unsigned int PRN_ ); std::set system_set; // = {"GPS", "GLONASS", "SBAS", "Galileo", "Compass"}; void reset(); - }; #endif diff --git a/src/core/system_parameters/gps_cnav_navigation_message.cc b/src/core/system_parameters/gps_cnav_navigation_message.cc index bac4dc90c..7c6d34de2 100644 --- a/src/core/system_parameters/gps_cnav_navigation_message.cc +++ b/src/core/system_parameters/gps_cnav_navigation_message.cc @@ -1,9 +1,9 @@ /*! - * \file Gps_CNAV_Navigation_Message.cc - * \brief Implementation of a GPS NAV Data message decoder as described in IS-GPS-200E + * \file gps_cnav_navigation_message.cc + * \brief Implementation of a GPS CNAV Data message decoder as described in IS-GPS-200H * - * See http://www.gps.gov/technical/icwg/IS-GPS-200E.pdf Appendix II - * \author Javier Arribas, 2011. jarribas(at)cttc.es + * See http://www.gps.gov/technical/icwg/IS-GPS-200H.pdf Appendix III + * \author Javier Arribas, 2015. jarribas(at)cttc.es * * ------------------------------------------------------------------------- * @@ -32,7 +32,8 @@ #include "gps_cnav_navigation_message.h" #include -#include "boost/date_time/posix_time/posix_time.hpp" +#include +#include "gnss_satellite.h" void Gps_CNAV_Navigation_Message::reset() @@ -52,50 +53,16 @@ void Gps_CNAV_Navigation_Message::reset() d_satvel_X = 0; d_satvel_Y = 0; d_satvel_Z = 0; - - //Plane A (info from http://www.navcen.uscg.gov/?Do=constellationStatus) - satelliteBlock[9] = "IIA"; - satelliteBlock[31] = "IIR-M"; - satelliteBlock[8] = "IIA"; - satelliteBlock[7] = "IIR-M"; - satelliteBlock[27] = "IIA"; - //Plane B - satelliteBlock[16] = "IIR"; - satelliteBlock[25] = "IIF"; - satelliteBlock[28] = "IIR"; - satelliteBlock[12] = "IIR-M"; - satelliteBlock[30] = "IIA"; - //Plane C - satelliteBlock[29] = "IIR-M"; - satelliteBlock[3] = "IIA"; - satelliteBlock[19] = "IIR"; - satelliteBlock[17] = "IIR-M"; - satelliteBlock[6] = "IIA"; - //Plane D - satelliteBlock[2] = "IIR"; - satelliteBlock[1] = "IIF"; - satelliteBlock[21] = "IIR"; - satelliteBlock[4] = "IIA"; - satelliteBlock[11] = "IIR"; - satelliteBlock[24] = "IIA"; // Decommissioned from active service on 04 Nov 2011 - //Plane E - satelliteBlock[20] = "IIR"; - satelliteBlock[22] = "IIR"; - satelliteBlock[5] = "IIR-M"; - satelliteBlock[18] = "IIR"; - satelliteBlock[32] = "IIA"; - satelliteBlock[10] = "IIA"; - //Plane F - satelliteBlock[14] = "IIR"; - satelliteBlock[15] = "IIR-M"; - satelliteBlock[13] = "IIR"; - satelliteBlock[23] = "IIR"; - satelliteBlock[26] = "IIA"; } Gps_CNAV_Navigation_Message::Gps_CNAV_Navigation_Message() { reset(); + Gnss_Satellite gnss_satellite_ = Gnss_Satellite(); + for(unsigned int prn_ = 1; prn_ < 33; prn_++) + { + satelliteBlock[prn_] = gnss_satellite_.what_block("GPS", prn_); + } } void Gps_CNAV_Navigation_Message::print_gps_word_bytes(unsigned int GPS_word)