mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-04-21 06:11:25 +00:00
Add work on getting TOW for E6 channels
This commit is contained in:
@@ -107,6 +107,13 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
if(PMT_USES_BOOST_ANY)
|
||||
target_compile_definitions(telemetry_decoder_gr_blocks
|
||||
PRIVATE
|
||||
-DPMT_USES_BOOST_ANY=1
|
||||
)
|
||||
endif()
|
||||
|
||||
if(ENABLE_CLANG_TIDY)
|
||||
if(CLANG_TIDY_EXE)
|
||||
set_target_properties(telemetry_decoder_gr_blocks
|
||||
|
||||
@@ -36,17 +36,32 @@
|
||||
#include "viterbi_decoder.h" // for Viterbi_Decoder
|
||||
#include <glog/logging.h> // for LOG, DLOG
|
||||
#include <gnuradio/io_signature.h> // for gr::io_signature::make
|
||||
#include <pmt/pmt.h> // for pmt::make_any
|
||||
#include <pmt/pmt_sugar.h> // for pmt::mp
|
||||
#include <array> // for std::array
|
||||
#include <cmath> // for std::fmod, std::abs
|
||||
#include <cstddef> // for size_t
|
||||
#include <exception> // for std::exception
|
||||
#include <iostream> // for std::cout
|
||||
#include <map> // for std::map
|
||||
#include <stdexcept> // for std::out_of_range
|
||||
#include <typeinfo> // for typeid
|
||||
#include <utility> // for std::pair
|
||||
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
#else
|
||||
#include <boost/bind/bind.hpp>
|
||||
#endif
|
||||
|
||||
#if PMT_USES_BOOST_ANY
|
||||
#include <boost/any.hpp>
|
||||
namespace wht = boost;
|
||||
#else
|
||||
#include <any>
|
||||
namespace wht = std;
|
||||
#endif
|
||||
|
||||
#define CRC_ERROR_LIMIT 6
|
||||
|
||||
|
||||
galileo_telemetry_decoder_gs_sptr
|
||||
galileo_make_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, int frame_type)
|
||||
{
|
||||
@@ -96,6 +111,8 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
|
||||
this->message_port_register_out(pmt::mp("telemetry_to_trk"));
|
||||
// register Gal E6 messages HAS out
|
||||
this->message_port_register_out(pmt::mp("E6_HAS_from_TLM"));
|
||||
// register TOW from map out
|
||||
this->message_port_register_out(pmt::mp("TOW_from_TLM"));
|
||||
|
||||
if (d_enable_navdata_monitor)
|
||||
{
|
||||
@@ -103,6 +120,20 @@ galileo_telemetry_decoder_gs::galileo_telemetry_decoder_gs(
|
||||
this->message_port_register_out(pmt::mp("Nav_msg_from_TLM"));
|
||||
}
|
||||
|
||||
// register TOW to TLM input
|
||||
this->message_port_register_in(pmt::mp("TOW_to_TLM"));
|
||||
// handler for input port
|
||||
this->set_msg_handler(pmt::mp("TOW_to_TLM"),
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
[this](auto &&PH1) { msg_handler_read_galileo_tow_map(PH1); });
|
||||
#else
|
||||
#if USE_BOOST_BIND_PLACEHOLDERS
|
||||
boost::bind(&galileo_telemetry_decoder_gs::msg_handler_read_galileo_tow_map, this, boost::placeholders::_1));
|
||||
#else
|
||||
boost::bind(&galileo_telemetry_decoder_gs::msg_handler_read_galileo_tow_map, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
d_satellite = Gnss_Satellite(satellite.get_system(), satellite.get_PRN());
|
||||
|
||||
// Viterbi decoder vars
|
||||
@@ -281,6 +312,34 @@ galileo_telemetry_decoder_gs::~galileo_telemetry_decoder_gs()
|
||||
}
|
||||
|
||||
|
||||
void galileo_telemetry_decoder_gs::msg_handler_read_galileo_tow_map(const pmt::pmt_t &msg)
|
||||
{
|
||||
if (d_frame_type == 3)
|
||||
{
|
||||
// Check if the input has the right format
|
||||
try
|
||||
{
|
||||
const size_t msg_type_hash_code = pmt::any_ref(msg).type().hash_code();
|
||||
if (msg_type_hash_code == typeid(std::shared_ptr<std::map<uint32_t, std::pair<uint32_t, uint64_t>>>).hash_code())
|
||||
{
|
||||
const auto received_tow_map = wht::any_cast<std::shared_ptr<std::map<uint32_t, std::pair<uint32_t, uint64_t>>>>(pmt::any_ref(msg));
|
||||
const std::pair<uint32_t, uint64_t> received_tow_sample = received_tow_map->at(d_satellite.get_PRN());
|
||||
std::cout << "Received TOW: " << received_tow_sample.first << '\n';
|
||||
std::cout << "Received sample counter: " << received_tow_sample.second << '\n';
|
||||
}
|
||||
}
|
||||
catch (const wht::bad_any_cast &e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_read_galileo_tow_map Bad any_cast: " << e.what();
|
||||
}
|
||||
catch (const std::out_of_range &oor)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_read_galileo_tow_map Out of Range error: " << oor.what();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void galileo_telemetry_decoder_gs::deinterleaver(int32_t rows, int32_t cols, const float *in, float *out)
|
||||
{
|
||||
for (int32_t r = 0; r < rows; r++)
|
||||
@@ -904,6 +963,9 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW5() * 1000.0);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
|
||||
d_inav_nav.set_TOW5_flag(false);
|
||||
const std::pair<uint32_t, uint64_t> tow_and_sample{d_inav_nav.get_TOW5(), current_symbol.Tracking_sample_counter};
|
||||
const auto tmp_obj = std::make_shared<std::pair<uint32_t, std::pair<uint32_t, uint64_t>>>(d_satellite.get_PRN(), tow_and_sample);
|
||||
this->message_port_pub(pmt::mp("TOW_from_TLM"), pmt::make_any(tmp_obj));
|
||||
// timetag debug
|
||||
if (d_valid_timetag == true)
|
||||
{
|
||||
@@ -924,6 +986,9 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW6() * 1000.0);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
|
||||
d_inav_nav.set_TOW6_flag(false);
|
||||
const std::pair<uint32_t, uint64_t> tow_and_sample{d_inav_nav.get_TOW6(), current_symbol.Tracking_sample_counter};
|
||||
const auto tmp_obj = std::make_shared<std::pair<uint32_t, std::pair<uint32_t, uint64_t>>>(d_satellite.get_PRN(), tow_and_sample);
|
||||
this->message_port_pub(pmt::mp("TOW_from_TLM"), pmt::make_any(tmp_obj));
|
||||
// timetag debug
|
||||
if (d_valid_timetag == true)
|
||||
{
|
||||
@@ -943,6 +1008,9 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
d_TOW_at_Preamble_ms = static_cast<uint32_t>(d_inav_nav.get_TOW0() * 1000.0);
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>(GALILEO_INAV_PAGE_PART_MS + (d_required_symbols + 1) * d_PRN_code_period_ms);
|
||||
d_inav_nav.set_TOW0_flag(false);
|
||||
const std::pair<uint32_t, uint64_t> tow_and_sample{d_inav_nav.get_TOW0(), current_symbol.Tracking_sample_counter};
|
||||
const auto tmp_obj = std::make_shared<std::pair<uint32_t, std::pair<uint32_t, uint64_t>>>(d_satellite.get_PRN(), tow_and_sample);
|
||||
this->message_port_pub(pmt::mp("TOW_from_TLM"), pmt::make_any(tmp_obj));
|
||||
// timetag debug
|
||||
if (d_valid_timetag == true)
|
||||
{
|
||||
@@ -984,6 +1052,9 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((GALILEO_FNAV_CODES_PER_PAGE + GALILEO_FNAV_CODES_PER_PREAMBLE) * GALILEO_E5a_CODE_PERIOD_MS);
|
||||
d_fnav_nav.set_TOW1_flag(false);
|
||||
const std::pair<uint32_t, uint64_t> tow_and_sample{d_fnav_nav.get_TOW1(), current_symbol.Tracking_sample_counter};
|
||||
const auto tmp_obj = std::make_shared<std::pair<uint32_t, std::pair<uint32_t, uint64_t>>>(d_satellite.get_PRN(), tow_and_sample);
|
||||
this->message_port_pub(pmt::mp("TOW_from_TLM"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
else if (d_fnav_nav.is_TOW2_set() == true)
|
||||
{
|
||||
@@ -991,6 +1062,9 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((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 + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
d_fnav_nav.set_TOW2_flag(false);
|
||||
const std::pair<uint32_t, uint64_t> tow_and_sample{d_fnav_nav.get_TOW2(), current_symbol.Tracking_sample_counter};
|
||||
const auto tmp_obj = std::make_shared<std::pair<uint32_t, std::pair<uint32_t, uint64_t>>>(d_satellite.get_PRN(), tow_and_sample);
|
||||
this->message_port_pub(pmt::mp("TOW_from_TLM"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
else if (d_fnav_nav.is_TOW3_set() == true)
|
||||
{
|
||||
@@ -998,6 +1072,9 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((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 + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
d_fnav_nav.set_TOW3_flag(false);
|
||||
const std::pair<uint32_t, uint64_t> tow_and_sample{d_fnav_nav.get_TOW3(), current_symbol.Tracking_sample_counter};
|
||||
const auto tmp_obj = std::make_shared<std::pair<uint32_t, std::pair<uint32_t, uint64_t>>>(d_satellite.get_PRN(), tow_and_sample);
|
||||
this->message_port_pub(pmt::mp("TOW_from_TLM"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
else if (d_fnav_nav.is_TOW4_set() == true)
|
||||
{
|
||||
@@ -1005,6 +1082,9 @@ int galileo_telemetry_decoder_gs::general_work(int noutput_items __attribute__((
|
||||
// d_TOW_at_current_symbol_ms = d_TOW_at_Preamble_ms + static_cast<uint32_t>((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 + static_cast<uint32_t>((d_required_symbols + 1) * GALILEO_FNAV_CODES_PER_SYMBOL * GALILEO_E5A_CODE_PERIOD_MS);
|
||||
d_fnav_nav.set_TOW4_flag(false);
|
||||
const std::pair<uint32_t, uint64_t> tow_and_sample{d_fnav_nav.get_TOW4(), current_symbol.Tracking_sample_counter};
|
||||
const auto tmp_obj = std::make_shared<std::pair<uint32_t, std::pair<uint32_t, uint64_t>>>(d_satellite.get_PRN(), tow_and_sample);
|
||||
this->message_port_pub(pmt::mp("TOW_from_TLM"), pmt::make_any(tmp_obj));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <boost/circular_buffer.hpp> // for boost::circular_buffer
|
||||
#include <gnuradio/block.h> // for block
|
||||
#include <gnuradio/types.h> // for gr_vector_const_void_star
|
||||
#include <pmt/pmt.h> // for pmt::pmt_t
|
||||
#include <cstdint> // for int32_t, uint32_t
|
||||
#include <fstream> // for std::ofstream
|
||||
#include <memory> // for std::unique_ptr
|
||||
@@ -80,6 +81,7 @@ private:
|
||||
|
||||
galileo_telemetry_decoder_gs(const Gnss_Satellite &satellite, const Tlm_Conf &conf, int frame_type);
|
||||
|
||||
void msg_handler_read_galileo_tow_map(const pmt::pmt_t &msg);
|
||||
void deinterleaver(int32_t rows, int32_t cols, const float *in, float *out);
|
||||
void decode_INAV_word(float *page_part_symbols, int32_t frame_length);
|
||||
void decode_FNAV_word(float *page_symbols, int32_t frame_length);
|
||||
|
||||
Reference in New Issue
Block a user