1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-31 23:33:03 +00:00

FIRST GALILEO STANDALONE PVT FIX!!

- Bug fixes at Galileo telemetry decoder state machine
- Bug fixes at Galileo Ephemeris decoder (two complement's data interpreted as unsigned, mismatch at the LSB weights)

Galileo KML output is avalable!!

Galileo RINEX is still under construction

git-svn-id: https://svn.code.sf.net/p/gnss-sdr/code/trunk@433 64b25241-fba3-4117-9849-534c7e92360d
This commit is contained in:
Javier Arribas
2013-11-06 20:14:40 +00:00
parent 83a9d41b05
commit 87c5c212a4
20 changed files with 535 additions and 553 deletions

View File

@@ -177,10 +177,11 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it
bool pvt_result;
pvt_result = d_ls_pvt->get_PVT(gnss_pseudoranges_map, d_rx_time, d_flag_averaging);
if (pvt_result==true)
{
d_kml_dump.print_position_galileo(d_ls_pvt, d_flag_averaging);
//ToDo: Implement Galileo RINEX and Galileo NMEA outputs
// if (pvt_result==true)
// {
// d_kml_dump.print_position(d_ls_pvt, d_flag_averaging);
// d_nmea_printer->Print_Nmea_Line(d_ls_pvt, d_flag_averaging);
//
// if (!b_rinex_header_writen) // & we have utc data in nav message!
@@ -210,7 +211,7 @@ int galileo_e1_pvt_cc::general_work (int noutput_items, gr_vector_int &ninput_it
// rp->log_rinex_obs(rp->obsFile, gps_ephemeris_iter->second, d_rx_time, gnss_pseudoranges_map);
// }
// }
// }
}
}
// DEBUG MESSAGE: Display position in console output

View File

@@ -43,7 +43,7 @@
#include "nmea_printer.h"
#include "kml_printer.h"
#include "rinex_printer.h"
#include "galileo_e1_ls_pvt.h" //this file is just a copy of gps
#include "galileo_e1_ls_pvt.h"
#include "GPS_L1_CA.h"
#include "Galileo_E1.h"

View File

@@ -245,7 +245,7 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
double TX_time_corrected_s;
double SV_clock_bias_s = 0;
double GST=0;
//double GST=0;
d_flag_averaging = flag_averaging;
@@ -269,7 +269,18 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
// COMMON RX TIME PVT ALGORITHM MODIFICATION (Like RINEX files)
// first estimate of transmit time
//Galileo_week_number = galileo_ephemeris_iter->second.WN_5;//for GST
//double sec_in_day = 86400;
//double day_in_week = 7;
// t = WN*sec_in_day*day_in_week + TOW; // t is Galileo System Time to use to compute satellite positions
//JAVIER VERSION:
double Rx_time = galileo_current_time;
//to compute satellite position we need GST = WN+TOW (everything expressed in seconds)
//double Rx_time = galileo_current_time + Galileo_week_number*sec_in_day*day_in_week;
double Tx_time = Rx_time - gnss_pseudoranges_iter->second.Pseudorange_m/GALILEO_C_m_s;
// 2- compute the clock drift using the clock model (broadcast) for this SV
@@ -299,11 +310,12 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
double GST=galileo_ephemeris_iter->second.Galileo_System_Time(Galileo_week_number,galileo_current_time);
utc = galileo_utc_model.GST_to_UTC_time(GST, Galileo_week_number);
// get time string gregorian calendar
//std::cout<<"UTC_raw="<<utc<<std::endl;
boost::posix_time::time_duration t = boost::posix_time::seconds(utc);
// 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);
d_position_UTC_time = p_time;
std::cout << "Galileo RX time at " << boost::posix_time::to_simple_string(p_time)<<std::endl;
//std::cout << "Galileo RX time at " << boost::posix_time::to_simple_string(p_time)<<std::endl;
//end debug
// SV ECEF DEBUG OUTPUT
@@ -345,12 +357,16 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
// 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);
d_position_UTC_time = p_time;
std::cout << "Galileo RX time at " << boost::posix_time::to_simple_string(p_time)<<std::endl;
//std::cout << "Galileo RX time at " << boost::posix_time::to_simple_string(p_time)<<std::endl;
DLOG(INFO) << "Galileo Position at TOW=" << galileo_current_time << " in ECEF (X,Y,Z) = " << mypos << std::endl;
cart2geo((double)mypos(0), (double)mypos(1), (double)mypos(2), 4);
// TODO: Compute UTC time and print PVT solution
//ToDo: Find an Observables/PVT random bug with some satellite configurations that gives an erratic PVT solution (i.e. height>50 km)
if (d_height_m>50000)
{
b_valid_position=false;
return false; //erratic PVT
}
DLOG(INFO) << "Galileo Position at " << boost::posix_time::to_simple_string(p_time)
<< " is Lat = " << d_latitude_d << " [deg], Long = " << d_longitude_d
<< " [deg], Height= " << d_height_m << " [m]" << std::endl;

View File

@@ -110,6 +110,36 @@ bool Kml_Printer::print_position(gps_l1_ca_ls_pvt* position,bool print_average_v
}
}
//ToDo: make the class ls_pvt generic and heritate the particular gps/gal/glo ls_pvt in order to
// reuse kml_printer functions
bool Kml_Printer::print_position_galileo(galileo_e1_ls_pvt* position,bool print_average_values)
{
double latitude;
double longitude;
double height;
if (print_average_values == false)
{
latitude = position->d_latitude_d;
longitude = position->d_longitude_d;
height = position->d_height_m;
}
else
{
latitude = position->d_avg_latitude_d;
longitude = position->d_avg_longitude_d;
height = position->d_avg_height_m;
}
if (kml_file.is_open())
{
kml_file << longitude << "," << latitude << "," << height << std::endl;
return true;
}
else
{
return false;
}
}
bool Kml_Printer::close_file()

