mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-12-03 15:18:08 +00:00
Added message port observables->channel
This allows the observables to send messages back to the tracking channels, for example when system time has been received by at least one channel, it can then be broadcast back to all other channels. This is useful in long code tracking, so that we don't have to receive a TOW on every single channel before we start tracking.
This commit is contained in:
@@ -43,6 +43,7 @@
|
||||
#include "control_message_factory.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "Galileo_E1.h"
|
||||
#include "gnss_message.h"
|
||||
|
||||
|
||||
using google::LogMessage;
|
||||
@@ -59,6 +60,9 @@ galileo_e1_observables_cc::galileo_e1_observables_cc(unsigned int nchannels, boo
|
||||
gr::block("galileo_e1_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
// Create the gnss_message port:
|
||||
message_port_register_out( GNSS_MESSAGE_PORT_ID );
|
||||
|
||||
// initialize internal vars
|
||||
d_queue = queue;
|
||||
d_dump = dump;
|
||||
@@ -66,6 +70,7 @@ galileo_e1_observables_cc::galileo_e1_observables_cc(unsigned int nchannels, boo
|
||||
d_output_rate_ms = output_rate_ms;
|
||||
d_dump_filename = dump_filename;
|
||||
d_flag_averaging = flag_averaging;
|
||||
d_rx_time_set = false;
|
||||
|
||||
for (unsigned int i = 0; i < d_nchannels; i++)
|
||||
{
|
||||
@@ -192,6 +197,21 @@ int galileo_e1_observables_cc::general_work (int noutput_items, gr_vector_int &n
|
||||
double d_ref_PRN_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms;
|
||||
//int reference_channel= gnss_synchro_iter->second.Channel_ID;
|
||||
|
||||
|
||||
if( !d_rx_time_set )
|
||||
{
|
||||
// Let everyone know the current receiver time:
|
||||
pmt::pmt_t msg = gnss_message::make( "RECEIVER_TIME_SET",
|
||||
d_ref_PRN_rx_time_ms/1000.0 );
|
||||
|
||||
double rx_time_estimate = d_TOW_reference + GALILEO_STARTOFFSET_ms / 1000.0;
|
||||
msg = pmt::dict_add( msg, pmt::mp("TOW"),
|
||||
pmt::from_double( rx_time_estimate ) );
|
||||
message_port_pub( GNSS_MESSAGE_PORT_ID, msg );
|
||||
|
||||
d_rx_time_set = true;
|
||||
}
|
||||
|
||||
// Now compute RX time differences due to the PRN alignment in the correlators
|
||||
double traveltime_ms;
|
||||
double pseudorange_m;
|
||||
|
||||
@@ -83,6 +83,8 @@ private:
|
||||
int d_output_rate_ms;
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
bool d_rx_time_set;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -124,6 +124,10 @@ galileo_e1b_telemetry_decoder_cc::galileo_e1b_telemetry_decoder_cc(
|
||||
{
|
||||
// Create the gnss_message port:
|
||||
message_port_register_out( GNSS_MESSAGE_PORT_ID );
|
||||
message_port_register_in( GNSS_MESSAGE_PORT_ID );
|
||||
set_msg_handler( GNSS_MESSAGE_PORT_ID,
|
||||
boost::bind( &galileo_e1b_telemetry_decoder_cc::gnss_message_handler,
|
||||
this, _1 ) );
|
||||
|
||||
// initialize internal vars
|
||||
d_queue = queue;
|
||||
@@ -342,6 +346,10 @@ int galileo_e1b_telemetry_decoder_cc::general_work (int noutput_items, gr_vector
|
||||
LOG(INFO) << "Starting page decoder for Galileo SAT " << this->d_satellite;
|
||||
d_preamble_index = d_sample_counter; //record the preamble sample stamp
|
||||
d_stat = 2;
|
||||
d_preamble_time_seconds = in[0][0].Tracking_timestamp_secs; // - d_preamble_duration_seconds; //record the PRN start sample index associated to the preamble
|
||||
pmt::pmt_t msg = gnss_message::make( "PREAMBLE_START_DETECTED",
|
||||
d_preamble_time_seconds );
|
||||
message_port_pub( GNSS_MESSAGE_PORT_ID, msg );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -596,4 +604,8 @@ void galileo_e1b_telemetry_decoder_cc::set_utc_model_queue(concurrent_queue<Gali
|
||||
d_utc_model_queue = utc_model_queue;
|
||||
}
|
||||
|
||||
|
||||
void galileo_e1b_telemetry_decoder_cc::gnss_message_handler( pmt::pmt_t msg )
|
||||
{
|
||||
// Forward incoming messages to listeners
|
||||
message_port_pub( GNSS_MESSAGE_PORT_ID, msg );
|
||||
}
|
||||
|
||||
@@ -147,6 +147,8 @@ private:
|
||||
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
|
||||
void gnss_message_handler( pmt::pmt_t msg );
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "gnss_block_interface.h"
|
||||
#include "channel_interface.h"
|
||||
#include "gnss_block_factory.h"
|
||||
#include "gnss_message.h"
|
||||
|
||||
#define GNSS_SDR_ARRAY_SIGNAL_CONDITIONER_CHANNELS 8
|
||||
|
||||
@@ -297,6 +298,30 @@ void GNSSFlowgraph::connect()
|
||||
{
|
||||
top_block_->connect(channels_.at(i)->get_right_block(), 0,
|
||||
observables_->get_left_block(), i);
|
||||
|
||||
bool has_gnss_message_port =
|
||||
observables_->get_left_block()->has_msg_port(
|
||||
GNSS_MESSAGE_PORT_ID );
|
||||
|
||||
// Now check if the tracking loop can accept messages:
|
||||
if( has_gnss_message_port )
|
||||
{
|
||||
has_gnss_message_port = channels_.at(i)->get_right_block()->has_msg_port(
|
||||
GNSS_MESSAGE_PORT_ID );
|
||||
|
||||
if( has_gnss_message_port )
|
||||
{
|
||||
// Connect the input port to the output port:
|
||||
top_block_->msg_connect( observables_->get_left_block(), GNSS_MESSAGE_PORT_ID,
|
||||
channels_.at(i)->get_right_block(), GNSS_MESSAGE_PORT_ID );
|
||||
|
||||
DLOG(INFO) << "Connected gnss_message port: observables -> tracking";
|
||||
has_gnss_message_port = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user