diff --git a/CMakeLists.txt b/CMakeLists.txt index c1cde5911..a4ff3cd2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,9 +303,9 @@ set(Boost_ADDITIONAL_VERSIONS ) set(Boost_USE_MULTITHREAD ON) set(Boost_USE_STATIC_LIBS OFF) -find_package(Boost COMPONENTS date_time system filesystem thread serialization REQUIRED) +find_package(Boost COMPONENTS date_time system filesystem thread serialization chrono REQUIRED) if(NOT Boost_FOUND) - message(FATAL_ERROR "Fatal error: Boost (version >=1.42.0) required.") + message(FATAL_ERROR "Fatal error: Boost (version >=1.45.0) required.") endif(NOT Boost_FOUND) diff --git a/README.md b/README.md index 7bada58a0..74307ceed 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Before building GNSS-SDR, you need to install all the required dependencies. If ~~~~~~ $ sudo apt-get install build-essential cmake git libboost-dev libboost-date-time-dev \ - libboost-system-dev libboost-filesystem-dev libboost-thread-dev \ + libboost-system-dev libboost-filesystem-dev libboost-thread-dev libboost-chrono-dev \ libboost-serialization-dev libboost-program-options-dev libboost-test-dev \ liblog4cpp5-dev libuhd-dev gnuradio-dev gr-osmosdr libblas-dev liblapack-dev gfortran \ libarmadillo-dev libgflags-dev libgoogle-glog-dev libssl-dev libgtest-dev diff --git a/src/algorithms/channel/adapters/CMakeLists.txt b/src/algorithms/channel/adapters/CMakeLists.txt index 09c8a1529..5264ae3fe 100644 --- a/src/algorithms/channel/adapters/CMakeLists.txt +++ b/src/algorithms/channel/adapters/CMakeLists.txt @@ -18,6 +18,10 @@ set(CHANNEL_ADAPTER_SOURCES channel.cc) +if(Boost_VERSION LESS 105000) + add_definitions(-DOLD_BOOST=1) +endif(Boost_VERSION LESS 105000) + include_directories( $(CMAKE_CURRENT_SOURCE_DIR) ${CMAKE_SOURCE_DIR}/src/core/system_parameters @@ -26,6 +30,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/src/algorithms/channel/libs ${GLOG_INCLUDE_DIRS} ${GFlags_INCLUDE_DIRS} + ${Boost_INCLUDE_DIRS} ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) diff --git a/src/algorithms/channel/adapters/channel.cc b/src/algorithms/channel/adapters/channel.cc index b720ed53c..5c1b7ef97 100644 --- a/src/algorithms/channel/adapters/channel.cc +++ b/src/algorithms/channel/adapters/channel.cc @@ -34,6 +34,8 @@ #include #include #include +#include +#include #include #include #include @@ -234,9 +236,15 @@ void Channel::stop() * the boost::thread object must be used. join() will block the calling * thread until the thread represented by the boost::thread object * has completed. - * + * NOTE: timed_join() is deprecated and only present up to Boost 1.56 + * try_join_until() was introduced in Boost 1.50 */ - ch_thread_.join(); +#ifdef OLD_BOOST + ch_thread_.timed_join(boost::posix_time::seconds(1)); +#endif +#ifndef OLD_BOOST + ch_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); +#endif } diff --git a/src/core/receiver/CMakeLists.txt b/src/core/receiver/CMakeLists.txt index e185f87c3..92521bf84 100644 --- a/src/core/receiver/CMakeLists.txt +++ b/src/core/receiver/CMakeLists.txt @@ -64,6 +64,9 @@ include_directories( ${GNURADIO_RUNTIME_INCLUDE_DIRS} ) +if(Boost_VERSION LESS 105000) + add_definitions(-DOLD_BOOST=1) +endif(Boost_VERSION LESS 105000) if(ENABLE_GN3S) add_definitions(-DGN3S_DRIVER=1) diff --git a/src/core/receiver/control_thread.cc b/src/core/receiver/control_thread.cc index f27c704f9..f68c3972e 100644 --- a/src/core/receiver/control_thread.cc +++ b/src/core/receiver/control_thread.cc @@ -19,7 +19,7 @@ * 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. + * (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 @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -174,6 +175,7 @@ void ControlThread::run() std::cout << "Stopping GNSS-SDR, please wait!" << std::endl; flowgraph_->stop(); +#ifdef OLD_BOOST // Join GPS threads gps_ephemeris_data_collector_thread_.timed_join(boost::posix_time::seconds(1)); gps_iono_data_collector_thread_.timed_join(boost::posix_time::seconds(1)); @@ -190,6 +192,25 @@ void ControlThread::run() //Join keyboard threads keyboard_thread_.timed_join(boost::posix_time::seconds(1)); +#endif +#ifndef OLD_BOOST + // Join GPS threads + gps_ephemeris_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + gps_iono_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + gps_utc_model_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + gps_acq_assist_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + gps_ref_location_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + gps_ref_time_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + + //Join Galileo threads + galileo_ephemeris_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + galileo_iono_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + galileo_almanac_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + galileo_utc_model_data_collector_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + + //Join keyboard threads + keyboard_thread_.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); +#endif LOG(INFO) << "Flowgraph stopped"; } @@ -886,27 +907,26 @@ void ControlThread::galileo_utc_model_data_collector() // Check the UTC timestamp. If it is newer, then update the ephemeris if (galileo_utc.WNot_6 > galileo_utc_old.WNot_6) //further check because it is not clear when IOD is reset { - //std::cout << "UTC record updated --new GALILEO UTC Week Number ="<set_property("SignalSource.repeat", "true"); config->set_property("SignalConditioner.implementation", "Pass_Through"); config->set_property("SignalConditioner.item_type", "gr_complex"); - config->set_property("Channels_GPS.count", "2"); + config->set_property("Channels_GPS.count", "1"); + config->set_property("Channels.in_acquisition", "1"); + config->set_property("Channel.system", "GPS"); + config->set_property("Channel.signal", "1C"); config->set_property("Acquisition_GPS.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition_GPS.item_type", "gr_complex"); - config->set_property("Acquisition_GPS.threshold", "0.8"); + config->set_property("Acquisition_GPS.threshold", "1"); + config->set_property("Acquisition_GPS.doppler_max", "5000"); + config->set_property("Acquisition_GPS.doppler_min", "-5000"); config->set_property("Tracking_GPS.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); config->set_property("Tracking_GPS.item_type", "gr_complex"); config->set_property("TelemetryDecoder_GPS.implementation", "GPS_L1_CA_Telemetry_Decoder"); @@ -77,22 +81,12 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages) config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); config->set_property("OutputFilter.item_type", "gr_complex"); - std::unique_ptr control_thread(new ControlThread(config)); + std::shared_ptr control_thread = std::make_shared(config); gr::msg_queue::sptr control_queue = gr::msg_queue::make(0); - //ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); - //try - //{ - std::unique_ptr control_msg_factory(new ControlMessageFactory()); - //} - //catch( boost::exception & e ) - //{ - // std::cout << "Boost exception: " << boost::diagnostic_information(e); - //} - //catch(std::exception const& ex) - //{ - // std::cout << "STD exception: " << ex.what(); - //} + + std::unique_ptr control_msg_factory(new ControlMessageFactory()); + control_queue->handle(control_msg_factory->GetQueueMessage(0,0)); control_queue->handle(control_msg_factory->GetQueueMessage(1,0)); control_queue->handle(control_msg_factory->GetQueueMessage(200,0)); @@ -111,10 +105,10 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages) std::cout << "STD exception: " << ex.what(); } - unsigned int expected3 = 3; + unsigned int expected0 = 0; unsigned int expected1 = 1; - EXPECT_EQ(expected3, control_thread->processed_control_messages()); - EXPECT_EQ(expected1, control_thread->applied_actions()); + EXPECT_EQ(expected1, control_thread->processed_control_messages()); + EXPECT_EQ(expected0, control_thread->applied_actions()); } @@ -135,8 +129,13 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages2) config->set_property("SignalConditioner.implementation", "Pass_Through"); config->set_property("SignalConditioner.item_type", "gr_complex"); config->set_property("Channels_GPS.count", "1"); + config->set_property("Channels.in_acquisition", "4"); + config->set_property("Channel.system", "GPS"); + config->set_property("Channel.signal", "1C"); config->set_property("Acquisition_GPS.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Acquisition_GPS.item_type", "gr_complex"); + config->set_property("Acquisition_GPS.threshold", "1"); + config->set_property("Acquisition_GPS.doppler_max", "5000"); + config->set_property("Acquisition_GPS.doppler_min", "-5000"); config->set_property("Tracking_GPS.implementation", "GPS_L1_CA_DLL_FLL_PLL_Tracking"); config->set_property("Tracking_GPS.item_type", "gr_complex"); config->set_property("TelemetryDecoder_GPS.implementation", "GPS_L1_CA_Telemetry_Decoder"); @@ -151,7 +150,7 @@ TEST(Control_Thread_Test, InstantiateRunControlMessages2) std::unique_ptr control_thread2(new ControlThread(config)); gr::msg_queue::sptr control_queue2 = gr::msg_queue::make(0); - //ControlMessageFactory *control_msg_factory = new ControlMessageFactory(); + std::unique_ptr control_msg_factory2(new ControlMessageFactory()); control_queue2->handle(control_msg_factory2->GetQueueMessage(0,0)); diff --git a/src/tests/flowgraph/gnss_flowgraph_test.cc b/src/tests/flowgraph/gnss_flowgraph_test.cc index 25e674548..2b35a794f 100644 --- a/src/tests/flowgraph/gnss_flowgraph_test.cc +++ b/src/tests/flowgraph/gnss_flowgraph_test.cc @@ -17,7 +17,7 @@ * 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. + * (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 @@ -31,6 +31,7 @@ */ #include +#include #include "gnss_flowgraph.h" #include "gnss_block_interface.h" #include "in_memory_configuration.h" @@ -48,45 +49,40 @@ TEST(GNSSFlowgraph, InstantiateConnectStartStop) { std::shared_ptr config = std::make_shared(); + config->set_property("GNSS-SDR.SUPL_gps_enabled", "false"); config->set_property("SignalSource.sampling_frequency", "4000000"); config->set_property("SignalSource.implementation", "File_Signal_Source"); config->set_property("SignalSource.item_type", "gr_complex"); + config->set_property("SignalSource.repeat", "true"); std::string path = std::string(TEST_PATH); std::string filename = path + "signal_samples/Galileo_E1_ID_1_Fs_4Msps_8ms.dat"; config->set_property("SignalSource.filename", filename); config->set_property("SignalConditioner.implementation", "Pass_Through"); - config->set_property("Channels.count", "2"); - config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); - config->set_property("Tracking.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); - config->set_property("TelemetryDecoder.implementation", "GPS_L1_CA_Telemetry_Decoder"); - //config->set_property("Channels.observables.implementation", "Pass_Through"); + config->set_property("Channels_GPS.count", "1"); + config->set_property("Channels.in_acquisition", "1"); + config->set_property("Channel.system", "GPS"); + config->set_property("Channel.signal", "1C"); + config->set_property("Acquisition_GPS.implementation", "GPS_L1_CA_PCPS_Acquisition"); + config->set_property("Acquisition_GPS.threshold", "1"); + config->set_property("Acquisition_GPS.doppler_max", "5000"); + config->set_property("Acquisition_GPS.doppler_min", "-5000"); + config->set_property("Tracking_GPS.implementation", "GPS_L1_CA_DLL_PLL_Tracking"); + config->set_property("TelemetryDecoder_GPS.implementation", "GPS_L1_CA_Telemetry_Decoder"); config->set_property("Observables.implementation", "GPS_L1_CA_Observables"); config->set_property("PVT.implementation", "GPS_L1_CA_PVT"); config->set_property("OutputFilter.implementation", "Null_Sink_Output_Filter"); + config->set_property("OutputFilter.item_type", "gr_complex"); std::shared_ptr flowgraph = std::make_shared(config, gr::msg_queue::make(0)); - flowgraph->set_configuration(config); - EXPECT_NO_THROW(flowgraph->connect()); - EXPECT_TRUE(flowgraph->connected()); - EXPECT_STREQ("File_Signal_Source", flowgraph->sig_source_->implementation().c_str()); - EXPECT_STREQ("Pass_Through", flowgraph->sig_conditioner_->implementation().c_str()); - EXPECT_STREQ("Channel", flowgraph->channels_.at(0)->implementation().c_str()); - // EXPECT_STREQ("Pass_Through", (flowgraph->channel(0)->acquisition()->implementation().c_str())); - // EXPECT_STREQ("Pass_Through", (flowgraph->channel(0)->tracking()->implementation().c_str()); - // EXPECT_STREQ("Pass_Through", (flowgraph->channel(0)->telemetry()->implementation().c_str()); - EXPECT_STREQ("Channel", flowgraph->channels_.at(1)->implementation().c_str()); - // EXPECT_STREQ("Pass_Through", (flowgraph->channel(1)->acquisition()->implementation().c_str()); - // EXPECT_STREQ("Pass_Through", (flowgraph->channel(1)->tracking()->implementation().c_str()); - // EXPECT_STREQ("Pass_Through", (flowgraph->channel(1)->telemetry()->implementation().c_str()); - EXPECT_STREQ("GPS_L1_CA_Observables", flowgraph->observables_->implementation().c_str()); - EXPECT_STREQ("GPS_L1_CA_PVT", flowgraph->pvt_->implementation().c_str()); - EXPECT_STREQ("Null_Sink_Output_Filter", flowgraph->output_filter_->implementation().c_str()); + EXPECT_NO_THROW(flowgraph->connect()); + EXPECT_TRUE(flowgraph->connected()); EXPECT_NO_THROW(flowgraph->start()); EXPECT_TRUE(flowgraph->running()); flowgraph->stop(); EXPECT_FALSE(flowgraph->running()); - - //delete flowgraph; } + + + diff --git a/src/tests/flowgraph/pass_through_test.cc b/src/tests/flowgraph/pass_through_test.cc index f11069c6f..274dd17c3 100644 --- a/src/tests/flowgraph/pass_through_test.cc +++ b/src/tests/flowgraph/pass_through_test.cc @@ -17,7 +17,7 @@ * 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. + * (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 @@ -32,20 +32,18 @@ #include "pass_through.h" +#include #include "in_memory_configuration.h" TEST(Pass_Through_Test, Instantiate) { - InMemoryConfiguration* config = new InMemoryConfiguration(); + std::shared_ptr config = std::make_shared(); config->set_property("Test.item_type", "gr_complex"); config->set_property("Test.vector_size", "2"); - Pass_Through *signal_conditioner = new Pass_Through(config, "Test", 1, 1); - + std::shared_ptr signal_conditioner = std::make_shared(config.get(), "Test", 1, 1); EXPECT_STREQ("gr_complex", signal_conditioner->item_type().c_str()); unsigned int expected2 = 2; EXPECT_EQ(expected2, signal_conditioner->vector_size()); - - delete signal_conditioner; } diff --git a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc index 115f062b5..58fba8540 100644 --- a/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc +++ b/src/tests/gnss_block/galileo_e1_dll_pll_veml_tracking_test.cc @@ -113,7 +113,7 @@ TEST_F(GalileoE1DllPllVemlTrackingInternalTest, Instantiate) TEST_F(GalileoE1DllPllVemlTrackingInternalTest, ConnectAndRun) { int fs_in = 8000000; - int nsamples = 80000000; + int nsamples = 40000000; struct timeval tv; long long int begin = 0; long long int end = 0; diff --git a/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc index 7139e893f..c9cf803a2 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_8ms_ambiguous_acquisition_gsoc2013_test.cc @@ -32,6 +32,8 @@ #include #include +#include +#include #include #include #include @@ -46,7 +48,6 @@ #include "signal_generator_c.h" #include "fir_filter.h" #include "gen_signal_source.h" -#include "boost/shared_ptr.hpp" #include "gnss_sdr_valve.h" @@ -502,9 +503,16 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResults) EXPECT_EQ(2, message) << "Acquisition failure. Expected message: 2=ACQ FAIL."; } +#ifdef OLD_BOOST ASSERT_NO_THROW( { ch_thread.timed_join(boost::posix_time::seconds(1)); }) << "Failure while waiting the queue to stop" << std::endl; +#endif +#ifndef OLD_BOOST + ASSERT_NO_THROW( { + ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + }) << "Failure while waiting the queue to stop" << std::endl; +#endif } } @@ -590,9 +598,15 @@ TEST_F(GalileoE1Pcps8msAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsProb std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl; std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl; } +#ifdef OLD_BOOST ASSERT_NO_THROW( { ch_thread.timed_join(boost::posix_time::seconds(1)); }) << "Failure while waiting the queue to stop" << std::endl; - +#endif +#ifndef OLD_BOOST + ASSERT_NO_THROW( { + ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + }) << "Failure while waiting the queue to stop" << std::endl; +#endif } } diff --git a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc index 5068ca9bc..5ab478971 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_ambiguous_acquisition_gsoc_test.cc @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -244,9 +245,16 @@ TEST_F(GalileoE1PcpsAmbiguousAcquisitionGSoCTest, ValidationOfResults) end = tv.tv_sec*1000000 + tv.tv_usec; }) << "Failure running the top_block." << std::endl; - ASSERT_NO_THROW( { - ch_thread.timed_join(boost::posix_time::seconds(1)); - }) << "Failure while waiting the queue to stop" << std::endl; +#ifdef OLD_BOOST + ASSERT_NO_THROW( { + ch_thread.timed_join(boost::posix_time::seconds(1)); + }) << "Failure while waiting the queue to stop" << std::endl; +#endif +#ifndef OLD_BOOST + ASSERT_NO_THROW( { + ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + }) << "Failure while waiting the queue to stop" << std::endl; +#endif unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; std::cout << "Acquired " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; diff --git a/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc b/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc index cf0b9236e..b4056d068 100644 --- a/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc +++ b/src/tests/gnss_block/galileo_e1_pcps_tong_ambiguous_acquisition_gsoc2013_test.cc @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -570,8 +571,15 @@ TEST_F(GalileoE1PcpsTongAmbiguousAcquisitionGSoC2013Test, ValidationOfResultsPro std::cout << "Estimated probability of false alarm (satellite absent) = " << Pfa_a << std::endl; std::cout << "Mean acq time = " << mean_acq_time_us << " microseconds." << std::endl; } +#ifdef OLD_BOOST ASSERT_NO_THROW( { ch_thread.timed_join(boost::posix_time::seconds(1)); }) << "Failure while waiting the queue to stop" << std::endl; +#endif +#ifndef OLD_BOOST + ASSERT_NO_THROW( { + ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); + }) << "Failure while waiting the queue to stop" << std::endl; +#endif } } diff --git a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc index 27bd2624b..c564543a5 100644 --- a/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc +++ b/src/tests/gnss_block/gps_l1_ca_pcps_acquisition_test.cc @@ -33,7 +33,9 @@ #include +#include #include +#include #include #include #include @@ -99,8 +101,8 @@ void GpsL1CaPcpsAcquisitionTest::init() config->set_property("Acquisition.dump", "false"); config->set_property("Acquisition.implementation", "GPS_L1_CA_PCPS_Acquisition"); config->set_property("Acquisition.threshold", "0.000"); - config->set_property("Acquisition.doppler_max", "7200"); - config->set_property("Acquisition.doppler_step", "600"); + config->set_property("Acquisition.doppler_max", "5000"); + config->set_property("Acquisition.doppler_step", "500"); config->set_property("Acquisition.repeat_satellite", "false"); } @@ -170,8 +172,8 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) struct timeval tv; long long int begin = 0; long long int end = 0; - double expected_delay_samples = 127; - double expected_doppler_hz = -2400; + double expected_delay_samples = 945; + double expected_doppler_hz = 4500; init(); std::shared_ptr acquisition = std::make_shared(config.get(), "Acquisition", 1, 1, queue); @@ -188,15 +190,15 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) }) << "Failure setting channel_internal_queue." << std::endl; ASSERT_NO_THROW( { - acquisition->set_threshold(config->property("Acquisition.threshold", 0.0001)); + acquisition->set_threshold(config->property("Acquisition.threshold", 0)); }) << "Failure setting threshold." << std::endl; ASSERT_NO_THROW( { - acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 10000)); + acquisition->set_doppler_max(config->property("Acquisition.doppler_max", 5000)); }) << "Failure setting doppler_max." << std::endl; ASSERT_NO_THROW( { - acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 500)); + acquisition->set_doppler_step(config->property("Acquisition.doppler_step", 50)); }) << "Failure setting doppler_step." << std::endl; ASSERT_NO_THROW( { @@ -224,20 +226,25 @@ TEST_F(GpsL1CaPcpsAcquisitionTest, ValidationOfResults) end = tv.tv_sec*1000000 + tv.tv_usec; }) << "Failure running the top_block." << std::endl; +#ifdef OLD_BOOST ch_thread.timed_join(boost::posix_time::seconds(1)); +#endif +#ifndef OLD_BOOST + ch_thread.try_join_until(boost::chrono::steady_clock::now() + boost::chrono::milliseconds(50)); +#endif unsigned long int nsamples = gnss_synchro.Acq_samplestamp_samples; std::cout << "Acquired " << nsamples << " samples in " << (end - begin) << " microseconds" << std::endl; ASSERT_EQ(1, message) << "Acquisition failure. Expected message: 1=ACQ SUCCESS."; - //std::cout << "----Aq_delay: " << gnss_synchro.Acq_delay_samples << std::endl; - //std::cout << "----Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl; + std::cout << "----Aq_delay: " << gnss_synchro.Acq_delay_samples << std::endl; + std::cout << "----Doppler: " << gnss_synchro.Acq_doppler_hz << std::endl; - double delay_error_samples = abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); + double delay_error_samples = std::abs(expected_delay_samples - gnss_synchro.Acq_delay_samples); float delay_error_chips = (float)(delay_error_samples*1023/4000); - double doppler_error_hz = abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); + double doppler_error_hz = std::abs(expected_doppler_hz - gnss_synchro.Acq_doppler_hz); - EXPECT_LE(doppler_error_hz, 333) << "Doppler error exceeds the expected value: 333 Hz = 2/(3*integration period)"; + EXPECT_LE(doppler_error_hz, 666) << "Doppler error exceeds the expected value: 666 Hz = 2/(3*integration period)"; EXPECT_LT(delay_error_chips, 0.5) << "Delay error exceeds the expected value: 0.5 chips"; } diff --git a/src/tests/test_main.cc b/src/tests/test_main.cc index 5e7d56530..b6d1206e6 100644 --- a/src/tests/test_main.cc +++ b/src/tests/test_main.cc @@ -76,9 +76,9 @@ DECLARE_string(log_dir); #include "configuration/file_configuration_test.cc" #include "configuration/in_memory_configuration_test.cc" #include "control_thread/control_message_factory_test.cc" -//#include "control_thread/control_thread_test.cc" +#include "control_thread/control_thread_test.cc" #include "flowgraph/pass_through_test.cc" -//#include "flowgraph/gnss_flowgraph_test.cc" +#include "flowgraph/gnss_flowgraph_test.cc" #include "gnss_block/gnss_block_factory_test.cc" #include "gnss_block/rtcm_printer_test.cc" #include "gnss_block/file_output_filter_test.cc"