diff --git a/README.md b/README.md index 41aa474253..31610a3ec9 100644 --- a/README.md +++ b/README.md @@ -37,13 +37,13 @@ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time libarmadillo-dev libgflags-dev libgoogle-glog-dev libgnutls-openssl-dev libgtest-dev ~~~~~~ -Alternatively, and starting from Ubuntu 16.04 LTS, you can install all required dependencies by adding the line +Alternatively, and starting from Ubuntu 16.04 LTS, you can install all the required dependencies by adding the line ~~~~~~ deb-src http://us.archive.ubuntu.com/ubuntu/ xenial universe ~~~~~~ -at your ```/etc/apt/sources.list``` file and doing: +to your ```/etc/apt/sources.list``` file and doing: ~~~~~~ $ sudo apt-get update diff --git a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc index 091958add5..65c8862f7e 100644 --- a/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc +++ b/src/algorithms/acquisition/gnuradio_blocks/pcps_acquisition_cc.cc @@ -53,12 +53,12 @@ pcps_acquisition_cc_sptr pcps_make_acquisition_cc( bool dump, std::string dump_filename) { - return pcps_acquisition_cc_sptr( new pcps_acquisition_cc(sampled_ms, max_dwells, doppler_max, freq, fs_in, samples_per_ms, - samples_per_code, bit_transition_flag, use_CFAR_algorithm_flag, dump, dump_filename)); + samples_per_code, bit_transition_flag, use_CFAR_algorithm_flag, dump, dump_filename)); } + pcps_acquisition_cc::pcps_acquisition_cc( unsigned int sampled_ms, unsigned int max_dwells, unsigned int doppler_max, long freq, long fs_in, @@ -70,7 +70,6 @@ pcps_acquisition_cc::pcps_acquisition_cc( gr::io_signature::make(1, 1, sizeof(gr_complex) * sampled_ms * samples_per_ms * ( bit_transition_flag ? 2 : 1 )), gr::io_signature::make(0, 0, sizeof(gr_complex) * sampled_ms * samples_per_ms * ( bit_transition_flag ? 2 : 1 )) ) { - this->message_port_register_out(pmt::mp("events")); d_sample_counter = 0; // SAMPLE COUNTER diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index a405a8a0db..0495d89025 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -29,15 +29,15 @@ * ------------------------------------------------------------------------- */ #include "channel.h" -#include +//#include #include #include -#include "channel_interface.h" -#include "acquisition_interface.h" -#include "tracking_interface.h" -#include "telemetry_decoder_interface.h" +//#include "channel_interface.h" +//#include "acquisition_interface.h" +//#include "tracking_interface.h" +//#include "telemetry_decoder_interface.h" #include "configuration_interface.h" -#include "channel_msg_receiver_cc.h" +//#include "channel_msg_receiver_cc.h" using google::LogMessage; diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc index bdf5cee54c..deca2f3157 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc2013_test.cc @@ -58,10 +58,13 @@ concurrent_queue channel_internal_queue; // ######## GNURADIO BLOCK MESSAGE RECEVER ######### class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx; + typedef boost::shared_ptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr; + GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(); + class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::block { private: @@ -75,31 +78,35 @@ class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx : public gr::block }; + GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make() { return GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_sptr(new GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx()); } + void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events(pmt::pmt_t msg) { - try { - long int message=pmt::to_long(msg); - rx_message=message; - channel_internal_queue.push(rx_message); - }catch(boost::bad_any_cast& e) + try + { + long int message = pmt::to_long(msg); + rx_message = message; + channel_internal_queue.push(rx_message); + } + catch(boost::bad_any_cast& e) { LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n"; rx_message = 0; } } + GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx() : gr::block("GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_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(&GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::msg_handler_events, this, _1)); - rx_message=0; + rx_message = 0; } GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx::~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx() @@ -122,8 +129,7 @@ class GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test: public ::testing::Test } ~GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test() - { - } + {} void init(); void config_1(); @@ -183,6 +189,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::init() Pfa_a = 0; } + void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1() { gnss_synchro.Channel_ID = 0; @@ -254,6 +261,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_1() config->set_property("Acquisition.dump", "false"); } + void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2() { gnss_synchro.Channel_ID = 0; @@ -343,12 +351,14 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::config_2() config->set_property("Acquisition.dump", "false"); } + void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::start_queue() { stop = false; ch_thread = boost::thread(&GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message, this); } + void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message() { struct timeval tv; @@ -373,6 +383,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::wait_message() } } + void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message() { if (message == 1) @@ -412,6 +423,7 @@ void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::process_message() } } + void GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test::stop_queue() { stop = true; @@ -446,7 +458,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) boost::shared_ptr 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")); + 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( { @@ -460,6 +472,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ConnectAndRun) std::cout << "Processed " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; } + TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) { config_1(); @@ -470,7 +483,6 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) boost::shared_ptr msg_rx = GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test_msg_rx_make(); - ASSERT_NO_THROW( { acquisition->set_channel(1); }) << "Failure setting channel." << std::endl; @@ -504,7 +516,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); - top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events")); + 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; // i = 0 --> satellite in acquisition is visible @@ -590,7 +602,7 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProbabi signal_source.reset(new GenSignalSource(signal_generator, filter, "SignalSource", queue)); signal_source->connect(top_block); top_block->connect(signal_source->get_right_block(), 0, acquisition->get_left_block(), 0); - top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events")); + 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; std::cout << "Probability of false alarm (target) = " << 0.1 << std::endl; diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc index 9d46915416..f2d7fd7766 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc @@ -54,6 +54,8 @@ #include "pass_through.h" +concurrent_queue channel_internal_queue; + class GpsL1CaPcpsAcquisitionGSoC2013Test: public ::testing::Test { protected: diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index e559668602..abe014c86e 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -89,7 +89,7 @@ DECLARE_string(log_dir); #include "gnss_block/fir_filter_test.cc" #include "gnss_block/gps_l1_ca_pcps_acquisition_test.cc" #include "gnss_block/gps_l2_m_pcps_acquisition_test.cc" -//#include "gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc" +#include "gnss_block/gps_l1_ca_pcps_acquisition_gsoc2013_test.cc" //#include "gnss_block/gps_l1_ca_pcps_multithread_acquisition_gsoc2013_test.cc" //#if OPENCL_BLOCKS_TEST //#include "gnss_block/gps_l1_ca_pcps_opencl_acquisition_gsoc2013_test.cc" @@ -117,6 +117,7 @@ DECLARE_string(log_dir); concurrent_queue global_gps_acq_assist_queue; concurrent_map global_gps_acq_assist_map; +concurrent_queue channel_internal_queue; int main(int argc, char **argv) { diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 164ee4ff6b..4d8d598609 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -100,6 +100,63 @@ GpsL1CaPcpsAcquisitionFineDoppler *acquisition; Gnss_Synchro *gnss_synchro; std::vector gnss_sync_vector; + +// ######## GNURADIO BLOCK MESSAGE RECEVER ######### +class FrontEndCal_msg_rx; + +typedef boost::shared_ptr FrontEndCal_msg_rx_sptr; + +FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make(); + + +class FrontEndCal_msg_rx : public gr::block +{ +private: + friend FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make(); + void msg_handler_events(pmt::pmt_t msg); + FrontEndCal_msg_rx(); + +public: + int rx_message; + ~FrontEndCal_msg_rx(); //!< Default destructor +}; + + +FrontEndCal_msg_rx_sptr FrontEndCal_msg_rx_make() +{ + return FrontEndCal_msg_rx_sptr(new FrontEndCal_msg_rx()); +} + + +void FrontEndCal_msg_rx::msg_handler_events(pmt::pmt_t msg) +{ + try + { + long int message = pmt::to_long(msg); + rx_message = message; + channel_internal_queue.push(rx_message); + } + catch(boost::bad_any_cast& e) + { + LOG(WARNING) << "msg_handler_telemetry Bad any cast!\n"; + rx_message = 0; + } +} + + +FrontEndCal_msg_rx::FrontEndCal_msg_rx() : + gr::block("FrontEndCal_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(&FrontEndCal_msg_rx::msg_handler_events, this, _1)); + rx_message = 0; +} + +FrontEndCal_msg_rx::~FrontEndCal_msg_rx() +{} + +// ########################################################### + void wait_message() { while (!stop) @@ -125,6 +182,7 @@ void wait_message() } } + bool front_end_capture(std::shared_ptr configuration) { gr::top_block_sptr top_block; @@ -320,6 +378,9 @@ int main(int argc, char** argv) gr::block_sptr source; source = gr::blocks::file_source::make(sizeof(gr_complex), "tmp_capture.dat"); + boost::shared_ptr msg_rx = FrontEndCal_msg_rx_make(); + + //gr_basic_block_sptr head = gr_make_head(sizeof(gr_complex), nsamples); //gr_head_sptr head_sptr = boost::dynamic_pointer_cast(head); //head_sptr->set_length(nsamples); @@ -329,6 +390,7 @@ int main(int argc, char** argv) { acquisition->connect(top_block); top_block->connect(source, 0, acquisition->get_left_block(), 0); + top_block->msg_connect(acquisition->get_right_block(),pmt::mp("events"), msg_rx,pmt::mp("events")); } catch(const std::exception & e) {