1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-09-05 04:17:58 +00:00

Small fixes

This commit is contained in:
Carles Fernandez
2017-10-24 14:47:05 +02:00
parent 2c3ada26f2
commit 218c23000b
2 changed files with 29 additions and 42 deletions

View File

@@ -32,7 +32,6 @@
#include <chrono> #include <chrono>
#include <iostream> #include <iostream>
//#include <memory>
#include <unistd.h> #include <unistd.h>
#include <vector> #include <vector>
#include <armadillo> #include <armadillo>
@@ -47,10 +46,8 @@
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "gnss_block_factory.h" #include "gnss_block_factory.h"
#include "gnss_block_interface.h"
#include "tracking_interface.h" #include "tracking_interface.h"
#include "in_memory_configuration.h" #include "in_memory_configuration.h"
#include "gnss_synchro.h"
#include "tracking_true_obs_reader.h" #include "tracking_true_obs_reader.h"
#include "tracking_dump_reader.h" #include "tracking_dump_reader.h"
#include "signal_generator_flags.h" #include "signal_generator_flags.h"
@@ -240,7 +237,6 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec & true_time_s,
arma::vec & meas_value) arma::vec & meas_value)
{ {
// 1. True value interpolation to match the measurement times // 1. True value interpolation to match the measurement times
arma::vec true_value_interp; arma::vec true_value_interp;
arma::uvec true_time_s_valid = find(true_time_s > 0); arma::uvec true_time_s_valid = find(true_time_s > 0);
true_time_s = true_time_s(true_time_s_valid); true_time_s = true_time_s(true_time_s_valid);
@@ -262,7 +258,7 @@ void GpsL1CADllPllTrackingTest::check_results_doppler(arma::vec & true_time_s,
double error_mean = arma::mean(err); double error_mean = arma::mean(err);
double error_var = arma::var(err); double error_var = arma::var(err);
// 5. Peaks // 4. Peaks
double max_error = arma::max(err); double max_error = arma::max(err);
double min_error = arma::min(err); double min_error = arma::min(err);
@@ -376,12 +372,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
std::string true_obs_file = std::string("./gps_l1_ca_obs_prn"); std::string true_obs_file = std::string("./gps_l1_ca_obs_prn");
true_obs_file.append(std::to_string(test_satellite_PRN)); true_obs_file.append(std::to_string(test_satellite_PRN));
true_obs_file.append(".dat"); true_obs_file.append(".dat");
ASSERT_NO_THROW({ ASSERT_EQ(true_obs_data.open_obs_file(true_obs_file), true) << "Failure opening true observables file";
if (true_obs_data.open_obs_file(true_obs_file) == false)
{
throw std::exception();
};
}) << "Failure opening true observables file" << std::endl;
top_block = gr::make_top_block("Tracking test"); top_block = gr::make_top_block("Tracking test");
@@ -406,15 +397,15 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
ASSERT_NO_THROW( { ASSERT_NO_THROW( {
tracking->set_channel(gnss_synchro.Channel_ID); tracking->set_channel(gnss_synchro.Channel_ID);
}) << "Failure setting channel." << std::endl; }) << "Failure setting channel.";
ASSERT_NO_THROW( { ASSERT_NO_THROW( {
tracking->set_gnss_synchro(&gnss_synchro); tracking->set_gnss_synchro(&gnss_synchro);
}) << "Failure setting gnss_synchro." << std::endl; }) << "Failure setting gnss_synchro.";
ASSERT_NO_THROW( { ASSERT_NO_THROW( {
tracking->connect(top_block); tracking->connect(top_block);
}) << "Failure connecting tracking to the top_block." << std::endl; }) << "Failure connecting tracking to the top_block.";
ASSERT_NO_THROW( { ASSERT_NO_THROW( {
std::string file = "./" + filename_raw_data; std::string file = "./" + filename_raw_data;
@@ -426,7 +417,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
top_block->connect(gr_interleaved_char_to_complex, 0, tracking->get_left_block(), 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->connect(tracking->get_right_block(), 0, sink, 0);
top_block->msg_connect(tracking->get_right_block(), pmt::mp("events"), msg_rx, pmt::mp("events")); 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; }) << "Failure connecting the blocks of tracking test.";
tracking->start_tracking(); tracking->start_tracking();
@@ -434,7 +425,7 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
start = std::chrono::system_clock::now(); start = std::chrono::system_clock::now();
top_block->run(); // Start threads and wait top_block->run(); // Start threads and wait
end = std::chrono::system_clock::now(); end = std::chrono::system_clock::now();
}) << "Failure running the top_block." << std::endl; }) << "Failure running the top_block.";
// check results // check results
// load the true values // load the true values
@@ -460,13 +451,9 @@ TEST_F(GpsL1CADllPllTrackingTest, ValidationOfResults)
//load the measured values //load the measured values
tracking_dump_reader trk_dump; tracking_dump_reader trk_dump;
ASSERT_NO_THROW({
if (trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")) == false)
{
throw std::exception(); ASSERT_EQ(trk_dump.open_obs_file(std::string("./tracking_ch_0.dat")), true)
}; << "Failure opening tracking dump file";
}) << "Failure opening tracking dump file" << std::endl;
nepoch = trk_dump.num_epochs(); nepoch = trk_dump.num_epochs();
std::cout << "Measured observation epochs=" << nepoch << std::endl; std::cout << "Measured observation epochs=" << nepoch << std::endl;