mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-10-30 06:36:21 +00:00
[TAS-111] time synch check: first draft
This commit is contained in:
parent
13cc59c5fa
commit
50fbc3e9e5
@ -188,6 +188,8 @@ rtklib_pvt_gs::rtklib_pvt_gs(uint32_t nchannels,
|
||||
this->message_port_register_out(pmt::mp("pvt_to_trk"));
|
||||
// Send PVT status to gnss_flowgraph
|
||||
this->message_port_register_out(pmt::mp("status"));
|
||||
// Send PVT time to OSNMA
|
||||
this->message_port_register_out(pmt::mp("pvt_to_osnma"));
|
||||
|
||||
// GPS Ephemeris data message port in
|
||||
this->message_port_register_in(pmt::mp("telemetry"));
|
||||
@ -2139,6 +2141,7 @@ int rtklib_pvt_gs::work(int noutput_items, gr_vector_const_void_star& input_item
|
||||
// #### solve PVT and store the corrected observable set
|
||||
if (d_internal_pvt_solver->get_PVT(d_gnss_observables_map, d_observable_interval_ms / 1000.0))
|
||||
{
|
||||
this->message_port_pub(pmt::mp("pvt_to_osnma"), pmt::make_any(convert_to_time_t(d_internal_pvt_solver->get_position_UTC_time())));
|
||||
d_pvt_errors_counter = 0; // Reset consecutive PVT error counter
|
||||
const double Rx_clock_offset_s = d_internal_pvt_solver->get_time_offset_s();
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "gnss_crypto.h"
|
||||
#include "gnss_satellite.h"
|
||||
#include "osnma_dsm_reader.h" // for OSNMA_DSM_Reader
|
||||
#include "pvt_interface.h"
|
||||
#include <glog/logging.h> // for DLOG
|
||||
#include <gnuradio/io_signature.h> // for gr::io_signature::make
|
||||
#include <cmath>
|
||||
@ -62,9 +63,6 @@ osnma_msg_receiver::osnma_msg_receiver(
|
||||
d_old_mack_message.set_capacity(10);
|
||||
// register OSNMA input message port from telemetry blocks
|
||||
this->message_port_register_in(pmt::mp("OSNMA_from_TLM"));
|
||||
// register OSNMA output message port to PVT block
|
||||
this->message_port_register_out(pmt::mp("OSNMA_to_PVT"));
|
||||
|
||||
this->set_msg_handler(pmt::mp("OSNMA_from_TLM"),
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
[this](auto&& PH1) { msg_handler_osnma(PH1); });
|
||||
@ -75,9 +73,33 @@ osnma_msg_receiver::osnma_msg_receiver(
|
||||
boost::bind(&osnma_msg_receiver::msg_handler_osnma, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
// register OSNMA input message port from PVT block
|
||||
this->message_port_register_in(pmt::mp("pvt_to_osnma"));
|
||||
this->set_msg_handler(pmt::mp("pvt_to_osnma"),
|
||||
#if HAS_GENERIC_LAMBDA
|
||||
[this](auto&& PH1) { msg_handler_pvt_to_osnma(PH1); });
|
||||
#else
|
||||
#if USE_BOOST_BIND_PLACEHOLDERS
|
||||
boost::bind(&osnma_msg_receiver::msg_handler_pvt_to_osnma, this, boost::placeholders::_1));
|
||||
#else
|
||||
boost::bind(&osnma_msg_receiver::msg_handler_pvt_to_osnma, this, _1));
|
||||
#endif
|
||||
#endif
|
||||
// register OSNMA output message port to PVT block
|
||||
this->message_port_register_out(pmt::mp("OSNMA_to_PVT"));
|
||||
}
|
||||
|
||||
|
||||
void osnma_msg_receiver::msg_handler_pvt_to_osnma(const pmt::pmt_t& msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
d_receiver_time = wht::any_cast<std::time_t>(pmt::any_ref(msg)); // C: TODO - check if this is the correct way to get the time from the PVT block
|
||||
}
|
||||
catch (const pmt::exception& e)
|
||||
{
|
||||
LOG(WARNING) << "osnma_msg_receiver pmt exception: " << e.what();
|
||||
}
|
||||
}
|
||||
void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg)
|
||||
{
|
||||
// requires mutex with msg_handler_osnma function called by the scheduler
|
||||
@ -97,7 +119,18 @@ void osnma_msg_receiver::msg_handler_osnma(const pmt::pmt_t& msg)
|
||||
<< ", from satellite "
|
||||
<< sat
|
||||
<< std::endl;
|
||||
process_osnma_message(nma_msg);
|
||||
|
||||
// compare local time with OSNMA subframe time
|
||||
d_GST_SIS = nma_msg->TOW_sf0 + nma_msg->WN_sf0 * 604800; // TODO - unsure about this operation and of the -24 seconds,...
|
||||
double_t T_L = 15; // TODO - to define the maximum allowed time difference between local time and OSNMA subframe time
|
||||
if(abs(d_GST_SIS - d_receiver_time) <= T_L)
|
||||
{
|
||||
process_osnma_message(nma_msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(WARNING) << "OSNMA: Subframe received with time difference greater than " << T_L << " seconds";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -432,7 +465,6 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
||||
d_public_key_verified = true;
|
||||
d_crypto->set_public_key(d_osnma_data.d_dsm_pkr_message.npk);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -446,7 +478,7 @@ void osnma_msg_receiver::process_dsm_message(const std::vector<uint8_t>& dsm_msg
|
||||
d_number_of_blocks[d_osnma_data.d_dsm_header.dsm_id] = 0;
|
||||
}
|
||||
|
||||
|
||||
// reads Mack message
|
||||
void osnma_msg_receiver::read_mack_block(const std::shared_ptr<OSNMA_msg>& osnma_msg)
|
||||
{
|
||||
uint32_t index = 0;
|
||||
@ -789,6 +821,7 @@ void osnma_msg_receiver::read_mack_body()
|
||||
|
||||
void osnma_msg_receiver::process_mack_message(const std::shared_ptr<OSNMA_msg>& osnma_msg)
|
||||
{
|
||||
// TODO - is it filled at this point always?
|
||||
d_old_mack_message.push_back(d_osnma_data.d_mack_message); // C: old mack message is needed for
|
||||
|
||||
// MACSEQ validation - case no FLX Tags
|
||||
@ -1018,7 +1051,6 @@ bool osnma_msg_receiver::verify_dsm_pkr(DSM_PKR_message message)
|
||||
{
|
||||
std::cout << "Galileo OSNMA: DSM-PKR verified successfully! " << std::endl;
|
||||
return true;
|
||||
// C: NPK verification against Merkle tree root.
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -60,6 +60,7 @@ private:
|
||||
osnma_msg_receiver(const std::string& pemFilePath, const std::string& merkleFilePath);
|
||||
|
||||
void msg_handler_osnma(const pmt::pmt_t& msg);
|
||||
void msg_handler_pvt_to_osnma(const pmt::pmt_t& msg);
|
||||
void process_osnma_message(const std::shared_ptr<OSNMA_msg>& osnma_msg);
|
||||
void read_nma_header(uint8_t nma_header);
|
||||
void read_dsm_header(uint8_t dsm_header);
|
||||
@ -88,6 +89,7 @@ private:
|
||||
uint8_t d_Lt_min {}; // minimum equivalent tag length
|
||||
uint32_t d_GST_0 {};
|
||||
uint32_t d_GST_SIS {};
|
||||
std::time_t d_receiver_time {};
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user