mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 11:40:33 +00:00
Add control thread to TTFF test
This commit is contained in:
parent
44239e69c3
commit
0a74ad17be
@ -31,10 +31,16 @@
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <ctime>
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include "in_memory_configuration.h"
|
||||
#include "concurrent_queue.h"
|
||||
#include "concurrent_map.h"
|
||||
#include "concurrent_map.h"
|
||||
#include "control_thread.h"
|
||||
#include "control_message_factory.h"
|
||||
#include "gps_acq_assist.h"
|
||||
#include "gnss_flowgraph.h"
|
||||
#include <glog/logging.h>
|
||||
@ -46,7 +52,7 @@ concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||
class TTFF_GPS_L1_CA_Test: public ::testing::Test
|
||||
{
|
||||
public:
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
std::shared_ptr<InMemoryConfiguration> config;
|
||||
};
|
||||
|
||||
TEST_F(TTFF_GPS_L1_CA_Test, ColdStart)
|
||||
@ -58,14 +64,14 @@ TEST_F(TTFF_GPS_L1_CA_Test, ColdStart)
|
||||
|
||||
// Set the Signal Source
|
||||
config->set_property("GNSS-SDR.internal_fs_hz", std::to_string(4000000.0));
|
||||
config->set_property("SignalSource.item_type", "gr_complex");
|
||||
config->set_property("SignalSource.item_type", "cshort");
|
||||
config->set_property("SignalSource.implementation", "UHD_Signal_Source");
|
||||
config->set_property("SignalSource.freq", std::to_string(1575420000));
|
||||
config->set_property("SignalSource.gain", std::to_string(40));
|
||||
config->set_property("SignalSource.subdevice", "A:0");
|
||||
config->set_property("SignalSource.subdevice", "B:0");
|
||||
config->set_property("SignalSource.samples", std::to_string(0));
|
||||
config->set_property("SignalSource.device_address", "192.168.40.2");
|
||||
config->set_property("SignalSource.item_type", "cshort");
|
||||
//config->set_property("SignalSource.item_type", "cshort");
|
||||
|
||||
// Set the Signal Conditioner
|
||||
config->set_property("SignalConditioner.implementation", "Signal_Conditioner");
|
||||
@ -151,35 +157,59 @@ TEST_F(TTFF_GPS_L1_CA_Test, ColdStart)
|
||||
config->set_property("PVT.dump", "false");
|
||||
|
||||
|
||||
bool valid_pvt_received = false;
|
||||
bool valid_pvt_received = false;
|
||||
|
||||
int n = 0;
|
||||
for(n=0; n<4; n++) // - for t > time_ obs || stop
|
||||
{
|
||||
// reset start( hot /warm / cold )
|
||||
// COLD START
|
||||
config->set_property("GNSS-SDR.SUPL_gps_enabled", "false");
|
||||
config->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false");
|
||||
std::shared_ptr<GNSSFlowgraph> flowgraph = std::make_shared<GNSSFlowgraph>(config, gr::msg_queue::make(0));
|
||||
EXPECT_NO_THROW(flowgraph->connect());
|
||||
EXPECT_TRUE(flowgraph->connected());
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
int n = 0;
|
||||
for(n=0; n<4; n++) // - for t > time_ obs || stop
|
||||
{
|
||||
// reset start( hot /warm / cold )
|
||||
// COLD START
|
||||
config->set_property("GNSS-SDR.SUPL_gps_enabled", "false");
|
||||
config->set_property("GNSS-SDR.SUPL_read_gps_assistance_xml", "false");
|
||||
|
||||
// - start clock
|
||||
// - start receiver
|
||||
EXPECT_NO_THROW(flowgraph->start());
|
||||
EXPECT_TRUE(flowgraph->running());
|
||||
// - if (pvt_fix | max_waiting_time)
|
||||
// - stop_clock
|
||||
flowgraph->stop();
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
num_measurements = num_measurements + 1;
|
||||
std::cout << "Measurement " << num_measurements << std::endl;
|
||||
// if (pvt_fix) num_valid_measurements = num_valid_measurements + 1;
|
||||
}
|
||||
std::shared_ptr<ControlThread> control_thread = std::make_shared<ControlThread>(config);
|
||||
|
||||
gr::msg_queue::sptr control_queue = gr::msg_queue::make(0);
|
||||
|
||||
std::unique_ptr<ControlMessageFactory> control_msg_factory(new ControlMessageFactory());
|
||||
|
||||
|
||||
control_thread->set_control_queue(control_queue);
|
||||
try
|
||||
{
|
||||
control_thread->run();
|
||||
}
|
||||
catch( boost::exception & e )
|
||||
{
|
||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||
}
|
||||
catch(std::exception const& ex)
|
||||
{
|
||||
std::cout << "STD exception: " << ex.what();
|
||||
}
|
||||
|
||||
std::shared_ptr<GNSSFlowgraph> flowgraph = std::make_shared<GNSSFlowgraph>(config, control_queue);
|
||||
EXPECT_NO_THROW(flowgraph->connect());
|
||||
EXPECT_TRUE(flowgraph->connected());
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
|
||||
// - start clock
|
||||
// - start receiver
|
||||
EXPECT_NO_THROW(flowgraph->start());
|
||||
EXPECT_TRUE(flowgraph->running());
|
||||
// - if (pvt_fix | max_waiting_time)
|
||||
// - stop_clock
|
||||
std::this_thread::sleep_until(std::chrono::system_clock::now() + std::chrono::seconds(90));
|
||||
//flowgraph->stop();
|
||||
control_queue->handle(control_msg_factory->GetQueueMessage(200,0));
|
||||
EXPECT_FALSE(flowgraph->running());
|
||||
num_measurements = num_measurements + 1;
|
||||
std::cout << "Measurement " << num_measurements << std::endl;
|
||||
// if (pvt_fix) num_valid_measurements = num_valid_measurements + 1;
|
||||
}
|
||||
std::cout << "BYE " << num_measurements << std::endl;
|
||||
// Compute min, max, mean, stdev,
|
||||
// Compute min, max, mean, stdev,
|
||||
|
||||
// Print TTFF report
|
||||
// Print TTFF report
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user