1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-13 19:50:34 +00:00

Adding RTCM messages for GLONASS support

Adds code for RTCM in GLONASS processing. The commit includes legacy
messages (MS1009-MS1012) and integrated messages for GNSS fields.
A couple of bug fixes are included and addition of ephemeris fields
is completed.
This commit is contained in:
Damian Miralles 2017-08-13 09:58:35 -07:00 committed by Damian Miralles
parent e58cd5450d
commit f720ddf208
7 changed files with 66 additions and 49 deletions

View File

@ -1116,7 +1116,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend())
{
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
}
}
@ -1135,7 +1135,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
gal_ephemeris_iter = d_ls_pvt->galileo_ephemeris_map.cbegin();
if (gal_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend())
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
}
}
@ -1156,7 +1156,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
gps_cnav_ephemeris_iter = d_ls_pvt->gps_cnav_ephemeris_map.cbegin();
if ((gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != d_ls_pvt->gps_cnav_ephemeris_map.cend()) )
{
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
}
}
@ -1214,14 +1214,14 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend())
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, galileo_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
}
if(flag_write_RTCM_MSM_output == true)
{
if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend())
{
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
}
}
@ -1241,7 +1241,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend())
{
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
b_rtcm_writing_started = true;
}
@ -1257,7 +1257,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
if (gal_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.cend())
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, gal_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
b_rtcm_writing_started = true;
}
@ -1273,7 +1273,7 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
if ((gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.cend()) && (gps_cnav_ephemeris_iter != d_ls_pvt->gps_cnav_ephemeris_map.cend()))
{
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, gps_cnav_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
b_rtcm_writing_started = true;
}
@ -1326,12 +1326,12 @@ int rtklib_pvt_cc::work (int noutput_items, gr_vector_const_void_star &input_ite
if (gps_ephemeris_iter != d_ls_pvt->gps_ephemeris_map.end() && (d_rtcm_MT1077_rate_ms != 0))
{
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, gps_ephemeris_iter->second, {}, {}, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
if (galileo_ephemeris_iter != d_ls_pvt->galileo_ephemeris_map.end() && (d_rtcm_MT1097_rate_ms != 0) )
{
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, galileo_ephemeris_iter->second, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
d_rtcm_printer->Print_Rtcm_MSM(7, {}, {}, galileo_ephemeris_iter->second, {}, d_rx_time, gnss_observables_map, 0, 0, 0, 0, 0);
}
b_rtcm_writing_started = true;
}

View File

@ -410,6 +410,7 @@ std::string Rinex_Printer::getLocalTime()
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if(glonass_gnav_almanac.i_satellite_freq_channel){}
std::string line;
stringVersion = "3.02";
version = 3;
@ -508,6 +509,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Glonass_Gnav_Utc_M
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if(glonass_gnav_almanac.i_satellite_freq_channel){} //Avoid compiler warning
std::string line;
stringVersion = "3.02";
version = 3;
@ -630,6 +632,7 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if(glonass_gnav_almanac.i_satellite_freq_channel){} //Avoid compiler warning
std::string line;
stringVersion = "3.02";
version = 3;
@ -1389,6 +1392,7 @@ void Rinex_Printer::rinex_sbs_header(std::fstream& out)
void Rinex_Printer::update_nav_header(std::fstream& out, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if(glonass_gnav_almanac.i_satellite_freq_channel){} //Avoid compiler warning
std::vector<std::string> data;
std::string line_aux;
@ -1935,6 +1939,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_ion
void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if(glonass_gnav_almanac.i_satellite_freq_channel){} //Avoid compiler warning
std::vector<std::string> data;
std::string line_aux;
@ -2041,6 +2046,7 @@ void Rinex_Printer::update_nav_header(std::fstream& out, const Gps_Iono& gps_ion
void Rinex_Printer::update_nav_header(std::fstream& out, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac, const Glonass_Gnav_Utc_Model& glonass_gnav_utc_model, const Glonass_Gnav_Almanac& glonass_gnav_almanac)
{
if(glonass_gnav_almanac.i_satellite_freq_channel){} //Avoid compiler warning
std::vector<std::string> data;
std::string line_aux;
@ -3031,6 +3037,7 @@ void Rinex_Printer::log_rinex_nav(std::fstream& out, const std::map<int, Galileo
void Rinex_Printer::rinex_obs_header(std::fstream& out, const Glonass_Gnav_Ephemeris& eph, const double d_TOW_first_observation, const std::string bands)
{
if(eph.d_m){} //Avoid compiler warning
std::string line;
std::map<int,Glonass_Gnav_Ephemeris>::const_iterator glonass_gnav_ephemeris_iter;
@ -5163,7 +5170,7 @@ void Rinex_Printer::update_obs_header(std::fstream& out, const Glonass_Gnav_Utc_
{
if(utc_model.d_N_4)
{
}
}

View File

@ -202,17 +202,17 @@ bool Rtcm_Printer::Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_
}
bool Rtcm_Printer::Print_Rtcm_MT1011(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int, Gnss_Synchro> & observables)
bool Rtcm_Printer::Print_Rtcm_MT1011(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int, Gnss_Synchro> & observables)
{
std::string m1011 = rtcm->print_MT1011(glonass_gnav_eph, obs_time, observables, station_id);
std::string m1011 = rtcm->print_MT1011(glonass_gnav_ephL1, glonass_gnav_ephL2, obs_time, observables, station_id);
Rtcm_Printer::Print_Message(m1011);
return true;
}
bool Rtcm_Printer::Print_Rtcm_MT1012(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int, Gnss_Synchro> & observables)
bool Rtcm_Printer::Print_Rtcm_MT1012(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int, Gnss_Synchro> & observables)
{
std::string m1012 = rtcm->print_MT1012(glonass_gnav_eph, obs_time, observables, station_id);
std::string m1012 = rtcm->print_MT1012(glonass_gnav_ephL1, glonass_gnav_ephL2, obs_time, observables, station_id);
Rtcm_Printer::Print_Message(m1012);
return true;
}
@ -226,9 +226,9 @@ bool Rtcm_Printer::Print_Rtcm_MT1019(const Gps_Ephemeris & gps_eph)
}
bool Rtcm_Printer::Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris & glonass_gnav_eph)
bool Rtcm_Printer::Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris & glonass_gnav_eph, const Glonass_Gnav_Utc_Model & glonass_gnav_utc_model)
{
std::string m1020 = rtcm->print_MT1020(glonass_gnav_eph);
std::string m1020 = rtcm->print_MT1020(glonass_gnav_eph, glonass_gnav_utc_model);
Rtcm_Printer::Print_Message(m1020);
return true;
}

View File

@ -63,9 +63,9 @@ public:
* \brief Prints L1-Only GLONASS RTK Observables
* \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred.
* \note Code added as part of GSoC 2017 program
* \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \params obs_time Time of observation at the moment of printing
* \params observables Set of observables as defined by the platform
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1009(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int, Gnss_Synchro> & observables);
@ -73,9 +73,9 @@ public:
* \brief Prints Extended L1-Only GLONASS RTK Observables
* \details This GLONASS message type is used when only L1 data is present and bandwidth is very tight, often 1012 is used in such cases.
* \note Code added as part of GSoC 2017 program
* \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \params obs_time Time of observation at the moment of printing
* \params observables Set of observables as defined by the platform
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1010(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int, Gnss_Synchro> & observables);
@ -83,22 +83,24 @@ public:
* \brief Prints L1&L2 GLONASS RTK Observables
* \details This GLONASS message type is not generally used or supported; type 1012 is to be preferred
* \note Code added as part of GSoC 2017 program
* \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \params obs_time Time of observation at the moment of printing
* \params observables Set of observables as defined by the platform
* \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
* \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1011(Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int, Gnss_Synchro> & observables);
bool Print_Rtcm_MT1011(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int, Gnss_Synchro> & observables);
/*!
* \brief Prints Extended L1&L2 GLONASS RTK Observables
* \details This GLONASS message type is the most common observational message type, with L1/L2/SNR content. This is one of the most common messages found.
* \note Code added as part of GSoC 2017 program
* \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \params obs_time Time of observation at the moment of printing
* \params observables Set of observables as defined by the platform
* \param glonass_gnav_ephL1 GLONASS L1 GNAV Broadcast Ephemeris for satellite
* \param glonass_gnav_ephL2 GLONASS L2 GNAV Broadcast Ephemeris for satellite
* \param obs_time Time of observation at the moment of printing
* \param observables Set of observables as defined by the platform
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1012(Glonass_Gnav_Ephemeris& glonass_gnav_eph, double obs_time, const std::map<int, Gnss_Synchro> & observables);
bool Print_Rtcm_MT1012(const Glonass_Gnav_Ephemeris& glonass_gnav_ephL1, const Glonass_Gnav_Ephemeris& glonass_gnav_ephL2, double obs_time, const std::map<int, Gnss_Synchro> & observables);
bool Print_Rtcm_MT1019(const Gps_Ephemeris & gps_eph); //<! GPS Ephemeris, should be broadcast in the event that the IODC does not match the IODE, and every 2 minutes.
bool Print_Rtcm_MT1045(const Galileo_Ephemeris & gal_eph); //<! Galileo Ephemeris, should be broadcast every 2 minutes
@ -106,10 +108,11 @@ public:
* \brief Prints GLONASS GNAV Ephemeris
* \details This GLONASS message should be broadcast every 2 minutes
* \note Code added as part of GSoC 2017 program
* \params glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \param glonass_gnav_eph GLONASS GNAV Broadcast Ephemeris
* \param utc_model GLONASS GNAV Clock Information broadcast in string 5
* \return true or false upon operation success
*/
bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris & glo_gnav_eph);
bool Print_Rtcm_MT1020(const Glonass_Gnav_Ephemeris & glo_gnav_eph, const Glonass_Gnav_Utc_Model & utc_model);
bool Print_Rtcm_MSM(unsigned int msm_number,
const Gps_Ephemeris & gps_eph,

View File

@ -65,6 +65,7 @@ const double TWO_N14 = (0.00006103515625); //!< 2^-14
const double TWO_N15 = (0.00003051757813); //!< 2^-15
const double TWO_N16 = (0.0000152587890625); //!< 2^-16
const double TWO_N17 = (7.629394531250000e-006); //!< 2^-17
const double TWO_N18 = (3.814697265625000e-006); //!< 2^-18
const double TWO_N19 = (1.907348632812500e-006); //!< 2^-19
const double TWO_N20 = (9.536743164062500e-007); //!< 2^-20
const double TWO_N21 = (4.768371582031250e-007); //!< 2^-21

View File

@ -69,8 +69,8 @@ public:
//!< Satellite Identification
int i_channel_ID; //!< Channel ID assigned by the receiver
int i_satellite_freq_channel; //!< SV Frequency Slot Number
int i_satellite_slot_number; //!< SV Orbit Slot Number
unsigned int i_satellite_freq_channel; //!< SV Frequency Slot Number
unsigned int i_satellite_slot_number; //!< SV Orbit Slot Number
//!< Ephmeris Flags
bool flag_all_ephemeris; //!< Flag indicating that all strings containing ephemeris have been received

View File

@ -1811,9 +1811,9 @@ int Rtcm::read_MT1020(const std::string & message, Glonass_Gnav_Ephemeris & glon
{
// Convert message to binary
std::string message_bin = Rtcm::binary_data_to_bin(message);
int glonass_gnav_alm_health;
int glonass_gnav_alm_health_ind;
int fifth_str_additional_data_ind;
int glonass_gnav_alm_health = 0;
int glonass_gnav_alm_health_ind = 0;
int fifth_str_additional_data_ind = 0;
if(!Rtcm::check_CRC(message) )
{
@ -1853,9 +1853,11 @@ int Rtcm::read_MT1020(const std::string & message, Glonass_Gnav_Ephemeris & glon
glonass_gnav_alm_health = static_cast<int>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
if(glonass_gnav_alm_health){} //Avoid comiler warning
glonass_gnav_alm_health_ind = static_cast<int>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
if(glonass_gnav_alm_health_ind){} //Avoid comiler warning
glonass_gnav_eph.d_P_1 = static_cast<int>(Rtcm::bin_to_uint(message_bin.substr(index, 2)));
index += 2;
@ -1940,19 +1942,22 @@ int Rtcm::read_MT1020(const std::string & message, Glonass_Gnav_Ephemeris & glon
fifth_str_additional_data_ind = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
index += 1;
glonass_gnav_utc_model.d_N_A = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 11)));
index += 11;
if(fifth_str_additional_data_ind == true)
{
glonass_gnav_utc_model.d_N_A = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 11)));
index += 11;
glonass_gnav_utc_model.d_tau_c = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 32)))* TWO_N31;
index += 32;
glonass_gnav_utc_model.d_tau_c = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 32)))* TWO_N31;
index += 32;
glonass_gnav_utc_model.d_N_4 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 5)));
index += 5;
glonass_gnav_utc_model.d_N_4 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 5)));
index += 5;
glonass_gnav_utc_model.d_tau_gps = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 22)))* TWO_N30;
index += 22;
glonass_gnav_utc_model.d_tau_gps = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 22)))* TWO_N30;
index += 22;
glonass_gnav_eph.d_l5th_n = static_cast<int>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
glonass_gnav_eph.d_l5th_n = static_cast<int>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
}
return 0;
}
@ -2301,7 +2306,8 @@ std::string Rtcm::get_MSM_header(unsigned int msg_number,
bool divergence_free,
bool more_messages)
{
std::string sys(&observables.second.System, 1);
std::map<int, Gnss_Synchro>::const_iterator gnss_synchro_iter;
std::string sys(gnss_synchro_iter->second.System, 1);
Rtcm::set_DF002(msg_number);
Rtcm::set_DF003(ref_id);
@ -4466,7 +4472,7 @@ int Rtcm::set_DF133(const Glonass_Gnav_Utc_Model & glonass_gnav_utc_model)
int Rtcm::set_DF134(const Glonass_Gnav_Utc_Model & glonass_gnav_utc_model)
{
unsigned int N_4 = static_cast<unsigned int>(std::round(glonass_gnav_utc_model.d_N_4));
DF134 = std::bitset<11>(N_4);
DF134 = std::bitset<5>(N_4);
return 0;
}