mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-02-22 14:00:13 +00:00
Simple example of GPSTk usage
This commit is contained in:
parent
cdf7fcfa99
commit
7f9d3c385d
@ -152,6 +152,10 @@ if(ENABLE_SW_GENERATOR)
|
|||||||
add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}")
|
add_definitions(-DSW_GENERATOR_BIN="${SW_GENERATOR_BIN}")
|
||||||
add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n")
|
add_definitions(-DDEFAULT_RINEX_NAV="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/brdc3540.14n")
|
||||||
add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv")
|
add_definitions(-DDEFAULT_POSITION_FILE="${CMAKE_CURRENT_BINARY_DIR}/../../../thirdparty/gnss-sim/circle.csv")
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
# Local installation of GPSTk http://www.gpstk.org/
|
||||||
|
################################################################################
|
||||||
set(gpstk_RELEASE "2.5")
|
set(gpstk_RELEASE "2.5")
|
||||||
set(gpstk_md5 "9d79f6838d274f5edfd46c780a6b1b72")
|
set(gpstk_md5 "9d79f6838d274f5edfd46c780a6b1b72")
|
||||||
ExternalProject_Add(
|
ExternalProject_Add(
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include "concurrent_queue.h"
|
#include "concurrent_queue.h"
|
||||||
#include "in_memory_configuration.h"
|
#include "in_memory_configuration.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 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;
|
||||||
@ -37,14 +39,36 @@ public:
|
|||||||
int configure_receiver();
|
int configure_receiver();
|
||||||
int run_receiver();
|
int run_receiver();
|
||||||
int check_results();
|
int check_results();
|
||||||
|
bool check_valid_rinex_nav(std::string filename); // return true if the file is a valid Rinex navigation file.
|
||||||
|
bool check_valid_rinex_obs(std::string filename); // return true if the file is a valid Rinex observation file.
|
||||||
|
|
||||||
std::shared_ptr<InMemoryConfiguration> config;
|
std::shared_ptr<InMemoryConfiguration> config;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
bool Trk_System_Test::check_valid_rinex_nav(std::string filename)
|
||||||
|
{
|
||||||
|
bool res = false;
|
||||||
|
res = gpstk::isRinexNavFile(filename);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Trk_System_Test::check_valid_rinex_obs(std::string filename)
|
||||||
|
{
|
||||||
|
bool res = false;
|
||||||
|
res = gpstk::isRinexObsFile(filename);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Trk_System_Test::configure_generator()
|
int Trk_System_Test::configure_generator()
|
||||||
{
|
{
|
||||||
// Configure signal
|
// Configure signal
|
||||||
generator_binary = std::string(SW_GENERATOR_BIN);
|
generator_binary = std::string(SW_GENERATOR_BIN);
|
||||||
|
|
||||||
|
EXPECT_EQ(true, check_valid_rinex_nav(std::string(DEFAULT_RINEX_NAV)));
|
||||||
|
|
||||||
p1 = std::string("-rinex_nav_file=") + std::string(DEFAULT_RINEX_NAV);
|
p1 = std::string("-rinex_nav_file=") + std::string(DEFAULT_RINEX_NAV);
|
||||||
p2_static = std::string("-static_position=30.286502,120.032669,100,1000");
|
p2_static = std::string("-static_position=30.286502,120.032669,100,1000");
|
||||||
p2_dynamic = std::string("-obs_pos_file=") + std::string(DEFAULT_POSITION_FILE); // Observer positions file, in .csv or .nmea format"
|
p2_dynamic = std::string("-obs_pos_file=") + std::string(DEFAULT_POSITION_FILE); // Observer positions file, in .csv or .nmea format"
|
||||||
@ -54,6 +78,7 @@ int Trk_System_Test::configure_generator()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Trk_System_Test::generate_signal()
|
int Trk_System_Test::generate_signal()
|
||||||
{
|
{
|
||||||
pid_t wait_result;
|
pid_t wait_result;
|
||||||
@ -65,17 +90,20 @@ int Trk_System_Test::generate_signal()
|
|||||||
if ((pid = fork()) == -1)
|
if ((pid = fork()) == -1)
|
||||||
perror("fork error");
|
perror("fork error");
|
||||||
else if (pid == 0)
|
else if (pid == 0)
|
||||||
{
|
{
|
||||||
execv(&generator_binary[0], parmList);
|
execv(&generator_binary[0], parmList);
|
||||||
std::cout << "Return not expected. Must be an execv error." << std::endl;
|
std::cout << "Return not expected. Must be an execv error." << std::endl;
|
||||||
std::terminate();
|
std::terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
wait_result = waitpid(pid, &child_status, 0);
|
wait_result = waitpid(pid, &child_status, 0);
|
||||||
|
|
||||||
|
EXPECT_EQ(true, check_valid_rinex_obs(filename_rinex_obs));
|
||||||
std::cout << "Signal and Observables RINEX files created." << std::endl;
|
std::cout << "Signal and Observables RINEX files created." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Trk_System_Test::configure_receiver()
|
int Trk_System_Test::configure_receiver()
|
||||||
{
|
{
|
||||||
config = std::make_shared<InMemoryConfiguration>();
|
config = std::make_shared<InMemoryConfiguration>();
|
||||||
@ -231,6 +259,7 @@ int Trk_System_Test::configure_receiver()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Trk_System_Test::run_receiver()
|
int Trk_System_Test::run_receiver()
|
||||||
{
|
{
|
||||||
std::shared_ptr<ControlThread> control_thread;
|
std::shared_ptr<ControlThread> control_thread;
|
||||||
@ -238,15 +267,15 @@ int Trk_System_Test::run_receiver()
|
|||||||
// start receiver
|
// start receiver
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
control_thread->run();
|
control_thread->run();
|
||||||
}
|
}
|
||||||
catch( boost::exception & e )
|
catch( boost::exception & e )
|
||||||
{
|
{
|
||||||
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
std::cout << "Boost exception: " << boost::diagnostic_information(e);
|
||||||
}
|
}
|
||||||
catch(std::exception const& ex)
|
catch(std::exception const& ex)
|
||||||
{
|
{
|
||||||
std::cout << "STD exception: " << ex.what();
|
std::cout << "STD exception: " << ex.what();
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -300,7 +329,7 @@ int main(int argc, char **argv)
|
|||||||
int res = 0;
|
int res = 0;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
}
|
}
|
||||||
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
catch(...) {} // catch the "testing::internal::<unnamed>::ClassUniqueToAlwaysTrue" from gtest
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user