mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Position file now admits a configuration file
e.g.: ../install/position_test --config_file_ptest=../conf/gnss-sdr.conf
This commit is contained in:
parent
27c31ef3b6
commit
a7c9fd657c
@ -40,15 +40,18 @@
|
|||||||
#include "concurrent_queue.h"
|
#include "concurrent_queue.h"
|
||||||
#include "control_thread.h"
|
#include "control_thread.h"
|
||||||
#include "in_memory_configuration.h"
|
#include "in_memory_configuration.h"
|
||||||
|
#include "file_configuration.h"
|
||||||
#include "MATH_CONSTANTS.h"
|
#include "MATH_CONSTANTS.h"
|
||||||
#include "signal_generator_flags.h"
|
#include "signal_generator_flags.h"
|
||||||
|
|
||||||
|
|
||||||
|
DEFINE_string(config_file_ptest, std::string(""), "File containing the configuration parameters for the position test.");
|
||||||
|
|
||||||
// For GPS NAVIGATION (L1)
|
// For GPS NAVIGATION (L1)
|
||||||
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
concurrent_queue<Gps_Acq_Assist> global_gps_acq_assist_queue;
|
||||||
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
concurrent_map<Gps_Acq_Assist> global_gps_acq_assist_map;
|
||||||
|
|
||||||
class Position_Gps_L1_System_Test: public ::testing::Test
|
class Static_Position_System_Test: public ::testing::Test
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string generator_binary;
|
std::string generator_binary;
|
||||||
@ -65,6 +68,7 @@ public:
|
|||||||
|
|
||||||
int configure_generator();
|
int configure_generator();
|
||||||
int generate_signal();
|
int generate_signal();
|
||||||
|
|
||||||
int configure_receiver();
|
int configure_receiver();
|
||||||
int run_receiver();
|
int run_receiver();
|
||||||
void check_results();
|
void check_results();
|
||||||
@ -77,6 +81,7 @@ public:
|
|||||||
double* east, double* north, double* up);
|
double* east, double* north, double* up);
|
||||||
|
|
||||||
std::shared_ptr<InMemoryConfiguration> config;
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
|
std::shared_ptr<FileConfiguration> config_f;
|
||||||
std::string generated_kml_file;
|
std::string generated_kml_file;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -87,7 +92,7 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Position_Gps_L1_System_Test::geodetic2Ecef(const double latitude, const double longitude, const double altitude,
|
void Static_Position_System_Test::geodetic2Ecef(const double latitude, const double longitude, const double altitude,
|
||||||
double* x, double* y, double* z)
|
double* x, double* y, double* z)
|
||||||
{
|
{
|
||||||
const double a = 6378137.0; // WGS84
|
const double a = 6378137.0; // WGS84
|
||||||
@ -112,7 +117,7 @@ void Position_Gps_L1_System_Test::geodetic2Ecef(const double latitude, const dou
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Position_Gps_L1_System_Test::geodetic2Enu(const double latitude, const double longitude, const double altitude,
|
void Static_Position_System_Test::geodetic2Enu(const double latitude, const double longitude, const double altitude,
|
||||||
double* east, double* north, double* up)
|
double* east, double* north, double* up)
|
||||||
{
|
{
|
||||||
double x, y, z;
|
double x, y, z;
|
||||||
@ -155,7 +160,7 @@ void Position_Gps_L1_System_Test::geodetic2Enu(const double latitude, const doub
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Position_Gps_L1_System_Test::compute_stdev_precision(const std::vector<double> & vec)
|
double Static_Position_System_Test::compute_stdev_precision(const std::vector<double> & vec)
|
||||||
{
|
{
|
||||||
double sum__ = std::accumulate(vec.begin(), vec.end(), 0.0);
|
double sum__ = std::accumulate(vec.begin(), vec.end(), 0.0);
|
||||||
double mean__ = sum__ / vec.size();
|
double mean__ = sum__ / vec.size();
|
||||||
@ -168,7 +173,7 @@ double Position_Gps_L1_System_Test::compute_stdev_precision(const std::vector<do
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
double Position_Gps_L1_System_Test::compute_stdev_accuracy(const std::vector<double> & vec, const double ref)
|
double Static_Position_System_Test::compute_stdev_accuracy(const std::vector<double> & vec, const double ref)
|
||||||
{
|
{
|
||||||
const double mean__ = ref;
|
const double mean__ = ref;
|
||||||
double accum__ = 0.0;
|
double accum__ = 0.0;
|
||||||
@ -180,7 +185,7 @@ double Position_Gps_L1_System_Test::compute_stdev_accuracy(const std::vector<dou
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Position_Gps_L1_System_Test::configure_generator()
|
int Static_Position_System_Test::configure_generator()
|
||||||
{
|
{
|
||||||
// Configure signal generator
|
// Configure signal generator
|
||||||
generator_binary = FLAGS_generator_binary;
|
generator_binary = FLAGS_generator_binary;
|
||||||
@ -202,7 +207,7 @@ int Position_Gps_L1_System_Test::configure_generator()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Position_Gps_L1_System_Test::generate_signal()
|
int Static_Position_System_Test::generate_signal()
|
||||||
{
|
{
|
||||||
pid_t wait_result;
|
pid_t wait_result;
|
||||||
int child_status;
|
int child_status;
|
||||||
@ -225,10 +230,11 @@ int Position_Gps_L1_System_Test::generate_signal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Position_Gps_L1_System_Test::configure_receiver()
|
int Static_Position_System_Test::configure_receiver()
|
||||||
|
{
|
||||||
|
if(FLAGS_config_file_ptest.empty())
|
||||||
{
|
{
|
||||||
config = std::make_shared<InMemoryConfiguration>();
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
|
|
||||||
const int sampling_rate_internal = baseband_sampling_freq;
|
const int sampling_rate_internal = baseband_sampling_freq;
|
||||||
|
|
||||||
const int number_of_taps = 11;
|
const int number_of_taps = 11;
|
||||||
@ -367,7 +373,6 @@ int Position_Gps_L1_System_Test::configure_receiver()
|
|||||||
|
|
||||||
// Set PVT
|
// Set PVT
|
||||||
config->set_property("PVT.implementation", "RTKLIB_PVT");
|
config->set_property("PVT.implementation", "RTKLIB_PVT");
|
||||||
//config->set_property("PVT.implementation", "Hybrid_PVT");
|
|
||||||
config->set_property("PVT.output_rate_ms", std::to_string(output_rate_ms));
|
config->set_property("PVT.output_rate_ms", std::to_string(output_rate_ms));
|
||||||
config->set_property("PVT.display_rate_ms", std::to_string(display_rate_ms));
|
config->set_property("PVT.display_rate_ms", std::to_string(display_rate_ms));
|
||||||
config->set_property("PVT.dump_filename", "./PVT");
|
config->set_property("PVT.dump_filename", "./PVT");
|
||||||
@ -383,14 +388,30 @@ int Position_Gps_L1_System_Test::configure_receiver()
|
|||||||
config->set_property("PVT.iono_model", "OFF");
|
config->set_property("PVT.iono_model", "OFF");
|
||||||
config->set_property("PVT.trop_model", "OFF");
|
config->set_property("PVT.trop_model", "OFF");
|
||||||
config->set_property("PVT.AR_GPS", "PPP-AR");
|
config->set_property("PVT.AR_GPS", "PPP-AR");
|
||||||
|
|
||||||
|
config_f = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
config_f = std::make_shared<FileConfiguration>(FLAGS_config_file_ptest);
|
||||||
|
config = 0;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Position_Gps_L1_System_Test::run_receiver()
|
int Static_Position_System_Test::run_receiver()
|
||||||
{
|
{
|
||||||
std::shared_ptr<ControlThread> control_thread;
|
std::shared_ptr<ControlThread> control_thread;
|
||||||
|
if(FLAGS_config_file_ptest.empty())
|
||||||
|
{
|
||||||
control_thread = std::make_shared<ControlThread>(config);
|
control_thread = std::make_shared<ControlThread>(config);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
control_thread = std::make_shared<ControlThread>(config_f);
|
||||||
|
}
|
||||||
|
|
||||||
// start receiver
|
// start receiver
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -420,17 +441,17 @@ int Position_Gps_L1_System_Test::run_receiver()
|
|||||||
{
|
{
|
||||||
std::string aux = std::string(buffer);
|
std::string aux = std::string(buffer);
|
||||||
EXPECT_EQ(aux.empty(), false);
|
EXPECT_EQ(aux.empty(), false);
|
||||||
Position_Gps_L1_System_Test::generated_kml_file = aux.erase(aux.length() - 1, 1);
|
Static_Position_System_Test::generated_kml_file = aux.erase(aux.length() - 1, 1);
|
||||||
}
|
}
|
||||||
pclose(fp);
|
pclose(fp);
|
||||||
EXPECT_EQ(Position_Gps_L1_System_Test::generated_kml_file.empty(), false);
|
EXPECT_EQ(Static_Position_System_Test::generated_kml_file.empty(), false);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Position_Gps_L1_System_Test::check_results()
|
void Static_Position_System_Test::check_results()
|
||||||
{
|
{
|
||||||
std::fstream myfile(Position_Gps_L1_System_Test::generated_kml_file, std::ios_base::in);
|
std::fstream myfile(Static_Position_System_Test::generated_kml_file, std::ios_base::in);
|
||||||
std::string line;
|
std::string line;
|
||||||
|
|
||||||
std::vector<double> pos_e;
|
std::vector<double> pos_e;
|
||||||
@ -494,6 +515,8 @@ void Position_Gps_L1_System_Test::check_results()
|
|||||||
double sum__u = std::accumulate(pos_u.begin(), pos_u.end(), 0.0);
|
double sum__u = std::accumulate(pos_u.begin(), pos_u.end(), 0.0);
|
||||||
double mean__u = sum__u / pos_u.size();
|
double mean__u = sum__u / pos_u.size();
|
||||||
|
|
||||||
|
if(FLAGS_config_file_ptest.empty())
|
||||||
|
{
|
||||||
std::cout << "---- ACCURACY ----" << std::endl;
|
std::cout << "---- ACCURACY ----" << std::endl;
|
||||||
std::cout << "2DRMS = " << 2 * sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]" << std::endl;
|
std::cout << "2DRMS = " << 2 * sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]" << std::endl;
|
||||||
std::cout << "DRMS = " << sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]" << std::endl;
|
std::cout << "DRMS = " << sqrt(sigma_E_2_accuracy + sigma_N_2_accuracy) << " [m]" << std::endl;
|
||||||
@ -505,6 +528,7 @@ void Position_Gps_L1_System_Test::check_results()
|
|||||||
std::cout << "Bias 2D = " << sqrt(std::pow(mean__e, 2.0) + std::pow(mean__n, 2.0)) << " [m]" << std::endl;
|
std::cout << "Bias 2D = " << sqrt(std::pow(mean__e, 2.0) + std::pow(mean__n, 2.0)) << " [m]" << std::endl;
|
||||||
std::cout << "Bias 3D = " << sqrt(std::pow(mean__e, 2.0) + std::pow(mean__n, 2.0) + std::pow(mean__u, 2.0)) << " [m]" << std::endl;
|
std::cout << "Bias 3D = " << sqrt(std::pow(mean__e, 2.0) + std::pow(mean__n, 2.0) + std::pow(mean__u, 2.0)) << " [m]" << std::endl;
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
std::cout << "---- PRECISION ----" << std::endl;
|
std::cout << "---- PRECISION ----" << std::endl;
|
||||||
std::cout << "2DRMS = " << 2 * sqrt(sigma_E_2_precision + sigma_N_2_precision) << " [m]" << std::endl;
|
std::cout << "2DRMS = " << 2 * sqrt(sigma_E_2_precision + sigma_N_2_precision) << " [m]" << std::endl;
|
||||||
@ -521,7 +545,9 @@ void Position_Gps_L1_System_Test::check_results()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST_F(Position_Gps_L1_System_Test, Position_system_test)
|
TEST_F(Static_Position_System_Test, Position_system_test)
|
||||||
|
{
|
||||||
|
if(FLAGS_config_file_ptest.empty())
|
||||||
{
|
{
|
||||||
// Configure the signal generator
|
// Configure the signal generator
|
||||||
configure_generator();
|
configure_generator();
|
||||||
@ -531,6 +557,7 @@ TEST_F(Position_Gps_L1_System_Test, Position_system_test)
|
|||||||
{
|
{
|
||||||
generate_signal();
|
generate_signal();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Configure receiver
|
// Configure receiver
|
||||||
configure_receiver();
|
configure_receiver();
|
||||||
|
Loading…
Reference in New Issue
Block a user