View File

@@ -30,12 +30,13 @@
*/
#ifndef GNSS_SDR_KML_PRINTER_H_
#define GNSS_SDR_KML_PRINTER_H_
#ifndef GNSS_SDR_KML_PRINTER_H_
#define GNSS_SDR_KML_PRINTER_H_
#include <iostream>
#include <fstream>
#include "gps_l1_ca_ls_pvt.h"
#include "galileo_e1_ls_pvt.h"
/*!
@@ -50,6 +51,7 @@ private:
public:
bool set_headers(std::string filename);
bool print_position(gps_l1_ca_ls_pvt* position, bool print_average_values);
bool print_position_galileo(galileo_e1_ls_pvt* position, bool print_average_values);
bool close_file();
Kml_Printer();
~Kml_Printer();

View File

@@ -157,6 +157,7 @@ int galileo_e1_observables_cc::general_work (int noutput_items, gr_vector_int &n
// compute the required symbol history shift in order to match the reference symbol
delta_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms-d_ref_PRN_rx_time_ms;
//std::cout<<"delta_rx_time_ms["<<gnss_synchro_iter->second.Channel_ID<<"]="<<delta_rx_time_ms<<std::endl;
//std::cout<<"d_TOW_at_current_symbol["<<gnss_synchro_iter->second.Channel_ID<<"]="<<gnss_synchro_iter->second.d_TOW_at_current_symbol<<std::endl;
//compute the pseudorange
traveltime_ms = (d_TOW_reference-gnss_synchro_iter->second.d_TOW_at_current_symbol)*1000.0 + delta_rx_time_ms + GALILEO_STARTOFFSET_ms;
//std::cout<<"traveltime_ms="<<traveltime_ms<<std::endl;

View File

@@ -64,10 +64,7 @@ galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, long if_freq, lo
void galileo_e1b_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
{
for (unsigned i = 0; i < 3; i++)
{
ninput_items_required[i] = GALILEO_INAV_PAGE_SYMBOLS; //set the required sample history
}
ninput_items_required[0] = GALILEO_INAV_PAGE_SYMBOLS; //set the required sample history
}
@@ -386,50 +383,45 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
current_synchro_data = in[0][0];
//std::cout<<"flag TOW before add the telemetry decoder information: d_nav.flag_TOW_set"<<std::endl;
//2. Add the telemetry decoder information
if (this->d_flag_preamble==true and d_nav.flag_TOW_set==true) //update TOW at the preamble instant (todo: check for valid d_TOW) //flag preamble is true after the all page (even or odd) is recevived
if (this->d_flag_preamble==true and d_nav.flag_TOW_set==true)
//update TOW at the preamble instant
//flag preamble is true after the all page (even and odd) is recevived. I/NAV page period is 2 SECONDS
{
//std::cout<<"time stamp, identified preamble and TOW set" << std::endl;
Prn_timestamp_at_preamble_ms = in[0][0].Tracking_timestamp_secs * 1000.0;
if((d_nav.flag_TOW_5 == 1) and (d_nav.Page_type_time_stamp == 5)) //page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
if(d_nav.flag_TOW_5 == true) //page 5 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
{
//std::cout<< "Using TOW_5 for timestamping" << std::endl;
d_TOW_at_Preamble = d_nav.TOW_5+GALILEO_PAGE_SECONDS; //TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later
/* 1 sec (GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD) is added because if we have a TOW value it means that we are at the and of the odd page*/
d_TOW_at_current_symbol = d_TOW_at_Preamble + GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD;
//std::cout << "d_TOW_at_current_symbol="<< d_TOW_at_current_symbol << std::endl;
d_nav.flag_TOW_5 = 0;
d_TOW_at_Preamble = d_nav.TOW_5+GALILEO_INAV_PAGE_PART_SECONDS; //TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later
/* 1 sec (GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD) is added because
* if we have a TOW value it means that we are at the begining of the last page part
* (GNU Radio history keeps in a buffer the rest of the incomming frame part)*/
d_TOW_at_current_symbol = d_TOW_at_Preamble;// + GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD;
d_nav.flag_TOW_5 = false;
}
else if((d_nav.flag_TOW_6 == 1) and (d_nav.Page_type_time_stamp == 6)) //page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
else if(d_nav.flag_TOW_6 == true) //page 6 arrived and decoded, so we are in the odd page (since Tow refers to the even page, we have to add 1 sec)
{
//std::cout<< "Using TOW_6 for timestamping" << std::endl;
d_TOW_at_Preamble = d_nav.TOW_6+GALILEO_PAGE_SECONDS; //TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later
//std::cout << "d_TOW_at_Preamble="<< d_TOW_at_Preamble<< std::endl;
d_TOW_at_current_symbol = d_TOW_at_Preamble + GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD;
//std::cout << "d_TOW_at_current_symbol="<< d_TOW_at_current_symbol << std::endl;
d_nav.flag_TOW_6 = 0;
d_TOW_at_Preamble = d_nav.TOW_6+GALILEO_INAV_PAGE_PART_SECONDS;
//TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later
/* 1 sec (GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD) is added because
* if we have a TOW value it means that we are at the begining of the last page part
* (GNU Radio history keeps in a buffer the rest of the incomming frame part)*/
d_TOW_at_current_symbol = d_TOW_at_Preamble;// + GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD;
d_nav.flag_TOW_6 = false;
}
else
{
d_TOW_at_Preamble = d_TOW_at_Preamble + GALILEO_PAGE_SECONDS; //this is the even preamble after the last odd preamble
//std::cout << "d_TOW_at_Preamble="<< d_TOW_at_Preamble << std::endl;
d_TOW_at_current_symbol = d_TOW_at_Preamble + GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD;
//std::cout << "d_TOW_at_current_symbol="<< d_TOW_at_current_symbol << std::endl;
//this page has no timming information
d_TOW_at_Preamble = d_TOW_at_Preamble + GALILEO_INAV_PAGE_SECONDS;
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GALIELO_E1_CODE_PERIOD;// + GALILEO_INAV_PAGE_PART_SYMBOLS*GALIELO_E1_CODE_PERIOD;
}
//std::cout << "Prn_timestamp_at_preamble_ms ="<< Prn_timestamp_at_preamble_ms << std::endl;
}
else //if there is not a new preamble, we define the TOW of the current symbol
{
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GALIELO_E1_CODE_PERIOD;
//std::cout << "d_TOW_at_current_symbol="<< d_TOW_at_current_symbol << std::endl;
}
//if (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true)
@@ -442,7 +434,6 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
current_synchro_data.d_TOW = d_TOW_at_Preamble;
current_synchro_data.d_TOW_at_current_symbol = d_TOW_at_current_symbol;
//current_synchro_data.Flag_valid_word = (d_flag_frame_sync == true and d_nav.flag_TOW_set==true and d_nav.flag_CRC_test == true);
current_synchro_data.Flag_preamble = d_flag_preamble;
current_synchro_data.Prn_timestamp_ms = in[0][0].Tracking_timestamp_secs * 1000.0;
current_synchro_data.Prn_timestamp_at_preamble_ms = Prn_timestamp_at_preamble_ms;

