mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-12-14 12:28:08 +00:00
Add mechanism for back-propagation of TOW from telemetry to tracking in GPS L1
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "gps_iono.h" // for Gps_Iono
|
||||
#include "gps_utc_model.h" // for Gps_Utc_Model
|
||||
#include "tlm_utils.h"
|
||||
#include "tow_to_trk.h"
|
||||
#include <gnuradio/io_signature.h>
|
||||
#include <pmt/pmt.h> // for make_any
|
||||
#include <pmt/pmt_sugar.h> // for mp
|
||||
@@ -695,6 +696,15 @@ int gps_l1_ca_telemetry_decoder_gs::general_work(int noutput_items __attribute__
|
||||
}
|
||||
}
|
||||
|
||||
// SEND TOW TO THE TRACKING BLOCK
|
||||
const std::shared_ptr<TOW_to_trk> tmp_tow_obj = std::make_shared<TOW_to_trk>(TOW_to_trk(
|
||||
std::string("1C"),
|
||||
d_channel,
|
||||
d_TOW_at_current_symbol_ms,
|
||||
current_symbol.Tracking_sample_counter,
|
||||
d_nav.get_GPS_week(), d_nav.get_satellite_PRN()));
|
||||
this->message_port_pub(pmt::mp("telemetry_to_trk"), pmt::make_any(tmp_tow_obj));
|
||||
|
||||
// 3. Make the output (move the object contents to the GNU Radio reserved memory)
|
||||
*out[0] = std::move(current_symbol);
|
||||
|
||||
|
||||
@@ -606,6 +606,7 @@ dll_pll_veml_tracking::dll_pll_veml_tracking(const Dll_Pll_Conf &conf_)
|
||||
d_last_timetag_samplecounter = 0;
|
||||
d_timetag_waiting = false;
|
||||
set_tag_propagation_policy(TPP_DONT); // no tag propagation, the time tag will be adjusted and regenerated in work()
|
||||
d_last_tow_received = std::make_shared<TOW_to_trk>();
|
||||
}
|
||||
|
||||
|
||||
@@ -623,7 +624,7 @@ void dll_pll_veml_tracking::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pmt::any_ref(msg).type().hash_code() == int_type_hash_code)
|
||||
if (pmt::any_ref(msg).type().hash_code() == d_int_type_hash_code)
|
||||
{
|
||||
const int tlm_event = wht::any_cast<int>(pmt::any_ref(msg));
|
||||
if (tlm_event == 1)
|
||||
@@ -633,6 +634,14 @@ void dll_pll_veml_tracking::msg_handler_telemetry_to_trk(const pmt::pmt_t &msg)
|
||||
d_carrier_lock_fail_counter = 200000; // force loss-of-lock condition
|
||||
}
|
||||
}
|
||||
if (pmt::any_ref(msg).type().hash_code() == d_tow_to_trk_type_hash_code)
|
||||
{
|
||||
const auto tow_event = wht::any_cast<const std::shared_ptr<TOW_to_trk>>(pmt::any_ref(msg));
|
||||
if (tow_event->signal == d_signal_type && tow_event->channel == static_cast<int32_t>(d_channel) && tow_event->prn == d_acquisition_gnss_synchro->PRN)
|
||||
{
|
||||
d_last_tow_received = tow_event;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (const wht::bad_any_cast &e)
|
||||
{
|
||||
@@ -2103,6 +2112,11 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
|
||||
add_item_tag(0, this->nitems_written(0) + 1, tag.key, tag.value);
|
||||
}
|
||||
|
||||
// Estimate TOW if received from telemetry
|
||||
if (d_last_tow_received->prn == current_synchro_data.PRN) // ensure we have received async messages
|
||||
{
|
||||
// TODO: Estimate TOW from d_last_tow_received and store it in current_synchro_data.TOW_at_current_symbol_ms
|
||||
}
|
||||
*out[0] = std::move(current_synchro_data);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
#include "dll_pll_conf.h"
|
||||
#include "exponential_smoother.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "gnss_time.h" // for timetags produced by File_Timestamp_Signal_Source
|
||||
#include "gnss_time.h" // for timetags produced by File_Timestamp_Signal_Source
|
||||
#include "tow_to_trk.h"
|
||||
#include "tracking_FLL_PLL_filter.h" // for PLL/FLL filter
|
||||
#include "tracking_loop_filter.h" // for DLL filter
|
||||
#include <boost/circular_buffer.hpp>
|
||||
@@ -112,7 +113,8 @@ private:
|
||||
boost::circular_buffer<std::pair<double, double>> d_carr_ph_history;
|
||||
boost::circular_buffer<gr_complex> d_Prompt_circular_buffer;
|
||||
|
||||
const size_t int_type_hash_code = typeid(int).hash_code();
|
||||
const size_t d_int_type_hash_code = typeid(int).hash_code();
|
||||
const size_t d_tow_to_trk_type_hash_code = typeid(std::shared_ptr<TOW_to_trk>).hash_code();
|
||||
|
||||
double d_signal_carrier_freq;
|
||||
double d_code_period;
|
||||
@@ -168,6 +170,7 @@ private:
|
||||
// uint64_t d_sample_counter;
|
||||
uint64_t d_acq_sample_stamp;
|
||||
GnssTime d_last_timetag{};
|
||||
std::shared_ptr<TOW_to_trk> d_last_tow_received;
|
||||
uint64_t d_last_timetag_samplecounter;
|
||||
bool d_timetag_waiting;
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ set(SYSTEM_PARAMETERS_HEADERS
|
||||
Galileo_OSNMA.h
|
||||
osnma_data.h
|
||||
osnma_dsm_reader.h
|
||||
tow_to_trk.h
|
||||
)
|
||||
|
||||
list(SORT SYSTEM_PARAMETERS_HEADERS)
|
||||
|
||||
48
src/core/system_parameters/tow_to_trk.h
Normal file
48
src/core/system_parameters/tow_to_trk.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*!
|
||||
* \file tow_to_trk.h
|
||||
* \brief Class to inform about TOW from Telemetry to Tracking blocks
|
||||
* \author Carles Fernandez, 2025. cfernandez(at)cttc.es
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*
|
||||
* GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* Copyright (C) 2010-2025 (see AUTHORS file for a list of contributors)
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*
|
||||
* -----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef GNSS_SDR_TOW_TO_TRK_H
|
||||
#define GNSS_SDR_TOW_TO_TRK_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
|
||||
/** \addtogroup Core
|
||||
* \{ */
|
||||
/** \addtogroup System_Parameters
|
||||
* \{ */
|
||||
|
||||
class TOW_to_trk
|
||||
{
|
||||
public:
|
||||
TOW_to_trk() = default;
|
||||
|
||||
// Constructor with all parameters
|
||||
TOW_to_trk(const std::string& sig, int32_t ch, uint32_t t, uint64_t stamp, int32_t w, uint32_t p)
|
||||
: signal(sig), channel(ch), tow(t), sample_stamp(stamp), wn(w), prn(p) {}
|
||||
|
||||
std::string signal;
|
||||
int32_t channel{0};
|
||||
uint32_t tow{0};
|
||||
uint64_t sample_stamp{0};
|
||||
int32_t wn{0};
|
||||
uint32_t prn{0};
|
||||
};
|
||||
|
||||
/** \} */
|
||||
/** \} */
|
||||
#endif // GNSS_SDR_TOW_TO_TRK_H
|
||||
Reference in New Issue
Block a user