mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-11-04 17:16:26 +00:00
Re-enabling more tests and bug fixes
This commit is contained in:
parent
5b30b3f8c6
commit
76f9ea0e07
@ -34,6 +34,7 @@
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/analog/sig_source_waveform.h>
|
||||
@ -50,6 +51,58 @@
|
||||
|
||||
#include "galileo_e1_pcps_ambiguous_acquisition.h"
|
||||
|
||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||
class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx> GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_sptr;
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||
|
||||
class GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx();
|
||||
|
||||
public:
|
||||
int* rx_message;
|
||||
~GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx(); //!< Default destructor
|
||||
|
||||
};
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_make()
|
||||
{
|
||||
return GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx_sptr(new GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx());
|
||||
}
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisitionTest_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!\n";
|
||||
*rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx() :
|
||||
gr::block("GalileoE1PcpsAmbiguousAcquisitionTest_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(&GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::msg_handler_events, this, _1));
|
||||
|
||||
}
|
||||
|
||||
GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx::~GalileoE1PcpsAmbiguousAcquisitionTest_msg_rx()
|
||||
{}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
class GalileoE1PcpsAmbiguousAcquisitionTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
@ -58,8 +111,6 @@ protected:
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
stop = false;
|
||||
message = 0;
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
|
||||
@ -67,9 +118,6 @@ protected:
|
||||
{}
|
||||
|
||||
void init();
|
||||
void start_queue();
|
||||
void wait_message();
|
||||
void stop_queue();
|
||||
|
||||
gr::msg_queue::sptr queue;
|
||||
gr::top_block_sptr top_block;
|
||||
@ -77,9 +125,6 @@ protected:
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
bool stop;
|
||||
int message;
|
||||
boost::thread ch_thread;
|
||||
};
|
||||
|
||||
|
||||
@ -104,29 +149,6 @@ void GalileoE1PcpsAmbiguousAcquisitionTest::init()
|
||||
config->set_property("Acquisition1.cboc", "true");
|
||||
}
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisitionTest::start_queue()
|
||||
{
|
||||
stop = false;
|
||||
ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionTest::wait_message, this);
|
||||
}
|
||||
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisitionTest::wait_message()
|
||||
{
|
||||
while (!stop)
|
||||
{
|
||||
channel_internal_queue.wait_and_pop(message);
|
||||
stop_queue();
|
||||
}
|
||||
}
|
||||
|
||||
void GalileoE1PcpsAmbiguousAcquisitionTest::stop_queue()
|
||||
{
|
||||
stop = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, Instantiate)
|
||||
{
|
||||
init();
|
||||
@ -142,11 +164,14 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
struct timeval tv;
|
||||
long long int begin = 0;
|
||||
long long int end = 0;
|
||||
int message=0;
|
||||
top_block = gr::make_top_block("Acquisition test");
|
||||
queue = gr::msg_queue::make(0);
|
||||
init();
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
|
||||
std::shared_ptr<AcquisitionInterface> acquisition = std::dynamic_pointer_cast<AcquisitionInterface>(acq_);
|
||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||
msg_rx->rx_message=&message; // set message pointer to get last acquisition message
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->connect(top_block);
|
||||
@ -154,6 +179,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ConnectAndRun)
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
||||
|
||||
EXPECT_NO_THROW( {
|
||||
@ -172,6 +198,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
struct timeval tv;
|
||||
long long int begin = 0;
|
||||
long long int end = 0;
|
||||
int message=0;
|
||||
double expected_delay_samples = 2920; //18250;
|
||||
double expected_doppler_hz = -632;
|
||||
init();
|
||||
@ -179,6 +206,8 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
queue = gr::msg_queue::make(0);
|
||||
std::shared_ptr<GNSSBlockInterface> acq_ = factory->GetBlock(config, "Acquisition", "Galileo_E1_PCPS_Ambiguous_Acquisition", 1, 1, queue);
|
||||
std::shared_ptr<GalileoE1PcpsAmbiguousAcquisition> acquisition = std::dynamic_pointer_cast<GalileoE1PcpsAmbiguousAcquisition>(acq_);
|
||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||
msg_rx->rx_message=&message; // set message pointer to get last acquisition message
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
acquisition->set_channel(gnss_synchro.Channel_ID);
|
||||
@ -210,12 +239,9 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
const char * file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
top_block->connect(file_source, 0, acquisition->get_left_block(), 0);
|
||||
top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events"));
|
||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
start_queue();
|
||||
}) << "Failure while starting the queue" << std::endl;
|
||||
|
||||
acquisition->init();
|
||||
acquisition->reset();
|
||||
acquisition->set_state(1);
|
||||
@ -227,11 +253,10 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
gettimeofday(&tv, NULL);
|
||||
end = tv.tv_sec * 1000000 + tv.tv_usec;
|
||||
}) << "Failure running the top_block." << std::endl;
|
||||
stop_queue();
|
||||
|
||||
unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples;
|
||||
std::cout << "Acquired " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||
EXPECT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
ASSERT_EQ(1, *(msg_rx->rx_message)) << "Acquisition failure. Expected message: 1=ACQ SUCCESS.";
|
||||
|
||||
std::cout << "Delay: " << gnss_synchro.Acq_delay_samples << std::endl;
|
||||
std::cout << "Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl;
|
||||
@ -242,7 +267,5 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionTest, ValidationOfResults)
|
||||
|
||||
EXPECT_LE(doppler_error_hz, 166) << "Doppler error exceeds the expected value: 166 Hz = 2/(3*integration period)";
|
||||
EXPECT_LT(delay_error_chips, 0.175) << "Delay error exceeds the expected value: 0.175 chips";
|
||||
|
||||
ch_thread.join();
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "pass_through.h"
|
||||
|
||||
#include "gnss_block_factory.h"
|
||||
|
||||
z
|
||||
class GalileoE5aPcpsAcquisitionGSoC2014GensourceTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <boost/chrono.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/analog/sig_source_waveform.h>
|
||||
|
@ -50,6 +50,59 @@
|
||||
#include "gps_l2_m_dll_pll_tracking.h"
|
||||
|
||||
|
||||
// ######## GNURADIO BLOCK MESSAGE RECEVER #########
|
||||
class GpsL2MDllPllTrackingTest_msg_rx;
|
||||
|
||||
typedef boost::shared_ptr<GpsL2MDllPllTrackingTest_msg_rx> GpsL2MDllPllTrackingTest_msg_rx_sptr;
|
||||
|
||||
GpsL2MDllPllTrackingTest_msg_rx_sptr GpsL2MDllPllTrackingTest_msg_rx_make();
|
||||
|
||||
class GpsL2MDllPllTrackingTest_msg_rx : public gr::block
|
||||
{
|
||||
private:
|
||||
friend GpsL2MDllPllTrackingTest_msg_rx_sptr GpsL2MDllPllTrackingTest_msg_rx_make();
|
||||
void msg_handler_events(pmt::pmt_t msg);
|
||||
GpsL2MDllPllTrackingTest_msg_rx();
|
||||
|
||||
public:
|
||||
int* rx_message;
|
||||
~GpsL2MDllPllTrackingTest_msg_rx(); //!< Default destructor
|
||||
|
||||
};
|
||||
|
||||
GpsL2MDllPllTrackingTest_msg_rx_sptr GpsL2MDllPllTrackingTest_msg_rx_make()
|
||||
{
|
||||
return GpsL2MDllPllTrackingTest_msg_rx_sptr(new GpsL2MDllPllTrackingTest_msg_rx());
|
||||
}
|
||||
|
||||
void GpsL2MDllPllTrackingTest_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!\n";
|
||||
*rx_message = 0;
|
||||
}
|
||||
}
|
||||
|
||||
GpsL2MDllPllTrackingTest_msg_rx::GpsL2MDllPllTrackingTest_msg_rx() :
|
||||
gr::block("GpsL2MDllPllTrackingTest_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(&GpsL2MDllPllTrackingTest_msg_rx::msg_handler_events, this, _1));
|
||||
|
||||
}
|
||||
|
||||
GpsL2MDllPllTrackingTest_msg_rx::~GpsL2MDllPllTrackingTest_msg_rx()
|
||||
{}
|
||||
|
||||
|
||||
// ###########################################################
|
||||
|
||||
|
||||
class GpsL2MDllPllTrackingTest: public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
@ -58,8 +111,6 @@ protected:
|
||||
factory = std::make_shared<GNSSBlockFactory>();
|
||||
config = std::make_shared<InMemoryConfiguration>();
|
||||
item_size = sizeof(gr_complex);
|
||||
stop = false;
|
||||
message = 0;
|
||||
gnss_synchro = Gnss_Synchro();
|
||||
}
|
||||
|
||||
@ -74,8 +125,6 @@ protected:
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
Gnss_Synchro gnss_synchro;
|
||||
size_t item_size;
|
||||
bool stop;
|
||||
int message;
|
||||
};
|
||||
|
||||
|
||||
@ -105,15 +154,17 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults)
|
||||
long long int end = 0;
|
||||
int fs_in = 5000000;
|
||||
int nsamples = fs_in*9;
|
||||
int message=0;
|
||||
|
||||
init();
|
||||
queue = gr::msg_queue::make(0);
|
||||
top_block = gr::make_top_block("Tracking test");
|
||||
|
||||
std::shared_ptr<TrackingInterface> tracking = std::make_shared<GpsL2MDllPllTracking>(config.get(), "Tracking_2S", 1, 1, queue);
|
||||
boost::shared_ptr<GpsL2MDllPllTrackingTest_msg_rx> msg_rx = GpsL2MDllPllTrackingTest_msg_rx_make();
|
||||
msg_rx->rx_message=&message; // set message pointer to get last message
|
||||
|
||||
//REAL
|
||||
gnss_synchro.Acq_delay_samples = 1;
|
||||
gnss_synchro.Acq_doppler_hz = 1200;//1200;
|
||||
gnss_synchro.Acq_doppler_hz = 1200;
|
||||
gnss_synchro.Acq_samplestamp_samples = 0;
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
@ -130,22 +181,16 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults)
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
//gr::analog::sig_source_c::sptr source = gr::analog::sig_source_c::make(fs_in, gr::analog::GR_SIN_WAVE, 1000, 1, gr_complex(0));
|
||||
|
||||
|
||||
std::string path = std::string(TEST_PATH);
|
||||
//std::string file = path + "signal_samples/GSoC_CTTC_capture_2012_07_26_4Msps_4ms.dat";
|
||||
//std::string file = "/datalogger/signals/Fraunhofer/L125_III1b_210s_L2_resampled.bin";
|
||||
std::string file = path + "/data/gps_l2c_m_prn7_5msps.dat";
|
||||
const char * file_name = file.c_str();
|
||||
gr::blocks::file_source::sptr file_source = gr::blocks::file_source::make(sizeof(gr_complex), file_name, false);
|
||||
|
||||
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
gr::blocks::null_sink::sptr sink = gr::blocks::null_sink::make(sizeof(Gnss_Synchro));
|
||||
top_block->connect(file_source, 0, valve, 0);
|
||||
top_block->connect(valve, 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();
|
||||
@ -158,6 +203,7 @@ TEST_F(GpsL2MDllPllTrackingTest, ValidationOfResults)
|
||||
end = tv.tv_sec *1000000 + tv.tv_usec;
|
||||
}) << "Failure running the top_block." << std::endl;
|
||||
|
||||
// TODO: Verify tracking results
|
||||
std::cout << "Tracked " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*!
|
||||
* \file gps_l1_ca_pcps_acquisition_test.cc
|
||||
* \file gps_l2_m_pcps_acquisition_test.cc
|
||||
* \brief This class implements an acquisition test for
|
||||
* GpsL1CaPcpsAcquisition class based on some input parameters.
|
||||
* \author Javier Arribas, 2015 (jarribas@cttc.es)
|
||||
@ -37,6 +37,7 @@
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
#include <boost/chrono.hpp>
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <gnuradio/top_block.h>
|
||||
#include <gnuradio/blocks/file_source.h>
|
||||
#include <gnuradio/analog/sig_source_waveform.h>
|
||||
@ -186,7 +187,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ConnectAndRun)
|
||||
boost::shared_ptr<gr::block> valve = gnss_sdr_make_valve(sizeof(gr_complex), nsamples, queue);
|
||||
top_block->connect(source, 0, valve, 0);
|
||||
top_block->connect(valve, 0, acquisition->get_left_block(), 0);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||
msg_rx->rx_message=&message; // set message pointer to get last acquisition message
|
||||
}) << "Failure connecting the blocks of acquisition test." << std::endl;
|
||||
|
||||
@ -213,7 +214,7 @@ TEST_F(GpsL2MPcpsAcquisitionTest, ValidationOfResults)
|
||||
double expected_doppler_hz = 1200;//3000;
|
||||
init();
|
||||
std::shared_ptr<GpsL2MPcpsAcquisition> acquisition = std::make_shared<GpsL2MPcpsAcquisition>(config.get(), "Acquisition", 1, 1);
|
||||
boost::shared_ptr<GpsL1CaPcpsAcquisitionTest_msg_rx> msg_rx = GpsL1CaPcpsAcquisitionTest_msg_rx_make();
|
||||
boost::shared_ptr<GpsL2MPcpsAcquisitionTest_msg_rx> msg_rx = GpsL2MPcpsAcquisitionTest_msg_rx_make();
|
||||
msg_rx->rx_message=&message; // set message pointer to get last acquisition message
|
||||
|
||||
ASSERT_NO_THROW( {
|
||||
|
@ -96,7 +96,7 @@ DECLARE_string(log_dir);
|
||||
//#endif
|
||||
//#include "gnss_block/gps_l1_ca_pcps_quicksync_acquisition_gsoc2014_test.cc"
|
||||
//#include "gnss_block/gps_l1_ca_pcps_tong_acquisition_gsoc2013_test.cc"
|
||||
//#include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc"
|
||||
#include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_test.cc"
|
||||
//#include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc"
|
||||
//#include "gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc"
|
||||
//#include "gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc"
|
||||
@ -107,8 +107,6 @@ DECLARE_string(log_dir);
|
||||
#include "gnuradio_block/gnss_sdr_valve_test.cc"
|
||||
#include "gnuradio_block/direct_resampler_conditioner_cc_test.cc"
|
||||
|
||||
//#include "gnss_block/galileo_e5a_pcps_acquisition_test.cc"
|
||||
//#include "gnss_block/galileo_e5a_pcps_acquisition_test_2.cc"
|
||||
//#include "gnss_block/galileo_e5a_pcps_acquisition_gsoc2014_gensource_test.cc"
|
||||
#include "gnss_block/galileo_e5a_tracking_test.cc"
|
||||
#include "gnss_block/gps_l2_m_dll_pll_tracking_test.cc"
|
||||
|
Loading…
Reference in New Issue
Block a user