View File

@@ -444,26 +444,28 @@ int galileo_e1_dll_pll_veml_tracking_cc::general_work (int noutput_items,gr_vect
/*!
* \todo The stop timer has to be moved to the signal source!
*/
// debug: Second counter in channel 0
if (d_channel == 0)
{
if (floor(d_sample_counter / d_fs_in) != d_last_seg)
{
d_last_seg = floor(d_sample_counter / d_fs_in);
std::cout << "Current input signal time = " << d_last_seg << " [s]" << std::endl;
std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
}
}
else
{
if (floor(d_sample_counter / d_fs_in) != d_last_seg)
{
d_last_seg = floor(d_sample_counter / d_fs_in);
std::cout << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
<< ", CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
}
}
// stream to collect cout calls to improve thread safety
std::stringstream tmp_str_stream;
if (floor(d_sample_counter / d_fs_in) != d_last_seg)
{
d_last_seg = floor(d_sample_counter / d_fs_in);
if (d_channel == 0)
{
// debug: Second counter in channel 0
tmp_str_stream << "Current input signal time = " << d_last_seg << " [s]" << std::endl << std::flush;
std::cout << tmp_str_stream.rdbuf() << std::flush;
}
tmp_str_stream << "Tracking CH " << d_channel << ": Satellite " << Gnss_Satellite(systemName[sys], d_acquisition_gnss_synchro->PRN)
<< ", Doppler="<<d_carrier_doppler_hz<<" [Hz] CN0 = " << d_CN0_SNV_dB_Hz << " [dB-Hz]" << std::endl;
std::cout << tmp_str_stream.rdbuf() << std::flush;
//std::cout<<"TRK CH "<<d_channel<<" Carrier_lock_test="<<d_carrier_lock_test<< std::endl;
//if (d_channel == 0 || d_last_seg==5) d_carrier_lock_fail_counter=500; //DEBUG: force unlock!
}
}
else
{