mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-03-06 11:38:17 +00:00
Partial bug correction in RINEX generation. Fotmat issues and UTC computation.
git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@286 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
parent
2a2a6f174d
commit
22254b05fd
@ -85,7 +85,7 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels, gr_msg_queue_sptr que
|
|||||||
d_ephemeris_clock_s = 0.0;
|
d_ephemeris_clock_s = 0.0;
|
||||||
|
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0;
|
||||||
|
d_last_sample_nav_output=0;
|
||||||
d_tx_time=0.0;
|
d_tx_time=0.0;
|
||||||
|
|
||||||
b_rinex_header_writen = false;
|
b_rinex_header_writen = false;
|
||||||
@ -222,8 +222,15 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_ite
|
|||||||
}
|
}
|
||||||
if(b_rinex_header_writen) // Put here another condition to separate annotations (e.g 30 s)
|
if(b_rinex_header_writen) // Put here another condition to separate annotations (e.g 30 s)
|
||||||
{
|
{
|
||||||
rp->log_rinex_nav(rp->navFile, nav_data_map);
|
// Limit the RINEX navigation output rate to 1/6 seg
|
||||||
rp->log_rinex_obs(rp->obsFile, d_last_nav_msg, pseudoranges);
|
// Notice that d_sample_counter period is 1ms (for GPS correlators)
|
||||||
|
|
||||||
|
if ((d_sample_counter-d_last_sample_nav_output)>=6000)
|
||||||
|
{
|
||||||
|
rp->log_rinex_nav(rp->navFile, nav_data_map);
|
||||||
|
d_last_sample_nav_output=d_sample_counter;
|
||||||
|
}
|
||||||
|
rp->log_rinex_obs(rp->obsFile, d_last_nav_msg, d_tx_time, pseudoranges);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,7 @@ private:
|
|||||||
int d_output_rate_ms;
|
int d_output_rate_ms;
|
||||||
int d_display_rate_ms;
|
int d_display_rate_ms;
|
||||||
long unsigned int d_sample_counter;
|
long unsigned int d_sample_counter;
|
||||||
|
long unsigned int d_last_sample_nav_output;
|
||||||
Kml_Printer d_kml_dump;
|
Kml_Printer d_kml_dump;
|
||||||
Nmea_Printer *d_nmea_printer;
|
Nmea_Printer *d_nmea_printer;
|
||||||
concurrent_queue<Gps_Navigation_Message> *d_nav_queue; // Navigation ephemeris queue
|
concurrent_queue<Gps_Navigation_Message> *d_nav_queue; // Navigation ephemeris queue
|
||||||
|
@ -516,7 +516,7 @@ void Rinex_Printer::log_rinex_nav(std::ofstream& out, std::map<int,Gps_Navigatio
|
|||||||
for (int i=0; i < (int)nav_msg.size(); i++)
|
for (int i=0; i < (int)nav_msg.size(); i++)
|
||||||
{
|
{
|
||||||
// -------- SV / EPOCH / SV CLK
|
// -------- SV / EPOCH / SV CLK
|
||||||
boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_time(nav_msg[i]);
|
boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_GPS_time(nav_msg[i],nav_msg[i].d_TOW);
|
||||||
std::string timestring = boost::posix_time::to_iso_string(p_utc_time);
|
std::string timestring = boost::posix_time::to_iso_string(p_utc_time);
|
||||||
std::string month (timestring, 4, 2);
|
std::string month (timestring, 4, 2);
|
||||||
std::string day (timestring, 6, 2);
|
std::string day (timestring, 6, 2);
|
||||||
@ -549,9 +549,9 @@ void Rinex_Printer::log_rinex_nav(std::ofstream& out, std::map<int,Gps_Navigatio
|
|||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f1, 18, 2);
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f2, 18, 2);
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
}
|
}
|
||||||
if (version == 3)
|
if (version == 3)
|
||||||
@ -575,9 +575,9 @@ void Rinex_Printer::log_rinex_nav(std::ofstream& out, std::map<int,Gps_Navigatio
|
|||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f1, 18, 2);
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f0, 18, 2);
|
line += Rinex_Printer::doub2for(nav_msg[i].d_A_f2, 18, 2);
|
||||||
}
|
}
|
||||||
Rinex_Printer::lengthCheck(line);
|
Rinex_Printer::lengthCheck(line);
|
||||||
out << line << std::endl;
|
out << line << std::endl;
|
||||||
@ -711,10 +711,10 @@ void Rinex_Printer::log_rinex_nav(std::ofstream& out, std::map<int,Gps_Navigatio
|
|||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for((double)(nav_msg[i].i_code_on_L2), 18, 2);
|
line += Rinex_Printer::doub2for((double)(nav_msg[i].i_code_on_L2), 18, 2);
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::doub2for((double)(nav_msg[i].i_code_on_L2), 18, 2);
|
|
||||||
line += std::string(1, ' ');
|
|
||||||
double GPS_week_continuous_number = (double)(nav_msg[i].i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
|
double GPS_week_continuous_number = (double)(nav_msg[i].i_GPS_week + 1024); // valid until April 7, 2019 (check http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm)
|
||||||
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
|
line += Rinex_Printer::doub2for(GPS_week_continuous_number, 18, 2);
|
||||||
|
line += std::string(1, ' ');
|
||||||
|
line += Rinex_Printer::doub2for((double)(nav_msg[i].i_code_on_L2), 18, 2);
|
||||||
if (version == 2)
|
if (version == 2)
|
||||||
{
|
{
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
@ -861,12 +861,12 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Navigation_Message
|
|||||||
out << line << std::endl;
|
out << line << std::endl;
|
||||||
|
|
||||||
// -------- Line MARKER TYPE
|
// -------- Line MARKER TYPE
|
||||||
line.clear();
|
//line.clear();
|
||||||
line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property
|
//line += Rinex_Printer::leftJustify("GROUND_CRAFT", 20); // put a flag or a property
|
||||||
line += std::string(40, ' ');
|
//line += std::string(40, ' ');
|
||||||
line += Rinex_Printer::leftJustify("MARKER TYPE", 20);
|
//line += Rinex_Printer::leftJustify("MARKER TYPE", 20);
|
||||||
Rinex_Printer::lengthCheck(line);
|
//Rinex_Printer::lengthCheck(line);
|
||||||
out << line << std::endl;
|
//out << line << std::endl;
|
||||||
|
|
||||||
// -------- Line OBSERVER / AGENCY
|
// -------- Line OBSERVER / AGENCY
|
||||||
line.clear();
|
line.clear();
|
||||||
@ -897,7 +897,18 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Navigation_Message
|
|||||||
out << line << std::endl;
|
out << line << std::endl;
|
||||||
|
|
||||||
// -------- APPROX POSITION (optional for moving platforms)
|
// -------- APPROX POSITION (optional for moving platforms)
|
||||||
|
// put here real data!
|
||||||
|
double antena_x = 0.0;
|
||||||
|
double antena_y = 0.0;
|
||||||
|
double antena_z = 0.0;
|
||||||
|
line.clear();
|
||||||
|
line += Rinex_Printer::rightJustify(Rinex_Printer::asString(antena_x, 4), 14);
|
||||||
|
line += Rinex_Printer::rightJustify(Rinex_Printer::asString(antena_y, 4), 14);
|
||||||
|
line += Rinex_Printer::rightJustify(Rinex_Printer::asString(antena_z, 4), 14);
|
||||||
|
line += std::string(18, ' ');
|
||||||
|
line += Rinex_Printer::leftJustify("APPROX POSITION XYZ", 20);
|
||||||
|
Rinex_Printer::lengthCheck(line);
|
||||||
|
out << line << std::endl;
|
||||||
|
|
||||||
// -------- ANTENNA: DELTA H/E/N
|
// -------- ANTENNA: DELTA H/E/N
|
||||||
// put here real data!
|
// put here real data!
|
||||||
@ -913,7 +924,6 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Navigation_Message
|
|||||||
Rinex_Printer::lengthCheck(line);
|
Rinex_Printer::lengthCheck(line);
|
||||||
out << line << std::endl;
|
out << line << std::endl;
|
||||||
|
|
||||||
|
|
||||||
// -------- SYS / OBS TYPES
|
// -------- SYS / OBS TYPES
|
||||||
|
|
||||||
// one line per available system
|
// one line per available system
|
||||||
@ -947,15 +957,15 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Navigation_Message
|
|||||||
|
|
||||||
// -------- TIME OF FIRST OBS
|
// -------- TIME OF FIRST OBS
|
||||||
line.clear();
|
line.clear();
|
||||||
boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_time(nav_msg);
|
boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(nav_msg,nav_msg.d_TOW);
|
||||||
std::string timestring=boost::posix_time::to_iso_string(p_utc_time);
|
std::string timestring=boost::posix_time::to_iso_string(p_gps_time);
|
||||||
std::string year (timestring, 0, 4);
|
std::string year (timestring, 0, 4);
|
||||||
std::string month (timestring, 4, 2);
|
std::string month (timestring, 4, 2);
|
||||||
std::string day (timestring, 6, 2);
|
std::string day (timestring, 6, 2);
|
||||||
std::string hour (timestring, 9, 2);
|
std::string hour (timestring, 9, 2);
|
||||||
std::string minutes (timestring, 11, 2);
|
std::string minutes (timestring, 11, 2);
|
||||||
double utc_t = nav_msg.utc_time(nav_msg.sv_clock_correction(nav_msg.d_TOW));
|
double gps_t =nav_msg.d_TOW;
|
||||||
double seconds = fmod(utc_t, 60);
|
double seconds = fmod(gps_t, 60);
|
||||||
line += Rinex_Printer::rightJustify(year, 6);
|
line += Rinex_Printer::rightJustify(year, 6);
|
||||||
line += Rinex_Printer::rightJustify(month, 6);
|
line += Rinex_Printer::rightJustify(month, 6);
|
||||||
line += Rinex_Printer::rightJustify(day, 6);
|
line += Rinex_Printer::rightJustify(day, 6);
|
||||||
@ -981,14 +991,17 @@ void Rinex_Printer::rinex_obs_header(std::ofstream& out, Gps_Navigation_Message
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Navigation_Message nav_msg, std::map<int,double> pseudoranges)
|
void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Navigation_Message nav_msg, double obs_time, std::map<int,double> pseudoranges)
|
||||||
{
|
{
|
||||||
|
// RINEX observations timestamps are GPS timestamps.
|
||||||
|
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
// Should look at the pseudoranges timestamp gnss_pseudorange.timestamp_ms!!!
|
boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(nav_msg,obs_time);
|
||||||
boost::posix_time::ptime p_utc_time = Rinex_Printer::compute_time(nav_msg);
|
std::string timestring=boost::posix_time::to_iso_string(p_gps_time);
|
||||||
std::string timestring=boost::posix_time::to_iso_string(p_utc_time);
|
//double utc_t = nav_msg.utc_time(nav_msg.sv_clock_correction(obs_time));
|
||||||
double utc_t = nav_msg.utc_time(nav_msg.sv_clock_correction(nav_msg.d_TOW));
|
double gps_t=nav_msg.sv_clock_correction(obs_time);
|
||||||
|
|
||||||
std::string month (timestring, 4, 2);
|
std::string month (timestring, 4, 2);
|
||||||
std::string day (timestring, 6, 2);
|
std::string day (timestring, 6, 2);
|
||||||
std::string hour (timestring, 9, 2);
|
std::string hour (timestring, 9, 2);
|
||||||
@ -1025,7 +1038,7 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Navigation_Message nav
|
|||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += minutes;
|
line += minutes;
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::asString(fmod(utc_t, 60), 7);
|
line += Rinex_Printer::asString(fmod(gps_t, 60), 7);
|
||||||
line += std::string(2, ' ');
|
line += std::string(2, ' ');
|
||||||
// Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event
|
// Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event
|
||||||
line += std::string(1, '0');
|
line += std::string(1, '0');
|
||||||
@ -1105,7 +1118,13 @@ void Rinex_Printer::log_rinex_obs(std::ofstream& out, Gps_Navigation_Message nav
|
|||||||
line += minutes;
|
line += minutes;
|
||||||
|
|
||||||
line += std::string(1, ' ');
|
line += std::string(1, ' ');
|
||||||
line += Rinex_Printer::asString(fmod(utc_t, 60), 7);
|
double seconds=fmod(gps_t, 60);
|
||||||
|
// Add extra 0 if seconds are < 10
|
||||||
|
if (seconds<10)
|
||||||
|
{
|
||||||
|
line +=std::string(1, '0');
|
||||||
|
}
|
||||||
|
line += Rinex_Printer::asString(seconds, 7);
|
||||||
line += std::string(2, ' ');
|
line += std::string(2, ' ');
|
||||||
// Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event
|
// Epoch flag 0: OK 1: power failure between previous and current epoch <1: Special event
|
||||||
line += std::string(1, '0');
|
line += std::string(1, '0');
|
||||||
@ -1177,9 +1196,7 @@ int Rinex_Printer::signalStrength(double snr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boost::posix_time::ptime Rinex_Printer::compute_UTC_time(Gps_Navigation_Message nav_msg)
|
||||||
|
|
||||||
boost::posix_time::ptime Rinex_Printer::compute_time(Gps_Navigation_Message nav_msg)
|
|
||||||
{
|
{
|
||||||
// if we are processing a file -> wait to leap second to resolve the ambiguity else take the week from the local system time
|
// if we are processing a file -> wait to leap second to resolve the ambiguity else take the week from the local system time
|
||||||
//: idea resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm
|
//: idea resolve the ambiguity with the leap second http://www.colorado.edu/geography/gcraft/notes/gps/gpseow.htm
|
||||||
@ -1189,6 +1206,19 @@ boost::posix_time::ptime Rinex_Printer::compute_time(Gps_Navigation_Message nav_
|
|||||||
return p_time;
|
return p_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boost::posix_time::ptime Rinex_Printer::compute_GPS_time(Gps_Navigation_Message nav_msg, double obs_time)
|
||||||
|
{
|
||||||
|
// The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here.
|
||||||
|
// (see Section 3 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex211.txt)
|
||||||
|
// (see Pag. 17 in http://igscb.jpl.nasa.gov/igscb/data/format/rinex300.pdf)
|
||||||
|
// --??? No time correction here, since it will be done in the RINEX processor
|
||||||
|
double gps_t = nav_msg.sv_clock_correction(obs_time);
|
||||||
|
//double gps_t=obs_time;
|
||||||
|
boost::posix_time::time_duration t = boost::posix_time::millisec((gps_t + 604800*(double)(nav_msg.i_GPS_week%1024))*1000);
|
||||||
|
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
|
||||||
|
return p_time;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
enum RINEX_enumMarkerType {
|
enum RINEX_enumMarkerType {
|
||||||
@ -1209,4 +1239,3 @@ enum RINEX_enumMarkerType {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +93,13 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Computes the UTC time and returns a boost::posix_time::ptime object
|
* \brief Computes the UTC time and returns a boost::posix_time::ptime object
|
||||||
*/
|
*/
|
||||||
boost::posix_time::ptime compute_time(Gps_Navigation_Message nav_msg);
|
boost::posix_time::ptime compute_UTC_time(Gps_Navigation_Message nav_msg);
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Computes the GPS time and returns a boost::posix_time::ptime object
|
||||||
|
*/
|
||||||
|
boost::posix_time::ptime compute_GPS_time(Gps_Navigation_Message nav_msg, double obs_time);
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Writes data from the navigation message into the RINEX file
|
* \brief Writes data from the navigation message into the RINEX file
|
||||||
@ -103,7 +109,7 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Writes observables into the RINEX file
|
* \brief Writes observables into the RINEX file
|
||||||
*/
|
*/
|
||||||
void log_rinex_obs(std::ofstream& out, Gps_Navigation_Message nav_msg, std::map<int,double> pseudoranges);
|
void log_rinex_obs(std::ofstream& out,Gps_Navigation_Message nav_msg, double obs_time, std::map<int,double> pseudoranges);
|
||||||
std::map<std::string,std::string> satelliteSystem; //<! GPS, GLONASS, SBAS payload, Galileo or Compass
|
std::map<std::string,std::string> satelliteSystem; //<! GPS, GLONASS, SBAS payload, Galileo or Compass
|
||||||
std::map<std::string,std::string> observationType; //<! PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH
|
std::map<std::string,std::string> observationType; //<! PSEUDORANGE, CARRIER_PHASE, DOPPLER, SIGNAL_STRENGTH
|
||||||
std::map<std::string,std::string> observationCode; //<! GNSS observation descriptors
|
std::map<std::string,std::string> observationCode; //<! GNSS observation descriptors
|
||||||
|
Loading…
x
Reference in New Issue
Block a user