mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-14 12:10:34 +00:00
PVT receiver time feedback to observables to account for the receiver clock offset. Prototype of observables unit test enabled
This commit is contained in:
parent
c6cb41cfe3
commit
3da0807044
@ -123,6 +123,9 @@ galileo_e1_pvt_cc::galileo_e1_pvt_cc(unsigned int nchannels, bool dump, std::str
|
||||
this->message_port_register_in(pmt::mp("telemetry"));
|
||||
this->set_msg_handler(pmt::mp("telemetry"), boost::bind(&galileo_e1_pvt_cc::msg_handler_telemetry, this, _1));
|
||||
|
||||
// Receiver time feedback to observables block
|
||||
this->message_port_register_out(pmt::mp("rx_dt_s"));
|
||||
|
||||
//initialize kml_printer
|
||||
std::string kml_dump_filename;
|
||||
kml_dump_filename = d_dump_filename;
|
||||
|
@ -227,6 +227,9 @@ gps_l1_ca_pvt_cc::gps_l1_ca_pvt_cc(unsigned int nchannels,
|
||||
this->set_msg_handler(pmt::mp("telemetry"),
|
||||
boost::bind(&gps_l1_ca_pvt_cc::msg_handler_telemetry, this, _1));
|
||||
|
||||
// Receiver time feedback to observables block
|
||||
this->message_port_register_out(pmt::mp("rx_dt_s"));
|
||||
|
||||
//initialize kml_printer
|
||||
std::string kml_dump_filename;
|
||||
kml_dump_filename = d_dump_filename;
|
||||
@ -373,6 +376,12 @@ int gps_l1_ca_pvt_cc::general_work (int noutput_items __attribute__((unused)), g
|
||||
pvt_result = d_ls_pvt->get_PVT(gnss_observables_map, d_rx_time, d_flag_averaging);
|
||||
if (pvt_result == true)
|
||||
{
|
||||
//feedback the receiver time offset estimation to observables block
|
||||
// send asynchronous message to observables block
|
||||
// time offset is expressed as the equivalent travel distance [m]
|
||||
pmt::pmt_t value = pmt::from_double(d_ls_pvt->d_rx_dt_s);
|
||||
this->message_port_pub(pmt::mp("rx_dt_s"), value);
|
||||
//std::cout<<"d_rx_dt_s*GPS_C_m_s="<<d_ls_pvt->d_rx_dt_s*GPS_C_m_s<<std::endl;
|
||||
if( first_fix == true)
|
||||
{
|
||||
std::cout << "First position fix at " << boost::posix_time::to_simple_string(d_ls_pvt->d_position_UTC_time)
|
||||
|
@ -216,6 +216,9 @@ hybrid_pvt_cc::hybrid_pvt_cc(unsigned int nchannels, bool dump, std::string dump
|
||||
this->message_port_register_in(pmt::mp("telemetry"));
|
||||
this->set_msg_handler(pmt::mp("telemetry"), boost::bind(&hybrid_pvt_cc::msg_handler_telemetry, this, _1));
|
||||
|
||||
// Receiver time feedback to observables block
|
||||
this->message_port_register_out(pmt::mp("rx_dt_s"));
|
||||
|
||||
//initialize kml_printer
|
||||
std::string kml_dump_filename;
|
||||
kml_dump_filename = d_dump_filename;
|
||||
|
@ -177,10 +177,10 @@ bool galileo_e1_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map
|
||||
DLOG(INFO) << "Galileo Position at TOW=" << galileo_current_time << " in ECEF (X,Y,Z) = " << mypos;
|
||||
|
||||
cart2geo(static_cast<double>(mypos(0)), static_cast<double>(mypos(1)), static_cast<double>(mypos(2)), 4);
|
||||
d_rx_dt_m = mypos(3)/GALILEO_C_m_s; // Convert RX time offset from meters to seconds
|
||||
d_rx_dt_s = mypos(3)/GALILEO_C_m_s; // Convert RX time offset from meters to seconds
|
||||
DLOG(INFO) << "Galileo Position at " << boost::posix_time::to_simple_string(p_time)
|
||||
<< " is Lat = " << d_latitude_d << " [deg], Long = " << d_longitude_d
|
||||
<< " [deg], Height= " << d_height_m << " [m]" << " RX time offset= " << d_rx_dt_m << " [s]";
|
||||
<< " [deg], Height= " << d_height_m << " [m]" << " RX time offset= " << d_rx_dt_s << " [s]";
|
||||
|
||||
// ###### Compute DOPs ########
|
||||
compute_DOP();
|
||||
|
@ -172,7 +172,7 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map,
|
||||
|
||||
cart2geo(static_cast<double>(mypos(0)), static_cast<double>(mypos(1)), static_cast<double>(mypos(2)), 4);
|
||||
|
||||
d_rx_dt_m = mypos(3)/GPS_C_m_s; // Convert RX time offset from meters to seconds
|
||||
d_rx_dt_s = mypos(3)/GPS_C_m_s; // Convert RX time offset from meters to seconds
|
||||
|
||||
// Compute UTC time and print PVT solution
|
||||
double secondsperweek = 604800.0; // number of seconds in one week (7*24*60*60)
|
||||
@ -183,7 +183,7 @@ bool gps_l1_ca_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_pseudoranges_map,
|
||||
|
||||
DLOG(INFO) << "Position at " << boost::posix_time::to_simple_string(p_time)
|
||||
<< " is Lat = " << d_latitude_d << " [deg], Long = " << d_longitude_d
|
||||
<< " [deg], Height= " << d_height_m << " [m]" << " RX time offset= " << d_rx_dt_m << " [s]";
|
||||
<< " [deg], Height= " << d_height_m << " [m]" << " RX time offset= " << d_rx_dt_s << " [s]";
|
||||
|
||||
// ###### Compute DOPs ########
|
||||
compute_DOP();
|
||||
|
@ -276,7 +276,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_observables_map, dou
|
||||
DLOG(INFO) << "W=" << W;
|
||||
|
||||
mypos = leastSquarePos(satpos, obs, W);
|
||||
d_rx_dt_m = mypos(3) / GPS_C_m_s; // Convert RX time offset from meters to seconds
|
||||
d_rx_dt_s = mypos(3) / GPS_C_m_s; // Convert RX time offset from meters to seconds
|
||||
double secondsperweek = 604800.0;
|
||||
// Compute GST and Gregorian time
|
||||
if( GST != 0.0)
|
||||
@ -300,7 +300,7 @@ bool hybrid_ls_pvt::get_PVT(std::map<int,Gnss_Synchro> gnss_observables_map, dou
|
||||
|
||||
DLOG(INFO) << "Hybrid Position at " << boost::posix_time::to_simple_string(p_time)
|
||||
<< " is Lat = " << d_latitude_d << " [deg], Long = " << d_longitude_d
|
||||
<< " [deg], Height= " << d_height_m << " [m]" << " RX time offset= " << d_rx_dt_m << " [s]";
|
||||
<< " [deg], Height= " << d_height_m << " [m]" << " RX time offset= " << d_rx_dt_s << " [s]";
|
||||
|
||||
// ###### Compute DOPs ########
|
||||
hybrid_ls_pvt::compute_DOP();
|
||||
|
@ -57,7 +57,7 @@ Pvt_Solution::Pvt_Solution()
|
||||
b_valid_position = false;
|
||||
d_averaging_depth = 0;
|
||||
d_valid_observations = 0;
|
||||
d_rx_dt_m = 0.0;
|
||||
d_rx_dt_s = 0.0;
|
||||
}
|
||||
|
||||
arma::vec Pvt_Solution::rotateSatellite(double const traveltime, const arma::vec & X_sat)
|
||||
|
@ -51,7 +51,7 @@ public:
|
||||
double d_latitude_d; //!< RX position Latitude WGS84 [deg]
|
||||
double d_longitude_d; //!< RX position Longitude WGS84 [deg]
|
||||
double d_height_m; //!< RX position height WGS84 [m]
|
||||
double d_rx_dt_m; //!< RX time offset [s]
|
||||
double d_rx_dt_s; //!< RX time offset [s]
|
||||
|
||||
boost::posix_time::ptime d_position_UTC_time;
|
||||
|
||||
|
@ -56,10 +56,24 @@ galileo_e1_make_observables_cc(unsigned int nchannels, bool dump, std::string du
|
||||
}
|
||||
|
||||
|
||||
void galileo_e1_observables_cc::msg_handler_rx_dt_s(pmt::pmt_t msg)
|
||||
{
|
||||
//pmt::print(msg);
|
||||
|
||||
d_rx_dt_s = pmt::to_double(msg);
|
||||
}
|
||||
|
||||
galileo_e1_observables_cc::galileo_e1_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history) :
|
||||
gr::block("galileo_e1_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("rx_dt_s"));
|
||||
|
||||
this->set_msg_handler(pmt::mp("rx_dt_s"),
|
||||
boost::bind(&galileo_e1_observables_cc::msg_handler_rx_dt_s, this, _1));
|
||||
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
d_nchannels = nchannels;
|
||||
|
@ -61,6 +61,7 @@ private:
|
||||
friend galileo_e1_observables_cc_sptr
|
||||
galileo_e1_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||
galileo_e1_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||
void msg_handler_rx_dt_s(pmt::pmt_t msg);
|
||||
|
||||
//Tracking observable history
|
||||
std::vector<std::deque<double>> d_acc_carrier_phase_queue_rads;
|
||||
@ -68,6 +69,7 @@ private:
|
||||
std::vector<std::deque<double>> d_symbol_TOW_queue_s;
|
||||
|
||||
// class private vars
|
||||
double d_rx_dt_s;
|
||||
bool d_dump;
|
||||
unsigned int d_nchannels;
|
||||
unsigned int history_deep;
|
||||
|
@ -57,6 +57,14 @@ gps_l1_ca_observables_cc::gps_l1_ca_observables_cc(unsigned int nchannels, bool
|
||||
gr::block("gps_l1_ca_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("rx_dt_s"));
|
||||
|
||||
this->set_msg_handler(pmt::mp("rx_dt_s"),
|
||||
boost::bind(&gps_l1_ca_observables_cc::msg_handler_rx_dt_s, this, _1));
|
||||
|
||||
d_rx_dt_s=0;
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
d_nchannels = nchannels;
|
||||
@ -97,6 +105,14 @@ gps_l1_ca_observables_cc::~gps_l1_ca_observables_cc()
|
||||
}
|
||||
|
||||
|
||||
void gps_l1_ca_observables_cc::msg_handler_rx_dt_s(pmt::pmt_t msg)
|
||||
{
|
||||
//pmt::print(msg);
|
||||
//accumulate the receiver time offset
|
||||
d_rx_dt_s = d_rx_dt_s+pmt::to_double(msg);
|
||||
}
|
||||
|
||||
|
||||
bool pairCompare_gnss_synchro_Prn_delay_ms(const std::pair<int,Gnss_Synchro>& a, const std::pair<int,Gnss_Synchro>& b)
|
||||
{
|
||||
return (a.second.Prn_timestamp_ms) < (b.second.Prn_timestamp_ms);
|
||||
@ -203,7 +219,8 @@ int gps_l1_ca_observables_cc::general_work (int noutput_items, gr_vector_int &ni
|
||||
delta_rx_time_ms = gnss_synchro_iter->second.Prn_timestamp_ms - d_ref_PRN_rx_time_ms;
|
||||
//compute the pseudorange
|
||||
traveltime_ms = (d_TOW_reference-gnss_synchro_iter->second.d_TOW_at_current_symbol) * 1000.0 + delta_rx_time_ms + GPS_STARTOFFSET_ms;
|
||||
pseudorange_m = traveltime_ms * GPS_C_m_ms; // [m]
|
||||
//convert to meters and remove the receiver time offset in meters
|
||||
pseudorange_m = traveltime_ms * GPS_C_m_ms-d_rx_dt_s*GPS_C_m_s; // [m]
|
||||
// update the pseudorange object
|
||||
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID] = gnss_synchro_iter->second;
|
||||
current_gnss_synchro[gnss_synchro_iter->second.Channel_ID].Pseudorange_m = pseudorange_m;
|
||||
|
@ -61,7 +61,7 @@ private:
|
||||
friend gps_l1_ca_observables_cc_sptr
|
||||
gps_l1_ca_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||
gps_l1_ca_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||
|
||||
void msg_handler_rx_dt_s(pmt::pmt_t msg);
|
||||
|
||||
//Tracking observable history
|
||||
std::vector<std::deque<double>> d_acc_carrier_phase_queue_rads;
|
||||
@ -69,6 +69,7 @@ private:
|
||||
std::vector<std::deque<double>> d_symbol_TOW_queue_s;
|
||||
|
||||
// class private vars
|
||||
double d_rx_dt_s;
|
||||
bool d_dump;
|
||||
unsigned int d_nchannels;
|
||||
unsigned int history_deep;
|
||||
|
@ -55,10 +55,24 @@ hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_f
|
||||
}
|
||||
|
||||
|
||||
void hybrid_observables_cc::msg_handler_rx_dt_s(pmt::pmt_t msg)
|
||||
{
|
||||
//pmt::print(msg);
|
||||
|
||||
d_rx_dt_s = pmt::to_double(msg);
|
||||
}
|
||||
|
||||
hybrid_observables_cc::hybrid_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history) :
|
||||
gr::block("hybrid_observables_cc", gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)),
|
||||
gr::io_signature::make(nchannels, nchannels, sizeof(Gnss_Synchro)))
|
||||
{
|
||||
|
||||
// Telemetry bit synchronization message port input
|
||||
this->message_port_register_in(pmt::mp("rx_dt_s"));
|
||||
|
||||
this->set_msg_handler(pmt::mp("rx_dt_s"),
|
||||
boost::bind(&hybrid_observables_cc::msg_handler_rx_dt_s, this, _1));
|
||||
|
||||
// initialize internal vars
|
||||
d_dump = dump;
|
||||
d_nchannels = nchannels;
|
||||
|
@ -59,6 +59,7 @@ private:
|
||||
friend hybrid_observables_cc_sptr
|
||||
hybrid_make_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||
hybrid_observables_cc(unsigned int nchannels, bool dump, std::string dump_filename, unsigned int deep_history);
|
||||
void msg_handler_rx_dt_s(pmt::pmt_t msg);
|
||||
|
||||
//Tracking observable history
|
||||
std::vector<std::deque<double>> d_acc_carrier_phase_queue_rads;
|
||||
@ -66,6 +67,7 @@ private:
|
||||
std::vector<std::deque<double>> d_symbol_TOW_queue_s;
|
||||
|
||||
// class private vars
|
||||
double d_rx_dt_s;
|
||||
bool d_dump;
|
||||
unsigned int d_nchannels;
|
||||
unsigned int history_deep;
|
||||
|
@ -324,6 +324,8 @@ void GNSSFlowgraph::connect()
|
||||
top_block_->connect(observables_->get_right_block(), i, pvt_->get_left_block(), i);
|
||||
top_block_->msg_connect(channels_.at(i)->get_right_block(), pmt::mp("telemetry"), pvt_->get_left_block(), pmt::mp("telemetry"));
|
||||
}
|
||||
//asynchronous feedback of receiver time estimation from PVT to observables
|
||||
top_block_->msg_connect(pvt_->get_left_block(), pmt::mp("rx_dt_s"), observables_->get_right_block(), pmt::mp("rx_dt_s"));
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
@ -114,7 +114,8 @@ DECLARE_string(log_dir);
|
||||
#include "unit-tests/signal-processing-blocks/tracking/galileo_e1_dll_pll_veml_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/galileo_e5a_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/gps_l2_m_dll_pll_tracking_test.cc"
|
||||
//#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/gps_l1_ca_dll_pll_tracking_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/telemetry_decoder/gps_l1_ca_telemetry_decoder_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/tracking_loop_filter_test.cc"
|
||||
#include "unit-tests/signal-processing-blocks/tracking/cpu_multicorrelator_test.cc"
|
||||
#if CUDA_BLOCKS_TEST
|
||||
|
@ -0,0 +1,271 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_dll_pll_tracking_test.cc
|
||||
* \brief This class implements a tracking test for Galileo_E5a_DLL_PLL_Tracking
|
||||
* implementation based on some input parameters.
|
||||
* \author Javier Arribas, 2015. jarribas(at)cttc.es
|
||||
*
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*
|
||||
* Copyright (C) 2012-2015 (see AUTHORS file for a list of contributors)
|
||||
*
|
||||
* GNSS-SDR is a software defined Global Navigation
|
||||
* Satellite Systems receiver
|
||||
*
|
||||
* This file is part of GNSS-SDR.
|
||||
*
|
||||
* GNSS-SDR is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GNSS-SDR is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/analog/sig_source_waveform.h>
|
||||
#include <gnuradio/analog/sig_source_c.h>
|
||||
#include <gnuradio/msg_queue.h>
|
||||
#include <gnuradio/blocks/interleaved_char_to_complex.h>
|
||||
#include <gnuradio/blocks/null_sink.h>
|
||||
#include <gnuradio/blocks/skiphead.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include "gnss_block_factory.h"
|
||||
#include "gnss_block_interface.h"
|
||||
#include "tracking_interface.h"
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include "in_memory_configuration.h"
|
||||
#include "gnss_sdr_valve.h"
|
||||
#include "gnss_synchro.h"
|
||||
#include "gps_l1_ca_telemetry_decoder.h"
|
||||
|
||||
// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TRACKING MESSAGES #########
|
||||
class GpsL1CADllPllTelemetryDecoderTest_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<GpsL1CADllPllTelemetryDecoderTest_msg_rx> GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr;
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_msg_rx_make();
|
||||
|
||||
class GpsL1CADllPllTelemetryDecoderTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTelemetryDecoderTest_msg_rx(); //!< Default destructor
|
||||
|
||||
};
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_msg_rx_make()
|
||||
{
|
||||
return GpsL1CADllPllTelemetryDecoderTest_msg_rx_sptr(new GpsL1CADllPllTelemetryDecoderTest_msg_rx());
|
||||
}
|
||||
|
||||
void GpsL1CADllPllTelemetryDecoderTest_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx::GpsL1CADllPllTelemetryDecoderTest_msg_rx() :
|
||||
gr::block("GpsL1CADllPllTelemetryDecoderTest_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTelemetryDecoderTest_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_msg_rx::~GpsL1CADllPllTelemetryDecoderTest_msg_rx()
|
||||
{}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
// ######## GNURADIO BLOCK MESSAGE RECEVER FOR TLM MESSAGES #########
|
||||
class GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx> GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr;
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_make();
|
||||
|
||||
class GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx();
|
||||
|
||||
public:
|
||||
int rx_message;
|
||||
~GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx(); //!< Default destructor
|
||||
|
||||
};
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_make()
|
||||
{
|
||||
return GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_sptr(new GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx());
|
||||
}
|
||||
|
||||
void GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::msg_handler_events(pmt::pmt_t msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
long int message = pmt::to_long(msg);
|
||||
rx_message = message;
|
||||
}
|
||||
catch(boost::bad_any_cast& e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_telemetry Bad any cast!";
|
||||
rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx() :
|
||||
gr::block("GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0))
|
||||
{
|
||||
this->message_port_register_in(pmt::mp("events"));
|
||||
this->set_msg_handler(pmt::mp("events"), boost::bind(&GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::msg_handler_events, this, _1));
|
||||
rx_message = 0;
|
||||
}
|
||||
|
||||
GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx::~GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx()
|
||||
{}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class GpsL1CATelemetryDecoderTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
GpsL1CATelemetryDecoderTest()
|
||||
{
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
|
||||
~GpsL1CATelemetryDecoderTest()
|
||||
{}
|
||||
|
||||
void init();
|
||||
|
||||
gr::msg_queue::sptr queue;
|
||||
gr::top_block_sptr top_block;
|
||||
std::shared_ptr<GNSSBlockFactory> factory;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
};
|
||||
|
||||
|
||||
void GpsL1CATelemetryDecoderTest::init()
|
||||
{
|
||||
gnss_synchro.Channel_ID = 0;
|
||||
gnss_synchro.System = 'G';
|
||||
std::string signal = "1C";
|
||||
signal.copy(gnss_synchro.Signal, 2, 0);
|
||||
gnss_synchro.PRN = 1;
|
||||
|
||||
config->set_property("GNSS-SDR.internal_fs_hz", "2600000");
|
||||
|
||||
// Set Tracking
|
||||
config->set_property("Tracking_1C.item_type", "gr_complex");
|
||||
config->set_property("Tracking_1C.if", "0");
|
||||
config->set_property("Tracking_1C.dump", "true");
|
||||
config->set_property("Tracking_1C.dump_filename", "./tracking_ch_");
|
||||
config->set_property("Tracking_1C.pll_bw_hz", "30.0");
|
||||
config->set_property("Tracking_1C.dll_bw_hz", "4.0");
|
||||
config->set_property("Tracking_1C.early_late_space_chips", "0.5");
|
||||
|
||||
config->set_property("TelemetryDecoder_1C.dump","true");
|
||||
config->set_property("TelemetryDecoder_1C.decimation_factor","1");
|
||||
|
||||
}
|
||||
|
||||
TEST_F(GpsL1CATelemetryDecoderTest, ValidationOfResults)
|
||||
{
|
||||
struct timeval tv;
|
||||
long long int begin = 0;
|
||||
long long int end = 0;
|
||||
int fs_in = 2600000;
|
||||
|
||||
init();
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Telemetry_Decoder test");
|
||||
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL1CaDllPllTracking>(config.get(), "Tracking_1C", 1, 1);
|
||||
boost::shared_ptr<GpsL1CADllPllTelemetryDecoderTest_msg_rx> msg_rx = GpsL1CADllPllTelemetryDecoderTest_msg_rx_make();
|
||||
|
||||
gnss_synchro.Acq_delay_samples = (1023-994.622/1023)*fs_in*1e-3;
|
||||
gnss_synchro.Acq_doppler_hz = -2583.86;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
std::shared_ptr<TelemetryDecoderInterface> tlm(new GpsL1CaTelemetryDecoder(config.get(), "TelemetryDecoder_1C",1, 1));
|
||||
boost::shared_ptr<GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx> tlm_msg_rx = GpsL1CADllPllTelemetryDecoderTest_tlm_msg_rx_make();
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_channel(gnss_synchro.Channel_ID);
|
||||
}) << "Failure setting channel." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->set_gnss_synchro(&gnss_synchro);
|
||||
}) << "Failure setting gnss_synchro." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
tracking->connect(top_block);
|
||||
}) << "Failure connecting tracking to the top_block." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
std::string path = std::string(TEST_PATH);
|
||||
std::string file = path + "data/gps_l1ca_prn1_2.6msps.dat";
|
||||
const char * file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(int8_t), file_name, false);
|
||||
//boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gr::blocks::interleaved_char_to_complex::sptr gr_interleaved_char_to_complex = gr::blocks::interleaved_char_to_complex::make();
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
top_block->connect(file_source, 0, gr_interleaved_char_to_complex, 0);
|
||||
//top_block->connect(gr_interleaved_char_to_complex, 0, valve, 0);
|
||||
top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 0);
|
||||
top_block->connect(tracking->get_right_block(), 0, sink, 0);
|
||||
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of tracking test." << std::endl;
|
||||
|
||||
tracking->start_tracking();
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
gettimeofday(&tv, NULL);
|
||||
begin = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
top_block->run(); // Start threads and wait
|
||||
gettimeofday(&tv, NULL);
|
||||
end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
}) << "Failure running the top_block." << std::endl;
|
||||
|
||||
// TODO: Verify tracking results
|
||||
std::cout << "Signal tracking completed in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user