mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-03-06 03:28:16 +00:00
Add more extensive use of cstdint typenames
This commit is contained in:
parent
65a0804084
commit
6cee58bdc1
@ -53,18 +53,18 @@ galileo_e1b_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1b_telemetry_decoder_cc::viterbi_decoder(double *page_part_symbols, int *page_part_bits)
|
void galileo_e1b_telemetry_decoder_cc::viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits)
|
||||||
{
|
{
|
||||||
Viterbi(page_part_bits, out0, state0, out1, state1,
|
Viterbi(page_part_bits, out0, state0, out1, state1,
|
||||||
page_part_symbols, KK, nn, DataLength);
|
page_part_symbols, KK, nn, DataLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1b_telemetry_decoder_cc::deinterleaver(int rows, int cols, double *in, double *out)
|
void galileo_e1b_telemetry_decoder_cc::deinterleaver(int32_t rows, int32_t cols, double *in, double *out)
|
||||||
{
|
{
|
||||||
for (int r = 0; r < rows; r++)
|
for (int32_t r = 0; r < rows; r++)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < cols; c++)
|
for (int32_t c = 0; c < cols; c++)
|
||||||
{
|
{
|
||||||
out[c * rows + r] = in[r * cols + c];
|
out[c * rows + r] = in[r * cols + c];
|
||||||
}
|
}
|
||||||
@ -86,18 +86,18 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
|||||||
d_samples_per_symbol = (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS) / Galileo_E1_B_SYMBOL_RATE_BPS;
|
d_samples_per_symbol = (Galileo_E1_CODE_CHIP_RATE_HZ / Galileo_E1_B_CODE_LENGTH_CHIPS) / Galileo_E1_B_SYMBOL_RATE_BPS;
|
||||||
|
|
||||||
// set the preamble
|
// set the preamble
|
||||||
unsigned short int preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS] = GALILEO_INAV_PREAMBLE;
|
uint16_t preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS] = GALILEO_INAV_PREAMBLE;
|
||||||
|
|
||||||
d_symbols_per_preamble = GALILEO_INAV_PREAMBLE_LENGTH_BITS * d_samples_per_symbol;
|
d_symbols_per_preamble = GALILEO_INAV_PREAMBLE_LENGTH_BITS * d_samples_per_symbol;
|
||||||
|
|
||||||
memcpy(static_cast<unsigned short int *>(this->d_preambles_bits), static_cast<unsigned short int *>(preambles_bits), GALILEO_INAV_PREAMBLE_LENGTH_BITS * sizeof(unsigned short int));
|
memcpy(static_cast<uint16_t *>(this->d_preambles_bits), static_cast<uint16_t *>(preambles_bits), GALILEO_INAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t));
|
||||||
|
|
||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = static_cast<int *>(volk_gnsssdr_malloc(d_symbols_per_preamble * sizeof(int), volk_gnsssdr_get_alignment()));
|
d_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(d_symbols_per_preamble * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
int n = 0;
|
int32_t n = 0;
|
||||||
for (int i = 0; i < GALILEO_INAV_PREAMBLE_LENGTH_BITS; i++)
|
for (int32_t i = 0; i < GALILEO_INAV_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < d_samples_per_symbol; j++)
|
for (uint32_t j = 0; j < d_samples_per_symbol; j++)
|
||||||
{
|
{
|
||||||
if (d_preambles_bits[i] == 1)
|
if (d_preambles_bits[i] == 1)
|
||||||
{
|
{
|
||||||
@ -110,9 +110,9 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0ULL;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
d_preamble_index = 0;
|
d_preamble_index = 0ULL;
|
||||||
|
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
|
|
||||||
@ -127,14 +127,14 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
|||||||
flag_TOW_set = false;
|
flag_TOW_set = false;
|
||||||
|
|
||||||
// vars for Viterbi decoder
|
// vars for Viterbi decoder
|
||||||
int max_states = 1 << mm; /* 2^mm */
|
int32_t max_states = 1 << mm; // 2^mm
|
||||||
g_encoder[0] = 121; // Polynomial G1
|
g_encoder[0] = 121; // Polynomial G1
|
||||||
g_encoder[1] = 91; // Polynomial G2
|
g_encoder[1] = 91; // Polynomial G2
|
||||||
out0 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
out0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
out1 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
out1 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
state0 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
state0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
state1 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
state1 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
/* create appropriate transition matrices */
|
// create appropriate transition matrices
|
||||||
nsc_transit(out0, state0, 0, g_encoder, KK, nn);
|
nsc_transit(out0, state0, 0, g_encoder, KK, nn);
|
||||||
nsc_transit(out1, state1, 1, g_encoder, KK, nn);
|
nsc_transit(out1, state1, 1, g_encoder, KK, nn);
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ galileo_e1b_telemetry_decoder_cc::~galileo_e1b_telemetry_decoder_cc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, int frame_length)
|
void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, int32_t frame_length)
|
||||||
{
|
{
|
||||||
double page_part_symbols_deint[frame_length];
|
double page_part_symbols_deint[frame_length];
|
||||||
// 1. De-interleave
|
// 1. De-interleave
|
||||||
@ -169,8 +169,8 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, in
|
|||||||
|
|
||||||
// 2. Viterbi decoder
|
// 2. Viterbi decoder
|
||||||
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
|
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
|
||||||
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180<EFBFBD>
|
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180º
|
||||||
for (int i = 0; i < frame_length; i++)
|
for (int32_t i = 0; i < frame_length; i++)
|
||||||
{
|
{
|
||||||
if ((i + 1) % 2 == 0)
|
if ((i + 1) % 2 == 0)
|
||||||
{
|
{
|
||||||
@ -178,12 +178,12 @@ void galileo_e1b_telemetry_decoder_cc::decode_word(double *page_part_symbols, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int page_part_bits[frame_length / 2];
|
int32_t page_part_bits[frame_length / 2];
|
||||||
viterbi_decoder(page_part_symbols_deint, page_part_bits);
|
viterbi_decoder(page_part_symbols_deint, page_part_bits);
|
||||||
|
|
||||||
// 3. Call the Galileo page decoder
|
// 3. Call the Galileo page decoder
|
||||||
std::string page_String;
|
std::string page_String;
|
||||||
for (int i = 0; i < (frame_length / 2); i++)
|
for (int32_t i = 0; i < (frame_length / 2); i++)
|
||||||
{
|
{
|
||||||
if (page_part_bits[i] > 0)
|
if (page_part_bits[i] > 0)
|
||||||
{
|
{
|
||||||
@ -268,7 +268,7 @@ void galileo_e1b_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e1b_telemetry_decoder_cc::set_channel(int channel)
|
void galileo_e1b_telemetry_decoder_cc::set_channel(int32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG(INFO) << "Navigation channel set to " << channel;
|
LOG(INFO) << "Navigation channel set to " << channel;
|
||||||
@ -298,8 +298,8 @@ void galileo_e1b_telemetry_decoder_cc::set_channel(int channel)
|
|||||||
int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
int corr_value = 0;
|
int32_t corr_value = 0;
|
||||||
int preamble_diff = 0;
|
int32_t preamble_diff = 0;
|
||||||
|
|
||||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
@ -312,13 +312,13 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
consume_each(1);
|
consume_each(1);
|
||||||
|
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
unsigned int required_symbols = GALILEO_INAV_PAGE_SYMBOLS + d_symbols_per_preamble;
|
uint32_t required_symbols = GALILEO_INAV_PAGE_SYMBOLS + d_symbols_per_preamble;
|
||||||
|
|
||||||
if (d_symbol_history.size() > required_symbols)
|
if (d_symbol_history.size() > required_symbols)
|
||||||
{
|
{
|
||||||
// TODO Optimize me!
|
// TODO Optimize me!
|
||||||
// ******* preamble correlation ********
|
// ******* preamble correlation ********
|
||||||
for (int i = 0; i < d_symbols_per_preamble; i++)
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
{
|
{
|
||||||
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
||||||
{
|
{
|
||||||
@ -346,7 +346,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
if (abs(corr_value) >= d_symbols_per_preamble)
|
if (abs(corr_value) >= d_symbols_per_preamble)
|
||||||
{
|
{
|
||||||
// check preamble separation
|
// check preamble separation
|
||||||
preamble_diff = d_sample_counter - d_preamble_index;
|
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
|
||||||
if (abs(preamble_diff - GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS) == 0)
|
if (abs(preamble_diff - GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS) == 0)
|
||||||
{
|
{
|
||||||
// try to decode frame
|
// try to decode frame
|
||||||
@ -365,14 +365,14 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
}
|
}
|
||||||
else if (d_stat == 2)
|
else if (d_stat == 2)
|
||||||
{
|
{
|
||||||
if (d_sample_counter == d_preamble_index + GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS)
|
if (d_sample_counter == d_preamble_index + static_cast<uint64_t>(GALILEO_INAV_PREAMBLE_PERIOD_SYMBOLS))
|
||||||
{
|
{
|
||||||
// NEW Galileo page part is received
|
// NEW Galileo page part is received
|
||||||
// 0. fetch the symbols into an array
|
// 0. fetch the symbols into an array
|
||||||
int frame_length = GALILEO_INAV_PAGE_PART_SYMBOLS - d_symbols_per_preamble;
|
int32_t frame_length = GALILEO_INAV_PAGE_PART_SYMBOLS - d_symbols_per_preamble;
|
||||||
double page_part_symbols[frame_length];
|
double page_part_symbols[frame_length];
|
||||||
|
|
||||||
for (int i = 0; i < frame_length; i++)
|
for (int32_t i = 0; i < frame_length; i++)
|
||||||
{
|
{
|
||||||
if (corr_value > 0)
|
if (corr_value > 0)
|
||||||
{
|
{
|
||||||
@ -423,7 +423,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
// 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
|
// 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_Preamble_ms = static_cast<unsigned int>(d_nav.TOW_5 * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.TOW_5 * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS;
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS;
|
||||||
d_nav.flag_TOW_5 = false;
|
d_nav.flag_TOW_5 = false;
|
||||||
}
|
}
|
||||||
@ -431,7 +431,7 @@ int galileo_e1b_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
// 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
|
// 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_Preamble_ms = static_cast<unsigned int>(d_nav.TOW_6 * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.TOW_6 * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS;
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + GALILEO_INAV_PAGE_PART_MS + (required_symbols + 1) * GALILEO_E1_CODE_PERIOD_MS;
|
||||||
d_nav.flag_TOW_6 = false;
|
d_nav.flag_TOW_6 = false;
|
||||||
}
|
}
|
||||||
|
@ -61,8 +61,8 @@ class galileo_e1b_telemetry_decoder_cc : public gr::block
|
|||||||
public:
|
public:
|
||||||
~galileo_e1b_telemetry_decoder_cc();
|
~galileo_e1b_telemetry_decoder_cc();
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
||||||
int flag_even_word_arrived;
|
int32_t flag_even_word_arrived;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -75,38 +75,38 @@ private:
|
|||||||
galileo_e1b_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
galileo_e1b_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
galileo_e1b_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
galileo_e1b_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
void viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits);
|
||||||
|
|
||||||
void deinterleaver(int rows, int cols, double *in, double *out);
|
void deinterleaver(int32_t rows, int32_t cols, double *in, double *out);
|
||||||
|
|
||||||
void decode_word(double *symbols, int frame_length);
|
void decode_word(double *symbols, int32_t frame_length);
|
||||||
|
|
||||||
unsigned short int d_preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS];
|
uint16_t d_preambles_bits[GALILEO_INAV_PREAMBLE_LENGTH_BITS];
|
||||||
|
|
||||||
int *d_preambles_symbols;
|
int32_t *d_preambles_symbols;
|
||||||
unsigned int d_samples_per_symbol;
|
uint32_t d_samples_per_symbol;
|
||||||
int d_symbols_per_preamble;
|
int32_t d_symbols_per_preamble;
|
||||||
|
|
||||||
std::deque<Gnss_Synchro> d_symbol_history;
|
std::deque<Gnss_Synchro> d_symbol_history;
|
||||||
|
|
||||||
uint64_t d_sample_counter;
|
uint64_t d_sample_counter;
|
||||||
uint64_t d_preamble_index;
|
uint64_t d_preamble_index;
|
||||||
unsigned int d_stat;
|
uint32_t d_stat;
|
||||||
bool d_flag_frame_sync;
|
bool d_flag_frame_sync;
|
||||||
|
|
||||||
bool d_flag_parity;
|
bool d_flag_parity;
|
||||||
bool d_flag_preamble;
|
bool d_flag_preamble;
|
||||||
int d_CRC_error_counter;
|
int32_t d_CRC_error_counter;
|
||||||
|
|
||||||
// navigation message vars
|
// navigation message vars
|
||||||
Galileo_Navigation_Message d_nav;
|
Galileo_Navigation_Message d_nav;
|
||||||
|
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int d_channel;
|
int32_t d_channel;
|
||||||
|
|
||||||
unsigned int d_TOW_at_Preamble_ms;
|
uint32_t d_TOW_at_Preamble_ms;
|
||||||
unsigned int d_TOW_at_current_symbol_ms;
|
uint32_t d_TOW_at_current_symbol_ms;
|
||||||
|
|
||||||
bool flag_TOW_set;
|
bool flag_TOW_set;
|
||||||
double delta_t; //GPS-GALILEO time offset
|
double delta_t; //GPS-GALILEO time offset
|
||||||
@ -115,13 +115,13 @@ private:
|
|||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
// vars for Viterbi decoder
|
// vars for Viterbi decoder
|
||||||
int *out0, *out1, *state0, *state1;
|
int32_t *out0, *out1, *state0, *state1;
|
||||||
int g_encoder[2];
|
int32_t g_encoder[2];
|
||||||
const int nn = 2; // Coding rate 1/n
|
const int32_t nn = 2; // Coding rate 1/n
|
||||||
const int KK = 7; // Constraint Length
|
const int32_t KK = 7; // Constraint Length
|
||||||
int mm = KK - 1;
|
int32_t mm = KK - 1;
|
||||||
const int CodeLength = 240;
|
const int32_t CodeLength = 240;
|
||||||
int DataLength = (CodeLength / nn) - mm;
|
int32_t DataLength = (CodeLength / nn) - mm;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -58,18 +58,18 @@ galileo_e5a_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5a_telemetry_decoder_cc::viterbi_decoder(double *page_part_symbols, int *page_part_bits)
|
void galileo_e5a_telemetry_decoder_cc::viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits)
|
||||||
{
|
{
|
||||||
Viterbi(page_part_bits, out0, state0, out1, state1,
|
Viterbi(page_part_bits, out0, state0, out1, state1,
|
||||||
page_part_symbols, KK, nn, DataLength);
|
page_part_symbols, KK, nn, DataLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5a_telemetry_decoder_cc::deinterleaver(int rows, int cols, double *in, double *out)
|
void galileo_e5a_telemetry_decoder_cc::deinterleaver(int32_t rows, int32_t cols, double *in, double *out)
|
||||||
{
|
{
|
||||||
for (int r = 0; r < rows; r++)
|
for (int32_t r = 0; r < rows; r++)
|
||||||
{
|
{
|
||||||
for (int c = 0; c < cols; c++)
|
for (int32_t c = 0; c < cols; c++)
|
||||||
{
|
{
|
||||||
out[c * rows + r] = in[r * cols + c];
|
out[c * rows + r] = in[r * cols + c];
|
||||||
}
|
}
|
||||||
@ -77,7 +77,7 @@ void galileo_e5a_telemetry_decoder_cc::deinterleaver(int rows, int cols, double
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int frame_length)
|
void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int32_t frame_length)
|
||||||
{
|
{
|
||||||
double page_symbols_deint[frame_length];
|
double page_symbols_deint[frame_length];
|
||||||
// 1. De-interleave
|
// 1. De-interleave
|
||||||
@ -86,19 +86,19 @@ void galileo_e5a_telemetry_decoder_cc::decode_word(double *page_symbols, int fra
|
|||||||
// 2. Viterbi decoder
|
// 2. Viterbi decoder
|
||||||
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
|
// 2.1 Take into account the NOT gate in G2 polynomial (Galileo ICD Figure 13, FEC encoder)
|
||||||
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180<38>
|
// 2.2 Take into account the possible inversion of the polarity due to PLL lock at 180<38>
|
||||||
for (int i = 0; i < frame_length; i++)
|
for (int32_t i = 0; i < frame_length; i++)
|
||||||
{
|
{
|
||||||
if ((i + 1) % 2 == 0)
|
if ((i + 1) % 2 == 0)
|
||||||
{
|
{
|
||||||
page_symbols_deint[i] = -page_symbols_deint[i];
|
page_symbols_deint[i] = -page_symbols_deint[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int page_bits[frame_length / 2];
|
int32_t page_bits[frame_length / 2];
|
||||||
viterbi_decoder(page_symbols_deint, page_bits);
|
viterbi_decoder(page_symbols_deint, page_bits);
|
||||||
|
|
||||||
// 3. Call the Galileo page decoder
|
// 3. Call the Galileo page decoder
|
||||||
std::string page_String;
|
std::string page_String;
|
||||||
for (int i = 0; i < frame_length; i++)
|
for (int32_t i = 0; i < frame_length; i++)
|
||||||
{
|
{
|
||||||
if (page_bits[i] > 0)
|
if (page_bits[i] > 0)
|
||||||
{
|
{
|
||||||
@ -156,7 +156,7 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
|
|||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
|
|
||||||
// set the preamble
|
// set the preamble
|
||||||
for (int i = 0; i < GALILEO_FNAV_PREAMBLE_LENGTH_BITS; i++)
|
for (int32_t i = 0; i < GALILEO_FNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
if (GALILEO_FNAV_PREAMBLE.at(i) == '0')
|
if (GALILEO_FNAV_PREAMBLE.at(i) == '0')
|
||||||
{
|
{
|
||||||
@ -167,19 +167,19 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
|
|||||||
d_preambles_bits[i] = -1;
|
d_preambles_bits[i] = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < GALILEO_FNAV_PREAMBLE_LENGTH_BITS; i++)
|
for (int32_t i = 0; i < GALILEO_FNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
for (int k = 0; k < GALILEO_FNAV_CODES_PER_SYMBOL; k++)
|
for (int32_t k = 0; k < GALILEO_FNAV_CODES_PER_SYMBOL; k++)
|
||||||
{
|
{
|
||||||
d_preamble_samples[(i * GALILEO_FNAV_CODES_PER_SYMBOL) + k] = d_preambles_bits[i];
|
d_preamble_samples[(i * GALILEO_FNAV_CODES_PER_SYMBOL) + k] = d_preambles_bits[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0ULL;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
corr_value = 0;
|
corr_value = 0;
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
d_preamble_index = 0;
|
d_preamble_index = 0ULL;
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
d_TOW_at_current_symbol_ms = 0;
|
d_TOW_at_current_symbol_ms = 0;
|
||||||
d_TOW_at_Preamble_ms = 0;
|
d_TOW_at_Preamble_ms = 0;
|
||||||
@ -194,13 +194,13 @@ galileo_e5a_telemetry_decoder_cc::galileo_e5a_telemetry_decoder_cc(
|
|||||||
required_symbols = GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS;
|
required_symbols = GALILEO_FNAV_SYMBOLS_PER_PAGE + GALILEO_FNAV_PREAMBLE_LENGTH_BITS;
|
||||||
|
|
||||||
// vars for Viterbi decoder
|
// vars for Viterbi decoder
|
||||||
int max_states = 1 << mm; // 2^mm
|
int32_t max_states = 1 << mm; // 2^mm
|
||||||
g_encoder[0] = 121; // Polynomial G1
|
g_encoder[0] = 121; // Polynomial G1
|
||||||
g_encoder[1] = 91; // Polynomial G2
|
g_encoder[1] = 91; // Polynomial G2
|
||||||
out0 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
out0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
out1 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
out1 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
state0 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
state0 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
state1 = static_cast<int *>(volk_gnsssdr_malloc(max_states * sizeof(int), volk_gnsssdr_get_alignment()));
|
state1 = static_cast<int32_t *>(volk_gnsssdr_malloc(max_states * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
// create appropriate transition matrices
|
// create appropriate transition matrices
|
||||||
nsc_transit(out0, state0, 0, g_encoder, KK, nn);
|
nsc_transit(out0, state0, 0, g_encoder, KK, nn);
|
||||||
nsc_transit(out1, state1, 1, g_encoder, KK, nn);
|
nsc_transit(out1, state1, 1, g_encoder, KK, nn);
|
||||||
@ -235,7 +235,7 @@ void galileo_e5a_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satel
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void galileo_e5a_telemetry_decoder_cc::set_channel(int channel)
|
void galileo_e5a_telemetry_decoder_cc::set_channel(int32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG(INFO) << "Navigation channel set to " << channel;
|
LOG(INFO) << "Navigation channel set to " << channel;
|
||||||
@ -265,7 +265,7 @@ void galileo_e5a_telemetry_decoder_cc::set_channel(int channel)
|
|||||||
int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
int preamble_diff = 0;
|
int32_t preamble_diff = 0;
|
||||||
|
|
||||||
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
|
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
|
||||||
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
||||||
@ -298,8 +298,8 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
|
|
||||||
if (d_preamble_init.size() == GALILEO_FNAV_CODES_PER_PREAMBLE)
|
if (d_preamble_init.size() == GALILEO_FNAV_CODES_PER_PREAMBLE)
|
||||||
{
|
{
|
||||||
std::deque<int>::iterator iter;
|
std::deque<int32_t>::iterator iter;
|
||||||
int k = 0;
|
int32_t k = 0;
|
||||||
corr_value = 0;
|
corr_value = 0;
|
||||||
for (iter = d_preamble_init.begin(); iter != d_preamble_init.end(); iter++)
|
for (iter = d_preamble_init.begin(); iter != d_preamble_init.end(); iter++)
|
||||||
{
|
{
|
||||||
@ -330,7 +330,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
{
|
{
|
||||||
// ****************** Preamble orrelation ******************
|
// ****************** Preamble orrelation ******************
|
||||||
corr_value = 0;
|
corr_value = 0;
|
||||||
for (int i = 0; i < GALILEO_FNAV_PREAMBLE_LENGTH_BITS; i++)
|
for (int32_t i = 0; i < GALILEO_FNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
if (d_symbol_history.at(i).Prompt_I < 0.0) // symbols clipping
|
if (d_symbol_history.at(i).Prompt_I < 0.0) // symbols clipping
|
||||||
{
|
{
|
||||||
@ -357,7 +357,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
if (abs(corr_value) == GALILEO_FNAV_PREAMBLE_LENGTH_BITS)
|
if (abs(corr_value) == GALILEO_FNAV_PREAMBLE_LENGTH_BITS)
|
||||||
{
|
{
|
||||||
// check preamble separation
|
// check preamble separation
|
||||||
preamble_diff = d_sample_counter - d_preamble_index;
|
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
|
||||||
if (preamble_diff == GALILEO_FNAV_CODES_PER_PAGE)
|
if (preamble_diff == GALILEO_FNAV_CODES_PER_PAGE)
|
||||||
{
|
{
|
||||||
// try to decode frame
|
// try to decode frame
|
||||||
@ -375,11 +375,11 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
}
|
}
|
||||||
else if ((d_stat == 2) && new_symbol)
|
else if ((d_stat == 2) && new_symbol)
|
||||||
{
|
{
|
||||||
if (d_sample_counter == (d_preamble_index + GALILEO_FNAV_CODES_PER_PAGE))
|
if (d_sample_counter == (d_preamble_index + static_cast<uint64_t>(GALILEO_FNAV_CODES_PER_PAGE)))
|
||||||
{
|
{
|
||||||
// NEW Galileo page part is received
|
// NEW Galileo page part is received
|
||||||
// 0. fetch the symbols into an array
|
// 0. fetch the symbols into an array
|
||||||
int frame_length = GALILEO_FNAV_SYMBOLS_PER_PAGE - GALILEO_FNAV_PREAMBLE_LENGTH_BITS;
|
int32_t frame_length = GALILEO_FNAV_SYMBOLS_PER_PAGE - GALILEO_FNAV_PREAMBLE_LENGTH_BITS;
|
||||||
double corr_sign = 0.0;
|
double corr_sign = 0.0;
|
||||||
if (corr_value > 0)
|
if (corr_value > 0)
|
||||||
{
|
{
|
||||||
@ -389,7 +389,7 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
{
|
{
|
||||||
corr_sign = 1.0;
|
corr_sign = 1.0;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < frame_length; i++)
|
for (int32_t i = 0; i < frame_length; i++)
|
||||||
{
|
{
|
||||||
page_symbols[i] = corr_sign * d_symbol_history.at(i + GALILEO_FNAV_PREAMBLE_LENGTH_BITS).Prompt_I; // because last symbol of the preamble is just received now!
|
page_symbols[i] = corr_sign * d_symbol_history.at(i + GALILEO_FNAV_PREAMBLE_LENGTH_BITS).Prompt_I; // because last symbol of the preamble is just received now!
|
||||||
}
|
}
|
||||||
@ -435,25 +435,25 @@ int galileo_e5a_telemetry_decoder_cc::general_work(int noutput_items __attribute
|
|||||||
{
|
{
|
||||||
if (d_nav.flag_TOW_1 == true)
|
if (d_nav.flag_TOW_1 == true)
|
||||||
{
|
{
|
||||||
d_TOW_at_Preamble_ms = static_cast<unsigned int>(d_nav.FNAV_TOW_1 * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_1 * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
||||||
d_nav.flag_TOW_1 = false;
|
d_nav.flag_TOW_1 = false;
|
||||||
}
|
}
|
||||||
else if (d_nav.flag_TOW_2 == true)
|
else if (d_nav.flag_TOW_2 == true)
|
||||||
{
|
{
|
||||||
d_TOW_at_Preamble_ms = static_cast<unsigned int>(d_nav.FNAV_TOW_2 * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_2 * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
||||||
d_nav.flag_TOW_2 = false;
|
d_nav.flag_TOW_2 = false;
|
||||||
}
|
}
|
||||||
else if (d_nav.flag_TOW_3 == true)
|
else if (d_nav.flag_TOW_3 == true)
|
||||||
{
|
{
|
||||||
d_TOW_at_Preamble_ms = static_cast<unsigned int>(d_nav.FNAV_TOW_3 * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_3 * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
||||||
d_nav.flag_TOW_3 = false;
|
d_nav.flag_TOW_3 = false;
|
||||||
}
|
}
|
||||||
else if (d_nav.flag_TOW_4 == true)
|
else if (d_nav.flag_TOW_4 == true)
|
||||||
{
|
{
|
||||||
d_TOW_at_Preamble_ms = static_cast<unsigned int>(d_nav.FNAV_TOW_4 * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.FNAV_TOW_4 * 1000.0);
|
||||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + (GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS;
|
||||||
d_nav.flag_TOW_4 = false;
|
d_nav.flag_TOW_4 = false;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ class galileo_e5a_telemetry_decoder_cc : public gr::block
|
|||||||
public:
|
public:
|
||||||
~galileo_e5a_telemetry_decoder_cc();
|
~galileo_e5a_telemetry_decoder_cc();
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
*/
|
*/
|
||||||
@ -79,21 +79,21 @@ private:
|
|||||||
galileo_e5a_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
galileo_e5a_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
galileo_e5a_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
galileo_e5a_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
void viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits);
|
||||||
|
|
||||||
void deinterleaver(int rows, int cols, double *in, double *out);
|
void deinterleaver(int32_t rows, int32_t cols, double *in, double *out);
|
||||||
|
|
||||||
void decode_word(double *page_symbols, int frame_length);
|
void decode_word(double *page_symbols, int32_t frame_length);
|
||||||
|
|
||||||
int d_preambles_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
int32_t d_preambles_bits[GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
||||||
int d_preamble_samples[GALILEO_FNAV_CODES_PER_PREAMBLE];
|
int32_t d_preamble_samples[GALILEO_FNAV_CODES_PER_PREAMBLE];
|
||||||
std::deque<int> d_preamble_init;
|
std::deque<int> d_preamble_init;
|
||||||
int d_stat;
|
int32_t d_stat;
|
||||||
int d_CRC_error_counter;
|
int32_t d_CRC_error_counter;
|
||||||
int d_channel;
|
int32_t d_channel;
|
||||||
int d_symbol_counter;
|
int32_t d_symbol_counter;
|
||||||
int corr_value;
|
int32_t corr_value;
|
||||||
unsigned int required_symbols;
|
uint32_t required_symbols;
|
||||||
uint64_t d_sample_counter;
|
uint64_t d_sample_counter;
|
||||||
uint64_t d_preamble_index;
|
uint64_t d_preamble_index;
|
||||||
bool d_flag_frame_sync;
|
bool d_flag_frame_sync;
|
||||||
@ -104,8 +104,8 @@ private:
|
|||||||
bool new_symbol;
|
bool new_symbol;
|
||||||
double d_prompt_acum;
|
double d_prompt_acum;
|
||||||
double page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE - GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
double page_symbols[GALILEO_FNAV_SYMBOLS_PER_PAGE - GALILEO_FNAV_PREAMBLE_LENGTH_BITS];
|
||||||
unsigned int d_TOW_at_Preamble_ms;
|
uint32_t d_TOW_at_Preamble_ms;
|
||||||
unsigned int d_TOW_at_current_symbol_ms;
|
uint32_t d_TOW_at_current_symbol_ms;
|
||||||
double delta_t; //GPS-GALILEO time offset
|
double delta_t; //GPS-GALILEO time offset
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
@ -115,13 +115,13 @@ private:
|
|||||||
Galileo_Fnav_Message d_nav;
|
Galileo_Fnav_Message d_nav;
|
||||||
|
|
||||||
// vars for Viterbi decoder
|
// vars for Viterbi decoder
|
||||||
int *out0, *out1, *state0, *state1;
|
int32_t *out0, *out1, *state0, *state1;
|
||||||
int g_encoder[2];
|
int32_t g_encoder[2];
|
||||||
const int nn = 2; // Coding rate 1/n
|
const int32_t nn = 2; // Coding rate 1/n
|
||||||
const int KK = 7; // Constraint Length
|
const int32_t KK = 7; // Constraint Length
|
||||||
int mm = KK - 1;
|
int32_t mm = KK - 1;
|
||||||
const int CodeLength = 488;
|
const int32_t CodeLength = 488;
|
||||||
int DataLength = (CodeLength / nn) - mm;
|
int32_t DataLength = (CodeLength / nn) - mm;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GALILEO_E5A_TELEMETRY_DECODER_CC_H_ */
|
#endif /* GNSS_SDR_GALILEO_E5A_TELEMETRY_DECODER_CC_H_ */
|
||||||
|
@ -65,18 +65,18 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
|||||||
d_samples_per_symbol = (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS) / GLONASS_L1_CA_SYMBOL_RATE_BPS;
|
d_samples_per_symbol = (GLONASS_L1_CA_CODE_RATE_HZ / GLONASS_L1_CA_CODE_LENGTH_CHIPS) / GLONASS_L1_CA_SYMBOL_RATE_BPS;
|
||||||
|
|
||||||
// Set the preamble information
|
// Set the preamble information
|
||||||
unsigned short int preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS] = GLONASS_GNAV_PREAMBLE;
|
uint16_t preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS] = GLONASS_GNAV_PREAMBLE;
|
||||||
// Since preamble rate is different than navigation data rate we use a constant
|
// Since preamble rate is different than navigation data rate we use a constant
|
||||||
d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
|
||||||
memcpy(static_cast<unsigned short int *>(this->d_preambles_bits), static_cast<unsigned short int *>(preambles_bits), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(unsigned short int));
|
memcpy(static_cast<uint16_t *>(this->d_preambles_bits), static_cast<uint16_t *>(preambles_bits), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t));
|
||||||
|
|
||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = static_cast<signed int *>(malloc(sizeof(signed int) * d_symbols_per_preamble));
|
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
||||||
int n = 0;
|
int32_t n = 0;
|
||||||
for (int i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++)
|
for (int32_t i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
||||||
{
|
{
|
||||||
if (d_preambles_bits[i] == 1)
|
if (d_preambles_bits[i] == 1)
|
||||||
{
|
{
|
||||||
@ -89,9 +89,9 @@ glonass_l1_ca_telemetry_decoder_cc::glonass_l1_ca_telemetry_decoder_cc(
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0ULL;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
d_preamble_index = 0;
|
d_preamble_index = 0ULL;
|
||||||
|
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
|
|
||||||
@ -124,10 +124,10 @@ glonass_l1_ca_telemetry_decoder_cc::~glonass_l1_ca_telemetry_decoder_cc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, int frame_length)
|
void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, int32_t frame_length)
|
||||||
{
|
{
|
||||||
double chip_acc = 0.0;
|
double chip_acc = 0.0;
|
||||||
int chip_acc_counter = 0;
|
int32_t chip_acc_counter = 0;
|
||||||
|
|
||||||
// 1. Transform from symbols to bits
|
// 1. Transform from symbols to bits
|
||||||
std::string bi_binary_code;
|
std::string bi_binary_code;
|
||||||
@ -135,7 +135,7 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
std::string data_bits;
|
std::string data_bits;
|
||||||
|
|
||||||
// Group samples into bi-binary code
|
// Group samples into bi-binary code
|
||||||
for (int i = 0; i < (frame_length); i++)
|
for (int32_t i = 0; i < (frame_length); i++)
|
||||||
{
|
{
|
||||||
chip_acc += frame_symbols[i];
|
chip_acc += frame_symbols[i];
|
||||||
chip_acc_counter += 1;
|
chip_acc_counter += 1;
|
||||||
@ -157,7 +157,7 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Convert from bi-binary code to relative code
|
// Convert from bi-binary code to relative code
|
||||||
for (int i = 0; i < (GLONASS_GNAV_STRING_BITS); i++)
|
for (int32_t i = 0; i < (GLONASS_GNAV_STRING_BITS); i++)
|
||||||
{
|
{
|
||||||
if (bi_binary_code[2 * i] == '1' && bi_binary_code[2 * i + 1] == '0')
|
if (bi_binary_code[2 * i] == '1' && bi_binary_code[2 * i + 1] == '0')
|
||||||
{
|
{
|
||||||
@ -170,7 +170,7 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
}
|
}
|
||||||
// Convert from relative code to data bits
|
// Convert from relative code to data bits
|
||||||
data_bits.push_back('0');
|
data_bits.push_back('0');
|
||||||
for (int i = 1; i < (GLONASS_GNAV_STRING_BITS); i++)
|
for (int32_t i = 1; i < (GLONASS_GNAV_STRING_BITS); i++)
|
||||||
{
|
{
|
||||||
data_bits.push_back(((relative_code[i - 1] - '0') ^ (relative_code[i] - '0')) + '0');
|
data_bits.push_back(((relative_code[i - 1] - '0') ^ (relative_code[i] - '0')) + '0');
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ void glonass_l1_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
}
|
}
|
||||||
if (d_nav.have_new_almanac() == true)
|
if (d_nav.have_new_almanac() == true)
|
||||||
{
|
{
|
||||||
unsigned int slot_nbr = d_nav.i_alm_satellite_slot_number;
|
uint32_t slot_nbr = d_nav.i_alm_satellite_slot_number;
|
||||||
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
||||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||||
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
||||||
@ -232,7 +232,7 @@ void glonass_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &sat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void glonass_l1_ca_telemetry_decoder_cc::set_channel(int channel)
|
void glonass_l1_ca_telemetry_decoder_cc::set_channel(int32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG(INFO) << "Navigation channel set to " << channel;
|
LOG(INFO) << "Navigation channel set to " << channel;
|
||||||
@ -262,8 +262,8 @@ void glonass_l1_ca_telemetry_decoder_cc::set_channel(int channel)
|
|||||||
int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
int corr_value = 0;
|
int32_t corr_value = 0;
|
||||||
int preamble_diff = 0;
|
int32_t preamble_diff = 0;
|
||||||
|
|
||||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
@ -276,12 +276,12 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
consume_each(1);
|
consume_each(1);
|
||||||
|
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
unsigned int required_symbols = GLONASS_GNAV_STRING_SYMBOLS;
|
uint32_t required_symbols = GLONASS_GNAV_STRING_SYMBOLS;
|
||||||
|
|
||||||
if (d_symbol_history.size() > required_symbols)
|
if (d_symbol_history.size() > required_symbols)
|
||||||
{
|
{
|
||||||
// ******* preamble correlation ********
|
// ******* preamble correlation ********
|
||||||
for (int i = 0; i < d_symbols_per_preamble; i++)
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
{
|
{
|
||||||
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
||||||
{
|
{
|
||||||
@ -312,9 +312,9 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
if (abs(corr_value) >= d_symbols_per_preamble)
|
if (abs(corr_value) >= d_symbols_per_preamble)
|
||||||
{
|
{
|
||||||
// check preamble separation
|
// check preamble separation
|
||||||
preamble_diff = d_sample_counter - d_preamble_index;
|
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
|
||||||
// Record the PRN start sample index associated to the preamble
|
// Record the PRN start sample index associated to the preamble
|
||||||
d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter;
|
d_preamble_time_samples = static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter);
|
||||||
if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0)
|
if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0)
|
||||||
{
|
{
|
||||||
// try to decode frame
|
// try to decode frame
|
||||||
@ -335,15 +335,15 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
else if (d_stat == 2)
|
else if (d_stat == 2)
|
||||||
{
|
{
|
||||||
// FIXME: The preamble index marks the first symbol of the string count. Here I just wait for another full string to be received before processing
|
// FIXME: The preamble index marks the first symbol of the string count. Here I just wait for another full string to be received before processing
|
||||||
if (d_sample_counter == d_preamble_index + GLONASS_GNAV_STRING_SYMBOLS)
|
if (d_sample_counter == d_preamble_index + static_cast<uint64_t>(GLONASS_GNAV_STRING_SYMBOLS))
|
||||||
{
|
{
|
||||||
// NEW GLONASS string received
|
// NEW GLONASS string received
|
||||||
// 0. fetch the symbols into an array
|
// 0. fetch the symbols into an array
|
||||||
int string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||||
double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0};
|
double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0};
|
||||||
|
|
||||||
// ******* SYMBOL TO BIT *******
|
// ******* SYMBOL TO BIT *******
|
||||||
for (int i = 0; i < string_length; i++)
|
for (int32_t i = 0; i < string_length; i++)
|
||||||
{
|
{
|
||||||
if (corr_value > 0)
|
if (corr_value > 0)
|
||||||
{
|
{
|
||||||
@ -415,7 +415,7 @@ int glonass_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
current_symbol.PRN = this->d_satellite.get_PRN();
|
current_symbol.PRN = this->d_satellite.get_PRN();
|
||||||
current_symbol.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0);
|
current_symbol.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0);
|
||||||
// todo: glonass time to gps time should be done in observables block
|
// todo: glonass time to gps time should be done in observables block
|
||||||
// current_symbol.TOW_at_current_symbol_ms -= -= static_cast<unsigned int>(delta_t) * 1000; // Galileo to GPS TOW
|
// current_symbol.TOW_at_current_symbol_ms -= -= static_cast<uint32_t>(delta_t) * 1000; // Galileo to GPS TOW
|
||||||
|
|
||||||
if (d_dump == true)
|
if (d_dump == true)
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,7 @@ class glonass_l1_ca_telemetry_decoder_cc : public gr::block
|
|||||||
public:
|
public:
|
||||||
~glonass_l1_ca_telemetry_decoder_cc(); //!< Class destructor
|
~glonass_l1_ca_telemetry_decoder_cc(); //!< Class destructor
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -76,30 +76,30 @@ private:
|
|||||||
glonass_l1_ca_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
glonass_l1_ca_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
glonass_l1_ca_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
glonass_l1_ca_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
void decode_string(double *symbols, int frame_length);
|
void decode_string(double *symbols, int32_t frame_length);
|
||||||
|
|
||||||
//!< Help with coherent tracking
|
//!< Help with coherent tracking
|
||||||
double d_preamble_time_samples;
|
double d_preamble_time_samples;
|
||||||
|
|
||||||
//!< Preamble decoding
|
//!< Preamble decoding
|
||||||
unsigned short int d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS];
|
uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS];
|
||||||
int *d_preambles_symbols;
|
int32_t *d_preambles_symbols;
|
||||||
unsigned int d_samples_per_symbol;
|
uint32_t d_samples_per_symbol;
|
||||||
int d_symbols_per_preamble;
|
int32_t d_symbols_per_preamble;
|
||||||
|
|
||||||
//!< Storage for incoming data
|
//!< Storage for incoming data
|
||||||
std::deque<Gnss_Synchro> d_symbol_history;
|
std::deque<Gnss_Synchro> d_symbol_history;
|
||||||
|
|
||||||
//!< Variables for internal functionality
|
//!< Variables for internal functionality
|
||||||
uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||||
uint64_t d_preamble_index; //!< Index of sample number where preamble was found
|
uint64_t d_preamble_index; //!< Index of sample number where preamble was found
|
||||||
unsigned int d_stat; //!< Status of decoder
|
uint32_t d_stat; //!< Status of decoder
|
||||||
bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved
|
bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved
|
||||||
bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check)
|
bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check)
|
||||||
bool d_flag_preamble; //!< Flag indicating when preamble was found
|
bool d_flag_preamble; //!< Flag indicating when preamble was found
|
||||||
int d_CRC_error_counter; //!< Number of failed CRC operations
|
int32_t d_CRC_error_counter; //!< Number of failed CRC operations
|
||||||
bool flag_TOW_set; //!< Indicates when time of week is set
|
bool flag_TOW_set; //!< Indicates when time of week is set
|
||||||
double delta_t; //!< GPS-GLONASS time offset
|
double delta_t; //!< GPS-GLONASS time offset
|
||||||
|
|
||||||
//!< Navigation Message variable
|
//!< Navigation Message variable
|
||||||
Glonass_Gnav_Navigation_Message d_nav;
|
Glonass_Gnav_Navigation_Message d_nav;
|
||||||
@ -110,7 +110,7 @@ private:
|
|||||||
|
|
||||||
//!< Satellite Information and logging capacity
|
//!< Satellite Information and logging capacity
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int d_channel;
|
int32_t d_channel;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
@ -65,18 +65,18 @@ glonass_l2_ca_telemetry_decoder_cc::glonass_l2_ca_telemetry_decoder_cc(
|
|||||||
d_samples_per_symbol = (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS) / GLONASS_L2_CA_SYMBOL_RATE_BPS;
|
d_samples_per_symbol = (GLONASS_L2_CA_CODE_RATE_HZ / GLONASS_L2_CA_CODE_LENGTH_CHIPS) / GLONASS_L2_CA_SYMBOL_RATE_BPS;
|
||||||
|
|
||||||
// Set the preamble information
|
// Set the preamble information
|
||||||
unsigned short int preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS] = GLONASS_GNAV_PREAMBLE;
|
uint16_t preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS] = GLONASS_GNAV_PREAMBLE;
|
||||||
// Since preamble rate is different than navigation data rate we use a constant
|
// Since preamble rate is different than navigation data rate we use a constant
|
||||||
d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
d_symbols_per_preamble = GLONASS_GNAV_PREAMBLE_LENGTH_SYMBOLS;
|
||||||
|
|
||||||
memcpy(static_cast<unsigned short int *>(this->d_preambles_bits), static_cast<unsigned short int *>(preambles_bits), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(unsigned short int));
|
memcpy(static_cast<uint16_t *>(this->d_preambles_bits), static_cast<uint16_t *>(preambles_bits), GLONASS_GNAV_PREAMBLE_LENGTH_BITS * sizeof(uint16_t));
|
||||||
|
|
||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = static_cast<signed int *>(malloc(sizeof(signed int) * d_symbols_per_preamble));
|
d_preambles_symbols = static_cast<int32_t *>(malloc(sizeof(int32_t) * d_symbols_per_preamble));
|
||||||
int n = 0;
|
int32_t n = 0;
|
||||||
for (int i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++)
|
for (int32_t i = 0; i < GLONASS_GNAV_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
for (uint32_t j = 0; j < GLONASS_GNAV_TELEMETRY_SYMBOLS_PER_PREAMBLE_BIT; j++)
|
||||||
{
|
{
|
||||||
if (d_preambles_bits[i] == 1)
|
if (d_preambles_bits[i] == 1)
|
||||||
{
|
{
|
||||||
@ -89,9 +89,9 @@ glonass_l2_ca_telemetry_decoder_cc::glonass_l2_ca_telemetry_decoder_cc(
|
|||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d_sample_counter = 0;
|
d_sample_counter = 0ULL;
|
||||||
d_stat = 0;
|
d_stat = 0;
|
||||||
d_preamble_index = 0;
|
d_preamble_index = 0ULL;
|
||||||
|
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
|
|
||||||
@ -124,10 +124,10 @@ glonass_l2_ca_telemetry_decoder_cc::~glonass_l2_ca_telemetry_decoder_cc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, int frame_length)
|
void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, int32_t frame_length)
|
||||||
{
|
{
|
||||||
double chip_acc = 0.0;
|
double chip_acc = 0.0;
|
||||||
int chip_acc_counter = 0;
|
int32_t chip_acc_counter = 0;
|
||||||
|
|
||||||
// 1. Transform from symbols to bits
|
// 1. Transform from symbols to bits
|
||||||
std::string bi_binary_code;
|
std::string bi_binary_code;
|
||||||
@ -135,7 +135,7 @@ void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
std::string data_bits;
|
std::string data_bits;
|
||||||
|
|
||||||
// Group samples into bi-binary code
|
// Group samples into bi-binary code
|
||||||
for (int i = 0; i < (frame_length); i++)
|
for (int32_t i = 0; i < (frame_length); i++)
|
||||||
{
|
{
|
||||||
chip_acc += frame_symbols[i];
|
chip_acc += frame_symbols[i];
|
||||||
chip_acc_counter += 1;
|
chip_acc_counter += 1;
|
||||||
@ -157,7 +157,7 @@ void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Convert from bi-binary code to relative code
|
// Convert from bi-binary code to relative code
|
||||||
for (int i = 0; i < (GLONASS_GNAV_STRING_BITS); i++)
|
for (int32_t i = 0; i < (GLONASS_GNAV_STRING_BITS); i++)
|
||||||
{
|
{
|
||||||
if (bi_binary_code[2 * i] == '1' && bi_binary_code[2 * i + 1] == '0')
|
if (bi_binary_code[2 * i] == '1' && bi_binary_code[2 * i + 1] == '0')
|
||||||
{
|
{
|
||||||
@ -170,7 +170,7 @@ void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
}
|
}
|
||||||
// Convert from relative code to data bits
|
// Convert from relative code to data bits
|
||||||
data_bits.push_back('0');
|
data_bits.push_back('0');
|
||||||
for (int i = 1; i < (GLONASS_GNAV_STRING_BITS); i++)
|
for (int32_t i = 1; i < (GLONASS_GNAV_STRING_BITS); i++)
|
||||||
{
|
{
|
||||||
data_bits.push_back(((relative_code[i - 1] - '0') ^ (relative_code[i] - '0')) + '0');
|
data_bits.push_back(((relative_code[i - 1] - '0') ^ (relative_code[i] - '0')) + '0');
|
||||||
}
|
}
|
||||||
@ -207,7 +207,7 @@ void glonass_l2_ca_telemetry_decoder_cc::decode_string(double *frame_symbols, in
|
|||||||
}
|
}
|
||||||
if (d_nav.have_new_almanac() == true)
|
if (d_nav.have_new_almanac() == true)
|
||||||
{
|
{
|
||||||
unsigned int slot_nbr = d_nav.i_alm_satellite_slot_number;
|
uint32_t slot_nbr = d_nav.i_alm_satellite_slot_number;
|
||||||
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
||||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||||
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
||||||
@ -232,7 +232,7 @@ void glonass_l2_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &sat
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void glonass_l2_ca_telemetry_decoder_cc::set_channel(int channel)
|
void glonass_l2_ca_telemetry_decoder_cc::set_channel(int32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG(INFO) << "Navigation channel set to " << channel;
|
LOG(INFO) << "Navigation channel set to " << channel;
|
||||||
@ -262,8 +262,8 @@ void glonass_l2_ca_telemetry_decoder_cc::set_channel(int channel)
|
|||||||
int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
int corr_value = 0;
|
int32_t corr_value = 0;
|
||||||
int preamble_diff = 0;
|
int32_t preamble_diff = 0;
|
||||||
|
|
||||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
@ -276,12 +276,12 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
consume_each(1);
|
consume_each(1);
|
||||||
|
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
unsigned int required_symbols = GLONASS_GNAV_STRING_SYMBOLS;
|
uint32_t required_symbols = GLONASS_GNAV_STRING_SYMBOLS;
|
||||||
|
|
||||||
if (d_symbol_history.size() > required_symbols)
|
if (d_symbol_history.size() > required_symbols)
|
||||||
{
|
{
|
||||||
// ******* preamble correlation ********
|
// ******* preamble correlation ********
|
||||||
for (int i = 0; i < d_symbols_per_preamble; i++)
|
for (int32_t i = 0; i < d_symbols_per_preamble; i++)
|
||||||
{
|
{
|
||||||
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
if (d_symbol_history.at(i).Prompt_I < 0) // symbols clipping
|
||||||
{
|
{
|
||||||
@ -312,9 +312,9 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
if (abs(corr_value) >= d_symbols_per_preamble)
|
if (abs(corr_value) >= d_symbols_per_preamble)
|
||||||
{
|
{
|
||||||
// check preamble separation
|
// check preamble separation
|
||||||
preamble_diff = d_sample_counter - d_preamble_index;
|
preamble_diff = static_cast<int32_t>(d_sample_counter - d_preamble_index);
|
||||||
// Record the PRN start sample index associated to the preamble
|
// Record the PRN start sample index associated to the preamble
|
||||||
d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter;
|
d_preamble_time_samples = static_cast<double>(d_symbol_history.at(0).Tracking_sample_counter);
|
||||||
if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0)
|
if (abs(preamble_diff - GLONASS_GNAV_PREAMBLE_PERIOD_SYMBOLS) == 0)
|
||||||
{
|
{
|
||||||
// try to decode frame
|
// try to decode frame
|
||||||
@ -335,15 +335,15 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
else if (d_stat == 2)
|
else if (d_stat == 2)
|
||||||
{
|
{
|
||||||
// FIXME: The preamble index marks the first symbol of the string count. Here I just wait for another full string to be received before processing
|
// FIXME: The preamble index marks the first symbol of the string count. Here I just wait for another full string to be received before processing
|
||||||
if (d_sample_counter == d_preamble_index + GLONASS_GNAV_STRING_SYMBOLS)
|
if (d_sample_counter == d_preamble_index + static_cast<uint64_t>(GLONASS_GNAV_STRING_SYMBOLS))
|
||||||
{
|
{
|
||||||
// NEW GLONASS string received
|
// NEW GLONASS string received
|
||||||
// 0. fetch the symbols into an array
|
// 0. fetch the symbols into an array
|
||||||
int string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||||
double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0};
|
double string_symbols[GLONASS_GNAV_DATA_SYMBOLS] = {0};
|
||||||
|
|
||||||
// ******* SYMBOL TO BIT *******
|
// ******* SYMBOL TO BIT *******
|
||||||
for (int i = 0; i < string_length; i++)
|
for (int32_t i = 0; i < string_length; i++)
|
||||||
{
|
{
|
||||||
if (corr_value > 0)
|
if (corr_value > 0)
|
||||||
{
|
{
|
||||||
@ -415,7 +415,7 @@ int glonass_l2_ca_telemetry_decoder_cc::general_work(int noutput_items __attribu
|
|||||||
current_symbol.PRN = this->d_satellite.get_PRN();
|
current_symbol.PRN = this->d_satellite.get_PRN();
|
||||||
current_symbol.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0);
|
current_symbol.TOW_at_current_symbol_ms = round(d_TOW_at_current_symbol * 1000.0);
|
||||||
// todo: glonass time to gps time should be done in observables block
|
// todo: glonass time to gps time should be done in observables block
|
||||||
// current_symbol.TOW_at_current_symbol_ms -= static_cast<unsigned int>(delta_t) * 1000;
|
// current_symbol.TOW_at_current_symbol_ms -= static_cast<uint32_t>(delta_t) * 1000;
|
||||||
|
|
||||||
if (d_dump == true)
|
if (d_dump == true)
|
||||||
{
|
{
|
||||||
|
@ -61,7 +61,7 @@ class glonass_l2_ca_telemetry_decoder_cc : public gr::block
|
|||||||
public:
|
public:
|
||||||
~glonass_l2_ca_telemetry_decoder_cc(); //!< Class destructor
|
~glonass_l2_ca_telemetry_decoder_cc(); //!< Class destructor
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -74,30 +74,30 @@ private:
|
|||||||
glonass_l2_ca_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
glonass_l2_ca_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
glonass_l2_ca_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
glonass_l2_ca_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
void decode_string(double *symbols, int frame_length);
|
void decode_string(double *symbols, int32_t frame_length);
|
||||||
|
|
||||||
//!< Help with coherent tracking
|
//!< Help with coherent tracking
|
||||||
double d_preamble_time_samples;
|
double d_preamble_time_samples;
|
||||||
|
|
||||||
//!< Preamble decoding
|
//!< Preamble decoding
|
||||||
unsigned short int d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS];
|
uint16_t d_preambles_bits[GLONASS_GNAV_PREAMBLE_LENGTH_BITS];
|
||||||
int *d_preambles_symbols;
|
int32_t *d_preambles_symbols;
|
||||||
unsigned int d_samples_per_symbol;
|
uint32_t d_samples_per_symbol;
|
||||||
int d_symbols_per_preamble;
|
int32_t d_symbols_per_preamble;
|
||||||
|
|
||||||
//!< Storage for incoming data
|
//!< Storage for incoming data
|
||||||
std::deque<Gnss_Synchro> d_symbol_history;
|
std::deque<Gnss_Synchro> d_symbol_history;
|
||||||
|
|
||||||
//!< Variables for internal functionality
|
//!< Variables for internal functionality
|
||||||
uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
uint64_t d_sample_counter; //!< Sample counter as an index (1,2,3,..etc) indicating number of samples processed
|
||||||
uint64_t d_preamble_index; //!< Index of sample number where preamble was found
|
uint64_t d_preamble_index; //!< Index of sample number where preamble was found
|
||||||
unsigned int d_stat; //!< Status of decoder
|
uint32_t d_stat; //!< Status of decoder
|
||||||
bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved
|
bool d_flag_frame_sync; //!< Indicate when a frame sync is achieved
|
||||||
bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check)
|
bool d_flag_parity; //!< Flag indicating when parity check was achieved (crc check)
|
||||||
bool d_flag_preamble; //!< Flag indicating when preamble was found
|
bool d_flag_preamble; //!< Flag indicating when preamble was found
|
||||||
int d_CRC_error_counter; //!< Number of failed CRC operations
|
int32_t d_CRC_error_counter; //!< Number of failed CRC operations
|
||||||
bool flag_TOW_set; //!< Indicates when time of week is set
|
bool flag_TOW_set; //!< Indicates when time of week is set
|
||||||
double delta_t; //!< GPS-GLONASS time offset
|
double delta_t; //!< GPS-GLONASS time offset
|
||||||
|
|
||||||
//!< Navigation Message variable
|
//!< Navigation Message variable
|
||||||
Glonass_Gnav_Navigation_Message d_nav;
|
Glonass_Gnav_Navigation_Message d_nav;
|
||||||
@ -108,7 +108,7 @@ private:
|
|||||||
|
|
||||||
//!< Satellite Information and logging capacity
|
//!< Satellite Information and logging capacity
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int d_channel;
|
int32_t d_channel;
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
@ -62,14 +62,14 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
|||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
|
|
||||||
// set the preamble
|
// set the preamble
|
||||||
unsigned short int preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS] = GPS_PREAMBLE;
|
uint16_t preambles_bits[GPS_CA_PREAMBLE_LENGTH_BITS] = GPS_PREAMBLE;
|
||||||
|
|
||||||
// preamble bits to sampled symbols
|
// preamble bits to sampled symbols
|
||||||
d_preambles_symbols = static_cast<int *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int), volk_gnsssdr_get_alignment()));
|
d_preambles_symbols = static_cast<int32_t *>(volk_gnsssdr_malloc(GPS_CA_PREAMBLE_LENGTH_SYMBOLS * sizeof(int32_t), volk_gnsssdr_get_alignment()));
|
||||||
int n = 0;
|
int32_t n = 0;
|
||||||
for (int i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
|
for (int32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_BITS; i++)
|
||||||
{
|
{
|
||||||
for (unsigned int j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
for (uint32_t j = 0; j < GPS_CA_TELEMETRY_SYMBOLS_PER_BIT; j++)
|
||||||
{
|
{
|
||||||
if (preambles_bits[i] == 1)
|
if (preambles_bits[i] == 1)
|
||||||
{
|
{
|
||||||
@ -91,7 +91,7 @@ gps_l1_ca_telemetry_decoder_cc::gps_l1_ca_telemetry_decoder_cc(
|
|||||||
d_flag_new_tow_available = false;
|
d_flag_new_tow_available = false;
|
||||||
d_channel = 0;
|
d_channel = 0;
|
||||||
flag_PLL_180_deg_phase_locked = false;
|
flag_PLL_180_deg_phase_locked = false;
|
||||||
d_preamble_time_samples = 0;
|
d_preamble_time_samples = 0ULL;
|
||||||
d_TOW_at_current_symbol_ms = 0;
|
d_TOW_at_current_symbol_ms = 0;
|
||||||
d_symbol_history.resize(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); // Change fixed buffer size
|
d_symbol_history.resize(GPS_CA_PREAMBLE_LENGTH_SYMBOLS); // Change fixed buffer size
|
||||||
d_symbol_history.clear(); // Clear all the elements in the buffer
|
d_symbol_history.clear(); // Clear all the elements in the buffer
|
||||||
@ -117,13 +117,13 @@ gps_l1_ca_telemetry_decoder_cc::~gps_l1_ca_telemetry_decoder_cc()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(unsigned int gpsword)
|
bool gps_l1_ca_telemetry_decoder_cc::gps_word_parityCheck(uint32_t gpsword)
|
||||||
{
|
{
|
||||||
unsigned int d1, d2, d3, d4, d5, d6, d7, t, parity;
|
uint32_t d1, d2, d3, d4, d5, d6, d7, t, parity;
|
||||||
/* XOR as many bits in parallel as possible. The magic constants pick
|
// XOR as many bits in parallel as possible. The magic constants pick
|
||||||
up bits which are to be XOR'ed together to implement the GPS parity
|
// up bits which are to be XOR'ed together to implement the GPS parity
|
||||||
check algorithm described in IS-GPS-200E. This avoids lengthy shift-
|
// check algorithm described in IS-GPS-200E. This avoids lengthy shift-
|
||||||
and-xor loops. */
|
// and-xor loops.
|
||||||
d1 = gpsword & 0xFBFFBF00;
|
d1 = gpsword & 0xFBFFBF00;
|
||||||
d2 = _rotl(gpsword, 1) & 0x07FFBF01;
|
d2 = _rotl(gpsword, 1) & 0x07FFBF01;
|
||||||
d3 = _rotl(gpsword, 2) & 0xFC0F8100;
|
d3 = _rotl(gpsword, 2) & 0xFC0F8100;
|
||||||
@ -152,7 +152,7 @@ void gps_l1_ca_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satelli
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l1_ca_telemetry_decoder_cc::set_channel(int channel)
|
void gps_l1_ca_telemetry_decoder_cc::set_channel(int32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
d_nav.i_channel_ID = channel;
|
d_nav.i_channel_ID = channel;
|
||||||
@ -185,28 +185,28 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe()
|
|||||||
{
|
{
|
||||||
char subframe[GPS_SUBFRAME_LENGTH];
|
char subframe[GPS_SUBFRAME_LENGTH];
|
||||||
|
|
||||||
int symbol_accumulator_counter = 0;
|
int32_t symbol_accumulator_counter = 0;
|
||||||
int frame_bit_index = 0;
|
int32_t frame_bit_index = 0;
|
||||||
int word_index = 0;
|
int32_t word_index = 0;
|
||||||
uint32_t GPS_frame_4bytes = 0;
|
uint32_t GPS_frame_4bytes = 0;
|
||||||
float symbol_accumulator = 0;
|
float symbol_accumulator = 0;
|
||||||
bool subframe_synchro_confirmation = false;
|
bool subframe_synchro_confirmation = false;
|
||||||
bool CRC_ok = true;
|
bool CRC_ok = true;
|
||||||
|
|
||||||
for (int n = 0; n < GPS_SUBFRAME_MS; n++)
|
for (int32_t n = 0; n < GPS_SUBFRAME_MS; n++)
|
||||||
{
|
{
|
||||||
//******* SYMBOL TO BIT *******
|
// ******* SYMBOL TO BIT *******
|
||||||
// extended correlation to bit period is enabled in tracking!
|
// extended correlation to bit period is enabled in tracking!
|
||||||
symbol_accumulator += d_subframe_symbols[n]; // accumulate the input value in d_symbol_accumulator
|
symbol_accumulator += d_subframe_symbols[n]; // accumulate the input value in d_symbol_accumulator
|
||||||
symbol_accumulator_counter++;
|
symbol_accumulator_counter++;
|
||||||
if (symbol_accumulator_counter == 20)
|
if (symbol_accumulator_counter == 20)
|
||||||
{
|
{
|
||||||
//symbol to bit
|
// symbol to bit
|
||||||
if (symbol_accumulator > 0) GPS_frame_4bytes += 1; //insert the telemetry bit in LSB
|
if (symbol_accumulator > 0) GPS_frame_4bytes += 1; // insert the telemetry bit in LSB
|
||||||
symbol_accumulator = 0;
|
symbol_accumulator = 0;
|
||||||
symbol_accumulator_counter = 0;
|
symbol_accumulator_counter = 0;
|
||||||
|
|
||||||
//******* bits to words ******
|
// ******* bits to words ******
|
||||||
frame_bit_index++;
|
frame_bit_index++;
|
||||||
if (frame_bit_index == 30)
|
if (frame_bit_index == 30)
|
||||||
{
|
{
|
||||||
@ -224,8 +224,8 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe()
|
|||||||
{
|
{
|
||||||
GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000;
|
GPS_frame_4bytes = GPS_frame_4bytes | 0x80000000;
|
||||||
}
|
}
|
||||||
/* Check that the 2 most recently logged words pass parity. Have to first
|
// Check that the 2 most recently logged words pass parity. Have to first
|
||||||
invert the data bits according to bit 30 of the previous word. */
|
// invert the data bits according to bit 30 of the previous word.
|
||||||
if (GPS_frame_4bytes & 0x40000000)
|
if (GPS_frame_4bytes & 0x40000000)
|
||||||
{
|
{
|
||||||
GPS_frame_4bytes ^= 0x3FFFFFC0; // invert the data bits (using XOR)
|
GPS_frame_4bytes ^= 0x3FFFFFC0; // invert the data bits (using XOR)
|
||||||
@ -236,10 +236,10 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//std::cout << "word invalid sat " << this->d_satellite << std::endl;
|
// std::cout << "word invalid sat " << this->d_satellite << std::endl;
|
||||||
CRC_ok = false;
|
CRC_ok = false;
|
||||||
}
|
}
|
||||||
//add word to subframe
|
// add word to subframe
|
||||||
// insert the word in the correct position of the subframe
|
// insert the word in the correct position of the subframe
|
||||||
std::memcpy(&subframe[word_index * GPS_WORD_LENGTH], &GPS_frame_4bytes, sizeof(uint32_t));
|
std::memcpy(&subframe[word_index * GPS_WORD_LENGTH], &GPS_frame_4bytes, sizeof(uint32_t));
|
||||||
word_index++;
|
word_index++;
|
||||||
@ -248,17 +248,16 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GPS_frame_4bytes <<= 1; //shift 1 bit left the telemetry word
|
GPS_frame_4bytes <<= 1; // shift 1 bit left the telemetry word
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// decode subframe
|
||||||
//decode subframe
|
|
||||||
// NEW GPS SUBFRAME HAS ARRIVED!
|
// NEW GPS SUBFRAME HAS ARRIVED!
|
||||||
if (CRC_ok)
|
if (CRC_ok)
|
||||||
{
|
{
|
||||||
int subframe_ID = d_nav.subframe_decoder(subframe); //decode the subframe
|
int32_t subframe_ID = d_nav.subframe_decoder(subframe); //d ecode the subframe
|
||||||
if (subframe_ID > 0 and subframe_ID < 6)
|
if (subframe_ID > 0 and subframe_ID < 6)
|
||||||
{
|
{
|
||||||
std::cout << "New GPS NAV message received in channel " << this->d_channel << ": "
|
std::cout << "New GPS NAV message received in channel " << this->d_channel << ": "
|
||||||
@ -268,7 +267,7 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe()
|
|||||||
|
|
||||||
switch (subframe_ID)
|
switch (subframe_ID)
|
||||||
{
|
{
|
||||||
case 3: //we have a new set of ephemeris data for the current SV
|
case 3: // we have a new set of ephemeris data for the current SV
|
||||||
if (d_nav.satellite_validation() == true)
|
if (d_nav.satellite_validation() == true)
|
||||||
{
|
{
|
||||||
// get ephemeris object for this SV (mandatory)
|
// get ephemeris object for this SV (mandatory)
|
||||||
@ -306,37 +305,37 @@ bool gps_l1_ca_telemetry_decoder_cc::decode_subframe()
|
|||||||
return subframe_synchro_confirmation;
|
return subframe_synchro_confirmation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)),
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
|
||||||
{
|
{
|
||||||
int preamble_diff_ms = 0;
|
int32_t preamble_diff_ms = 0;
|
||||||
|
|
||||||
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
Gnss_Synchro **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]); // Get the output buffer pointer
|
||||||
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
const Gnss_Synchro **in = reinterpret_cast<const Gnss_Synchro **>(&input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
|
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
|
// 1. Copy the current tracking output
|
||||||
current_symbol = in[0][0];
|
current_symbol = in[0][0];
|
||||||
|
|
||||||
//record the oldest subframe symbol before inserting a new symbol into the circular buffer
|
// record the oldest subframe symbol before inserting a new symbol into the circular buffer
|
||||||
if (d_current_subframe_symbol < GPS_SUBFRAME_MS and d_symbol_history.size() > 0)
|
if (d_current_subframe_symbol < GPS_SUBFRAME_MS and d_symbol_history.size() > 0)
|
||||||
{
|
{
|
||||||
d_subframe_symbols[d_current_subframe_symbol] = d_symbol_history.at(0).Prompt_I;
|
d_subframe_symbols[d_current_subframe_symbol] = d_symbol_history.at(0).Prompt_I;
|
||||||
d_current_subframe_symbol++;
|
d_current_subframe_symbol++;
|
||||||
}
|
}
|
||||||
|
|
||||||
d_symbol_history.push_back(current_symbol); //add new symbol to the symbol queue
|
d_symbol_history.push_back(current_symbol); // add new symbol to the symbol queue
|
||||||
consume_each(1);
|
consume_each(1);
|
||||||
|
|
||||||
d_flag_preamble = false;
|
d_flag_preamble = false;
|
||||||
|
|
||||||
|
// ******* preamble correlation ********
|
||||||
//******* preamble correlation ********
|
int32_t corr_value = 0;
|
||||||
int corr_value = 0;
|
|
||||||
if ((d_symbol_history.size() == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)) // and (d_make_correlation or !d_flag_frame_sync))
|
if ((d_symbol_history.size() == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)) // and (d_make_correlation or !d_flag_frame_sync))
|
||||||
{
|
{
|
||||||
// std::cout << "-------\n";
|
// std::cout << "-------\n";
|
||||||
for (unsigned int i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
|
for (uint32_t i = 0; i < GPS_CA_PREAMBLE_LENGTH_SYMBOLS; i++)
|
||||||
{
|
{
|
||||||
if (d_symbol_history.at(i).Flag_valid_symbol_output == true)
|
if (d_symbol_history.at(i).Flag_valid_symbol_output == true)
|
||||||
{
|
{
|
||||||
@ -352,19 +351,18 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ******* frame sync ******************
|
||||||
//******* frame sync ******************
|
|
||||||
if (std::abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
if (std::abs(corr_value) == GPS_CA_PREAMBLE_LENGTH_SYMBOLS)
|
||||||
{
|
{
|
||||||
//TODO: Rewrite with state machine
|
//TODO: Rewrite with state machine
|
||||||
if (d_stat == 0)
|
if (d_stat == 0)
|
||||||
{
|
{
|
||||||
//record the preamble sample stamp
|
// record the preamble sample stamp
|
||||||
d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; // record the preamble sample stamp
|
d_preamble_time_samples = d_symbol_history.at(0).Tracking_sample_counter; // record the preamble sample stamp
|
||||||
DLOG(INFO) << "Preamble detection for SAT " << this->d_satellite << "d_symbol_history.at(0).Tracking_sample_counter=" << d_symbol_history.at(0).Tracking_sample_counter;
|
DLOG(INFO) << "Preamble detection for SAT " << this->d_satellite << "d_symbol_history.at(0).Tracking_sample_counter=" << d_symbol_history.at(0).Tracking_sample_counter;
|
||||||
d_stat = 1; // enter into frame pre-detection status
|
d_stat = 1; // enter into frame pre-detection status
|
||||||
}
|
}
|
||||||
else if (d_stat == 1) //check 6 seconds of preamble separation
|
else if (d_stat == 1) // check 6 seconds of preamble separation
|
||||||
{
|
{
|
||||||
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);
|
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) % GPS_SUBFRAME_MS == 0)
|
if (std::abs(preamble_diff_ms - GPS_SUBFRAME_MS) % GPS_SUBFRAME_MS == 0)
|
||||||
@ -388,14 +386,14 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
<< static_cast<double>(d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs) << " [s]";
|
<< static_cast<double>(d_preamble_time_samples) / static_cast<double>(d_symbol_history.at(0).fs) << " [s]";
|
||||||
}
|
}
|
||||||
|
|
||||||
//try to decode the subframe:
|
// try to decode the subframe:
|
||||||
if (decode_subframe() == false)
|
if (decode_subframe() == false)
|
||||||
{
|
{
|
||||||
d_crc_error_synchronization_counter++;
|
d_crc_error_synchronization_counter++;
|
||||||
if (d_crc_error_synchronization_counter > 3)
|
if (d_crc_error_synchronization_counter > 3)
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "TOO MANY CRC ERRORS: Lost of frame sync SAT " << this->d_satellite << std::endl;
|
DLOG(INFO) << "TOO MANY CRC ERRORS: Lost of frame sync SAT " << this->d_satellite << std::endl;
|
||||||
d_stat = 0; //lost of frame sync
|
d_stat = 0; // lost of frame sync
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
flag_TOW_set = false;
|
flag_TOW_set = false;
|
||||||
d_crc_error_synchronization_counter = 0;
|
d_crc_error_synchronization_counter = 0;
|
||||||
@ -413,8 +411,8 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
if (preamble_diff_ms > GPS_SUBFRAME_MS)
|
if (preamble_diff_ms > GPS_SUBFRAME_MS)
|
||||||
{
|
{
|
||||||
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms;
|
DLOG(INFO) << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms;
|
||||||
// std::cout << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms << std::endl;
|
// std::cout << "Lost of frame sync SAT " << this->d_satellite << " preamble_diff= " << preamble_diff_ms << std::endl;
|
||||||
d_stat = 0; //lost of frame sync
|
d_stat = 0; // lost of frame sync
|
||||||
d_flag_frame_sync = false;
|
d_flag_frame_sync = false;
|
||||||
flag_TOW_set = false;
|
flag_TOW_set = false;
|
||||||
d_current_subframe_symbol = 0;
|
d_current_subframe_symbol = 0;
|
||||||
@ -424,11 +422,11 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//2. Add the telemetry decoder information
|
// 2. Add the telemetry decoder information
|
||||||
if (this->d_flag_preamble == true and d_flag_new_tow_available == true)
|
if (this->d_flag_preamble == true and d_flag_new_tow_available == true)
|
||||||
{
|
{
|
||||||
d_TOW_at_current_symbol_ms = static_cast<unsigned int>(d_nav.d_TOW * 1000.0) + GPS_CA_PREAMBLE_DURATION_MS;
|
d_TOW_at_current_symbol_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0) + GPS_CA_PREAMBLE_DURATION_MS;
|
||||||
d_TOW_at_Preamble_ms = static_cast<unsigned int>(d_nav.d_TOW * 1000.0);
|
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_nav.d_TOW * 1000.0);
|
||||||
flag_TOW_set = true;
|
flag_TOW_set = true;
|
||||||
d_flag_new_tow_available = false;
|
d_flag_new_tow_available = false;
|
||||||
}
|
}
|
||||||
@ -447,7 +445,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
|
|
||||||
if (flag_PLL_180_deg_phase_locked == true)
|
if (flag_PLL_180_deg_phase_locked == true)
|
||||||
{
|
{
|
||||||
//correct the accumulated phase for the Costas loop phase shift, if required
|
// correct the accumulated phase for the Costas loop phase shift, if required
|
||||||
current_symbol.Carrier_phase_rads += GPS_PI;
|
current_symbol.Carrier_phase_rads += GPS_PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,7 +469,7 @@ int gps_l1_ca_telemetry_decoder_cc::general_work(int noutput_items __attribute__
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//3. Make the output (copy the object contents to the GNURadio reserved memory)
|
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
|
||||||
*out[0] = current_symbol;
|
*out[0] = current_symbol;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -70,23 +70,23 @@ private:
|
|||||||
|
|
||||||
gps_l1_ca_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
gps_l1_ca_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
bool gps_word_parityCheck(unsigned int gpsword);
|
bool gps_word_parityCheck(uint32_t gpsword);
|
||||||
|
|
||||||
bool decode_subframe();
|
bool decode_subframe();
|
||||||
bool new_decoder();
|
bool new_decoder();
|
||||||
int d_crc_error_synchronization_counter;
|
int d_crc_error_synchronization_counter;
|
||||||
|
|
||||||
int *d_preambles_symbols;
|
int *d_preambles_symbols;
|
||||||
unsigned int d_stat;
|
uint32_t d_stat;
|
||||||
bool d_flag_frame_sync;
|
bool d_flag_frame_sync;
|
||||||
|
|
||||||
// symbols
|
// symbols
|
||||||
boost::circular_buffer<Gnss_Synchro> d_symbol_history;
|
boost::circular_buffer<Gnss_Synchro> d_symbol_history;
|
||||||
float d_subframe_symbols[GPS_SUBFRAME_MS]; //symbols per subframe
|
float d_subframe_symbols[GPS_SUBFRAME_MS]; // symbols per subframe
|
||||||
int d_current_subframe_symbol;
|
int d_current_subframe_symbol;
|
||||||
|
|
||||||
//bits and frame
|
// bits and frame
|
||||||
unsigned int d_prev_GPS_frame_4bytes;
|
uint32_t d_prev_GPS_frame_4bytes;
|
||||||
bool d_flag_preamble;
|
bool d_flag_preamble;
|
||||||
bool d_flag_new_tow_available;
|
bool d_flag_new_tow_available;
|
||||||
|
|
||||||
@ -99,8 +99,8 @@ private:
|
|||||||
|
|
||||||
uint64_t d_preamble_time_samples;
|
uint64_t d_preamble_time_samples;
|
||||||
|
|
||||||
unsigned int d_TOW_at_Preamble_ms;
|
uint32_t d_TOW_at_Preamble_ms;
|
||||||
unsigned int d_TOW_at_current_symbol_ms;
|
uint32_t d_TOW_at_current_symbol_ms;
|
||||||
|
|
||||||
bool flag_TOW_set;
|
bool flag_TOW_set;
|
||||||
bool flag_PLL_180_deg_phase_locked;
|
bool flag_PLL_180_deg_phase_locked;
|
||||||
|
@ -61,7 +61,7 @@ gps_l2c_telemetry_decoder_cc::gps_l2c_telemetry_decoder_cc(
|
|||||||
d_dump = dump;
|
d_dump = dump;
|
||||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||||
DLOG(INFO) << "GPS L2C M TELEMETRY PROCESSING: satellite " << d_satellite;
|
DLOG(INFO) << "GPS L2C M TELEMETRY PROCESSING: satellite " << d_satellite;
|
||||||
//set_output_multiple (1);
|
// set_output_multiple (1);
|
||||||
d_channel = 0;
|
d_channel = 0;
|
||||||
d_flag_valid_word = false;
|
d_flag_valid_word = false;
|
||||||
d_TOW_at_current_symbol = 0;
|
d_TOW_at_current_symbol = 0;
|
||||||
@ -69,7 +69,7 @@ gps_l2c_telemetry_decoder_cc::gps_l2c_telemetry_decoder_cc(
|
|||||||
d_state = 0; //initial state
|
d_state = 0; //initial state
|
||||||
d_crc_error_count = 0;
|
d_crc_error_count = 0;
|
||||||
|
|
||||||
//initialize the CNAV frame decoder (libswiftcnav)
|
// initialize the CNAV frame decoder (libswiftcnav)
|
||||||
cnav_msg_decoder_init(&d_cnav_decoder);
|
cnav_msg_decoder_init(&d_cnav_decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,34 +134,34 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
|
|
||||||
bool flag_new_cnav_frame = false;
|
bool flag_new_cnav_frame = false;
|
||||||
cnav_msg_t msg;
|
cnav_msg_t msg;
|
||||||
u32 delay = 0;
|
uint32_t delay = 0;
|
||||||
|
|
||||||
//add the symbol to the decoder
|
// add the symbol to the decoder
|
||||||
u8 symbol_clip = static_cast<u8>(in[0].Prompt_I > 0) * 255;
|
uint8_t symbol_clip = static_cast<uint8_t>(in[0].Prompt_I > 0) * 255;
|
||||||
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
|
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
|
||||||
|
|
||||||
consume_each(1); //one by one
|
consume_each(1); // one by one
|
||||||
|
|
||||||
// UPDATE GNSS SYNCHRO DATA
|
// UPDATE GNSS SYNCHRO DATA
|
||||||
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
|
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
|
// 1. Copy the current tracking output
|
||||||
current_synchro_data = in[0];
|
current_synchro_data = in[0];
|
||||||
|
|
||||||
//2. Add the telemetry decoder information
|
// 2. Add the telemetry decoder information
|
||||||
//check if new CNAV frame is available
|
// check if new CNAV frame is available
|
||||||
if (flag_new_cnav_frame == true)
|
if (flag_new_cnav_frame == true)
|
||||||
{
|
{
|
||||||
std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> raw_bits;
|
std::bitset<GPS_L2_CNAV_DATA_PAGE_BITS> raw_bits;
|
||||||
//Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
|
// Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
|
||||||
for (u32 i = 0; i < GPS_L2_CNAV_DATA_PAGE_BITS; i++)
|
for (uint32_t i = 0; i < GPS_L2_CNAV_DATA_PAGE_BITS; i++)
|
||||||
{
|
{
|
||||||
raw_bits[GPS_L2_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1u);
|
raw_bits[GPS_L2_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
d_CNAV_Message.decode_page(raw_bits);
|
d_CNAV_Message.decode_page(raw_bits);
|
||||||
|
|
||||||
//Push the new navigation data to the queues
|
// Push the new navigation data to the queues
|
||||||
if (d_CNAV_Message.have_new_ephemeris() == true)
|
if (d_CNAV_Message.have_new_ephemeris() == true)
|
||||||
{
|
{
|
||||||
// get ephemeris object for this SV
|
// get ephemeris object for this SV
|
||||||
@ -183,12 +183,12 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
//update TOW at the preamble instant
|
// update TOW at the preamble instant
|
||||||
d_TOW_at_Preamble = static_cast<double>(msg.tow);
|
d_TOW_at_Preamble = static_cast<double>(msg.tow);
|
||||||
//* The time of the last input symbol can be computed from the message ToW and
|
// The time of the last input symbol can be computed from the message ToW and
|
||||||
//* delay by the formulae:
|
// delay by the formulae:
|
||||||
//* \code
|
// \code
|
||||||
//* symbolTime_ms = msg->tow * 6000 + *pdelay * 20 + (12 * 20); 12 symbols of the encoder's transitory
|
// symbolTime_ms = msg->tow * 6000 + *pdelay * 20 + (12 * 20); 12 symbols of the encoder's transitory
|
||||||
d_TOW_at_current_symbol = static_cast<double>(msg.tow) * 6.0 + static_cast<double>(delay) * GPS_L2_M_PERIOD + 12 * GPS_L2_M_PERIOD;
|
d_TOW_at_current_symbol = static_cast<double>(msg.tow) * 6.0 + static_cast<double>(delay) * GPS_L2_M_PERIOD + 12 * GPS_L2_M_PERIOD;
|
||||||
//d_TOW_at_current_symbol = floor(d_TOW_at_current_symbol * 1000.0) / 1000.0;
|
//d_TOW_at_current_symbol = floor(d_TOW_at_current_symbol * 1000.0) / 1000.0;
|
||||||
d_flag_valid_word = true;
|
d_flag_valid_word = true;
|
||||||
@ -224,7 +224,7 @@ int gps_l2c_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//3. Make the output (copy the object contents to the GNURadio reserved memory)
|
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
|
||||||
out[0] = current_synchro_data;
|
out[0] = current_synchro_data;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "gps_cnav_iono.h"
|
#include "gps_cnav_iono.h"
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
#include <algorithm> // for copy
|
#include <algorithm> // for copy
|
||||||
|
#include <cstdint>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -70,7 +71,7 @@ class gps_l2c_telemetry_decoder_cc : public gr::block
|
|||||||
public:
|
public:
|
||||||
~gps_l2c_telemetry_decoder_cc();
|
~gps_l2c_telemetry_decoder_cc();
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -78,7 +79,6 @@ public:
|
|||||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend gps_l2c_telemetry_decoder_cc_sptr
|
friend gps_l2c_telemetry_decoder_cc_sptr
|
||||||
gps_l2c_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
gps_l2c_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
@ -86,15 +86,15 @@ private:
|
|||||||
|
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int d_channel;
|
int32_t d_channel;
|
||||||
|
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
cnav_msg_decoder_t d_cnav_decoder;
|
cnav_msg_decoder_t d_cnav_decoder;
|
||||||
|
|
||||||
int d_state;
|
int32_t d_state;
|
||||||
int d_crc_error_count;
|
int32_t d_crc_error_count;
|
||||||
|
|
||||||
double d_TOW_at_current_symbol;
|
double d_TOW_at_current_symbol;
|
||||||
double d_TOW_at_Preamble;
|
double d_TOW_at_Preamble;
|
||||||
|
@ -66,9 +66,9 @@ gps_l5_telemetry_decoder_cc::gps_l5_telemetry_decoder_cc(
|
|||||||
d_flag_valid_word = false;
|
d_flag_valid_word = false;
|
||||||
d_TOW_at_current_symbol_ms = 0;
|
d_TOW_at_current_symbol_ms = 0;
|
||||||
d_TOW_at_Preamble_ms = 0;
|
d_TOW_at_Preamble_ms = 0;
|
||||||
//initialize the CNAV frame decoder (libswiftcnav)
|
// initialize the CNAV frame decoder (libswiftcnav)
|
||||||
cnav_msg_decoder_init(&d_cnav_decoder);
|
cnav_msg_decoder_init(&d_cnav_decoder);
|
||||||
for (int aux = 0; aux < GPS_L5i_NH_CODE_LENGTH; aux++)
|
for (int32_t aux = 0; aux < GPS_L5i_NH_CODE_LENGTH; aux++)
|
||||||
{
|
{
|
||||||
if (GPS_L5i_NH_CODE[aux] == 0)
|
if (GPS_L5i_NH_CODE[aux] == 0)
|
||||||
{
|
{
|
||||||
@ -108,7 +108,7 @@ void gps_l5_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void gps_l5_telemetry_decoder_cc::set_channel(int channel)
|
void gps_l5_telemetry_decoder_cc::set_channel(int32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
d_CNAV_Message.reset();
|
d_CNAV_Message.reset();
|
||||||
@ -146,17 +146,17 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u
|
|||||||
|
|
||||||
// UPDATE GNSS SYNCHRO DATA
|
// UPDATE GNSS SYNCHRO DATA
|
||||||
Gnss_Synchro current_synchro_data; //structure to save the synchronization information and send the output object to the next block
|
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
|
// 1. Copy the current tracking output
|
||||||
current_synchro_data = in[0];
|
current_synchro_data = in[0];
|
||||||
consume_each(1); //one by one
|
consume_each(1); //one by one
|
||||||
sym_hist.push_back(in[0].Prompt_I);
|
sym_hist.push_back(in[0].Prompt_I);
|
||||||
int corr_NH = 0;
|
int32_t corr_NH = 0;
|
||||||
int symbol_value = 0;
|
int32_t symbol_value = 0;
|
||||||
|
|
||||||
//Search correlation with Neuman-Hofman Code (see IS-GPS-705D)
|
// Search correlation with Neuman-Hofman Code (see IS-GPS-705D)
|
||||||
if (sym_hist.size() == GPS_L5i_NH_CODE_LENGTH)
|
if (sym_hist.size() == GPS_L5i_NH_CODE_LENGTH)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < GPS_L5i_NH_CODE_LENGTH; i++)
|
for (int32_t i = 0; i < GPS_L5i_NH_CODE_LENGTH; i++)
|
||||||
{
|
{
|
||||||
if ((bits_NH[i] * sym_hist.at(i)) > 0.0)
|
if ((bits_NH[i] * sym_hist.at(i)) > 0.0)
|
||||||
{
|
{
|
||||||
@ -191,29 +191,29 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u
|
|||||||
|
|
||||||
bool flag_new_cnav_frame = false;
|
bool flag_new_cnav_frame = false;
|
||||||
cnav_msg_t msg;
|
cnav_msg_t msg;
|
||||||
u32 delay = 0;
|
uint32_t delay = 0;
|
||||||
|
|
||||||
//add the symbol to the decoder
|
// add the symbol to the decoder
|
||||||
if (new_sym)
|
if (new_sym)
|
||||||
{
|
{
|
||||||
u8 symbol_clip = static_cast<u8>(symbol_value > 0) * 255;
|
uint8_t symbol_clip = static_cast<uint8_t>(symbol_value > 0) * 255;
|
||||||
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
|
flag_new_cnav_frame = cnav_msg_decoder_add_symbol(&d_cnav_decoder, symbol_clip, &msg, &delay);
|
||||||
new_sym = false;
|
new_sym = false;
|
||||||
}
|
}
|
||||||
//2. Add the telemetry decoder information
|
// 2. Add the telemetry decoder information
|
||||||
//check if new CNAV frame is available
|
// check if new CNAV frame is available
|
||||||
if (flag_new_cnav_frame == true)
|
if (flag_new_cnav_frame == true)
|
||||||
{
|
{
|
||||||
std::bitset<GPS_L5_CNAV_DATA_PAGE_BITS> raw_bits;
|
std::bitset<GPS_L5_CNAV_DATA_PAGE_BITS> raw_bits;
|
||||||
//Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
|
// Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
|
||||||
for (u32 i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS; i++)
|
for (uint32_t i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS; i++)
|
||||||
{
|
{
|
||||||
raw_bits[GPS_L5_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1u);
|
raw_bits[GPS_L5_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1u);
|
||||||
}
|
}
|
||||||
|
|
||||||
d_CNAV_Message.decode_page(raw_bits);
|
d_CNAV_Message.decode_page(raw_bits);
|
||||||
|
|
||||||
//Push the new navigation data to the queues
|
// Push the new navigation data to the queues
|
||||||
if (d_CNAV_Message.have_new_ephemeris() == true)
|
if (d_CNAV_Message.have_new_ephemeris() == true)
|
||||||
{
|
{
|
||||||
// get ephemeris object for this SV
|
// get ephemeris object for this SV
|
||||||
@ -235,14 +235,12 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u
|
|||||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
//update TOW at the preamble instant
|
// update TOW at the preamble instant
|
||||||
d_TOW_at_Preamble_ms = msg.tow * 6000;
|
d_TOW_at_Preamble_ms = msg.tow * 6000;
|
||||||
//* The time of the last input symbol can be computed from the message ToW and
|
// The time of the last input symbol can be computed from the message ToW and
|
||||||
//* delay by the formulae:
|
// delay by the formulae:
|
||||||
//* \code
|
// \code
|
||||||
//* symbolTime_ms = msg->tow * 6000 + *pdelay * 10 + (12 * 10); 12 symbols of the encoder's transitory
|
// symbolTime_ms = msg->tow * 6000 + *pdelay * 10 + (12 * 10); 12 symbols of the encoder's transitory
|
||||||
//d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5i_SYMBOL_PERIOD_MS;
|
|
||||||
|
|
||||||
d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5i_SYMBOL_PERIOD_MS;
|
d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5i_SYMBOL_PERIOD_MS;
|
||||||
d_flag_valid_word = true;
|
d_flag_valid_word = true;
|
||||||
}
|
}
|
||||||
@ -280,7 +278,7 @@ int gps_l5_telemetry_decoder_cc::general_work(int noutput_items __attribute__((u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//3. Make the output (copy the object contents to the GNURadio reserved memory)
|
// 3. Make the output (copy the object contents to the GNURadio reserved memory)
|
||||||
out[0] = current_synchro_data;
|
out[0] = current_synchro_data;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -35,13 +35,15 @@
|
|||||||
#include "gps_cnav_navigation_message.h"
|
#include "gps_cnav_navigation_message.h"
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstdint>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
extern "C" {
|
extern "C"
|
||||||
|
{
|
||||||
#include "cnav_msg.h"
|
#include "cnav_msg.h"
|
||||||
#include "edc.h"
|
#include "edc.h"
|
||||||
#include "bits.h"
|
#include "bits.h"
|
||||||
@ -65,11 +67,10 @@ class gps_l5_telemetry_decoder_cc : public gr::block
|
|||||||
public:
|
public:
|
||||||
~gps_l5_telemetry_decoder_cc();
|
~gps_l5_telemetry_decoder_cc();
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
||||||
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
int general_work(int noutput_items, gr_vector_int &ninput_items,
|
||||||
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend gps_l5_telemetry_decoder_cc_sptr
|
friend gps_l5_telemetry_decoder_cc_sptr
|
||||||
gps_l5_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
gps_l5_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
@ -77,15 +78,15 @@ private:
|
|||||||
|
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int d_channel;
|
int32_t d_channel;
|
||||||
|
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
|
|
||||||
cnav_msg_decoder_t d_cnav_decoder;
|
cnav_msg_decoder_t d_cnav_decoder;
|
||||||
|
|
||||||
unsigned int d_TOW_at_current_symbol_ms;
|
uint32_t d_TOW_at_current_symbol_ms;
|
||||||
unsigned int d_TOW_at_Preamble_ms;
|
uint32_t d_TOW_at_Preamble_ms;
|
||||||
bool d_flag_valid_word;
|
bool d_flag_valid_word;
|
||||||
|
|
||||||
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
Gps_CNAV_Navigation_Message d_CNAV_Message;
|
||||||
|
@ -94,7 +94,7 @@ void sbas_l1_telemetry_decoder_cc::set_satellite(const Gnss_Satellite &satellite
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sbas_l1_telemetry_decoder_cc::set_channel(int channel)
|
void sbas_l1_telemetry_decoder_cc::set_channel(int32_t channel)
|
||||||
{
|
{
|
||||||
d_channel = channel;
|
d_channel = channel;
|
||||||
LOG(INFO) << "SBAS channel set to " << channel;
|
LOG(INFO) << "SBAS channel set to " << channel;
|
||||||
@ -137,12 +137,12 @@ bool sbas_l1_telemetry_decoder_cc::sample_aligner::get_symbols(const std::vector
|
|||||||
VLOG(FLOW) << "get_symbols(): "
|
VLOG(FLOW) << "get_symbols(): "
|
||||||
<< "d_past_sample=" << d_past_sample << "\tsamples size=" << samples.size();
|
<< "d_past_sample=" << d_past_sample << "\tsamples size=" << samples.size();
|
||||||
|
|
||||||
for (unsigned int i_sym = 0; i_sym < samples.size() / sbas_l1_telemetry_decoder_cc::d_samples_per_symbol; i_sym++)
|
for (uint32_t i_sym = 0; i_sym < samples.size() / sbas_l1_telemetry_decoder_cc::d_samples_per_symbol; i_sym++)
|
||||||
{
|
{
|
||||||
// get the next samples
|
// get the next samples
|
||||||
for (int i = 0; i < d_n_smpls_in_history; i++)
|
for (int32_t i = 0; i < d_n_smpls_in_history; i++)
|
||||||
{
|
{
|
||||||
smpls[i] = static_cast<int>(i_sym) * sbas_l1_telemetry_decoder_cc::d_samples_per_symbol + i - 1 == -1 ? d_past_sample : samples[i_sym * sbas_l1_telemetry_decoder_cc::d_samples_per_symbol + i - 1];
|
smpls[i] = static_cast<int32_t>(i_sym) * sbas_l1_telemetry_decoder_cc::d_samples_per_symbol + i - 1 == -1 ? d_past_sample : samples[i_sym * sbas_l1_telemetry_decoder_cc::d_samples_per_symbol + i - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the pseudo correlations (IIR method) of the two possible alignments
|
// update the pseudo correlations (IIR method) of the two possible alignments
|
||||||
@ -158,7 +158,7 @@ bool sbas_l1_telemetry_decoder_cc::sample_aligner::get_symbols(const std::vector
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sum the correct pair of samples to a symbol, depending on the current alignment d_align
|
// sum the correct pair of samples to a symbol, depending on the current alignment d_align
|
||||||
sym = smpls[0 + int(d_aligned) * 2] + smpls[1];
|
sym = smpls[0 + int32_t(d_aligned) * 2] + smpls[1];
|
||||||
symbols.push_back(sym);
|
symbols.push_back(sym);
|
||||||
|
|
||||||
// sample alignment debug output
|
// sample alignment debug output
|
||||||
@ -189,8 +189,8 @@ sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::symbol_aligner_and_dec
|
|||||||
{
|
{
|
||||||
// convolutional code properties
|
// convolutional code properties
|
||||||
d_KK = 7;
|
d_KK = 7;
|
||||||
int nn = 2;
|
int32_t nn = 2;
|
||||||
int g_encoder[nn];
|
int32_t g_encoder[nn];
|
||||||
g_encoder[0] = 121;
|
g_encoder[0] = 121;
|
||||||
g_encoder[1] = 91;
|
g_encoder[1] = 91;
|
||||||
|
|
||||||
@ -215,11 +215,11 @@ void sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::get_bits(const std::vector<double> symbols, std::vector<int> &bits)
|
bool sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::get_bits(const std::vector<double> symbols, std::vector<int32_t> &bits)
|
||||||
{
|
{
|
||||||
const int traceback_depth = 5 * d_KK;
|
const int32_t traceback_depth = 5 * d_KK;
|
||||||
int nbits_requested = symbols.size() / d_symbols_per_bit;
|
int32_t nbits_requested = symbols.size() / d_symbols_per_bit;
|
||||||
int nbits_decoded;
|
int32_t nbits_decoded;
|
||||||
// fill two vectors with the two possible symbol alignments
|
// fill two vectors with the two possible symbol alignments
|
||||||
std::vector<double> symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector
|
std::vector<double> symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector
|
||||||
std::vector<double> symbols_vd2; // shifted symbol vector -> add past sample in front of input vector
|
std::vector<double> symbols_vd2; // shifted symbol vector -> add past sample in front of input vector
|
||||||
@ -229,13 +229,13 @@ bool sbas_l1_telemetry_decoder_cc::symbol_aligner_and_decoder::get_bits(const st
|
|||||||
symbols_vd2.push_back(*symbol_it);
|
symbols_vd2.push_back(*symbol_it);
|
||||||
}
|
}
|
||||||
// arrays for decoded bits
|
// arrays for decoded bits
|
||||||
int *bits_vd1 = new int[nbits_requested];
|
int32_t *bits_vd1 = new int32_t[nbits_requested];
|
||||||
int *bits_vd2 = new int[nbits_requested];
|
int32_t *bits_vd2 = new int32_t[nbits_requested];
|
||||||
// decode
|
// decode
|
||||||
float metric_vd1 = d_vd1->decode_continuous(symbols_vd1.data(), traceback_depth, bits_vd1, nbits_requested, nbits_decoded);
|
float metric_vd1 = d_vd1->decode_continuous(symbols_vd1.data(), traceback_depth, bits_vd1, nbits_requested, nbits_decoded);
|
||||||
float metric_vd2 = d_vd2->decode_continuous(symbols_vd2.data(), traceback_depth, bits_vd2, nbits_requested, nbits_decoded);
|
float metric_vd2 = d_vd2->decode_continuous(symbols_vd2.data(), traceback_depth, bits_vd2, nbits_requested, nbits_decoded);
|
||||||
// choose the bits with the better metric
|
// choose the bits with the better metric
|
||||||
for (int i = 0; i < nbits_decoded; i++)
|
for (int32_t i = 0; i < nbits_decoded; i++)
|
||||||
{
|
{
|
||||||
if (metric_vd1 > metric_vd2)
|
if (metric_vd1 > metric_vd2)
|
||||||
{ // symbols aligned
|
{ // symbols aligned
|
||||||
@ -260,35 +260,35 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const std::vector<int> bits, std::vector<std::pair<int, std::vector<int>>> &msg_candidates)
|
void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const std::vector<int32_t> bits, std::vector<std::pair<int32_t, std::vector<int32_t>>> &msg_candidates)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
unsigned int sbas_msg_length = 250;
|
uint32_t sbas_msg_length = 250;
|
||||||
std::vector<std::vector<int>> preambles = {{0, 1, 0, 1, 0, 0, 1, 1},
|
std::vector<std::vector<int32_t>> preambles = {{0, 1, 0, 1, 0, 0, 1, 1},
|
||||||
{1, 0, 0, 1, 1, 0, 1, 0},
|
{1, 0, 0, 1, 1, 0, 1, 0},
|
||||||
{1, 1, 0, 0, 0, 1, 1, 0}};
|
{1, 1, 0, 0, 0, 1, 1, 0}};
|
||||||
VLOG(FLOW) << "get_frame_candidates(): "
|
VLOG(FLOW) << "get_frame_candidates(): "
|
||||||
<< "d_buffer.size()=" << d_buffer.size() << "\tbits.size()=" << bits.size();
|
<< "d_buffer.size()=" << d_buffer.size() << "\tbits.size()=" << bits.size();
|
||||||
ss << "copy bits ";
|
ss << "copy bits ";
|
||||||
int count = 0;
|
int32_t count = 0;
|
||||||
// copy new bits into the working buffer
|
// copy new bits into the working buffer
|
||||||
for (std::vector<int>::const_iterator bit_it = bits.cbegin(); bit_it < bits.cend(); ++bit_it)
|
for (std::vector<int32_t>::const_iterator bit_it = bits.cbegin(); bit_it < bits.cend(); ++bit_it)
|
||||||
{
|
{
|
||||||
d_buffer.push_back(*bit_it);
|
d_buffer.push_back(*bit_it);
|
||||||
ss << *bit_it;
|
ss << *bit_it;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
VLOG(SAMP_SYNC) << ss.str() << " into working buffer (" << count << " bits)";
|
VLOG(SAMP_SYNC) << ss.str() << " into working buffer (" << count << " bits)";
|
||||||
int relative_preamble_start = 0;
|
int32_t relative_preamble_start = 0;
|
||||||
while (d_buffer.size() >= sbas_msg_length)
|
while (d_buffer.size() >= sbas_msg_length)
|
||||||
{
|
{
|
||||||
// compare with all preambles
|
// compare with all preambles
|
||||||
for (std::vector<std::vector<int>>::iterator preample_it = preambles.begin(); preample_it < preambles.end(); ++preample_it)
|
for (std::vector<std::vector<int32_t>>::iterator preample_it = preambles.begin(); preample_it < preambles.end(); ++preample_it)
|
||||||
{
|
{
|
||||||
bool preamble_detected = true;
|
bool preamble_detected = true;
|
||||||
bool inv_preamble_detected = true;
|
bool inv_preamble_detected = true;
|
||||||
// compare the buffer bits with the preamble bits
|
// compare the buffer bits with the preamble bits
|
||||||
for (std::vector<int>::iterator preample_bit_it = preample_it->begin(); preample_bit_it < preample_it->end(); ++preample_bit_it)
|
for (std::vector<int32_t>::iterator preample_bit_it = preample_it->begin(); preample_bit_it < preample_it->end(); ++preample_bit_it)
|
||||||
{
|
{
|
||||||
preamble_detected = *preample_bit_it == d_buffer[preample_bit_it - preample_it->begin()] ? preamble_detected : false;
|
preamble_detected = *preample_bit_it == d_buffer[preample_bit_it - preample_it->begin()] ? preamble_detected : false;
|
||||||
inv_preamble_detected = *preample_bit_it != d_buffer[preample_bit_it - preample_it->begin()] ? inv_preamble_detected : false;
|
inv_preamble_detected = *preample_bit_it != d_buffer[preample_bit_it - preample_it->begin()] ? inv_preamble_detected : false;
|
||||||
@ -296,18 +296,18 @@ void sbas_l1_telemetry_decoder_cc::frame_detector::get_frame_candidates(const st
|
|||||||
if (preamble_detected || inv_preamble_detected)
|
if (preamble_detected || inv_preamble_detected)
|
||||||
{
|
{
|
||||||
// copy candidate
|
// copy candidate
|
||||||
std::vector<int> candidate;
|
std::vector<int32_t> candidate;
|
||||||
std::copy(d_buffer.begin(), d_buffer.begin() + sbas_msg_length, std::back_inserter(candidate));
|
std::copy(d_buffer.begin(), d_buffer.begin() + sbas_msg_length, std::back_inserter(candidate));
|
||||||
if (inv_preamble_detected)
|
if (inv_preamble_detected)
|
||||||
{
|
{
|
||||||
// invert bits
|
// invert bits
|
||||||
for (std::vector<int>::iterator candidate_bit_it = candidate.begin(); candidate_bit_it != candidate.end(); candidate_bit_it++)
|
for (std::vector<int32_t>::iterator candidate_bit_it = candidate.begin(); candidate_bit_it != candidate.end(); candidate_bit_it++)
|
||||||
*candidate_bit_it = *candidate_bit_it == 0 ? 1 : 0;
|
*candidate_bit_it = *candidate_bit_it == 0 ? 1 : 0;
|
||||||
}
|
}
|
||||||
msg_candidates.push_back(std::pair<int, std::vector<int>>(relative_preamble_start, candidate));
|
msg_candidates.push_back(std::pair<int32_t, std::vector<int32_t>>(relative_preamble_start, candidate));
|
||||||
ss.str("");
|
ss.str("");
|
||||||
ss << "preamble " << preample_it - preambles.begin() << (inv_preamble_detected ? " inverted" : " normal") << " detected! candidate=";
|
ss << "preamble " << preample_it - preambles.begin() << (inv_preamble_detected ? " inverted" : " normal") << " detected! candidate=";
|
||||||
for (std::vector<int>::iterator bit_it = candidate.begin(); bit_it < candidate.end(); ++bit_it)
|
for (std::vector<int32_t>::iterator bit_it = candidate.begin(); bit_it < candidate.end(); ++bit_it)
|
||||||
ss << *bit_it;
|
ss << *bit_it;
|
||||||
VLOG(EVENT) << ss.str();
|
VLOG(EVENT) << ss.str();
|
||||||
}
|
}
|
||||||
@ -334,12 +334,12 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vec
|
|||||||
for (std::vector<msg_candiate_int_t>::const_iterator candidate_it = msg_candidates.cbegin(); candidate_it < msg_candidates.cend(); ++candidate_it)
|
for (std::vector<msg_candiate_int_t>::const_iterator candidate_it = msg_candidates.cbegin(); candidate_it < msg_candidates.cend(); ++candidate_it)
|
||||||
{
|
{
|
||||||
// convert to bytes
|
// convert to bytes
|
||||||
std::vector<unsigned char> candidate_bytes;
|
std::vector<uint8_t> candidate_bytes;
|
||||||
zerropad_back_and_convert_to_bytes(candidate_it->second, candidate_bytes);
|
zerropad_back_and_convert_to_bytes(candidate_it->second, candidate_bytes);
|
||||||
// verify CRC
|
// verify CRC
|
||||||
d_checksum_agent.reset(0);
|
d_checksum_agent.reset(0);
|
||||||
d_checksum_agent.process_bytes(candidate_bytes.data(), candidate_bytes.size());
|
d_checksum_agent.process_bytes(candidate_bytes.data(), candidate_bytes.size());
|
||||||
unsigned int crc = d_checksum_agent.checksum();
|
uint32_t crc = d_checksum_agent.checksum();
|
||||||
VLOG(SAMP_SYNC) << "candidate " << candidate_it - msg_candidates.begin()
|
VLOG(SAMP_SYNC) << "candidate " << candidate_it - msg_candidates.begin()
|
||||||
<< ": final crc remainder= " << std::hex << crc
|
<< ": final crc remainder= " << std::hex << crc
|
||||||
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
||||||
@ -354,66 +354,66 @@ void sbas_l1_telemetry_decoder_cc::crc_verifier::get_valid_frames(const std::vec
|
|||||||
ss << "Not a valid message.";
|
ss << "Not a valid message.";
|
||||||
}
|
}
|
||||||
ss << " Relbitoffset=" << candidate_it->first << " content=";
|
ss << " Relbitoffset=" << candidate_it->first << " content=";
|
||||||
for (std::vector<unsigned char>::iterator byte_it = candidate_bytes.begin(); byte_it < candidate_bytes.end(); ++byte_it)
|
for (std::vector<uint8_t>::iterator byte_it = candidate_bytes.begin(); byte_it < candidate_bytes.end(); ++byte_it)
|
||||||
{
|
{
|
||||||
ss << std::setw(2) << std::setfill('0') << std::hex << static_cast<unsigned int>((*byte_it));
|
ss << std::setw(2) << std::setfill('0') << std::hex << static_cast<uint32_t>((*byte_it));
|
||||||
}
|
}
|
||||||
VLOG(SAMP_SYNC) << ss.str() << std::setfill(' ') << std::resetiosflags(std::ios::hex) << std::endl;
|
VLOG(SAMP_SYNC) << ss.str() << std::setfill(' ') << std::resetiosflags(std::ios::hex) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes)
|
void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_back_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<uint8_t> &bytes)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
const size_t bits_per_byte = 8;
|
const size_t bits_per_byte = 8;
|
||||||
unsigned char byte = 0;
|
uint8_t byte = 0;
|
||||||
VLOG(LMORE) << "zerropad_back_and_convert_to_bytes():" << byte;
|
VLOG(LMORE) << "zerropad_back_and_convert_to_bytes():" << byte;
|
||||||
for (std::vector<int>::const_iterator candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it)
|
for (std::vector<int>::const_iterator candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it)
|
||||||
{
|
{
|
||||||
int idx_bit = candidate_bit_it - msg_candidate.begin();
|
int32_t idx_bit = candidate_bit_it - msg_candidate.begin();
|
||||||
int bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||||
byte |= static_cast<unsigned char>(*candidate_bit_it) << bit_pos_in_current_byte;
|
byte |= static_cast<uint8_t>(*candidate_bit_it) << bit_pos_in_current_byte;
|
||||||
ss << *candidate_bit_it;
|
ss << *candidate_bit_it;
|
||||||
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
||||||
{
|
{
|
||||||
bytes.push_back(byte);
|
bytes.push_back(byte);
|
||||||
VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2) << std::setfill('0') << std::hex << static_cast<unsigned int>(byte);
|
VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2) << std::setfill('0') << std::hex << static_cast<uint32_t>(byte);
|
||||||
ss.str("");
|
ss.str("");
|
||||||
byte = 0;
|
byte = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes.push_back(byte); // implies: insert 6 zeros at the end to fit the 250bits into a multiple of bytes
|
bytes.push_back(byte); // implies: insert 6 zeros at the end to fit the 250bits into a multiple of bytes
|
||||||
VLOG(LMORE) << " -> byte=" << std::setw(2)
|
VLOG(LMORE) << " -> byte=" << std::setw(2)
|
||||||
<< std::setfill('0') << std::hex << static_cast<unsigned int>(byte)
|
<< std::setfill('0') << std::hex << static_cast<uint32_t>(byte)
|
||||||
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes)
|
void sbas_l1_telemetry_decoder_cc::crc_verifier::zerropad_front_and_convert_to_bytes(const std::vector<int32_t> msg_candidate, std::vector<uint8_t> &bytes)
|
||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
const size_t bits_per_byte = 8;
|
const size_t bits_per_byte = 8;
|
||||||
unsigned char byte = 0;
|
uint8_t byte = 0;
|
||||||
int idx_bit = 6; // insert 6 zeros at the front to fit the 250bits into a multiple of bytes
|
int32_t idx_bit = 6; // insert 6 zeros at the front to fit the 250bits into a multiple of bytes
|
||||||
VLOG(LMORE) << "zerropad_front_and_convert_to_bytes():" << byte;
|
VLOG(LMORE) << "zerropad_front_and_convert_to_bytes():" << byte;
|
||||||
for (std::vector<int>::const_iterator candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it)
|
for (std::vector<int32_t>::const_iterator candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it)
|
||||||
{
|
{
|
||||||
int bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||||
byte |= static_cast<unsigned char>(*candidate_bit_it) << bit_pos_in_current_byte;
|
byte |= static_cast<uint8_t>(*candidate_bit_it) << bit_pos_in_current_byte;
|
||||||
ss << *candidate_bit_it;
|
ss << *candidate_bit_it;
|
||||||
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
||||||
{
|
{
|
||||||
bytes.push_back(byte);
|
bytes.push_back(byte);
|
||||||
VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2)
|
VLOG(LMORE) << ss.str() << " -> byte=" << std::setw(2)
|
||||||
<< std::setfill('0') << std::hex << static_cast<unsigned int>(byte);
|
<< std::setfill('0') << std::hex << static_cast<uint32_t>(byte);
|
||||||
ss.str("");
|
ss.str("");
|
||||||
byte = 0;
|
byte = 0;
|
||||||
}
|
}
|
||||||
idx_bit++;
|
idx_bit++;
|
||||||
}
|
}
|
||||||
VLOG(LMORE) << " -> byte=" << std::setw(2)
|
VLOG(LMORE) << " -> byte=" << std::setw(2)
|
||||||
<< std::setfill('0') << std::hex << static_cast<unsigned int>(byte)
|
<< std::setfill('0') << std::hex << static_cast<uint32_t>(byte)
|
||||||
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,8 +427,8 @@ int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
|
Gnss_Synchro *out = reinterpret_cast<Gnss_Synchro *>(output_items[0]); // Get the output buffer pointer
|
||||||
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
const Gnss_Synchro *in = reinterpret_cast<const Gnss_Synchro *>(input_items[0]); // Get the input buffer pointer
|
||||||
|
|
||||||
Gnss_Synchro current_symbol; //structure to save the synchronization information and send the output object to the next block
|
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
|
// 1. Copy the current tracking output
|
||||||
current_symbol = in[0];
|
current_symbol = in[0];
|
||||||
// copy correlation samples into samples vector
|
// copy correlation samples into samples vector
|
||||||
d_sample_buf.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue
|
d_sample_buf.push_back(current_symbol.Prompt_I); //add new symbol to the symbol queue
|
||||||
@ -446,7 +446,7 @@ int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
|
|
||||||
// align symbols in pairs
|
// align symbols in pairs
|
||||||
// and obtain the bits by decoding the symbol pairs
|
// and obtain the bits by decoding the symbol pairs
|
||||||
std::vector<int> bits;
|
std::vector<int32_t> bits;
|
||||||
bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits);
|
bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits);
|
||||||
|
|
||||||
// search for preambles
|
// search for preambles
|
||||||
@ -465,7 +465,7 @@ int sbas_l1_telemetry_decoder_cc::general_work(int noutput_items __attribute__((
|
|||||||
for (std::vector<msg_candiate_char_t>::const_iterator it = valid_msgs.cbegin();
|
for (std::vector<msg_candiate_char_t>::const_iterator it = valid_msgs.cbegin();
|
||||||
it != valid_msgs.cend(); ++it)
|
it != valid_msgs.cend(); ++it)
|
||||||
{
|
{
|
||||||
int message_sample_offset =
|
int32_t message_sample_offset =
|
||||||
(sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first;
|
(sample_alignment ? 0 : -1) + d_samples_per_symbol * (symbol_alignment ? -1 : 0) + d_samples_per_symbol * d_symbols_per_bit * it->first;
|
||||||
double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
|
double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
|
||||||
VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp
|
VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include <boost/crc.hpp>
|
#include <boost/crc.hpp>
|
||||||
#include <gnuradio/block.h>
|
#include <gnuradio/block.h>
|
||||||
#include <algorithm> // for copy
|
#include <algorithm> // for copy
|
||||||
|
#include <cstdint>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -59,7 +60,7 @@ class sbas_l1_telemetry_decoder_cc : public gr::block
|
|||||||
public:
|
public:
|
||||||
~sbas_l1_telemetry_decoder_cc();
|
~sbas_l1_telemetry_decoder_cc();
|
||||||
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
void set_satellite(const Gnss_Satellite &satellite); //!< Set satellite PRN
|
||||||
void set_channel(int channel); //!< Set receiver's channel
|
void set_channel(int32_t channel); //!< Set receiver's channel
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief This is where all signal processing takes place
|
* \brief This is where all signal processing takes place
|
||||||
@ -72,16 +73,16 @@ private:
|
|||||||
sbas_l1_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
sbas_l1_make_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
sbas_l1_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
sbas_l1_telemetry_decoder_cc(const Gnss_Satellite &satellite, bool dump);
|
||||||
|
|
||||||
void viterbi_decoder(double *page_part_symbols, int *page_part_bits);
|
void viterbi_decoder(double *page_part_symbols, int32_t *page_part_bits);
|
||||||
void align_samples();
|
void align_samples();
|
||||||
|
|
||||||
static const int d_samples_per_symbol = 2;
|
static const int32_t d_samples_per_symbol = 2;
|
||||||
static const int d_symbols_per_bit = 2;
|
static const int32_t d_symbols_per_bit = 2;
|
||||||
static const int d_block_size_in_bits = 30;
|
static const int32_t d_block_size_in_bits = 30;
|
||||||
|
|
||||||
bool d_dump;
|
bool d_dump;
|
||||||
Gnss_Satellite d_satellite;
|
Gnss_Satellite d_satellite;
|
||||||
int d_channel;
|
int32_t d_channel;
|
||||||
|
|
||||||
std::string d_dump_filename;
|
std::string d_dump_filename;
|
||||||
std::ofstream d_dump_file;
|
std::ofstream d_dump_file;
|
||||||
@ -89,8 +90,8 @@ private:
|
|||||||
size_t d_block_size; //!< number of samples which are processed during one invocation of the algorithms
|
size_t d_block_size; //!< number of samples which are processed during one invocation of the algorithms
|
||||||
std::vector<double> d_sample_buf; //!< input buffer holding the samples to be processed in one block
|
std::vector<double> d_sample_buf; //!< input buffer holding the samples to be processed in one block
|
||||||
|
|
||||||
typedef std::pair<int, std::vector<int>> msg_candiate_int_t;
|
typedef std::pair<int32_t, std::vector<int32_t>> msg_candiate_int_t;
|
||||||
typedef std::pair<int, std::vector<unsigned char>> msg_candiate_char_t;
|
typedef std::pair<int32_t, std::vector<uint8_t>> msg_candiate_char_t;
|
||||||
|
|
||||||
// helper class for sample alignment
|
// helper class for sample alignment
|
||||||
class sample_aligner
|
class sample_aligner
|
||||||
@ -106,7 +107,7 @@ private:
|
|||||||
bool get_symbols(const std::vector<double> samples, std::vector<double> &symbols);
|
bool get_symbols(const std::vector<double> samples, std::vector<double> &symbols);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int d_n_smpls_in_history;
|
int32_t d_n_smpls_in_history;
|
||||||
double d_iir_par;
|
double d_iir_par;
|
||||||
double d_corr_paired;
|
double d_corr_paired;
|
||||||
double d_corr_shifted;
|
double d_corr_shifted;
|
||||||
@ -121,10 +122,10 @@ private:
|
|||||||
symbol_aligner_and_decoder();
|
symbol_aligner_and_decoder();
|
||||||
~symbol_aligner_and_decoder();
|
~symbol_aligner_and_decoder();
|
||||||
void reset();
|
void reset();
|
||||||
bool get_bits(const std::vector<double> symbols, std::vector<int> &bits);
|
bool get_bits(const std::vector<double> symbols, std::vector<int32_t> &bits);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int d_KK;
|
int32_t d_KK;
|
||||||
Viterbi_Decoder *d_vd1;
|
Viterbi_Decoder *d_vd1;
|
||||||
Viterbi_Decoder *d_vd2;
|
Viterbi_Decoder *d_vd2;
|
||||||
double d_past_symbol;
|
double d_past_symbol;
|
||||||
@ -136,10 +137,10 @@ private:
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void reset();
|
void reset();
|
||||||
void get_frame_candidates(const std::vector<int> bits, std::vector<std::pair<int, std::vector<int>>> &msg_candidates);
|
void get_frame_candidates(const std::vector<int32_t> bits, std::vector<std::pair<int32_t, std::vector<int32_t>>> &msg_candidates);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::deque<int> d_buffer;
|
std::deque<int32_t> d_buffer;
|
||||||
} d_frame_detector;
|
} d_frame_detector;
|
||||||
|
|
||||||
|
|
||||||
@ -153,8 +154,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
typedef boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> crc_24_q_type;
|
typedef boost::crc_optimal<24, 0x1864CFBu, 0x0, 0x0, false, false> crc_24_q_type;
|
||||||
crc_24_q_type d_checksum_agent;
|
crc_24_q_type d_checksum_agent;
|
||||||
void zerropad_front_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes);
|
void zerropad_front_and_convert_to_bytes(const std::vector<int32_t> msg_candidate, std::vector<uint8_t> &bytes);
|
||||||
void zerropad_back_and_convert_to_bytes(const std::vector<int> msg_candidate, std::vector<unsigned char> &bytes);
|
void zerropad_back_and_convert_to_bytes(const std::vector<int32_t> msg_candidate, std::vector<uint8_t> &bytes);
|
||||||
} d_crc_verifier;
|
} d_crc_verifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user