1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-12-18 06:18:05 +00:00

fix: small fixes & cleanup

This commit is contained in:
Victor Castillo
2025-06-09 04:59:59 +02:00
committed by Carles Fernandez
parent 5934879ae7
commit 131cc2ce93
5 changed files with 36 additions and 12 deletions

View File

@@ -2001,6 +2001,35 @@ void rtklib_pvt_gs::update_HAS_corrections()
int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items __attribute__((unused)))
{
// *************** time tags ****************
if (d_enable_rx_clock_correction == false) // todo: currently only works if clock correction is disabled
{
std::vector<gr::tag_t> tags_vec;
// time tag from obs to pvt is always propagated in channel 0
this->get_tags_in_range(tags_vec, 0, this->nitems_read(0), this->nitems_read(0) + noutput_items);
for (const auto& it : tags_vec)
{
try
{
if (pmt::any_ref(it.value).type().hash_code() == typeid(const std::shared_ptr<GnssTime>).hash_code())
{
const auto timetag = wht::any_cast<const std::shared_ptr<GnssTime>>(pmt::any_ref(it.value));
// std::cout << "PVT timetag: " << timetag->rx_time << '\n';
d_TimeChannelTagTimestamps.push(*timetag);
}
else
{
std::cout << "hash code not match\n";
}
}
catch (const wht::bad_any_cast& e)
{
std::cout << "msg Bad any_cast: " << e.what();
}
}
}
// ************ end time tags **************
std::vector<gr::tag_t> sensor_tags;
this->get_tags_in_range(sensor_tags, 0, this->nitems_read(0), this->nitems_read(0) + noutput_items, d_sensor_data_aggregator->SENSOR_DATA_TAG);
d_sensor_data_aggregator->update(sensor_tags);

View File

@@ -70,7 +70,6 @@ hybrid_observables_gs::hybrid_observables_gs(const Obs_Conf &conf_)
d_smooth_filter_M(static_cast<double>(conf_.smoothing_factor)),
d_T_rx_step_s(static_cast<double>(conf_.observable_interval_ms) / 1000.0),
d_last_rx_clock_round20ms_error(0.0),
d_ref_channel(0U),
d_T_rx_TOW_ms(0U),
d_T_rx_step_ms(conf_.observable_interval_ms),
d_T_status_report_timer_ms(0),
@@ -226,7 +225,6 @@ void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg
{
case 1: // reset TOW
d_T_rx_TOW_ms = 0;
d_ref_channel = 0;
d_last_rx_clock_round20ms_error = 0;
d_T_rx_TOW_set = false;
for (uint32_t n = 0; n < d_nchannels_out; n++)
@@ -510,20 +508,17 @@ void hybrid_observables_gs::update_TOW(const std::vector<Gnss_Synchro> &data)
{
// int32_t TOW_ref = std::numeric_limits<uint32_t>::max();
uint32_t TOW_ref = 0U;
uint32_t ref_ch = 0U;
for (it = data.cbegin(); it != data.cend(); it++)
{
if (it->Flag_valid_word)
{
if (it->TOW_at_current_symbol_ms > TOW_ref)
{
ref_ch = it->Channel_ID;
TOW_ref = it->TOW_at_current_symbol_ms;
d_T_rx_TOW_set = true;
}
}
}
d_ref_channel = ref_ch;
d_T_rx_TOW_ms = TOW_ref;
// align the receiver clock to integer multiple of d_T_rx_step_ms
if (d_T_rx_TOW_ms % d_T_rx_step_ms)

View File

@@ -107,7 +107,6 @@ private:
double d_T_rx_step_s;
double d_last_rx_clock_round20ms_error;
uint32_t d_ref_channel;
uint32_t d_T_rx_TOW_ms;
uint32_t d_T_rx_step_ms;
uint32_t d_T_status_report_timer_ms;

View File

@@ -18,8 +18,8 @@
#ifndef GNSS_SDR_FILE_SOURCE_BASE_H
#define GNSS_SDR_FILE_SOURCE_BASE_H
#include "../../libs/sensor_data/sensor_data_source.h"
#include "concurrent_queue.h"
#include "sensor_data/sensor_data_source.h"
#include "signal_source_base.h"
#include <gnuradio/blocks/file_sink.h> // for dump
#include <gnuradio/blocks/file_source.h>

View File

@@ -1736,6 +1736,9 @@ int64_t dll_pll_veml_tracking::uint64diff(uint64_t first, uint64_t second)
int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)), gr_vector_int &ninput_items,
gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
{
// std::vector<gr::tag_t> tags{};
// get_tags_in_window(tags, 0, 0, ninput_items[0], pmt::mp("sensor_data"));
gr::thread::scoped_lock l(d_setlock);
const auto *in = reinterpret_cast<const gr_complex *>(input_items[0]);
auto **out = reinterpret_cast<Gnss_Synchro **>(&output_items[0]);
@@ -2095,16 +2098,14 @@ int dll_pll_veml_tracking::general_work(int noutput_items __attribute__((unused)
d_timetag_waiting = false;
}
// Propagate sensor data tags
std::vector<gr::tag_t> tags{};
// get_tags_in_window(tags, 0, 0, ninput_items[0], pmt::mp("extra_data"));
get_tags_in_range(tags, 0, nitems_read(0) - d_current_prn_length_samples, nitems_read(0), pmt::mp("extra_data"));
get_tags_in_range(tags, 0, nitems_read(0) - d_current_prn_length_samples, nitems_read(0), pmt::mp("sensor_data"));
for (const auto &tag : tags)
{
add_item_tag(0, this->nitems_written(0) + 1, tag.key, tag.value);
// std::cout << "[ED TAG (TRK)] [" << std::to_string(tag.offset) << "] ";
// std::cout << std::endl;
}
*out[0] = std::move(current_synchro_data);
return 1;
}