mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-10-04 14:51:50 +00:00
Improve const correctness. Improve usage of typeid
This commit is contained in:
@@ -241,7 +241,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
if (d_nav.have_new_ephemeris() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Beidou_Dnav_Ephemeris> tmp_obj = std::make_shared<Beidou_Dnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
const std::shared_ptr<Beidou_Dnav_Ephemeris> tmp_obj = std::make_shared<Beidou_Dnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "BEIDOU DNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
std::cout << TEXT_YELLOW << "New BEIDOU B1I DNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
@@ -249,7 +249,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
if (d_nav.have_new_utc_model() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Beidou_Dnav_Utc_Model> tmp_obj = std::make_shared<Beidou_Dnav_Utc_Model>(d_nav.get_utc_model());
|
||||
const std::shared_ptr<Beidou_Dnav_Utc_Model> tmp_obj = std::make_shared<Beidou_Dnav_Utc_Model>(d_nav.get_utc_model());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "BEIDOU DNAV UTC Model have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
std::cout << TEXT_YELLOW << "New BEIDOU B1I DNAV utc model message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
@@ -257,7 +257,7 @@ void beidou_b1i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
if (d_nav.have_new_iono() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Beidou_Dnav_Iono> tmp_obj = std::make_shared<Beidou_Dnav_Iono>(d_nav.get_iono());
|
||||
const std::shared_ptr<Beidou_Dnav_Iono> tmp_obj = std::make_shared<Beidou_Dnav_Iono>(d_nav.get_iono());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "BEIDOU DNAV Iono have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
std::cout << TEXT_YELLOW << "New BEIDOU B1I DNAV Iono message received in channel " << d_channel << ": Iono model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
@@ -362,6 +362,7 @@ void beidou_b1i_telemetry_decoder_gs::set_channel(int32_t channel)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void beidou_b1i_telemetry_decoder_gs::reset()
|
||||
{
|
||||
d_last_valid_preamble = d_sample_counter;
|
||||
@@ -371,6 +372,7 @@ void beidou_b1i_telemetry_decoder_gs::reset()
|
||||
DLOG(INFO) << "Beidou B1I Telemetry decoder reset for satellite " << d_satellite;
|
||||
}
|
||||
|
||||
|
||||
int beidou_b1i_telemetry_decoder_gs::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)
|
||||
{
|
||||
@@ -427,7 +429,6 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
||||
DLOG(INFO) << "Starting BeiDou DNAV frame decoding for BeiDou B1I SAT " << this->d_satellite;
|
||||
d_preamble_index = d_sample_counter; // record the preamble sample stamp
|
||||
|
||||
|
||||
d_stat = 2;
|
||||
|
||||
// ******* SAMPLES TO SYMBOLS *******
|
||||
@@ -539,7 +540,7 @@ int beidou_b1i_telemetry_decoder_gs::general_work(int noutput_items __attribute_
|
||||
// Reporting sow as gps time of week
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.get_SOW() + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||
// check TOW update consistency
|
||||
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
const uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
// compute new TOW
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
|
||||
flag_SOW_set = true;
|
||||
|
||||
@@ -242,7 +242,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
if (d_nav.have_new_ephemeris() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Beidou_Dnav_Ephemeris> tmp_obj =
|
||||
const std::shared_ptr<Beidou_Dnav_Ephemeris> tmp_obj =
|
||||
std::make_shared<Beidou_Dnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "BEIDOU DNAV Ephemeris have been received in channel"
|
||||
@@ -253,7 +253,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
if (d_nav.have_new_utc_model() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Beidou_Dnav_Utc_Model> tmp_obj =
|
||||
const std::shared_ptr<Beidou_Dnav_Utc_Model> tmp_obj =
|
||||
std::make_shared<Beidou_Dnav_Utc_Model>(d_nav.get_utc_model());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "BEIDOU DNAV UTC Model have been received in channel"
|
||||
@@ -265,7 +265,7 @@ void beidou_b3i_telemetry_decoder_gs::decode_subframe(float *frame_symbols)
|
||||
if (d_nav.have_new_iono() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Beidou_Dnav_Iono> tmp_obj =
|
||||
const std::shared_ptr<Beidou_Dnav_Iono> tmp_obj =
|
||||
std::make_shared<Beidou_Dnav_Iono>(d_nav.get_iono());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "BEIDOU DNAV Iono have been received in channel" << d_channel
|
||||
@@ -570,7 +570,7 @@ int beidou_b3i_telemetry_decoder_gs::general_work(
|
||||
// Reporting sow as gps time of week
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>((d_nav.get_SOW() + BEIDOU_DNAV_BDT2GPST_LEAP_SEC_OFFSET) * 1000.0);
|
||||
// check TOW update consistency
|
||||
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
const uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
// compute new TOW
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + d_required_symbols * d_symbol_duration_ms;
|
||||
flag_SOW_set = true;
|
||||
|
||||
@@ -114,7 +114,7 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
|
||||
d_codelength = 0;
|
||||
d_datalength = 0;
|
||||
d_max_symbols_without_valid_frame = 0;
|
||||
std::cout << "Galileo unified telemetry decoder error: Unknown frame type \n";
|
||||
std::cout << "Galileo unified telemetry decoder error: Unknown frame type\n";
|
||||
}
|
||||
|
||||
d_page_part_symbols.reserve(d_frame_length_symbols);
|
||||
@@ -166,8 +166,8 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
|
||||
d_symbol_history.set_capacity(d_required_symbols + 1);
|
||||
|
||||
// vars for Viterbi decoder
|
||||
int32_t max_states = 1U << static_cast<uint32_t>(d_mm); // 2^d_mm
|
||||
std::array<int32_t, 2> g_encoder{{121, 91}}; // Polynomial G1 and G2
|
||||
const int32_t max_states = 1U << static_cast<uint32_t>(d_mm); // 2^d_mm
|
||||
std::array<int32_t, 2> g_encoder{{121, 91}}; // Polynomial G1 and G2
|
||||
d_out0.reserve(max_states);
|
||||
d_out1.reserve(max_states);
|
||||
d_state0.reserve(max_states);
|
||||
@@ -274,21 +274,21 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
|
||||
if (d_inav_nav.have_new_ephemeris() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Galileo_Ephemeris> tmp_obj = std::make_shared<Galileo_Ephemeris>(d_inav_nav.get_ephemeris());
|
||||
const std::shared_ptr<Galileo_Ephemeris> tmp_obj = std::make_shared<Galileo_Ephemeris>(d_inav_nav.get_ephemeris());
|
||||
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
if (d_inav_nav.have_new_iono_and_GST() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Galileo_Iono> tmp_obj = std::make_shared<Galileo_Iono>(d_inav_nav.get_iono());
|
||||
const std::shared_ptr<Galileo_Iono> tmp_obj = std::make_shared<Galileo_Iono>(d_inav_nav.get_iono());
|
||||
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": iono/GST model parameters from satellite " << d_satellite << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
if (d_inav_nav.have_new_utc_model() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(d_inav_nav.get_utc_model());
|
||||
const std::shared_ptr<Galileo_Utc_Model> tmp_obj = std::make_shared<Galileo_Utc_Model>(d_inav_nav.get_utc_model());
|
||||
std::cout << "New Galileo E1 I/NAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
d_delta_t = tmp_obj->A_0G_10 + tmp_obj->A_1G_10 * (static_cast<double>(d_TOW_at_current_symbol_ms) / 1000.0 - tmp_obj->t_0G_10 + 604800 * (std::fmod(static_cast<float>(d_inav_nav.get_Galileo_week() - tmp_obj->WN_0G_10), 64.0)));
|
||||
@@ -296,7 +296,7 @@ void galileo_telemetry_decoder_gs::decode_INAV_word(float *page_part_symbols, in
|
||||
}
|
||||
if (d_inav_nav.have_new_almanac() == true)
|
||||
{
|
||||
std::shared_ptr<Galileo_Almanac_Helper> tmp_obj = std::make_shared<Galileo_Almanac_Helper>(d_inav_nav.get_almanac());
|
||||
const std::shared_ptr<Galileo_Almanac_Helper> tmp_obj = std::make_shared<Galileo_Almanac_Helper>(d_inav_nav.get_almanac());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
// debug
|
||||
std::cout << "Galileo E1 I/NAV almanac received in channel " << d_channel << " from satellite " << d_satellite << '\n';
|
||||
|
||||
+5
-5
@@ -179,7 +179,7 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
d_nav.set_rf_link(d_satellite.get_rf_link());
|
||||
std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
const std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
std::cout << "New GLONASS L1 GNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << '\n';
|
||||
@@ -187,15 +187,15 @@ void glonass_l1_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
if (d_nav.have_new_utc_model() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Glonass_Gnav_Utc_Model> tmp_obj = std::make_shared<Glonass_Gnav_Utc_Model>(d_nav.get_utc_model());
|
||||
const std::shared_ptr<Glonass_Gnav_Utc_Model> tmp_obj = std::make_shared<Glonass_Gnav_Utc_Model>(d_nav.get_utc_model());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV UTC Model have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
std::cout << "New GLONASS L1 GNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << '\n';
|
||||
}
|
||||
if (d_nav.have_new_almanac() == true)
|
||||
{
|
||||
uint32_t slot_nbr = d_nav.get_alm_satellite_slot_number();
|
||||
std::shared_ptr<Glonass_Gnav_Almanac>
|
||||
const uint32_t slot_nbr = d_nav.get_alm_satellite_slot_number();
|
||||
const 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));
|
||||
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
||||
@@ -326,7 +326,7 @@ int glonass_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
||||
{
|
||||
// NEW GLONASS string received
|
||||
// 0. fetch the symbols into an array
|
||||
int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||
const int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||
std::array<double, GLONASS_GNAV_DATA_SYMBOLS> string_symbols{};
|
||||
|
||||
// ******* SYMBOL TO BIT *******
|
||||
|
||||
+5
-5
@@ -179,7 +179,7 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
d_nav.set_rf_link(d_satellite.get_rf_link());
|
||||
std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
const std::shared_ptr<Glonass_Gnav_Ephemeris> tmp_obj = std::make_shared<Glonass_Gnav_Ephemeris>(d_nav.get_ephemeris());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV Ephemeris have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
std::cout << TEXT_CYAN << "New GLONASS L2 GNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
@@ -187,15 +187,15 @@ void glonass_l2_ca_telemetry_decoder_gs::decode_string(const double *frame_symbo
|
||||
if (d_nav.have_new_utc_model() == true)
|
||||
{
|
||||
// get object for this SV (mandatory)
|
||||
std::shared_ptr<Glonass_Gnav_Utc_Model> tmp_obj = std::make_shared<Glonass_Gnav_Utc_Model>(d_nav.get_utc_model());
|
||||
const std::shared_ptr<Glonass_Gnav_Utc_Model> tmp_obj = std::make_shared<Glonass_Gnav_Utc_Model>(d_nav.get_utc_model());
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
LOG(INFO) << "GLONASS GNAV UTC Model have been received in channel" << d_channel << " from satellite " << d_satellite;
|
||||
std::cout << TEXT_CYAN << "New GLONASS L2 GNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
}
|
||||
if (d_nav.have_new_almanac() == true)
|
||||
{
|
||||
uint32_t slot_nbr = d_nav.get_alm_satellite_slot_number();
|
||||
std::shared_ptr<Glonass_Gnav_Almanac> tmp_obj = std::make_shared<Glonass_Gnav_Almanac>(d_nav.get_almanac(slot_nbr));
|
||||
const uint32_t slot_nbr = d_nav.get_alm_satellite_slot_number();
|
||||
const 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));
|
||||
LOG(INFO) << "GLONASS GNAV Almanac have been received in channel" << d_channel << " in slot number " << slot_nbr;
|
||||
std::cout << TEXT_CYAN << "New GLONASS L2 GNAV almanac received in channel " << d_channel << " from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
@@ -325,7 +325,7 @@ int glonass_l2_ca_telemetry_decoder_gs::general_work(int noutput_items __attribu
|
||||
{
|
||||
// NEW GLONASS string received
|
||||
// 0. fetch the symbols into an array
|
||||
int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||
const int32_t string_length = GLONASS_GNAV_STRING_SYMBOLS - d_symbols_per_preamble;
|
||||
std::array<double, GLONASS_GNAV_DATA_SYMBOLS> string_symbols{};
|
||||
|
||||
// ******* SYMBOL TO BIT *******
|
||||
|
||||
+10
-19
@@ -135,29 +135,20 @@ gps_l1_ca_telemetry_decoder_gs::~gps_l1_ca_telemetry_decoder_gs()
|
||||
|
||||
bool gps_l1_ca_telemetry_decoder_gs::gps_word_parityCheck(uint32_t gpsword)
|
||||
{
|
||||
uint32_t d1;
|
||||
uint32_t d2;
|
||||
uint32_t d3;
|
||||
uint32_t d4;
|
||||
uint32_t d5;
|
||||
uint32_t d6;
|
||||
uint32_t d7;
|
||||
uint32_t t;
|
||||
uint32_t parity;
|
||||
// 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
|
||||
// check algorithm described in IS-GPS-200K. This avoids lengthy shift-
|
||||
// and-xor loops.
|
||||
d1 = gpsword & 0xFBFFBF00U;
|
||||
d2 = my_rotl::rotl(gpsword, 1U) & 0x07FFBF01U;
|
||||
d3 = my_rotl::rotl(gpsword, 2U) & 0xFC0F8100U;
|
||||
d4 = my_rotl::rotl(gpsword, 3U) & 0xF81FFE02U;
|
||||
d5 = my_rotl::rotl(gpsword, 4U) & 0xFC00000EU;
|
||||
d6 = my_rotl::rotl(gpsword, 5U) & 0x07F00001U;
|
||||
d7 = my_rotl::rotl(gpsword, 6U) & 0x00003000U;
|
||||
t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7;
|
||||
const uint32_t d1 = gpsword & 0xFBFFBF00U;
|
||||
const uint32_t d2 = my_rotl::rotl(gpsword, 1U) & 0x07FFBF01U;
|
||||
const uint32_t d3 = my_rotl::rotl(gpsword, 2U) & 0xFC0F8100U;
|
||||
const uint32_t d4 = my_rotl::rotl(gpsword, 3U) & 0xF81FFE02U;
|
||||
const uint32_t d5 = my_rotl::rotl(gpsword, 4U) & 0xFC00000EU;
|
||||
const uint32_t d6 = my_rotl::rotl(gpsword, 5U) & 0x07F00001U;
|
||||
const uint32_t d7 = my_rotl::rotl(gpsword, 6U) & 0x00003000U;
|
||||
const uint32_t t = d1 ^ d2 ^ d3 ^ d4 ^ d5 ^ d6 ^ d7;
|
||||
// Now XOR the 5 6-bit fields together to produce the 6-bit final result.
|
||||
parity = t ^ my_rotl::rotl(t, 6U) ^ my_rotl::rotl(t, 12U) ^ my_rotl::rotl(t, 18U) ^ my_rotl::rotl(t, 24U);
|
||||
uint32_t parity = t ^ my_rotl::rotl(t, 6U) ^ my_rotl::rotl(t, 12U) ^ my_rotl::rotl(t, 18U) ^ my_rotl::rotl(t, 24U);
|
||||
parity = parity & 0x3FU;
|
||||
if (parity == (gpsword & 0x3FU))
|
||||
{
|
||||
@@ -269,7 +260,7 @@ bool gps_l1_ca_telemetry_decoder_gs::decode_subframe()
|
||||
// NEW GPS SUBFRAME HAS ARRIVED!
|
||||
if (subframe_synchro_confirmation)
|
||||
{
|
||||
int32_t subframe_ID = d_nav.subframe_decoder(subframe.data()); // decode the subframe
|
||||
const int32_t subframe_ID = d_nav.subframe_decoder(subframe.data()); // decode the subframe
|
||||
if (subframe_ID > 0 and subframe_ID < 6)
|
||||
{
|
||||
std::cout << "New GPS NAV message received in channel " << this->d_channel << ": "
|
||||
|
||||
@@ -150,7 +150,7 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
uint32_t delay = 0;
|
||||
|
||||
// add the symbol to the decoder
|
||||
uint8_t symbol_clip = static_cast<uint8_t>(in[0].Prompt_I > 0) * 255;
|
||||
const 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);
|
||||
|
||||
consume_each(1); // one by one
|
||||
@@ -198,20 +198,20 @@ int gps_l2c_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
if (d_CNAV_Message.have_new_ephemeris() == true)
|
||||
{
|
||||
// get ephemeris object for this SV
|
||||
std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(d_CNAV_Message.get_ephemeris());
|
||||
const std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(d_CNAV_Message.get_ephemeris());
|
||||
std::cout << TEXT_BLUE << "New GPS CNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
if (d_CNAV_Message.have_new_iono() == true)
|
||||
{
|
||||
std::shared_ptr<Gps_CNAV_Iono> tmp_obj = std::make_shared<Gps_CNAV_Iono>(d_CNAV_Message.get_iono());
|
||||
const std::shared_ptr<Gps_CNAV_Iono> tmp_obj = std::make_shared<Gps_CNAV_Iono>(d_CNAV_Message.get_iono());
|
||||
std::cout << TEXT_BLUE << "New GPS CNAV message received in channel " << d_channel << ": iono model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
|
||||
if (d_CNAV_Message.have_new_utc_model() == true)
|
||||
{
|
||||
std::shared_ptr<Gps_CNAV_Utc_Model> tmp_obj = std::make_shared<Gps_CNAV_Utc_Model>(d_CNAV_Message.get_utc_model());
|
||||
const std::shared_ptr<Gps_CNAV_Utc_Model> tmp_obj = std::make_shared<Gps_CNAV_Utc_Model>(d_CNAV_Message.get_utc_model());
|
||||
std::cout << TEXT_BLUE << "New GPS CNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
|
||||
@@ -190,20 +190,20 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
|
||||
if (d_CNAV_Message.have_new_ephemeris() == true)
|
||||
{
|
||||
// get ephemeris object for this SV
|
||||
std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(d_CNAV_Message.get_ephemeris());
|
||||
const std::shared_ptr<Gps_CNAV_Ephemeris> tmp_obj = std::make_shared<Gps_CNAV_Ephemeris>(d_CNAV_Message.get_ephemeris());
|
||||
std::cout << TEXT_MAGENTA << "New GPS L5 CNAV message received in channel " << d_channel << ": ephemeris from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
if (d_CNAV_Message.have_new_iono() == true)
|
||||
{
|
||||
std::shared_ptr<Gps_CNAV_Iono> tmp_obj = std::make_shared<Gps_CNAV_Iono>(d_CNAV_Message.get_iono());
|
||||
const std::shared_ptr<Gps_CNAV_Iono> tmp_obj = std::make_shared<Gps_CNAV_Iono>(d_CNAV_Message.get_iono());
|
||||
std::cout << TEXT_MAGENTA << "New GPS L5 CNAV message received in channel " << d_channel << ": iono model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
|
||||
if (d_CNAV_Message.have_new_utc_model() == true)
|
||||
{
|
||||
std::shared_ptr<Gps_CNAV_Utc_Model> tmp_obj = std::make_shared<Gps_CNAV_Utc_Model>(d_CNAV_Message.get_utc_model());
|
||||
const std::shared_ptr<Gps_CNAV_Utc_Model> tmp_obj = std::make_shared<Gps_CNAV_Utc_Model>(d_CNAV_Message.get_utc_model());
|
||||
std::cout << TEXT_MAGENTA << "New GPS L5 CNAV message received in channel " << d_channel << ": UTC model parameters from satellite " << d_satellite << TEXT_RESET << '\n';
|
||||
this->message_port_pub(pmt::mp("telemetry"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
@@ -217,7 +217,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
|
||||
// symbolTime_ms = msg->tow * 6000 + *pdelay * 10 + (12 * 10); 12 symbols of the encoder's transitory
|
||||
|
||||
// check TOW update consistency
|
||||
uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
const uint32_t last_d_TOW_at_current_symbol_ms = d_TOW_at_current_symbol_ms;
|
||||
d_TOW_at_current_symbol_ms = msg.tow * 6000 + (delay + 12) * GPS_L5I_SYMBOL_PERIOD_MS;
|
||||
if (last_d_TOW_at_current_symbol_ms != 0 and std::llabs(static_cast<int64_t>(d_TOW_at_current_symbol_ms) - static_cast<int64_t>(last_d_TOW_at_current_symbol_ms)) > static_cast<int64_t>(GPS_L5I_SYMBOL_PERIOD_MS))
|
||||
{
|
||||
|
||||
@@ -199,7 +199,7 @@ void sbas_l1_telemetry_decoder_gs::Symbol_Aligner_And_Decoder::reset()
|
||||
bool sbas_l1_telemetry_decoder_gs::Symbol_Aligner_And_Decoder::get_bits(const std::vector<double> &symbols, std::vector<int32_t> &bits)
|
||||
{
|
||||
const int32_t traceback_depth = 5 * d_KK;
|
||||
int32_t nbits_requested = symbols.size() / D_SYMBOLS_PER_BIT;
|
||||
const int32_t nbits_requested = symbols.size() / D_SYMBOLS_PER_BIT;
|
||||
int32_t nbits_decoded;
|
||||
// fill two vectors with the two possible symbol alignments
|
||||
std::vector<double> symbols_vd1(symbols); // aligned symbol vector -> copy input symbol vector
|
||||
@@ -213,8 +213,8 @@ bool sbas_l1_telemetry_decoder_gs::Symbol_Aligner_And_Decoder::get_bits(const st
|
||||
std::vector<int32_t> bits_vd1(nbits_requested);
|
||||
std::vector<int32_t> bits_vd2(nbits_requested);
|
||||
// decode
|
||||
float metric_vd1 = d_vd1->decode_continuous(symbols_vd1.data(), traceback_depth, bits_vd1.data(), nbits_requested, nbits_decoded);
|
||||
float metric_vd2 = d_vd2->decode_continuous(symbols_vd2.data(), traceback_depth, bits_vd2.data(), nbits_requested, nbits_decoded);
|
||||
const float metric_vd1 = d_vd1->decode_continuous(symbols_vd1.data(), traceback_depth, bits_vd1.data(), nbits_requested, nbits_decoded);
|
||||
const float metric_vd2 = d_vd2->decode_continuous(symbols_vd2.data(), traceback_depth, bits_vd2.data(), nbits_requested, nbits_decoded);
|
||||
// choose the bits with the better metric
|
||||
for (int32_t i = 0; i < nbits_decoded; i++)
|
||||
{
|
||||
@@ -242,8 +242,8 @@ void sbas_l1_telemetry_decoder_gs::Frame_Detector::reset()
|
||||
void sbas_l1_telemetry_decoder_gs::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;
|
||||
uint32_t sbas_msg_length = 250;
|
||||
std::vector<std::vector<int32_t>> preambles = {{0, 1, 0, 1, 0, 0, 1, 1},
|
||||
const uint32_t sbas_msg_length = 250;
|
||||
const std::vector<std::vector<int32_t>> preambles = {{0, 1, 0, 1, 0, 0, 1, 1},
|
||||
{1, 0, 0, 1, 1, 0, 1, 0},
|
||||
{1, 1, 0, 0, 0, 1, 1, 0}};
|
||||
VLOG(FLOW) << "get_frame_candidates(): "
|
||||
@@ -322,7 +322,7 @@ void sbas_l1_telemetry_decoder_gs::Crc_Verifier::get_valid_frames(const std::vec
|
||||
// verify CRC
|
||||
d_checksum_agent.reset(0);
|
||||
d_checksum_agent.process_bytes(candidate_bytes.data(), candidate_bytes.size());
|
||||
uint32_t crc = d_checksum_agent.checksum();
|
||||
const uint32_t crc = d_checksum_agent.checksum();
|
||||
VLOG(SAMP_SYNC) << "candidate " << candidate_it - msg_candidates.begin()
|
||||
<< ": final crc remainder= " << std::hex << crc
|
||||
<< std::setfill(' ') << std::resetiosflags(std::ios::hex);
|
||||
@@ -354,8 +354,8 @@ void sbas_l1_telemetry_decoder_gs::Crc_Verifier::zerropad_back_and_convert_to_by
|
||||
VLOG(LMORE) << "zerropad_back_and_convert_to_bytes():" << byte;
|
||||
for (auto candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it)
|
||||
{
|
||||
int32_t idx_bit = candidate_bit_it - msg_candidate.begin();
|
||||
int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||
const int32_t idx_bit = candidate_bit_it - msg_candidate.begin();
|
||||
const int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||
byte |= static_cast<uint8_t>(*candidate_bit_it) << bit_pos_in_current_byte;
|
||||
ss << *candidate_bit_it;
|
||||
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
||||
@@ -382,7 +382,7 @@ void sbas_l1_telemetry_decoder_gs::Crc_Verifier::zerropad_front_and_convert_to_b
|
||||
VLOG(LMORE) << "zerropad_front_and_convert_to_bytes():" << byte;
|
||||
for (auto candidate_bit_it = msg_candidate.cbegin(); candidate_bit_it < msg_candidate.cend(); ++candidate_bit_it)
|
||||
{
|
||||
int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||
const int32_t bit_pos_in_current_byte = (bits_per_byte - 1) - (idx_bit % bits_per_byte);
|
||||
byte |= static_cast<uint8_t>(*candidate_bit_it) << bit_pos_in_current_byte;
|
||||
ss << *candidate_bit_it;
|
||||
if (idx_bit % bits_per_byte == bits_per_byte - 1)
|
||||
@@ -417,7 +417,7 @@ int sbas_l1_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
d_sample_buf.push_back(current_symbol.Prompt_I); // add new symbol to the symbol queue
|
||||
|
||||
// store the time stamp of the first sample in the processed sample block
|
||||
double sample_stamp = static_cast<double>(in[0].Tracking_sample_counter) / static_cast<double>(in[0].fs);
|
||||
const double sample_stamp = static_cast<double>(in[0].Tracking_sample_counter) / static_cast<double>(in[0].fs);
|
||||
|
||||
// decode only if enough samples in buffer
|
||||
if (d_sample_buf.size() >= d_block_size)
|
||||
@@ -425,12 +425,12 @@ int sbas_l1_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
// align correlation samples in pairs
|
||||
// and obtain the symbols by summing the paired correlation samples
|
||||
std::vector<double> symbols;
|
||||
bool sample_alignment = d_sample_aligner.get_symbols(d_sample_buf, symbols);
|
||||
const bool sample_alignment = d_sample_aligner.get_symbols(d_sample_buf, symbols);
|
||||
|
||||
// align symbols in pairs
|
||||
// and obtain the bits by decoding the symbol pairs
|
||||
std::vector<int32_t> bits;
|
||||
bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits);
|
||||
const bool symbol_alignment = d_symbol_aligner_and_decoder.get_bits(symbols, bits);
|
||||
|
||||
// search for preambles
|
||||
// and extract the corresponding message candidates
|
||||
@@ -447,9 +447,9 @@ int sbas_l1_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
// std::vector<Sbas_Raw_Msg> sbas_raw_msgs;
|
||||
for (const auto &valid_msg : valid_msgs)
|
||||
{
|
||||
int32_t message_sample_offset =
|
||||
const 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 * valid_msg.first;
|
||||
double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
|
||||
const double message_sample_stamp = sample_stamp + static_cast<double>(message_sample_offset) / 1000.0;
|
||||
VLOG(EVENT) << "message_sample_stamp=" << message_sample_stamp
|
||||
<< " (sample_stamp=" << sample_stamp
|
||||
<< " sample_alignment=" << sample_alignment
|
||||
|
||||
Reference in New Issue
Block a user