mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 04:00:34 +00:00
Now the Rtcm class prints and reads Messages of type 1045 (Galileo
ephemeris)
This commit is contained in:
parent
7890622090
commit
855d707865
@ -278,7 +278,7 @@ std::string Rtcm::build_message(std::string data)
|
||||
//
|
||||
// **********************************************
|
||||
|
||||
std::bitset<64> Rtcm::get_M1001_header(const Gps_Ephemeris & gps_eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges,
|
||||
std::bitset<64> Rtcm::get_MT1001_header(const Gps_Ephemeris & gps_eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges,
|
||||
unsigned int ref_id, unsigned int smooth_int, bool sync_flag, bool divergence_free)
|
||||
{
|
||||
unsigned int m1001 = 1001;
|
||||
@ -308,7 +308,7 @@ std::bitset<64> Rtcm::get_M1001_header(const Gps_Ephemeris & gps_eph, double obs
|
||||
}
|
||||
|
||||
|
||||
std::bitset<58> Rtcm::get_M1001_sat_content(const Gnss_Synchro & gnss_synchro)
|
||||
std::bitset<58> Rtcm::get_MT1001_sat_content(const Gnss_Synchro & gnss_synchro)
|
||||
{
|
||||
Gnss_Synchro gnss_synchro_ = gnss_synchro;
|
||||
bool code_indicator = false; // code indicator 0: C/A code 1: P(Y) code direct
|
||||
@ -336,14 +336,14 @@ std::bitset<58> Rtcm::get_M1001_sat_content(const Gnss_Synchro & gnss_synchro)
|
||||
|
||||
|
||||
|
||||
std::string Rtcm::print_M1001(const Gps_Ephemeris & gps_eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges)
|
||||
std::string Rtcm::print_MT1001(const Gps_Ephemeris & gps_eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges)
|
||||
{
|
||||
unsigned int ref_id = static_cast<unsigned int>(FLAGS_RTCM_Ref_Station_ID);
|
||||
unsigned int smooth_int = 0;
|
||||
bool sync_flag = false;
|
||||
bool divergence_free = false;
|
||||
|
||||
std::bitset<64> header = Rtcm::get_M1001_header(gps_eph, obs_time, pseudoranges, ref_id, smooth_int, sync_flag, divergence_free);
|
||||
std::bitset<64> header = Rtcm::get_MT1001_header(gps_eph, obs_time, pseudoranges, ref_id, smooth_int, sync_flag, divergence_free);
|
||||
std::string data = header.to_string();
|
||||
|
||||
std::map<int, Gnss_Synchro>::const_iterator pseudoranges_iter;
|
||||
@ -352,7 +352,7 @@ std::string Rtcm::print_M1001(const Gps_Ephemeris & gps_eph, double obs_time, co
|
||||
pseudoranges_iter++)
|
||||
{
|
||||
|
||||
std::bitset<58> content = Rtcm::get_M1001_sat_content(pseudoranges_iter->second);
|
||||
std::bitset<58> content = Rtcm::get_MT1001_sat_content(pseudoranges_iter->second);
|
||||
data += content.to_string();
|
||||
}
|
||||
|
||||
@ -378,9 +378,9 @@ std::string Rtcm::print_M1001(const Gps_Ephemeris & gps_eph, double obs_time, co
|
||||
Expected output: D3 00 13 3E D7 D3 02 02 98 0E DE EF 34 B4 BD 62
|
||||
AC 09 41 98 6F 33 36 0B 98
|
||||
*/
|
||||
std::bitset<152> Rtcm::get_M1005_test ()
|
||||
std::bitset<152> Rtcm::get_MT1005_test ()
|
||||
{
|
||||
unsigned int m1005 = 1005;
|
||||
unsigned int mt1005 = 1005;
|
||||
unsigned int reference_station_id = 2003; // Max: 4095
|
||||
double ECEF_X = 1114104.5999; // units: m
|
||||
double ECEF_Y = -4850729.7108; // units: m
|
||||
@ -388,7 +388,7 @@ std::bitset<152> Rtcm::get_M1005_test ()
|
||||
|
||||
std::bitset<1> DF001_;
|
||||
|
||||
Rtcm::set_DF002(m1005);
|
||||
Rtcm::set_DF002(mt1005);
|
||||
Rtcm::set_DF003(reference_station_id);
|
||||
Rtcm::set_DF021();
|
||||
Rtcm::set_DF022(true); // GPS
|
||||
@ -420,7 +420,8 @@ std::bitset<152> Rtcm::get_M1005_test ()
|
||||
return test_msg;
|
||||
}
|
||||
|
||||
std::string Rtcm::print_M1005( unsigned int ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, unsigned int quarter_cycle_indicator)
|
||||
|
||||
std::string Rtcm::print_MT1005( unsigned int ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, unsigned int quarter_cycle_indicator)
|
||||
{
|
||||
unsigned int msg_number = 1005;
|
||||
std::bitset<1> DF001_;
|
||||
@ -457,15 +458,15 @@ std::string Rtcm::print_M1005( unsigned int ref_id, double ecef_x, double ecef_y
|
||||
return message;
|
||||
}
|
||||
|
||||
int Rtcm::read_M1005(const std::string & message, unsigned int & ref_id, double & ecef_x, double & ecef_y, double & ecef_z, bool & gps, bool & glonass, bool & galileo)
|
||||
|
||||
int Rtcm::read_MT1005(const std::string & message, unsigned int & ref_id, double & ecef_x, double & ecef_y, double & ecef_z, bool & gps, bool & glonass, bool & galileo)
|
||||
{
|
||||
// Convert message to binary
|
||||
std::string message_bin = Rtcm::hex_to_bin(message);
|
||||
|
||||
if(!Rtcm::check_CRC(message) )
|
||||
{
|
||||
LOG(WARNING) << " Bad CRC detected in RTCM message M1005";
|
||||
std::cout << " ----- Bad CRC detected in RTCM message M1005 " << std::endl;
|
||||
LOG(WARNING) << " Bad CRC detected in RTCM message MT1005";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -478,8 +479,7 @@ int Rtcm::read_M1005(const std::string & message, unsigned int & ref_id, double
|
||||
index += 10;
|
||||
if (read_message_length != 19)
|
||||
{
|
||||
LOG(WARNING) << " Message M1005 seems too long (19 bytes expected, " << read_message_length << " received)";
|
||||
std::cout << " -----Message M1005 seems too long (19 bytes expected, " << read_message_length << " received)" << std::endl;
|
||||
LOG(WARNING) << " Message MT1005 with wrong length (19 bytes expected, " << read_message_length << " received)";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -490,8 +490,7 @@ int Rtcm::read_M1005(const std::string & message, unsigned int & ref_id, double
|
||||
|
||||
if (DF002 != read_msg_number)
|
||||
{
|
||||
LOG(WARNING) << " This is not a M1005 message";
|
||||
std::cout << " ----- This is not a M1005 message"<< std::endl;
|
||||
LOG(WARNING) << " This is not a MT1005 message";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -509,7 +508,7 @@ int Rtcm::read_M1005(const std::string & message, unsigned int & ref_id, double
|
||||
galileo = static_cast<bool>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
|
||||
index += 1;
|
||||
|
||||
index += 1; // ref_sattion_indicator
|
||||
index += 1; // ref_station_indicator
|
||||
|
||||
ecef_x = Rtcm::bin_to_double(message_bin.substr(index, 38)) / 10000.0;
|
||||
index += 38;
|
||||
@ -527,10 +526,10 @@ int Rtcm::read_M1005(const std::string & message, unsigned int & ref_id, double
|
||||
}
|
||||
|
||||
|
||||
std::string Rtcm::print_M1005_test()
|
||||
std::string Rtcm::print_MT1005_test()
|
||||
{
|
||||
std::bitset<152> m1005 = get_M1005_test();
|
||||
return Rtcm::build_message(m1005.to_string());
|
||||
std::bitset<152> mt1005 = get_MT1005_test();
|
||||
return Rtcm::build_message(mt1005.to_string());
|
||||
}
|
||||
|
||||
|
||||
@ -541,7 +540,7 @@ std::string Rtcm::print_M1005_test()
|
||||
//
|
||||
// **********************************************
|
||||
|
||||
std::string Rtcm::print_M1019(const Gps_Ephemeris & gps_eph)
|
||||
std::string Rtcm::print_MT1019(const Gps_Ephemeris & gps_eph)
|
||||
{
|
||||
unsigned int msg_number = 1019;
|
||||
|
||||
@ -613,7 +612,7 @@ std::string Rtcm::print_M1019(const Gps_Ephemeris & gps_eph)
|
||||
|
||||
if (data.length() != 488)
|
||||
{
|
||||
LOG(WARNING) << "Bad-formatted RTCM M1019 (488 bits expected, found " << data.length() << ")";
|
||||
LOG(WARNING) << "Bad-formatted RTCM MT1019 (488 bits expected, found " << data.length() << ")";
|
||||
}
|
||||
|
||||
message1019_content = std::bitset<488>(data);
|
||||
@ -622,14 +621,14 @@ std::string Rtcm::print_M1019(const Gps_Ephemeris & gps_eph)
|
||||
}
|
||||
|
||||
|
||||
int Rtcm::read_M1019(const std::string & message, Gps_Ephemeris & gps_eph)
|
||||
int Rtcm::read_MT1019(const std::string & message, Gps_Ephemeris & gps_eph)
|
||||
{
|
||||
// Convert message to binary
|
||||
std::string message_bin = Rtcm::hex_to_bin(message);
|
||||
|
||||
if(!Rtcm::check_CRC(message) )
|
||||
{
|
||||
LOG(WARNING) << " Bad CRC detected in RTCM message M1019";
|
||||
LOG(WARNING) << " Bad CRC detected in RTCM message MT1019";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -642,7 +641,7 @@ int Rtcm::read_M1019(const std::string & message, Gps_Ephemeris & gps_eph)
|
||||
|
||||
if (read_message_length != 61)
|
||||
{
|
||||
LOG(WARNING) << " Message M1019 seems too long (61 bytes expected, " << read_message_length << " received)";
|
||||
LOG(WARNING) << " Message MT1019 seems too long (61 bytes expected, " << read_message_length << " received)";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -652,7 +651,7 @@ int Rtcm::read_M1019(const std::string & message, Gps_Ephemeris & gps_eph)
|
||||
|
||||
if (1019 != read_msg_number)
|
||||
{
|
||||
LOG(WARNING) << " This is not a M1019 message";
|
||||
LOG(WARNING) << " This is not a MT1019 message";
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -758,7 +757,7 @@ int Rtcm::read_M1019(const std::string & message, Gps_Ephemeris & gps_eph)
|
||||
//
|
||||
// **********************************************
|
||||
|
||||
std::string Rtcm::print_M1045(const Galileo_Ephemeris & gal_eph)
|
||||
std::string Rtcm::print_MT1045(const Galileo_Ephemeris & gal_eph)
|
||||
{
|
||||
unsigned int msg_number = 1045;
|
||||
|
||||
@ -826,7 +825,7 @@ std::string Rtcm::print_M1045(const Galileo_Ephemeris & gal_eph)
|
||||
|
||||
if (data.length() != 496)
|
||||
{
|
||||
LOG(WARNING) << "Bad-formatted RTCM M1045 (496 bits expected, found " << data.length() << ")";
|
||||
LOG(WARNING) << "Bad-formatted RTCM MT1045 (496 bits expected, found " << data.length() << ")";
|
||||
}
|
||||
message1045_content = std::bitset<496>(data);
|
||||
std::string message = build_message(data);
|
||||
@ -834,6 +833,124 @@ std::string Rtcm::print_M1045(const Galileo_Ephemeris & gal_eph)
|
||||
}
|
||||
|
||||
|
||||
int Rtcm::read_MT1045(const std::string & message, Galileo_Ephemeris & gal_eph)
|
||||
{
|
||||
// Convert message to binary
|
||||
std::string message_bin = Rtcm::hex_to_bin(message);
|
||||
|
||||
if(!Rtcm::check_CRC(message) )
|
||||
{
|
||||
LOG(WARNING) << " Bad CRC detected in RTCM message MT1045";
|
||||
return 1;
|
||||
}
|
||||
|
||||
unsigned int preamble_length = 8;
|
||||
unsigned int reserved_field_length = 6;
|
||||
unsigned int index = preamble_length + reserved_field_length;
|
||||
|
||||
unsigned int read_message_length = static_cast<unsigned int>(Rtcm::bin_to_uint(message_bin.substr(index, 10)));
|
||||
index += 10;
|
||||
|
||||
if (read_message_length != 62)
|
||||
{
|
||||
LOG(WARNING) << " Message MT1045 seems too long (62 bytes expected, " << read_message_length << " received)";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Check than the message number is correct
|
||||
unsigned int read_msg_number = Rtcm::bin_to_uint(message_bin.substr(index, 12));
|
||||
index += 12;
|
||||
|
||||
if (1045 != read_msg_number)
|
||||
{
|
||||
LOG(WARNING) << " This is not a MT1045 message";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Fill Galileo Ephemeris with message data content
|
||||
gal_eph.i_satellite_PRN = static_cast<unsigned int>(Rtcm::bin_to_uint(message_bin.substr(index, 6)));
|
||||
index += 6;
|
||||
|
||||
gal_eph.WN_5 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 12)));
|
||||
index += 12;
|
||||
|
||||
gal_eph.IOD_nav_1 = static_cast<int>(Rtcm::bin_to_uint(message_bin.substr(index, 10)));
|
||||
index += 10;
|
||||
|
||||
gal_eph.SISA_3 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 8)));
|
||||
index += 8;
|
||||
|
||||
gal_eph.iDot_2 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 14))) * iDot_2_LSB;
|
||||
index += 14;
|
||||
|
||||
gal_eph.t0c_4 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 14))) * t0c_4_LSB;
|
||||
index += 14;
|
||||
|
||||
gal_eph.af2_4 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 6))) * af2_4_LSB;
|
||||
index += 6;
|
||||
|
||||
gal_eph.af1_4 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 21))) * af1_4_LSB;
|
||||
index += 21;
|
||||
|
||||
gal_eph.af0_4 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 31))) * af0_4_LSB;
|
||||
index += 31;
|
||||
|
||||
gal_eph.C_rs_3 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_rs_3_LSB;
|
||||
index += 16;
|
||||
|
||||
gal_eph.delta_n_3 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * delta_n_3_LSB;
|
||||
index += 16;
|
||||
|
||||
gal_eph.M0_1 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 32))) * M0_1_LSB;
|
||||
index += 32;
|
||||
|
||||
gal_eph.C_uc_3 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_uc_3_LSB;
|
||||
index += 16;
|
||||
|
||||
gal_eph.e_1 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 32))) * e_1_LSB;
|
||||
index += 32;
|
||||
|
||||
gal_eph.C_us_3 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_us_3_LSB;
|
||||
index += 16;
|
||||
|
||||
gal_eph.A_1 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 32))) * A_1_LSB_gal;
|
||||
index += 32;
|
||||
|
||||
gal_eph.t0e_1 = static_cast<double>(Rtcm::bin_to_uint(message_bin.substr(index, 14))) * t0e_1_LSB;
|
||||
index += 14;
|
||||
|
||||
gal_eph.C_ic_4 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_ic_4_LSB;
|
||||
index += 16;
|
||||
|
||||
gal_eph.OMEGA_0_2 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 32))) * OMEGA_0_2_LSB;
|
||||
index += 32;
|
||||
|
||||
gal_eph.C_is_4 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_is_4_LSB;
|
||||
index += 16;
|
||||
|
||||
gal_eph.i_0_2 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 32))) * i_0_2_LSB;
|
||||
index += 32;
|
||||
|
||||
gal_eph.C_rc_3 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 16))) * C_rc_3_LSB;
|
||||
index += 16;
|
||||
|
||||
gal_eph.omega_2 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 32))) * omega_2_LSB;
|
||||
index += 32;
|
||||
|
||||
gal_eph.OMEGA_dot_3 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 24))) * OMEGA_dot_3_LSB;
|
||||
index += 24;
|
||||
|
||||
gal_eph.BGD_E1E5a_5 = static_cast<double>(Rtcm::bin_to_int(message_bin.substr(index, 10)));
|
||||
index += 10;
|
||||
|
||||
gal_eph.E5a_HS = static_cast<unsigned int>(Rtcm::bin_to_uint(message_bin.substr(index, 2)));
|
||||
index += 2;
|
||||
|
||||
gal_eph.E5a_DVS = static_cast<bool>(Rtcm::bin_to_uint(message_bin.substr(index, 1)));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// *****************************************************************************************************
|
||||
//
|
||||
@ -1062,10 +1179,11 @@ int Rtcm::set_DF011(const Gnss_Synchro & gnss_synchro)
|
||||
int Rtcm::set_DF012(const Gnss_Synchro & gnss_synchro)
|
||||
{
|
||||
double L1_pseudorange = gnss_synchro.Pseudorange_m;
|
||||
double L1_pseudorange_integers = std::floor(L1_pseudorange / 299792.458);
|
||||
//double L1_pseudorange_integers = std::floor(L1_pseudorange / 299792.458);
|
||||
double L1_pseudorange_field = std::fmod(L1_pseudorange, 299792.458);
|
||||
double L1_phaserange_m = (gnss_synchro.Carrier_phase_rads / GPS_TWO_PI) * GPS_C_m_s / GPS_L1_FREQ_HZ;
|
||||
|
||||
long int gps_L1_phaserange_minus_L1_pseudorange = 0; ///////////////////////
|
||||
long int gps_L1_phaserange_minus_L1_pseudorange = static_cast<long int>((0 - L1_pseudorange_field) / 0.0005); ///////////////////////
|
||||
DF012 = std::bitset<20>(gps_L1_phaserange_minus_L1_pseudorange);
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,9 +33,9 @@
|
||||
#define GNSS_SDR_RTCM_H_
|
||||
|
||||
|
||||
#include <bitset> // std::bitset
|
||||
#include <bitset>
|
||||
#include <map>
|
||||
#include <string> // std::string
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/crc.hpp>
|
||||
#include "gnss_synchro.h"
|
||||
@ -43,42 +43,46 @@
|
||||
#include "gps_navigation_message.h"
|
||||
|
||||
/*!
|
||||
* \brief This class implements the RTCM 3.2 Standard
|
||||
*
|
||||
* \brief This class implements the generation and reading of some Message Types
|
||||
* defined in the RTCM 3.2 Standard.
|
||||
*/
|
||||
class Rtcm
|
||||
{
|
||||
public:
|
||||
Rtcm(); //<! Default constructor
|
||||
|
||||
std::string print_M1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges);
|
||||
std::string print_MT1001(const Gps_Ephemeris& gps_eph, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges);
|
||||
|
||||
/*!
|
||||
* \brief Prints message type 1005 (Stationary Antenna Reference Point)
|
||||
*/
|
||||
std::string print_M1005(unsigned int ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, unsigned int quarter_cycle_indicator);
|
||||
std::string print_MT1005(unsigned int ref_id, double ecef_x, double ecef_y, double ecef_z, bool gps, bool glonass, bool galileo, bool non_physical, bool single_oscillator, unsigned int quarter_cycle_indicator);
|
||||
|
||||
/*!
|
||||
* \brief Verifies and reads messages of type 1005 (Stationary Antenna Reference Point)
|
||||
* \brief Verifies and reads messages of type 1005 (Stationary Antenna Reference Point). Returns 1 if anything goes wrong, 0 otherwise.
|
||||
*/
|
||||
int read_M1005(const std::string & message, unsigned int & ref_id, double & ecef_x, double & ecef_y, double & ecef_z, bool & gps, bool & glonass, bool & galileo);
|
||||
int read_MT1005(const std::string & message, unsigned int & ref_id, double & ecef_x, double & ecef_y, double & ecef_z, bool & gps, bool & glonass, bool & galileo);
|
||||
|
||||
/*!
|
||||
* \brief Prints message type 1019 (GPS Ephemeris), should be broadcast in the event that
|
||||
* the IODC does not match the IODE, and every 2 minutes.
|
||||
*/
|
||||
std::string print_M1019(const Gps_Ephemeris & gps_eph);
|
||||
std::string print_MT1019(const Gps_Ephemeris & gps_eph);
|
||||
|
||||
/*!
|
||||
* \brief Verifies and reads messages of type 1019 (GPS Ephemeris)
|
||||
* \brief Verifies and reads messages of type 1019 (GPS Ephemeris). Returns 1 if anything goes wrong, 0 otherwise.
|
||||
*/
|
||||
int read_M1019(const std::string & message, Gps_Ephemeris & gps_eph);
|
||||
int read_MT1019(const std::string & message, Gps_Ephemeris & gps_eph);
|
||||
|
||||
/*!
|
||||
* \brief Prints message type 1045 (Galileo Ephemeris)
|
||||
* \brief Prints message type 1045 (Galileo Ephemeris), should be broadcast every 2 minutes
|
||||
*/
|
||||
std::string print_M1045(const Galileo_Ephemeris & gal_eph); //<! Galileo Ephemeris, should be broadcast every 2 minutes
|
||||
std::string print_MT1045(const Galileo_Ephemeris & gal_eph);
|
||||
|
||||
/*!
|
||||
* \brief Verifies and reads messages of type 1045 (Galileo Ephemeris). Returns 1 if anything goes wrong, 0 otherwise.
|
||||
*/
|
||||
int read_MT1045(const std::string & message, Galileo_Ephemeris & gal_eph);
|
||||
|
||||
std::string bin_to_hex(const std::string& s); //<! Returns a string of hexadecimal symbols from a string of binary symbols
|
||||
std::string hex_to_bin(const std::string& s); //<! Returns a string of binary symbols from a string of hexadecimal symbols
|
||||
@ -89,11 +93,10 @@ public:
|
||||
unsigned long int hex_to_uint(const std::string& s); //<! Returns an unsigned long int from a string of hexadecimal symbols
|
||||
long int hex_to_int(const std::string& s); //<! Returns a long int from a string of hexadecimal symbols
|
||||
|
||||
double bin_to_double(const std::string& s); //<! Returns double from a string of binary symbols
|
||||
double bin_to_double(const std::string& s); //<! Returns double from a string of binary symbols
|
||||
std::string print_MT1005_test(); //<! For testing purposes
|
||||
|
||||
std::string print_M1005_test(); //<! For testing purposes
|
||||
|
||||
bool check_CRC(const std::string & message); //<! Checks that the CRC of a RTCM package is correct
|
||||
bool check_CRC(const std::string & message); //<! Checks that the CRC of a RTCM package is correct
|
||||
private:
|
||||
//
|
||||
// Messages
|
||||
@ -102,19 +105,13 @@ private:
|
||||
std::bitset<58> message1001_content;
|
||||
std::bitset<64> message1002_header;
|
||||
std::bitset<74> message1002_content;
|
||||
|
||||
std::bitset<488> message1019_content;
|
||||
|
||||
std::bitset<496> message1045_content;
|
||||
|
||||
std::bitset<169> MSM_header; // 169+X
|
||||
|
||||
std::vector<std::bitset<18> > MSM4_content; // 18 * Nsat
|
||||
|
||||
std::vector<std::bitset<36> > MSM5_content; // 36 * Nsat
|
||||
|
||||
|
||||
std::bitset<64> get_M1001_header(const Gps_Ephemeris & gps_eph,
|
||||
std::bitset<64> get_MT1001_header(const Gps_Ephemeris & gps_eph,
|
||||
double obs_time,
|
||||
const std::map<int, Gnss_Synchro> & pseudoranges,
|
||||
unsigned int ref_id,
|
||||
@ -122,14 +119,9 @@ private:
|
||||
bool sync_flag,
|
||||
bool divergence_free);
|
||||
|
||||
std::bitset<58> get_M1001_sat_content(const Gnss_Synchro & gnss_synchro);
|
||||
|
||||
//std::bitset<138> get_M1002(); // GPS observables
|
||||
//std::bitset<488> get_M1019(); // GPS ephemeris
|
||||
//std::bitset<496> get_M1045(); // Galileo ephemeris
|
||||
std::bitset<152> get_M1005_test();
|
||||
|
||||
std::bitset<58> get_MT1001_sat_content(const Gnss_Synchro & gnss_synchro);
|
||||
|
||||
std::bitset<152> get_MT1005_test();
|
||||
|
||||
//
|
||||
// Transport Layer
|
||||
@ -142,7 +134,6 @@ private:
|
||||
std::string add_CRC(const std::string& m);
|
||||
std::string build_message(std::string data); // adds 0s to complete a byte and adds the CRC
|
||||
|
||||
|
||||
//
|
||||
// Data Fields
|
||||
//
|
||||
@ -170,8 +161,8 @@ private:
|
||||
int set_DF008(short int smoothing_interval);
|
||||
|
||||
std::bitset<6> DF009;
|
||||
int set_DF009(const Gps_Ephemeris & gps_eph);
|
||||
int set_DF009(const Gnss_Synchro & gnss_synchro);
|
||||
int set_DF009(const Gps_Ephemeris & gps_eph);
|
||||
|
||||
std::bitset<1> DF010;
|
||||
int set_DF010(bool code_indicator);
|
||||
|
@ -159,17 +159,17 @@ TEST(Rtcm_Test, Check_CRC)
|
||||
EXPECT_EQ(true, rtcm->check_CRC("D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B98"));
|
||||
EXPECT_EQ(false, rtcm->check_CRC("D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B99"));
|
||||
|
||||
EXPECT_EQ(true, rtcm->check_CRC(rtcm->print_M1005_test()));
|
||||
EXPECT_EQ(true, rtcm->check_CRC(rtcm->print_M1005_test())); // Run twice to check that CRC has no memory
|
||||
EXPECT_EQ(true, rtcm->check_CRC(rtcm->print_MT1005_test()));
|
||||
EXPECT_EQ(true, rtcm->check_CRC(rtcm->print_MT1005_test())); // Run twice to check that CRC has no memory
|
||||
}
|
||||
|
||||
|
||||
TEST(Rtcm_Test, Test_MT1005)
|
||||
{
|
||||
auto rtcm = std::make_shared<Rtcm>();
|
||||
std::string reference_msg = rtcm->print_M1005_test();
|
||||
std::string reference_msg = rtcm->print_MT1005_test();
|
||||
|
||||
std::string reference_msg2 = rtcm->print_M1005(2003, 1114104.5999, -4850729.7108, 3975521.4643, true, false, false, false, false, 0);
|
||||
std::string reference_msg2 = rtcm->print_MT1005(2003, 1114104.5999, -4850729.7108, 3975521.4643, true, false, false, false, false, 0);
|
||||
|
||||
EXPECT_EQ(0, reference_msg.compare(reference_msg2));
|
||||
|
||||
@ -181,7 +181,7 @@ TEST(Rtcm_Test, Test_MT1005)
|
||||
bool glonass;
|
||||
bool galileo;
|
||||
|
||||
rtcm->read_M1005(reference_msg, ref_id, ecef_x, ecef_y, ecef_z, gps, glonass, galileo);
|
||||
rtcm->read_MT1005(reference_msg, ref_id, ecef_x, ecef_y, ecef_z, gps, glonass, galileo);
|
||||
|
||||
EXPECT_EQ(true, gps);
|
||||
EXPECT_EQ(false, glonass);
|
||||
@ -192,7 +192,7 @@ TEST(Rtcm_Test, Test_MT1005)
|
||||
EXPECT_DOUBLE_EQ(-4850729.7108, ecef_y);
|
||||
EXPECT_DOUBLE_EQ(3975521.4643, ecef_z);
|
||||
|
||||
rtcm->read_M1005("D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B98", ref_id, ecef_x, ecef_y, ecef_z, gps, glonass, galileo);
|
||||
rtcm->read_MT1005("D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B98", ref_id, ecef_x, ecef_y, ecef_z, gps, glonass, galileo);
|
||||
|
||||
EXPECT_EQ(true, gps);
|
||||
EXPECT_EQ(false, glonass);
|
||||
@ -217,13 +217,35 @@ TEST(Rtcm_Test, Test_MT1019)
|
||||
gps_eph.d_IODC = 4;
|
||||
gps_eph.d_e_eccentricity = 2.0 * E_LSB;
|
||||
gps_eph.b_fit_interval_flag = true;
|
||||
std::string tx_msg = rtcm->print_M1019(gps_eph);
|
||||
std::string tx_msg = rtcm->print_MT1019(gps_eph);
|
||||
|
||||
EXPECT_EQ(0, rtcm->read_M1019(tx_msg, gps_eph_read));
|
||||
EXPECT_EQ(0, rtcm->read_MT1019(tx_msg, gps_eph_read));
|
||||
EXPECT_EQ(3, gps_eph_read.i_satellite_PRN);
|
||||
EXPECT_DOUBLE_EQ(4, gps_eph_read.d_IODC);
|
||||
EXPECT_DOUBLE_EQ( 2.0 * E_LSB, gps_eph_read.d_e_eccentricity);
|
||||
EXPECT_EQ(true, gps_eph_read.b_fit_interval_flag);
|
||||
EXPECT_EQ(1, rtcm->read_M1019("FFFFFFFFFFF", gps_eph_read));
|
||||
EXPECT_EQ(1, rtcm->read_MT1019("FFFFFFFFFFF", gps_eph_read));
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST(Rtcm_Test, Test_MT1045)
|
||||
{
|
||||
auto rtcm = std::make_shared<Rtcm>();
|
||||
|
||||
Galileo_Ephemeris gal_eph = Galileo_Ephemeris();
|
||||
Galileo_Ephemeris gal_eph_read = Galileo_Ephemeris();
|
||||
|
||||
gal_eph.i_satellite_PRN = 5;
|
||||
gal_eph.OMEGA_dot_3 = 53.0 * OMEGA_dot_3_LSB;
|
||||
gal_eph.E5a_DVS = true;
|
||||
|
||||
std::string tx_msg = rtcm->print_MT1045(gal_eph);
|
||||
|
||||
EXPECT_EQ(0, rtcm->read_MT1045(tx_msg, gal_eph_read));
|
||||
EXPECT_EQ(true, gal_eph_read.E5a_DVS);
|
||||
EXPECT_DOUBLE_EQ( 53.0 * OMEGA_dot_3_LSB, gal_eph_read.OMEGA_dot_3);
|
||||
EXPECT_EQ(5, gal_eph_read.i_satellite_PRN);
|
||||
EXPECT_EQ(1, rtcm->read_MT1045("FFFFFFFFFFF", gal_eph_read));
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ TEST(Rtcm_Printer_Test, Run)
|
||||
std::unique_ptr<Rtcm_Printer> RTCM_printer(new Rtcm_Printer(filename, flag_rtcm_tty_port, rtcm_dump_devname));
|
||||
|
||||
std::string reference_msg = "D300133ED7D30202980EDEEF34B4BD62AC0941986F33360B98";
|
||||
std::string testing_msg = RTCM_printer->print_M1005_test();
|
||||
std::string testing_msg = RTCM_printer->print_MT1005_test();
|
||||
|
||||
EXPECT_EQ(reference_msg, testing_msg);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user