1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-25 22:43:14 +00:00

Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next

This commit is contained in:
Carles Fernandez 2017-05-16 18:47:04 +02:00
commit 16561a5f14
8 changed files with 107 additions and 180 deletions

View File

@ -410,57 +410,7 @@ RtklibPvt::RtklibPvt(ConfigurationInterface* configuration,
{} /* char pppopt[256] ppp option "-GAP_RESION=" default gap to reset iono parameters (ep) */
};
sol_t sol_ = {{0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, {0,0,0,0,0,0}, '0', '0', '0', 0, 0, 0 };
ambc_t ambc_ = { {{0,0}, {0,0}, {0,0}, {0,0}}, {0, 0, 0, 0}, {}, {}, 0, {'0'}};
ssat_t ssat_ = { '0', /* navigation system */
'0', /* valid satellite flag single */
{0.0}, /* azel[2] azimuth/elevation angles {az,el} (rad) */
{0.0}, /* residuals of pseudorange (m) */
{0.0}, /* residuals of carrier-phase (m) */
{'0'}, /* valid satellite flag */
{'0'}, /* signal strength (0.25 dBHz) */
{'0'}, /* ambiguity fix flag (1:fix,2:float,3:hold) */
{'0'}, /* cycle-slip flag */
{'0'}, /* half-cycle valid flag */
{}, /* lock counter of phase */
{}, /* obs outage counter of phase */
{}, /* cycle-slip counter */
{}, /* reject counter */
0.0, /* geometry-free phase L1-L2 (m) */
0.0, /* geometry-free phase L1-L5 (m) */
0.0, /* MW-LC (m) */
0.0, /* phase windup (cycle) */
{{{0,0}},{{0,0}}}, /* previous carrier-phase time */
{{},{}} /* previous carrier-phase observable (cycle) */
};
int nx = 0; /* Number of estimated states */
if(positioning_mode <= PMODE_FIXED) nx = 4 + 3;
if(positioning_mode >= PMODE_PPP_KINEMA) nx = NX_PPP(&rtklib_configuration_options);
int na = NP_PPP(&rtklib_configuration_options);
double x[nx];
double Px[nx*nx];
double xa[na];
double Pa[na*na];
rtk = { sol_, /* RTK solution */
{}, /* base position/velocity (ecef) (m|m/s) */
nx, /* number of float states */
na, /* number of fixed states */
output_rate_ms / 1000.0, /* time difference between current and previous (s) */
x, /* float states */
Px, /* float states covariance */
xa, /* fixed states */
Pa, /* fixed states covariance */
3, /* number of continuous fixes of ambiguity */
{ambc_}, /* ambiguity control */
{ssat_}, /* satellite status */
256, /* bytes in error message buffer */
{'0'}, /* error message buffer */
rtklib_configuration_options /* processing options */
};
rtkinit(&rtk, &rtklib_configuration_options);
// make PVT object
pvt_ = rtklib_make_pvt_cc(in_streams_, dump_, dump_filename_, output_rate_ms, display_rate_ms, flag_nmea_tty_port, nmea_dump_filename, nmea_dump_devname, rinex_version, flag_rtcm_server, flag_rtcm_tty_port, rtcm_tcp_port, rtcm_station_id, rtcm_msg_rate_ms, rtcm_dump_devname, type_of_receiver, rtk);
@ -500,6 +450,7 @@ bool RtklibPvt::save_assistance_to_XML()
RtklibPvt::~RtklibPvt()
{
rtkfree(&rtk);
save_assistance_to_XML();
}

View File

@ -52,8 +52,6 @@
*----------------------------------------------------------------------------*/
#include "rtklib_rtcm.h"
#include "rtklib_rtcm2.h"
#include "rtklib_rtcm3.h"
#include "rtklib_rtkcmn.h"
//extern int encode_rtcm3(rtcm_t *rtcm, int type, int sync);

View File

@ -51,12 +51,14 @@
*
*----------------------------------------------------------------------------*/
#include "rtklib.h"
#ifndef GNSS_SDR_RTKLIB_RTCM_H_
#define GNSS_SDR_RTKLIB_RTCM_H_
#include "rtklib.h"
#include "rtklib_rtcm2.h"
#include "rtklib_rtcm3.h"
#define RTCM2PREAMB 0x66 /* rtcm ver.2 frame preamble */
#define RTCM3PREAMB 0xD3 /* rtcm ver.3 frame preamble */

View File

@ -54,7 +54,6 @@
#include "rtklib_rtcm2.h"
#include "rtklib_rtcm3.h"
#include "rtklib_rtkcmn.h"

View File

@ -56,8 +56,54 @@
#include "rtklib_rtkcmn.h"
/* msm signal id table -------------------------------------------------------*/
const char *msm_sig_gps[32] = {
/* GPS: ref [13] table 3.5-87, ref [14][15] table 3.5-91 */
"" , "1C", "1P", "1W", "1Y", "1M", "" , "2C", "2P", "2W", "2Y", "2M", /* 1-12 */
"" , "" , "2S", "2L", "2X", "" , "" , "" , "" , "5I", "5Q", "5X", /* 13-24 */
"" , "" , "" , "" , "" , "1S", "1L", "1X" /* 25-32 */
};
const char *msm_sig_glo[32] = {
/* GLONASS: ref [13] table 3.5-93, ref [14][15] table 3.5-97 */
"" , "1C", "1P", "" , "" , "" , "" , "2C", "2P", "" , "3I", "3Q",
"3X", "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,
"" , "" , "" , "" , "" , "" , "" , ""
};
const char *msm_sig_gal[32] = {
/* Galileo: ref [15] table 3.5-100 */
"" , "1C", "1A", "1B", "1X", "1Z", "" , "6C", "6A", "6B", "6X", "6Z",
"" , "7I", "7Q", "7X", "" , "8I", "8Q", "8X", "" , "5I", "5Q", "5X",
"" , "" , "" , "" , "" , "" , "" , ""
};
const char *msm_sig_qzs[32] = {
/* QZSS: ref [15] table 3.5-103 */
"" , "1C", "" , "" , "" , "" , "" , "" , "6S", "6L", "6X", "" ,
"" , "" , "2S", "2L", "2X", "" , "" , "" , "" , "5I", "5Q", "5X",
"" , "" , "" , "" , "" , "1S", "1L", "1X"
};
const char *msm_sig_sbs[32] = {
/* SBAS: ref [13] table 3.5-T+005 */
"" , "1C", "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,
"" , "" , "" , "" , "" , "" , "" , "" , "" , "5I", "5Q", "5X",
"" , "" , "" , "" , "" , "" , "" , ""
};
const char *msm_sig_cmp[32] = {
/* BeiDou: ref [15] table 3.5-106 */
"" , "1I", "1Q", "1X", "" , "" , "" , "6I", "6Q", "6X", "" , "" ,
"" , "7I", "7Q", "7X", "" , "" , "" , "" , "" , "" , "" , "" ,
"" , "" , "" , "" , "" , "" , "" , ""
};
/* get sign-magnitude bits ---------------------------------------------------*/
double getbitg(const unsigned char *buff, int pos, int len)
{
@ -137,7 +183,7 @@ unsigned char snratio(double snr)
/* get observation data index ------------------------------------------------*/
int obsindex(obs_t *obs, gtime_t time, int sat)
int obsindex3(obs_t *obs, gtime_t time, int sat)
{
int i, j;
@ -274,7 +320,7 @@ int decode_type1002(rtcm_t *rtcm)
{
rtcm->obs.n = rtcm->obsflag = 0;
}
if ((index = obsindex(&rtcm->obs, rtcm->time, sat)) < 0) continue;
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
pr1 = pr1*0.02+amb*PRUNIT_GPS;
if (ppr1 != (int)0xFFF80000)
{
@ -342,7 +388,7 @@ int decode_type1004(rtcm_t *rtcm)
{
rtcm->obs.n = rtcm->obsflag = 0;
}
if ((index = obsindex(&rtcm->obs, rtcm->time, sat)) < 0) continue;
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
pr1 = pr1*0.02+amb*PRUNIT_GPS;
if (ppr1 != (int)0xFFF80000)
{
@ -624,7 +670,7 @@ int decode_type1010(rtcm_t *rtcm)
{
rtcm->obs.n = rtcm->obsflag = 0;
}
if ((index = obsindex(&rtcm->obs, rtcm->time, sat)) < 0) continue;
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
pr1 = pr1*0.02+amb*PRUNIT_GLO;
if (ppr1 != (int)0xFFF80000)
{
@ -685,7 +731,7 @@ int decode_type1012(rtcm_t *rtcm)
{
rtcm->obs.n = rtcm->obsflag = 0;
}
if ((index = obsindex(&rtcm->obs, rtcm->time, sat)) < 0) continue;
if ((index = obsindex3(&rtcm->obs, rtcm->time, sat)) < 0) continue;
pr1 = pr1*0.02+amb*PRUNIT_GLO;
if (ppr1 != (int)0xFFF80000)
{
@ -2140,7 +2186,7 @@ void save_msm_obs(rtcm_t *rtcm, int sys, msm_h_t *h, const double *r,
{
rtcm->obs.n = rtcm->obsflag = 0;
}
index = obsindex(&rtcm->obs, rtcm->time, sat);
index = obsindex3(&rtcm->obs, rtcm->time, sat);
}
else
{

View File

@ -63,54 +63,6 @@ const double PRUNIT_GLO = 599584.916; /* rtcm ver.3 unit of glonass pseudorange
const double RANGE_MS = SPEED_OF_LIGHT * 0.001; /* range in 1 ms */
/* msm signal id table -------------------------------------------------------*/
const char *msm_sig_gps[32] = {
/* GPS: ref [13] table 3.5-87, ref [14][15] table 3.5-91 */
"" , "1C", "1P", "1W", "1Y", "1M", "" , "2C", "2P", "2W", "2Y", "2M", /* 1-12 */
"" , "" , "2S", "2L", "2X", "" , "" , "" , "" , "5I", "5Q", "5X", /* 13-24 */
"" , "" , "" , "" , "" , "1S", "1L", "1X" /* 25-32 */
};
const char *msm_sig_glo[32] = {
/* GLONASS: ref [13] table 3.5-93, ref [14][15] table 3.5-97 */
"" , "1C", "1P", "" , "" , "" , "" , "2C", "2P", "" , "3I", "3Q",
"3X", "" , "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,
"" , "" , "" , "" , "" , "" , "" , ""
};
const char *msm_sig_gal[32] = {
/* Galileo: ref [15] table 3.5-100 */
"" , "1C", "1A", "1B", "1X", "1Z", "" , "6C", "6A", "6B", "6X", "6Z",
"" , "7I", "7Q", "7X", "" , "8I", "8Q", "8X", "" , "5I", "5Q", "5X",
"" , "" , "" , "" , "" , "" , "" , ""
};
const char *msm_sig_qzs[32] = {
/* QZSS: ref [15] table 3.5-103 */
"" , "1C", "" , "" , "" , "" , "" , "" , "6S", "6L", "6X", "" ,
"" , "" , "2S", "2L", "2X", "" , "" , "" , "" , "5I", "5Q", "5X",
"" , "" , "" , "" , "" , "1S", "1L", "1X"
};
const char *msm_sig_sbs[32] = {
/* SBAS: ref [13] table 3.5-T+005 */
"" , "1C", "" , "" , "" , "" , "" , "" , "" , "" , "" , "" ,
"" , "" , "" , "" , "" , "" , "" , "" , "" , "5I", "5Q", "5X",
"" , "" , "" , "" , "" , "" , "" , ""
};
const char *msm_sig_cmp[32] = {
/* BeiDou: ref [15] table 3.5-106 */
"" , "1I", "1Q", "1X", "" , "" , "" , "6I", "6Q", "6X", "" , "" ,
"" , "7I", "7Q", "7X", "" , "" , "" , "" , "" , "" , "" , "" ,
"" , "" , "" , "" , "" , "" , "" , ""
};
/* ssr update intervals ------------------------------------------------------*/
const double ssrudint[16] = {
@ -169,7 +121,7 @@ int lossoflock(rtcm_t *rtcm, int sat, int freq, int lock);
unsigned char snratio(double snr);
int obsindex(obs_t *obs, gtime_t time, int sat);
int obsindex3(obs_t *obs, gtime_t time, int sat);
int test_staid(rtcm_t *rtcm, int staid);

View File

@ -54,16 +54,6 @@ galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump)
}
void galileo_e1b_telemetry_decoder_cc::forecast (int noutput_items, gr_vector_int &ninput_items_required)
{
if(noutput_items != 0)
{
ninput_items_required[0] = GALILEO_INAV_PAGE_SYMBOLS; // set the required sample history
}
}
void galileo_e1b_telemetry_decoder_cc::viterbi_decoder(double *page_part_symbols, int *page_part_bits)
{
int CodeLength = 240;
@ -161,7 +151,6 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
d_flag_frame_sync = false;
d_flag_parity = false;
d_TOW_at_Preamble = 0;
d_TOW_at_current_symbol = 0;
delta_t = 0;
d_CRC_error_counter = 0;
@ -286,25 +275,34 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
int preamble_diff = 0;
Gnss_Synchro **out = (Gnss_Synchro **) &output_items[0];
d_sample_counter++; //count for the processed samples
// ########### Output the tracking data to navigation and PVT ##########
const Gnss_Synchro **in = (const Gnss_Synchro **) &input_items[0]; //Get the input samples pointer
// TODO Optimize me!
//******* preamble correlation ********
for (int i = 0; i < d_symbols_per_preamble; i++)
{
if (in[0][i].Prompt_I < 0) // symbols clipping
{
corr_value -= d_preambles_symbols[i];
}
else
{
corr_value += d_preambles_symbols[i];
}
}
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
//1. Copy the current tracking output
current_symbol = in[0][0];
d_symbol_history.push_back(current_symbol); //add new symbol to the symbol queue
d_sample_counter++; //count for the processed samples
consume_each(1);
d_flag_preamble = false;
unsigned int required_symbols=GALILEO_INAV_PAGE_SYMBOLS+d_symbols_per_preamble;
if (d_symbol_history.size()>required_symbols)
{
// TODO Optimize me!
//******* preamble correlation ********
for (int i = 0; i < d_symbols_per_preamble; i++)
{
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
{
corr_value -= d_preambles_symbols[i];
}
else
{
corr_value += d_preambles_symbols[i];
}
}
}
//******* frame sync ******************
if (d_stat == 0) //no preamble information
@ -351,12 +349,12 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
{
if (corr_value > 0)
{
page_part_symbols[i] = in[0][i + d_symbols_per_preamble].Prompt_I; // because last symbol of the preamble is just received now!
page_part_symbols[i] = d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now!
}
else
{
page_part_symbols[i] = -in[0][i + d_symbols_per_preamble].Prompt_I; // because last symbol of the preamble is just received now!
page_part_symbols[i] = -d_symbol_history.at(i + d_symbols_per_preamble).Prompt_I; // because last symbol of the preamble is just received now!
}
}
@ -371,7 +369,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
{
d_flag_frame_sync = true;
DLOG(INFO) << " Frame sync SAT " << this->d_satellite << " with preamble start at "
<< in[0][0].Tracking_sample_counter << " [samples]";
<< d_symbol_history.at(0).Tracking_sample_counter << " [samples]";
}
}
else
@ -388,47 +386,27 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
}
}
consume_each(1); //one by one
// UPDATE GNSS SYNCHRO DATA
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];
//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
// JAVI: 30/06/2014
// TOW, in Galileo, is referred to the START of the PAGE PART, that is, THE FIRST SYMBOL OF THAT PAGE, NOT THE PREAMBLE.
// thus, no correction should be done. d_TOW_at_Preamble should be renamed to d_TOW_at_page_start.
// Since we detected the preamble, then, we are in the last symbol of that preamble, or just at the start of the first page symbol.
//flag preamble is true after the all page (even and odd) is received. I/NAV page period is 2 SECONDS
{
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_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*GALILEO_E1_CODE_PERIOD) is added because
* if we have a TOW value it means that we are at the beginning of the last page part
* (GNU Radio history keeps in a buffer the rest of the incoming frame part)*/
d_TOW_at_current_symbol = d_TOW_at_Preamble;//-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
//TOW_5 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_current_symbol = d_nav.TOW_5 + GALILEO_INAV_PAGE_PART_SECONDS+((double)required_symbols)*GALILEO_E1_CODE_PERIOD; //-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_nav.flag_TOW_5 = false;
}
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_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*GALILEO_E1_CODE_PERIOD) is added because
* if we have a TOW value it means that we are at the beginning of the last page part
* (GNU Radio history keeps in a buffer the rest of the incoming frame part)*/
d_TOW_at_current_symbol = d_TOW_at_Preamble;//-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
//TOW_6 refers to the even preamble, but when we decode it we are in the odd part, so 1 second later plus the decoding delay
d_TOW_at_current_symbol = d_nav.TOW_6 + GALILEO_INAV_PAGE_PART_SECONDS+((double)required_symbols)*GALILEO_E1_CODE_PERIOD;//-GALILEO_E1_CODE_PERIOD;//+ (double)GALILEO_INAV_PREAMBLE_LENGTH_BITS/(double)GALILEO_TELEMETRY_RATE_BITS_SECOND;
d_nav.flag_TOW_6 = false;
}
else
{
//this page has no timing information
d_TOW_at_Preamble = d_TOW_at_Preamble + GALILEO_INAV_PAGE_SECONDS;
d_TOW_at_current_symbol = d_TOW_at_current_symbol + GALILEO_E1_CODE_PERIOD;// + GALILEO_INAV_PAGE_PART_SYMBOLS*GALILEO_E1_CODE_PERIOD;
}
}
@ -446,15 +424,15 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
if (d_flag_frame_sync == true and d_nav.flag_TOW_set == true)
{
current_synchro_data.Flag_valid_word = true;
current_symbol.Flag_valid_word = true;
}
else
{
current_synchro_data.Flag_valid_word = false;
current_symbol.Flag_valid_word = false;
}
current_synchro_data.TOW_at_current_symbol_s = floor(d_TOW_at_current_symbol*1000.0)/1000.0;
current_synchro_data.TOW_at_current_symbol_s -=delta_t; //Galileo to GPS TOW
current_symbol.TOW_at_current_symbol_s = floor(d_TOW_at_current_symbol*1000.0)/1000.0;
current_symbol.TOW_at_current_symbol_s -=delta_t; //Galileo to GPS TOW
if(d_dump == true)
{
@ -465,9 +443,9 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
unsigned long int tmp_ulong_int;
tmp_double = d_TOW_at_current_symbol;
d_dump_file.write((char*)&tmp_double, sizeof(double));
tmp_ulong_int = current_synchro_data.Tracking_sample_counter;
tmp_ulong_int = current_symbol.Tracking_sample_counter;
d_dump_file.write((char*)&tmp_ulong_int, sizeof(unsigned long int));
tmp_double = d_TOW_at_Preamble;
tmp_double = 0;
d_dump_file.write((char*)&tmp_double, sizeof(double));
}
catch (const std::ifstream::failure & e)
@ -475,11 +453,16 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items __attribut
LOG(WARNING) << "Exception writing observables dump file " << e.what();
}
}
// remove used symbols from history
if (d_symbol_history.size()>required_symbols)
{
d_symbol_history.pop_front();
}
//3. Make the output (copy the object contents to the GNURadio reserved memory)
*out[0] = current_synchro_data;
*out[0] = current_symbol;
//std::cout<<"GPS L1 TLM output on CH="<<this->d_channel << " SAMPLE STAMP="<<d_sample_counter/d_decimation_output_factor<<std::endl;
return 1;
}

View File

@ -43,6 +43,7 @@
#include "galileo_almanac.h"
#include "galileo_iono.h"
#include "galileo_utc_model.h"
#include "gnss_synchro.h"
@ -70,12 +71,6 @@ public:
int general_work (int noutput_items, gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
/*!
* \brief Function which tells the scheduler how many input items
* are required to produce noutput_items output items.
*/
void forecast (int noutput_items, gr_vector_int &ninput_items_required);
private:
friend galileo_e1b_telemetry_decoder_cc_sptr
galileo_e1b_make_telemetry_decoder_cc(Gnss_Satellite satellite, bool dump);
@ -93,6 +88,8 @@ private:
unsigned int d_samples_per_symbol;
int d_symbols_per_preamble;
std::deque<Gnss_Synchro> d_symbol_history;
long unsigned int d_sample_counter;
long unsigned int d_preamble_index;
unsigned int d_stat;
@ -109,7 +106,6 @@ private:
Gnss_Satellite d_satellite;
int d_channel;
double d_TOW_at_Preamble;
double d_TOW_at_current_symbol;
bool flag_TOW_set;