mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Merge branch 'next' of https://github.com/gnss-sdr/gnss-sdr into next
This commit is contained in:
commit
b5c9015fbe
@ -108,8 +108,6 @@ Channel::Channel(ConfigurationInterface* configuration, unsigned int channel,
|
||||
|
||||
// Destructor
|
||||
Channel::~Channel() {}
|
||||
|
||||
|
||||
void Channel::connect(gr::top_block_sptr top_block)
|
||||
{
|
||||
if (connected_)
|
||||
@ -137,8 +135,6 @@ void Channel::connect(gr::top_block_sptr top_block)
|
||||
DLOG(INFO) << "tracking -> telemetry_decoder";
|
||||
|
||||
// Message ports
|
||||
top_block->msg_connect(nav_->get_left_block(), pmt::mp("preamble_timestamp_s"), trk_->get_right_block(), pmt::mp("preamble_timestamp_s"));
|
||||
DLOG(INFO) << "MSG FEEDBACK CHANNEL telemetry_decoder -> tracking";
|
||||
|
||||
top_block->msg_connect(acq_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events"));
|
||||
top_block->msg_connect(trk_->get_right_block(), pmt::mp("events"), channel_msg_rx, pmt::mp("events"));
|
||||
|
@ -2,7 +2,7 @@
|
||||
* \file gnss_circular_deque.h
|
||||
* \brief This class implements a circular deque for Gnss_Synchro
|
||||
*
|
||||
* \author Luis Esteve, 2018. antonio.ramos(at)cttc.es
|
||||
* \author Antonio Ramos, 2018. antonio.ramosdet(at)gmail.com
|
||||
*
|
||||
* Detailed description of the file here if needed.
|
||||
*
|
||||
|
@ -63,8 +63,8 @@ hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels_in,
|
||||
d_dump_filename = dump_filename;
|
||||
T_rx_s = 0.0;
|
||||
T_rx_step_s = 0.001; // 1 ms
|
||||
max_delta = 3.5; // 3.5 s
|
||||
d_latency = 0.08; // 80 ms
|
||||
max_delta = 1.5; // 1.5 s
|
||||
d_latency = 0.175; // 175 ms
|
||||
valid_channels.resize(d_nchannels, false);
|
||||
d_num_valid_channels = 0;
|
||||
d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(static_cast<unsigned int>(max_delta * 1000.0), d_nchannels);
|
||||
@ -306,21 +306,18 @@ bool hybrid_observables_cc::interpolate_data(Gnss_Synchro &out, const unsigned i
|
||||
{
|
||||
return false;
|
||||
}
|
||||
std::pair<unsigned int, unsigned int> ind = find_interp_elements(ch, ti);
|
||||
find_interp_elements(ch, ti);
|
||||
|
||||
//Linear interpolation: y(t) = y(t1) + (y(t2) - y(t1)) * (t - t1) / (t2 - t1)
|
||||
|
||||
// CARRIER PHASE INTERPOLATION
|
||||
|
||||
out.Carrier_phase_rads = d_gnss_synchro_history->at(ch, ind.first).Carrier_phase_rads + (d_gnss_synchro_history->at(ch, ind.second).Carrier_phase_rads - d_gnss_synchro_history->at(ch, ind.first).Carrier_phase_rads) * (ti - d_gnss_synchro_history->at(ch, ind.first).RX_time) / (d_gnss_synchro_history->at(ch, ind.second).RX_time - d_gnss_synchro_history->at(ch, ind.first).RX_time);
|
||||
out.Carrier_phase_rads = d_gnss_synchro_history->at(ch, 0).Carrier_phase_rads + (d_gnss_synchro_history->at(ch, 1).Carrier_phase_rads - d_gnss_synchro_history->at(ch, 0).Carrier_phase_rads) * (ti - d_gnss_synchro_history->at(ch, 0).RX_time) / (d_gnss_synchro_history->at(ch, 1).RX_time - d_gnss_synchro_history->at(ch, 0).RX_time);
|
||||
|
||||
// CARRIER DOPPLER INTERPOLATION
|
||||
|
||||
out.Carrier_Doppler_hz = d_gnss_synchro_history->at(ch, ind.first).Carrier_Doppler_hz + (d_gnss_synchro_history->at(ch, ind.second).Carrier_Doppler_hz - d_gnss_synchro_history->at(ch, ind.first).Carrier_Doppler_hz) * (ti - d_gnss_synchro_history->at(ch, ind.first).RX_time) / (d_gnss_synchro_history->at(ch, ind.second).RX_time - d_gnss_synchro_history->at(ch, ind.first).RX_time);
|
||||
out.Carrier_Doppler_hz = d_gnss_synchro_history->at(ch, 0).Carrier_Doppler_hz + (d_gnss_synchro_history->at(ch, 1).Carrier_Doppler_hz - d_gnss_synchro_history->at(ch, 0).Carrier_Doppler_hz) * (ti - d_gnss_synchro_history->at(ch, 0).RX_time) / (d_gnss_synchro_history->at(ch, 1).RX_time - d_gnss_synchro_history->at(ch, 0).RX_time);
|
||||
|
||||
// TOW INTERPOLATION
|
||||
|
||||
out.TOW_at_current_symbol_s = d_gnss_synchro_history->at(ch, ind.first).TOW_at_current_symbol_s + (d_gnss_synchro_history->at(ch, ind.second).TOW_at_current_symbol_s - d_gnss_synchro_history->at(ch, ind.first).TOW_at_current_symbol_s) * (ti - d_gnss_synchro_history->at(ch, ind.first).RX_time) / (d_gnss_synchro_history->at(ch, ind.second).RX_time - d_gnss_synchro_history->at(ch, ind.first).RX_time);
|
||||
out.TOW_at_current_symbol_s = d_gnss_synchro_history->at(ch, 0).TOW_at_current_symbol_s + (d_gnss_synchro_history->at(ch, 1).TOW_at_current_symbol_s - d_gnss_synchro_history->at(ch, 0).TOW_at_current_symbol_s) * (ti - d_gnss_synchro_history->at(ch, 0).RX_time) / (d_gnss_synchro_history->at(ch, 1).RX_time - d_gnss_synchro_history->at(ch, 0).RX_time);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -338,49 +335,50 @@ double hybrid_observables_cc::compute_T_rx_s(const Gnss_Synchro &a)
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<unsigned int, unsigned int> hybrid_observables_cc::find_interp_elements(const unsigned int &ch, const double &ti)
|
||||
void hybrid_observables_cc::find_interp_elements(const unsigned int &ch, const double &ti)
|
||||
{
|
||||
unsigned int closest = 0;
|
||||
double dif = std::numeric_limits<double>::max();
|
||||
double dt = 0.0;
|
||||
for (unsigned int i = 0; i < d_gnss_synchro_history->size(ch); i++)
|
||||
{
|
||||
dt = ti - d_gnss_synchro_history->at(ch, i).RX_time;
|
||||
if (dt < dif and dt > 0.0)
|
||||
dt = std::fabs(ti - d_gnss_synchro_history->at(ch, i).RX_time);
|
||||
if (dt < dif)
|
||||
{
|
||||
dif = dt;
|
||||
closest = i;
|
||||
dif = dt;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
unsigned int index1;
|
||||
unsigned int index2;
|
||||
if (closest == 0)
|
||||
if (ti > d_gnss_synchro_history->at(ch, closest).RX_time)
|
||||
{
|
||||
index1 = 0;
|
||||
index2 = 1;
|
||||
}
|
||||
else if (closest == (d_gnss_synchro_history->size(ch) - 1))
|
||||
{
|
||||
index1 = d_gnss_synchro_history->size(ch) - 2;
|
||||
index2 = d_gnss_synchro_history->size(ch) - 1;
|
||||
while (closest > 0)
|
||||
{
|
||||
d_gnss_synchro_history->pop_front(ch);
|
||||
closest--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
index1 = closest;
|
||||
index2 = closest + 1;
|
||||
while (closest > 1)
|
||||
{
|
||||
d_gnss_synchro_history->pop_front(ch);
|
||||
closest--;
|
||||
}
|
||||
}
|
||||
return std::pair<unsigned int, unsigned int>(index1, index2);
|
||||
}
|
||||
|
||||
|
||||
void hybrid_observables_cc::forecast(int noutput_items __attribute__((unused)),
|
||||
gr_vector_int &ninput_items_required)
|
||||
void hybrid_observables_cc::forecast(int noutput_items, gr_vector_int &ninput_items_required)
|
||||
{
|
||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
ninput_items_required[i] = 0;
|
||||
}
|
||||
ninput_items_required[d_nchannels] = 1;
|
||||
ninput_items_required[d_nchannels] = noutput_items;
|
||||
}
|
||||
|
||||
|
||||
@ -460,152 +458,161 @@ int hybrid_observables_cc::general_work(int noutput_items __attribute__((unused)
|
||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
|
||||
|
||||
unsigned int i;
|
||||
unsigned int returned_elements = 0;
|
||||
int total_input_items = 0;
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
total_input_items += ninput_items[i];
|
||||
}
|
||||
consume(d_nchannels, 1);
|
||||
T_rx_s += T_rx_step_s;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if ((total_input_items == 0) and (d_num_valid_channels == 0))
|
||||
for (int epoch = 0; epoch < ninput_items[d_nchannels]; epoch++)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
T_rx_s += T_rx_step_s;
|
||||
|
||||
if (total_input_items > 0)
|
||||
{
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if ((total_input_items == 0) and (d_num_valid_channels == 0))
|
||||
{
|
||||
if (ninput_items[i] > 0)
|
||||
consume(d_nchannels, epoch + 1);
|
||||
return returned_elements;
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (total_input_items > 0 and epoch == 0)
|
||||
{
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
// Add the new Gnss_Synchros to their corresponding deque
|
||||
for (int aux = 0; aux < ninput_items[i]; aux++)
|
||||
if (ninput_items[i] > 0)
|
||||
{
|
||||
if (in[i][aux].Flag_valid_word)
|
||||
// Add the new Gnss_Synchros to their corresponding deque
|
||||
for (int aux = 0; aux < ninput_items[i]; aux++)
|
||||
{
|
||||
d_gnss_synchro_history->push_back(i, in[i][aux]);
|
||||
d_gnss_synchro_history->back(i).RX_time = compute_T_rx_s(in[i][aux]);
|
||||
// Check if the last Gnss_Synchro comes from the same satellite as the previous ones
|
||||
if (d_gnss_synchro_history->size(i) > 1)
|
||||
if (in[i][aux].Flag_valid_word)
|
||||
{
|
||||
if (d_gnss_synchro_history->front(i).PRN != d_gnss_synchro_history->back(i).PRN)
|
||||
d_gnss_synchro_history->push_back(i, in[i][aux]);
|
||||
d_gnss_synchro_history->back(i).RX_time = compute_T_rx_s(in[i][aux]);
|
||||
// Check if the last Gnss_Synchro comes from the same satellite as the previous ones
|
||||
if (d_gnss_synchro_history->size(i) > 1)
|
||||
{
|
||||
d_gnss_synchro_history->clear(i);
|
||||
if (d_gnss_synchro_history->front(i).PRN != d_gnss_synchro_history->back(i).PRN)
|
||||
{
|
||||
d_gnss_synchro_history->clear(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
consume(i, ninput_items[i]);
|
||||
}
|
||||
consume(i, ninput_items[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
if (d_gnss_synchro_history->size(i) > 2)
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
valid_channels[i] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
valid_channels[i] = false;
|
||||
}
|
||||
}
|
||||
d_num_valid_channels = valid_channels.count();
|
||||
// Check if there is any valid channel after reading the new incoming Gnss_Synchro data
|
||||
if (d_num_valid_channels == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < d_nchannels; i++) //Discard observables with T_rx higher than the threshold
|
||||
{
|
||||
if (valid_channels[i])
|
||||
{
|
||||
clean_history(i);
|
||||
if (d_gnss_synchro_history->size(i) < 2)
|
||||
if (d_gnss_synchro_history->size(i) > 2)
|
||||
{
|
||||
valid_channels[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there is any valid channel after computing the time distance between the Gnss_Synchro data and the receiver time
|
||||
d_num_valid_channels = valid_channels.count();
|
||||
double T_rx_s_out = T_rx_s - d_latency;
|
||||
if ((d_num_valid_channels == 0) or (T_rx_s_out < 0.0))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<Gnss_Synchro> epoch_data;
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
if (valid_channels[i])
|
||||
{
|
||||
Gnss_Synchro interpolated_gnss_synchro = d_gnss_synchro_history->back(i);
|
||||
if (interpolate_data(interpolated_gnss_synchro, i, T_rx_s_out))
|
||||
{
|
||||
epoch_data.push_back(interpolated_gnss_synchro);
|
||||
valid_channels[i] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
valid_channels[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
d_num_valid_channels = valid_channels.count();
|
||||
if (d_num_valid_channels == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
correct_TOW_and_compute_prange(epoch_data);
|
||||
std::vector<Gnss_Synchro>::iterator it = epoch_data.begin();
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
if (valid_channels[i])
|
||||
d_num_valid_channels = valid_channels.count();
|
||||
// Check if there is any valid channel after reading the new incoming Gnss_Synchro data
|
||||
if (d_num_valid_channels == 0)
|
||||
{
|
||||
out[i][0] = (*it);
|
||||
out[i][0].Flag_valid_pseudorange = true;
|
||||
it++;
|
||||
consume(d_nchannels, epoch + 1);
|
||||
return returned_elements;
|
||||
}
|
||||
else
|
||||
|
||||
for (i = 0; i < d_nchannels; i++) //Discard observables with T_rx higher than the threshold
|
||||
{
|
||||
out[i][0] = Gnss_Synchro();
|
||||
out[i][0].Flag_valid_pseudorange = false;
|
||||
}
|
||||
}
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
try
|
||||
{
|
||||
double tmp_double;
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
if (valid_channels[i])
|
||||
{
|
||||
tmp_double = out[i][0].RX_time;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][0].TOW_at_current_symbol_s;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][0].Carrier_Doppler_hz;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][0].Carrier_phase_rads / GPS_TWO_PI;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][0].Pseudorange_m;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(out[i][0].PRN);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(out[i][0].Flag_valid_pseudorange);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
clean_history(i);
|
||||
if (d_gnss_synchro_history->size(i) < 2)
|
||||
{
|
||||
valid_channels[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
|
||||
// Check if there is any valid channel after computing the time distance between the Gnss_Synchro data and the receiver time
|
||||
d_num_valid_channels = valid_channels.count();
|
||||
double T_rx_s_out = T_rx_s - d_latency;
|
||||
if ((d_num_valid_channels == 0) or (T_rx_s_out < 0.0))
|
||||
{
|
||||
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
||||
d_dump = false;
|
||||
consume(d_nchannels, epoch + 1);
|
||||
return returned_elements;
|
||||
}
|
||||
|
||||
std::vector<Gnss_Synchro> epoch_data;
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
if (valid_channels[i])
|
||||
{
|
||||
Gnss_Synchro interpolated_gnss_synchro = d_gnss_synchro_history->back(i);
|
||||
if (interpolate_data(interpolated_gnss_synchro, i, T_rx_s_out))
|
||||
{
|
||||
epoch_data.push_back(interpolated_gnss_synchro);
|
||||
}
|
||||
else
|
||||
{
|
||||
valid_channels[i] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
d_num_valid_channels = valid_channels.count();
|
||||
if (d_num_valid_channels == 0)
|
||||
{
|
||||
consume(d_nchannels, epoch + 1);
|
||||
return returned_elements;
|
||||
}
|
||||
correct_TOW_and_compute_prange(epoch_data);
|
||||
std::vector<Gnss_Synchro>::iterator it = epoch_data.begin();
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
if (valid_channels[i])
|
||||
{
|
||||
out[i][epoch] = (*it);
|
||||
out[i][epoch].Flag_valid_pseudorange = true;
|
||||
it++;
|
||||
}
|
||||
else
|
||||
{
|
||||
out[i][epoch] = Gnss_Synchro();
|
||||
out[i][epoch].Flag_valid_pseudorange = false;
|
||||
}
|
||||
}
|
||||
if (d_dump)
|
||||
{
|
||||
// MULTIPLEXED FILE RECORDING - Record results to file
|
||||
try
|
||||
{
|
||||
double tmp_double;
|
||||
for (i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
tmp_double = out[i][epoch].RX_time;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][epoch].TOW_at_current_symbol_s;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][epoch].Carrier_Doppler_hz;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][epoch].Carrier_phase_rads / GPS_TWO_PI;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = out[i][epoch].Pseudorange_m;
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(out[i][epoch].PRN);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
tmp_double = static_cast<double>(out[i][epoch].Flag_valid_pseudorange);
|
||||
d_dump_file.write(reinterpret_cast<char *>(&tmp_double), sizeof(double));
|
||||
}
|
||||
}
|
||||
catch (const std::ifstream::failure &e)
|
||||
{
|
||||
LOG(WARNING) << "Exception writing observables dump file " << e.what();
|
||||
d_dump = false;
|
||||
}
|
||||
}
|
||||
returned_elements++;
|
||||
}
|
||||
return 1;
|
||||
consume(d_nchannels, ninput_items[d_nchannels]);
|
||||
return returned_elements;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ private:
|
||||
void clean_history(unsigned int pos);
|
||||
double compute_T_rx_s(const Gnss_Synchro& a);
|
||||
bool interpolate_data(Gnss_Synchro& out, const unsigned int& ch, const double& ti);
|
||||
std::pair<unsigned int, unsigned int> find_interp_elements(const unsigned int& ch, const double& ti);
|
||||
void find_interp_elements(const unsigned int& ch, const double& ti);
|
||||
void correct_TOW_and_compute_prange(std::vector<Gnss_Synchro>& data);
|
||||
int save_matfile();
|
||||
|
||||
|
@ -106,8 +106,6 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
||||
bool dump) : gr::block("galileo_e1b_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
|
@ -183,8 +183,6 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
|
@ -54,8 +54,6 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
||||
bool dump) : gr::block("glonass_l1_ca_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
@ -285,9 +283,6 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
||||
LOG(INFO) << "Starting string decoder for GLONASS L1 C/A SAT " << this->d_satellite;
|
||||
d_preamble_index = d_sample_counter; //record the preamble sample stamp
|
||||
d_stat = 2;
|
||||
// send asynchronous message to tracking to inform of frame sync and extend correlation time
|
||||
pmt::pmt_t value = pmt::from_double(static_cast<double>(d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs) - 0.001);
|
||||
this->message_port_pub(pmt::mp("preamble_timestamp_s"), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -53,8 +53,6 @@ glonass_l2_ca_telemetry_decoder_cc::glonass_l2_ca_telemetry_decoder_cc(
|
||||
bool dump) : gr::block("glonass_l2_ca_telemetry_decoder_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
@ -284,9 +282,6 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
||||
LOG(INFO) << "Starting string decoder for GLONASS L2 C/A SAT " << this->d_satellite;
|
||||
d_preamble_index = d_sample_counter; //record the preamble sample stamp
|
||||
d_stat = 2;
|
||||
// send asynchronous message to tracking to inform of frame sync and extend correlation time
|
||||
pmt::pmt_t value = pmt::from_double(static_cast<double>(d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs) - 0.001);
|
||||
this->message_port_pub(pmt::mp("preamble_timestamp_s"), value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -54,8 +54,6 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
||||
bool dump) : gr::block("gps_navigation_cc", gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
@ -107,6 +105,8 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
||||
d_TOW_at_current_symbol_ms = 0;
|
||||
d_symbol_history.resize(GPS_CA_PREAMBLE_LENGTH_SYMBOLS + 1); // Change fixed buffer size
|
||||
d_symbol_history.clear(); // Clear all the elements in the buffer
|
||||
d_make_correlation = true;
|
||||
d_symbol_counter_corr = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -170,7 +170,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
||||
unsigned int required_symbols = GPS_CA_PREAMBLE_LENGTH_SYMBOLS;
|
||||
d_flag_preamble = false;
|
||||
|
||||
if (d_symbol_history.size() > required_symbols)
|
||||
if ((d_symbol_history.size() > required_symbols) and (d_make_correlation or !d_flag_frame_sync))
|
||||
{
|
||||
//******* preamble correlation ********
|
||||
for (unsigned int i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
|
||||
@ -179,19 +179,22 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
||||
{
|
||||
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
||||
{
|
||||
corr_value -= d_preambles_symbols[i] * d_symbol_history.at(i).correlation_length_ms;
|
||||
corr_value -= d_preambles_symbols[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
corr_value += d_preambles_symbols[i] * d_symbol_history.at(i).correlation_length_ms;
|
||||
corr_value += d_preambles_symbols[i];
|
||||
}
|
||||
}
|
||||
if (corr_value >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS) break;
|
||||
}
|
||||
if (std::abs(corr_value) >= GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
||||
{
|
||||
d_symbol_counter_corr++;
|
||||
}
|
||||
}
|
||||
|
||||
//******* frame sync ******************
|
||||
if (abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
||||
if (std::abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
||||
{
|
||||
//TODO: Rewrite with state machine
|
||||
if (d_stat == 0)
|
||||
@ -208,18 +211,17 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
||||
}
|
||||
else if (d_stat == 1) //check 6 seconds of preamble separation
|
||||
{
|
||||
preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
||||
if (abs(preamble_diff_ms - GPS_SUBFRAME_MS) < 1)
|
||||
preamble_diff_ms = std::round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
||||
if (std::abs(preamble_diff_ms - GPS_SUBFRAME_MS) < 1)
|
||||
{
|
||||
DLOG(INFO) << "Preamble confirmation for SAT " << this->d_satellite;
|
||||
d_GPS_FSM.Event_gps_word_preamble();
|
||||
d_flag_preamble = true;
|
||||
d_make_correlation = false;
|
||||
d_symbol_counter_corr = 0;
|
||||
d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; // record the PRN start sample index associated to the preamble
|
||||
if (!d_flag_frame_sync)
|
||||
{
|
||||
// send asynchronous message to tracking to inform of frame sync and extend correlation time
|
||||
pmt::pmt_t value = pmt::from_double(static_cast<double>(d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs) - 0.001);
|
||||
this->message_port_pub(pmt::mp("preamble_timestamp_s"), value);
|
||||
d_flag_frame_sync = true;
|
||||
if (corr_value < 0)
|
||||
{
|
||||
@ -238,6 +240,11 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
||||
}
|
||||
else
|
||||
{
|
||||
d_symbol_counter_corr++;
|
||||
if (d_symbol_counter_corr > (GPS_SUBFRAME_MS - GPS_CA_TELEMETRY_SYMBOLS_PER_BIT))
|
||||
{
|
||||
d_make_correlation = true;
|
||||
}
|
||||
if (d_stat == 1)
|
||||
{
|
||||
preamble_diff_ms = round(((static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter) - static_cast<double>(d_preamble_time_samples)) / static_cast<double>(d_symbol_history.at(0).fs)) * 1000.0);
|
||||
@ -247,6 +254,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
||||
d_stat = 0; //lost of frame sync
|
||||
d_flag_frame_sync = false;
|
||||
flag_TOW_set = false;
|
||||
d_make_correlation = true;
|
||||
d_symbol_counter_corr = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,10 @@ private:
|
||||
double d_symbol_accumulator;
|
||||
short int d_symbol_accumulator_counter;
|
||||
|
||||
// symbol counting
|
||||
bool d_make_correlation;
|
||||
unsigned int d_symbol_counter_corr;
|
||||
|
||||
//bits and frame
|
||||
unsigned short int d_frame_bit_index;
|
||||
unsigned int d_GPS_frame_4bytes;
|
||||
|
@ -55,8 +55,6 @@ gps_l2c_telemetry_decoder_cc::gps_l2c_telemetry_decoder_cc(
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
|
@ -56,8 +56,6 @@ gps_l5_telemetry_decoder_cc::gps_l5_telemetry_decoder_cc(
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
|
@ -59,8 +59,6 @@ sbas_l1_telemetry_decoder_cc::sbas_l1_telemetry_decoder_cc(
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry Bit transition synchronization port out
|
||||
this->message_port_register_out(pmt::mp("preamble_timestamp_s"));
|
||||
// Ephemeris data port out
|
||||
this->message_port_register_out(pmt::mp("telemetry"));
|
||||
// initialize internal vars
|
||||
|
@ -82,7 +82,6 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(dllpllconf_t conf_) : gr::block("dl
|
||||
{
|
||||
trk_parameters = conf_;
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
this->set_relative_rate(1.0 / static_cast<double>(trk_parameters.vector_length));
|
||||
|
||||
|
@ -99,8 +99,6 @@ Galileo_E1_Tcp_Connector_Tracking_cc::Galileo_E1_Tcp_Connector_Tracking_cc(
|
||||
size_t port_ch0) : gr::block("Galileo_E1_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
this->set_relative_rate(1.0 / vector_length);
|
||||
// initialize internal vars
|
||||
|
@ -94,8 +94,6 @@ Glonass_L1_Ca_Dll_Pll_Tracking_cc::Glonass_L1_Ca_Dll_Pll_Tracking_cc(
|
||||
float early_late_space_chips) : gr::block("Glonass_L1_Ca_Dll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
|
||||
// initialize internal vars
|
||||
|
@ -94,8 +94,6 @@ Glonass_L2_Ca_Dll_Pll_Tracking_cc::Glonass_L2_Ca_Dll_Pll_Tracking_cc(
|
||||
float early_late_space_chips) : gr::block("Glonass_L2_Ca_Dll_Pll_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
|
||||
// initialize internal vars
|
||||
|
@ -91,8 +91,6 @@ Gps_L1_Ca_Tcp_Connector_Tracking_cc::Gps_L1_Ca_Tcp_Connector_Tracking_cc(
|
||||
size_t port_ch0) : gr::block("Gps_L1_Ca_Tcp_Connector_Tracking_cc", gr::io_signature::make(1, 1, sizeof(gr_complex)),
|
||||
gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("preamble_timestamp_s"));
|
||||
this->message_port_register_out(pmt::mp("events"));
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
|
Loading…
Reference in New Issue
Block a user