1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-07-03 10:32:55 +00:00

Fix computation of time in the hybrid Galileo/GPS solution

This commit is contained in:
Carles Fernandez 2016-05-10 21:19:09 +02:00
parent 3bd4547b57
commit fc7d3118c5

View File

@ -69,8 +69,6 @@ hybrid_ls_pvt::hybrid_ls_pvt(int nchannels, std::string dump_filename, bool flag
} }
hybrid_ls_pvt::~hybrid_ls_pvt() hybrid_ls_pvt::~hybrid_ls_pvt()
{ {
d_dump_file.close(); d_dump_file.close();
@ -79,10 +77,6 @@ hybrid_ls_pvt::~hybrid_ls_pvt()
} }
bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, double hybrid_current_time, bool flag_averaging) bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, double hybrid_current_time, bool flag_averaging)
{ {
std::map<int,Gnss_Synchro>::iterator gnss_pseudoranges_iter; std::map<int,Gnss_Synchro>::iterator gnss_pseudoranges_iter;
@ -115,10 +109,8 @@ bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, do
gnss_pseudoranges_iter != gnss_pseudoranges_map.end(); gnss_pseudoranges_iter != gnss_pseudoranges_map.end();
gnss_pseudoranges_iter++) gnss_pseudoranges_iter++)
{ {
if(gnss_pseudoranges_iter->second.System == 'E') if(gnss_pseudoranges_iter->second.System == 'E')
{ {
//std::cout << "Satellite System: " << gnss_pseudoranges_iter->second.System <<std::endl;
// 1 Gal - find the ephemeris for the current GALILEO SV observation. The SV PRN ID is the map key // 1 Gal - find the ephemeris for the current GALILEO SV observation. The SV PRN ID is the map key
galileo_ephemeris_iter = galileo_ephemeris_map.find(gnss_pseudoranges_iter->second.PRN); galileo_ephemeris_iter = galileo_ephemeris_map.find(gnss_pseudoranges_iter->second.PRN);
if (galileo_ephemeris_iter != galileo_ephemeris_map.end()) if (galileo_ephemeris_iter != galileo_ephemeris_map.end())
@ -241,6 +233,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, do
mypos = leastSquarePos(satpos, obs, W); mypos = leastSquarePos(satpos, obs, W);
d_rx_dt_m = mypos(3)/GPS_C_m_s; // Convert RX time offset from meters to seconds d_rx_dt_m = mypos(3)/GPS_C_m_s; // Convert RX time offset from meters to seconds
double secondsperweek = 604800.0;
// Compute GST and Gregorian time // Compute GST and Gregorian time
if( GST != 0.0) if( GST != 0.0)
{ {
@ -248,14 +241,15 @@ bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map, do
} }
else else
{ {
utc = gps_utc_model.utc_time(TX_time_corrected_s, GPS_week); utc = gps_utc_model.utc_time(TX_time_corrected_s, GPS_week) + secondsperweek * static_cast<double>(GPS_week);
} }
// get time string Gregorian calendar // get time string Gregorian calendar
double secondsperweek = 604800.0; // number of seconds in one week (7*24*60*60) boost::posix_time::time_duration t = boost::posix_time::seconds(utc);
boost::posix_time::time_duration t = boost::posix_time::seconds(utc + secondsperweek * static_cast<double>(GPS_week));
// 22 August 1999 00:00 last Galileo start GST epoch (ICD sec 5.1.2) // 22 August 1999 00:00 last Galileo start GST epoch (ICD sec 5.1.2)
boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t); boost::posix_time::ptime p_time(boost::gregorian::date(1999, 8, 22), t);
d_position_UTC_time = p_time; d_position_UTC_time = p_time;
DLOG(INFO) << "HYBRID Position at TOW=" << hybrid_current_time << " in ECEF (X,Y,Z) = " << mypos; DLOG(INFO) << "HYBRID Position at TOW=" << hybrid_current_time << " in ECEF (X,Y,Z) = " << mypos;
cart2geo(static_cast<double>(mypos(0)), static_cast<double>(mypos(1)), static_cast<double>(mypos(2)), 4); cart2geo(static_cast<double>(mypos(0)), static_cast<double>(mypos(1)), static_cast<double>(mypos(2)), 4);