mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Merge branch 'next' of https://github.com/carlesfernandez/gnss-sdr into next
This commit is contained in:
commit
a18a03bdf1
@ -34,7 +34,6 @@
|
||||
#include "pvt_solution.h"
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <cstdio> // for remove
|
||||
#include <ctime> // for tm
|
||||
#include <exception> // for exception
|
||||
#include <iomanip> // for operator<<
|
||||
@ -240,7 +239,8 @@ bool GeoJSON_Printer::close_file()
|
||||
// if nothing is written, erase the file
|
||||
if (first_pos == true)
|
||||
{
|
||||
if (remove(filename_.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(filename_), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "rtklib_solver.h"
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <cstdio> // for remove
|
||||
#include <ctime> // for tm
|
||||
#include <exception> // for exception
|
||||
#include <iomanip> // for operator<<
|
||||
@ -251,7 +250,8 @@ Gpx_Printer::~Gpx_Printer()
|
||||
}
|
||||
if (!positions_printed)
|
||||
{
|
||||
if (remove(gpx_filename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(gpx_filename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary GPX file";
|
||||
}
|
||||
|
@ -34,9 +34,7 @@
|
||||
#include "rtklib_solver.h"
|
||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
#include <glog/logging.h>
|
||||
#include <cstdio> // for remove
|
||||
#include <cstdlib> // for mkstemp
|
||||
#include <cstring> // for strncpy
|
||||
#include <ctime> // for tm
|
||||
#include <exception> // for exception
|
||||
#include <iostream> // for cout, cerr
|
||||
@ -366,7 +364,8 @@ Kml_Printer::~Kml_Printer()
|
||||
}
|
||||
if (!positions_printed)
|
||||
{
|
||||
if (remove(kml_filename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(kml_filename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary KML file";
|
||||
}
|
||||
|
@ -133,6 +133,7 @@ Nmea_Printer::Nmea_Printer(const std::string& filename, bool flag_nmea_output_fi
|
||||
|
||||
Nmea_Printer::~Nmea_Printer()
|
||||
{
|
||||
auto pos = nmea_file_descriptor.tellp();
|
||||
try
|
||||
{
|
||||
if (nmea_file_descriptor.is_open())
|
||||
@ -148,6 +149,14 @@ Nmea_Printer::~Nmea_Printer()
|
||||
{
|
||||
std::cerr << e.what() << '\n';
|
||||
}
|
||||
if (pos == 0)
|
||||
{
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(nmea_filename), ec))
|
||||
{
|
||||
std::cerr << "Problem removing NMEA temporary file: " << nmea_filename << '\n';
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
close_serial();
|
||||
|
@ -56,7 +56,6 @@
|
||||
#include <glog/logging.h>
|
||||
#include <algorithm> // for min and max
|
||||
#include <cmath> // for floor
|
||||
#include <cstring> // for memcpy
|
||||
#include <exception>
|
||||
#include <iostream> // for cout
|
||||
#include <iterator>
|
||||
@ -267,51 +266,59 @@ Rinex_Printer::~Rinex_Printer()
|
||||
std::cerr << e.what() << '\n';
|
||||
}
|
||||
// If nothing written, erase the files.
|
||||
|
||||
if (posn == 0)
|
||||
{
|
||||
if (remove(navfilename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(navfilename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
}
|
||||
if (poso == 0)
|
||||
{
|
||||
if (remove(obsfilename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(obsfilename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
}
|
||||
if (poss == 0)
|
||||
{
|
||||
if (remove(sbsfilename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(sbsfilename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
}
|
||||
if (posng == 0)
|
||||
{
|
||||
if (remove(navGalfilename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(navGalfilename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
}
|
||||
if (posmn == 0)
|
||||
{
|
||||
if (remove(navMixfilename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(navMixfilename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
}
|
||||
if (posnr == 0)
|
||||
{
|
||||
if (remove(navGlofilename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(navGlofilename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
}
|
||||
if (posnc == 0)
|
||||
{
|
||||
if (remove(navBdsfilename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(navBdsfilename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary file";
|
||||
}
|
||||
@ -10171,10 +10178,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& eph, c
|
||||
if ((total_mmap.count(mmap_iter->second.PRN)) == 1 && (mmap_iter->second.PRN != 0))
|
||||
{
|
||||
Gnss_Synchro gs = Gnss_Synchro();
|
||||
std::string sys = "G";
|
||||
gs.System = *sys.c_str();
|
||||
std::string sig = "2S";
|
||||
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3);
|
||||
gs.System = 'G';
|
||||
gs.Signal[0] = '2';
|
||||
gs.Signal[1] = 'S';
|
||||
gs.Signal[2] = '\0';
|
||||
gs.PRN = mmap_iter->second.PRN;
|
||||
total_mmap.insert(std::pair<uint32_t, Gnss_Synchro>(mmap_iter->second.PRN, gs));
|
||||
}
|
||||
@ -10401,10 +10408,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
|
||||
if (found_1B != std::string::npos)
|
||||
{
|
||||
Gnss_Synchro gs = Gnss_Synchro();
|
||||
std::string sys = "E";
|
||||
gs.System = *sys.c_str();
|
||||
std::string sig = "1B";
|
||||
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3);
|
||||
gs.System = 'E';
|
||||
gs.Signal[0] = '1';
|
||||
gs.Signal[1] = 'B';
|
||||
gs.Signal[2] = '\0';
|
||||
gs.PRN = prn_;
|
||||
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
|
||||
}
|
||||
@ -10426,20 +10433,20 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
|
||||
if (found_1B != std::string::npos)
|
||||
{
|
||||
Gnss_Synchro gs = Gnss_Synchro();
|
||||
std::string sys = "E";
|
||||
gs.System = *sys.c_str();
|
||||
std::string sig = "1B";
|
||||
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3);
|
||||
gs.System = 'E';
|
||||
gs.Signal[0] = '1';
|
||||
gs.Signal[1] = 'B';
|
||||
gs.Signal[2] = '\0';
|
||||
gs.PRN = prn_;
|
||||
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
|
||||
}
|
||||
if (found_E5a != std::string::npos)
|
||||
{
|
||||
Gnss_Synchro gs = Gnss_Synchro();
|
||||
std::string sys = "E";
|
||||
gs.System = *sys.c_str();
|
||||
std::string sig = "5X";
|
||||
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3);
|
||||
gs.System = 'E';
|
||||
gs.Signal[0] = '5';
|
||||
gs.Signal[1] = 'X';
|
||||
gs.Signal[2] = '\0';
|
||||
gs.PRN = prn_;
|
||||
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
|
||||
}
|
||||
@ -10452,10 +10459,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
|
||||
if ((total_map.count(prn_)) == 1)
|
||||
{
|
||||
Gnss_Synchro gs = Gnss_Synchro();
|
||||
std::string sys = "E";
|
||||
gs.System = *sys.c_str();
|
||||
std::string sig = "5X";
|
||||
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3);
|
||||
gs.System = 'E';
|
||||
gs.Signal[0] = '5';
|
||||
gs.Signal[1] = 'X';
|
||||
gs.Signal[2] = '\0';
|
||||
gs.PRN = prn_;
|
||||
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
|
||||
}
|
||||
@ -11521,10 +11528,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Beidou_Dnav_Ephemeris
|
||||
if (found_B1 != std::string::npos)
|
||||
{
|
||||
Gnss_Synchro gs = Gnss_Synchro();
|
||||
std::string sys = "C";
|
||||
gs.System = *sys.c_str();
|
||||
std::string sig = "B1";
|
||||
std::memcpy(static_cast<void*>(gs.Signal), sig.c_str(), 3);
|
||||
gs.System = 'C';
|
||||
gs.Signal[0] = 'B';
|
||||
gs.Signal[1] = '1';
|
||||
gs.Signal[2] = '\0';
|
||||
gs.PRN = prn_;
|
||||
total_map.insert(std::pair<uint32_t, Gnss_Synchro>(prn_, gs));
|
||||
}
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "gps_ephemeris.h"
|
||||
#include "rtcm.h"
|
||||
#include <glog/logging.h>
|
||||
#include <cstdio> // for remove
|
||||
#include <ctime> // for tm
|
||||
#include <exception> // for exception
|
||||
#include <fcntl.h> // for O_RDWR
|
||||
@ -221,7 +220,8 @@ Rtcm_Printer::~Rtcm_Printer()
|
||||
}
|
||||
if (pos == 0)
|
||||
{
|
||||
if (remove(rtcm_filename.c_str()) != 0)
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(rtcm_filename), ec))
|
||||
{
|
||||
LOG(INFO) << "Error deleting temporary RTCM file";
|
||||
}
|
||||
|
@ -67,6 +67,25 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if HAS_STD_FILESYSTEM
|
||||
#include <system_error>
|
||||
namespace errorlib = std;
|
||||
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
#else
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#endif
|
||||
#else
|
||||
#include <boost/filesystem/operations.hpp> // for create_directories, exists
|
||||
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||
#include <boost/system/error_code.hpp> // for error_code
|
||||
namespace fs = boost::filesystem;
|
||||
namespace errorlib = boost::system;
|
||||
#endif
|
||||
|
||||
|
||||
Rtklib_Solver::Rtklib_Solver(int nchannels, std::string dump_filename, bool flag_dump_to_file, bool flag_dump_to_mat, const rtk_t &rtk)
|
||||
{
|
||||
@ -341,6 +360,7 @@ Rtklib_Solver::~Rtklib_Solver()
|
||||
{
|
||||
if (d_dump_file.is_open() == true)
|
||||
{
|
||||
auto pos = d_dump_file.tellp();
|
||||
try
|
||||
{
|
||||
d_dump_file.close();
|
||||
@ -349,6 +369,15 @@ Rtklib_Solver::~Rtklib_Solver()
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor closing the RTKLIB dump file " << ex.what();
|
||||
}
|
||||
if (pos == 0)
|
||||
{
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||
{
|
||||
std::cerr << "Problem removing temporary file " << d_dump_filename << '\n';
|
||||
}
|
||||
d_flag_dump_mat_enabled = false;
|
||||
}
|
||||
}
|
||||
if (d_flag_dump_mat_enabled)
|
||||
{
|
||||
|
@ -203,7 +203,6 @@ signed int GalileoE1Pcps8msAmbiguousAcquisition::mag()
|
||||
void GalileoE1Pcps8msAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_cc_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@ -215,8 +214,10 @@ void GalileoE1Pcps8msAmbiguousAcquisition::set_local_code()
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code, code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
@ -232,7 +232,6 @@ signed int GalileoE1PcpsAmbiguousAcquisition::mag()
|
||||
void GalileoE1PcpsAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@ -261,8 +260,10 @@ void GalileoE1PcpsAmbiguousAcquisition::set_local_code()
|
||||
}
|
||||
else
|
||||
{
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
if (acq_parameters_.use_automatic_resampler)
|
||||
{
|
||||
galileo_e1_code_gen_complex_sampled(code_span, Signal_,
|
||||
|
@ -237,7 +237,6 @@ GalileoE1PcpsQuickSyncAmbiguousAcquisition::mag()
|
||||
void GalileoE1PcpsQuickSyncAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_cc_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@ -249,8 +248,10 @@ void GalileoE1PcpsQuickSyncAmbiguousAcquisition::set_local_code()
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
@ -207,7 +207,6 @@ signed int GalileoE1PcpsTongAmbiguousAcquisition::mag()
|
||||
void GalileoE1PcpsTongAmbiguousAcquisition::init()
|
||||
{
|
||||
acquisition_cc_->init();
|
||||
//set_local_code();
|
||||
}
|
||||
|
||||
|
||||
@ -219,8 +218,10 @@ void GalileoE1PcpsTongAmbiguousAcquisition::set_local_code()
|
||||
"Acquisition" + std::to_string(channel_) + ".cboc", false);
|
||||
|
||||
std::unique_ptr<std::complex<float>> code{new std::complex<float>[code_length_]};
|
||||
std::array<char, 3> Signal_;
|
||||
std::memcpy(Signal_.data(), gnss_synchro_->Signal, 3);
|
||||
std::array<char, 3> Signal_{};
|
||||
Signal_[0] = gnss_synchro_->Signal[0];
|
||||
Signal_[1] = gnss_synchro_->Signal[1];
|
||||
Signal_[2] = '\0';
|
||||
galileo_e1_code_gen_complex_sampled(gsl::span<std::complex<float>>(code.get(), code_length_), Signal_,
|
||||
cboc, gnss_synchro_->PRN, fs_in_, 0, false);
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "telemetry_decoder_interface.h"
|
||||
#include "tracking_interface.h"
|
||||
#include <glog/logging.h>
|
||||
#include <cstring> // for memcpy
|
||||
#include <utility> // for std::move
|
||||
|
||||
|
||||
@ -209,9 +208,9 @@ void Channel::set_signal(const Gnss_Signal& gnss_signal)
|
||||
std::lock_guard<std::mutex> lk(mx);
|
||||
gnss_signal_ = gnss_signal;
|
||||
std::string str_aux = gnss_signal_.get_signal_str();
|
||||
const char* str = str_aux.c_str(); // get a C style null terminated string
|
||||
std::memcpy(static_cast<void*>(gnss_synchro_.Signal), str, 3); // copy string into synchro char array: 2 char + null
|
||||
gnss_synchro_.Signal[2] = 0; // make sure that string length is only two characters
|
||||
gnss_synchro_.Signal[0] = str_aux[0];
|
||||
gnss_synchro_.Signal[1] = str_aux[1];
|
||||
gnss_synchro_.Signal[2] = '\0'; // make sure that string length is only two characters
|
||||
gnss_synchro_.PRN = gnss_signal_.get_satellite().get_PRN();
|
||||
gnss_synchro_.System = gnss_signal_.get_satellite().get_system_short().c_str()[0];
|
||||
acq_->set_local_code();
|
||||
|
@ -83,7 +83,10 @@ bool gnss_sdr_create_directory(const std::string& foldername)
|
||||
errorlib::error_code ec;
|
||||
os_test_file.close();
|
||||
|
||||
fs::remove(test_file, ec);
|
||||
if (!fs::remove(test_file, ec))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (static_cast<bool>(ec))
|
||||
{
|
||||
return false;
|
||||
|
@ -266,6 +266,8 @@ void write_results(const std::vector<volk_gnsssdr_test_results_t> *results, bool
|
||||
// Until we can update the config on a kernel by kernel basis
|
||||
// do not overwrite volk_gnsssdr_config when using a regex.
|
||||
if (!fs::exists(config_path.parent_path()))
|
||||
{
|
||||
try
|
||||
{
|
||||
std::cout << "Creating " << config_path.parent_path() << " ..." << std::endl;
|
||||
try
|
||||
@ -279,6 +281,13 @@ void write_results(const std::vector<volk_gnsssdr_test_results_t> *results, bool
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
// Catch exception when using std::experimental
|
||||
std::cerr << "ERROR: Could not create folder" << std::endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
std::ofstream config;
|
||||
if (update_result)
|
||||
|
@ -46,6 +46,8 @@
|
||||
#include <utility> // for move
|
||||
|
||||
#if HAS_STD_FILESYSTEM
|
||||
#include <system_error>
|
||||
namespace errorlib = std;
|
||||
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
@ -54,8 +56,12 @@ namespace fs = std::experimental::filesystem;
|
||||
namespace fs = std::filesystem;
|
||||
#endif
|
||||
#else
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp> // for create_directories, exists
|
||||
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||
#include <boost/system/error_code.hpp> // for error_code
|
||||
namespace fs = boost::filesystem;
|
||||
namespace errorlib = boost::system;
|
||||
#endif
|
||||
|
||||
|
||||
@ -64,33 +70,6 @@ hybrid_observables_gs_sptr hybrid_observables_gs_make(unsigned int nchannels_in,
|
||||
return hybrid_observables_gs_sptr(new hybrid_observables_gs(nchannels_in, nchannels_out, dump, dump_mat, std::move(dump_filename)));
|
||||
}
|
||||
|
||||
void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg)
|
||||
{
|
||||
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
|
||||
try
|
||||
{
|
||||
if (pmt::any_ref(msg).type() == typeid(double))
|
||||
{
|
||||
double new_rx_clock_offset_s;
|
||||
new_rx_clock_offset_s = boost::any_cast<double>(pmt::any_ref(msg));
|
||||
T_rx_offset_ms = new_rx_clock_offset_s * 1000.0;
|
||||
T_rx_TOW_ms = T_rx_TOW_ms - static_cast<int>(round(T_rx_offset_ms));
|
||||
T_rx_remnant_to_20ms = (T_rx_TOW_ms % 20);
|
||||
//d_Rx_clock_buffer.clear(); // Clear all the elements in the buffer
|
||||
for (uint32_t n = 0; n < d_nchannels_out; n++)
|
||||
{
|
||||
d_gnss_synchro_history->clear(n);
|
||||
}
|
||||
|
||||
LOG(INFO) << "Corrected new RX Time offset: " << T_rx_offset_ms << "[ms]";
|
||||
}
|
||||
}
|
||||
catch (boost::bad_any_cast &e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_pvt_to_observables Bad any cast!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
|
||||
uint32_t nchannels_out,
|
||||
@ -110,7 +89,7 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
|
||||
d_nchannels_out = nchannels_out;
|
||||
d_nchannels_in = nchannels_in;
|
||||
T_rx_offset_ms = 0;
|
||||
d_gnss_synchro_history = new Gnss_circular_deque<Gnss_Synchro>(500, d_nchannels_out);
|
||||
d_gnss_synchro_history = std::make_shared<Gnss_circular_deque<Gnss_Synchro>>(500, d_nchannels_out);
|
||||
|
||||
// ############# ENABLE DATA FILE LOG #################
|
||||
if (d_dump)
|
||||
@ -169,9 +148,9 @@ hybrid_observables_gs::hybrid_observables_gs(uint32_t nchannels_in,
|
||||
|
||||
hybrid_observables_gs::~hybrid_observables_gs()
|
||||
{
|
||||
delete d_gnss_synchro_history;
|
||||
if (d_dump_file.is_open())
|
||||
{
|
||||
auto pos = d_dump_file.tellp();
|
||||
try
|
||||
{
|
||||
d_dump_file.close();
|
||||
@ -180,6 +159,15 @@ hybrid_observables_gs::~hybrid_observables_gs()
|
||||
{
|
||||
LOG(WARNING) << "Exception in destructor closing the dump file " << ex.what();
|
||||
}
|
||||
if (pos == 0)
|
||||
{
|
||||
errorlib::error_code ec;
|
||||
if (!fs::remove(fs::path(d_dump_filename), ec))
|
||||
{
|
||||
std::cerr << "Problem removing temporary file " << d_dump_filename << '\n';
|
||||
}
|
||||
d_dump_mat = false;
|
||||
}
|
||||
}
|
||||
if (d_dump_mat)
|
||||
{
|
||||
@ -195,6 +183,34 @@ hybrid_observables_gs::~hybrid_observables_gs()
|
||||
}
|
||||
|
||||
|
||||
void hybrid_observables_gs::msg_handler_pvt_to_observables(const pmt::pmt_t &msg)
|
||||
{
|
||||
gr::thread::scoped_lock lock(d_setlock); // require mutex with work function called by the scheduler
|
||||
try
|
||||
{
|
||||
if (pmt::any_ref(msg).type() == typeid(double))
|
||||
{
|
||||
double new_rx_clock_offset_s;
|
||||
new_rx_clock_offset_s = boost::any_cast<double>(pmt::any_ref(msg));
|
||||
T_rx_offset_ms = new_rx_clock_offset_s * 1000.0;
|
||||
T_rx_TOW_ms = T_rx_TOW_ms - static_cast<int>(round(T_rx_offset_ms));
|
||||
T_rx_remnant_to_20ms = (T_rx_TOW_ms % 20);
|
||||
//d_Rx_clock_buffer.clear(); // Clear all the elements in the buffer
|
||||
for (uint32_t n = 0; n < d_nchannels_out; n++)
|
||||
{
|
||||
d_gnss_synchro_history->clear(n);
|
||||
}
|
||||
|
||||
LOG(INFO) << "Corrected new RX Time offset: " << T_rx_offset_ms << "[ms]";
|
||||
}
|
||||
}
|
||||
catch (boost::bad_any_cast &e)
|
||||
{
|
||||
LOG(WARNING) << "msg_handler_pvt_to_observables Bad any cast!";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int32_t hybrid_observables_gs::save_matfile()
|
||||
{
|
||||
// READ DUMP FILE
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include <gnuradio/types.h> // for gr_vector_int
|
||||
#include <cstdint> // for int32_t
|
||||
#include <fstream> // for string, ofstream
|
||||
#include <memory> // for shared_ptr
|
||||
#include <vector> // for vector
|
||||
|
||||
class Gnss_Synchro;
|
||||
@ -95,7 +96,7 @@ private:
|
||||
std::string d_dump_filename;
|
||||
std::ofstream d_dump_file;
|
||||
boost::circular_buffer<uint64_t> d_Rx_clock_buffer; // time history
|
||||
Gnss_circular_deque<Gnss_Synchro>* d_gnss_synchro_history; // Tracking observable history
|
||||
std::shared_ptr<Gnss_circular_deque<Gnss_Synchro>> d_gnss_synchro_history; // Tracking observable history
|
||||
void msg_handler_pvt_to_observables(const pmt::pmt_t& msg);
|
||||
double compute_T_rx_s(const Gnss_Synchro& a);
|
||||
bool interp_trk_obs(Gnss_Synchro& interpolated_obs, const uint32_t& ch, const uint64_t& rx_clock);
|
||||
|
@ -182,7 +182,7 @@ int gps_l5_telemetry_decoder_gs::general_work(int noutput_items __attribute__((u
|
||||
// Expand packet bits to bitsets. Notice the reverse order of the bits sequence, required by the CNAV message decoder
|
||||
for (uint32_t i = 0; i < GPS_L5_CNAV_DATA_PAGE_BITS; i++)
|
||||
{
|
||||
raw_bits[GPS_L5_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1u);
|
||||
raw_bits[GPS_L5_CNAV_DATA_PAGE_BITS - 1 - i] = ((msg.raw_msg[i / 8] >> (7 - i % 8)) & 1U);
|
||||
}
|
||||
|
||||
d_CNAV_Message.decode_page(raw_bits);
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include "dll_pll_conf.h"
|
||||
#include "gnss_sdr_flags.h"
|
||||
#include <cstring>
|
||||
|
||||
Dll_Pll_Conf::Dll_Pll_Conf()
|
||||
{
|
||||
@ -72,6 +71,7 @@ Dll_Pll_Conf::Dll_Pll_Conf()
|
||||
enable_doppler_correction = false;
|
||||
track_pilot = false;
|
||||
system = 'G';
|
||||
char sig_[3] = "1C";
|
||||
std::memcpy(signal, sig_, 3);
|
||||
signal[0] = '1';
|
||||
signal[1] = 'C';
|
||||
signal[2] = '\0';
|
||||
}
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
|
||||
#include "dll_pll_conf_fpga.h"
|
||||
#include <cstring>
|
||||
|
||||
Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
|
||||
{
|
||||
@ -68,8 +67,9 @@ Dll_Pll_Conf_Fpga::Dll_Pll_Conf_Fpga()
|
||||
carrier_lock_th = 0.85;
|
||||
track_pilot = false;
|
||||
system = 'G';
|
||||
char sig_[3] = "1C";
|
||||
std::memcpy(signal, sig_, 3);
|
||||
signal[0] = '1';
|
||||
signal[1] = 'C';
|
||||
signal[2] = '\0';
|
||||
device_name = "/dev/uio";
|
||||
device_base = 1U;
|
||||
multicorr_type = 0U;
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include <glog/logging.h>
|
||||
#include <volk_gnsssdr/volk_gnsssdr.h>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <fcntl.h> // for O_RDWR, O_RSYNC
|
||||
#include <string>
|
||||
#include <sys/mman.h> // for PROT_READ, PROT_WRITE, MAP_SHARED
|
||||
|
@ -91,7 +91,7 @@ bool operator==(const Gnss_Satellite& sat1, const Gnss_Satellite& sat2)
|
||||
|
||||
|
||||
// Copy constructor
|
||||
Gnss_Satellite::Gnss_Satellite(Gnss_Satellite&& other)
|
||||
Gnss_Satellite::Gnss_Satellite(Gnss_Satellite&& other) noexcept
|
||||
{
|
||||
*this = other;
|
||||
}
|
||||
@ -113,14 +113,14 @@ Gnss_Satellite& Gnss_Satellite::operator=(const Gnss_Satellite& rhs)
|
||||
|
||||
|
||||
// Move constructor
|
||||
Gnss_Satellite::Gnss_Satellite(const Gnss_Satellite& other)
|
||||
Gnss_Satellite::Gnss_Satellite(const Gnss_Satellite& other) noexcept
|
||||
{
|
||||
*this = std::move(other);
|
||||
*this = other;
|
||||
}
|
||||
|
||||
|
||||
// Move assignment operator
|
||||
Gnss_Satellite& Gnss_Satellite::operator=(Gnss_Satellite&& other)
|
||||
Gnss_Satellite& Gnss_Satellite::operator=(Gnss_Satellite&& other) noexcept
|
||||
{
|
||||
if (this != &other)
|
||||
{
|
||||
|
@ -62,10 +62,10 @@ public:
|
||||
friend bool operator==(const Gnss_Satellite& /*sat1*/, const Gnss_Satellite& /*sat2*/); //!< operator== for comparison
|
||||
friend std::ostream& operator<<(std::ostream& /*out*/, const Gnss_Satellite& /*sat*/); //!< operator<< for pretty printing
|
||||
|
||||
Gnss_Satellite(Gnss_Satellite&& other); //!< Copy constructor
|
||||
Gnss_Satellite(Gnss_Satellite&& other) noexcept; //!< Copy constructor
|
||||
Gnss_Satellite& operator=(const Gnss_Satellite&); //!< Copy assignment operator
|
||||
Gnss_Satellite(const Gnss_Satellite& other); //!< Move constructor
|
||||
Gnss_Satellite& operator=(Gnss_Satellite&& other); //!< Move assignment operator
|
||||
Gnss_Satellite(const Gnss_Satellite& other) noexcept; //!< Move constructor
|
||||
Gnss_Satellite& operator=(Gnss_Satellite&& other) noexcept; //!< Move assignment operator
|
||||
|
||||
private:
|
||||
uint32_t PRN{};
|
||||
|
@ -49,7 +49,6 @@
|
||||
|
||||
#include <gflags/gflags.h>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstdlib> // for getenv()
|
||||
#include <cstring> // for strncpy
|
||||
#include <fstream>
|
||||
|
@ -33,7 +33,25 @@
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <matio.h>
|
||||
#include <cstdio>
|
||||
|
||||
#if HAS_STD_FILESYSTEM
|
||||
#include <system_error>
|
||||
namespace errorlib = std;
|
||||
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
#else
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#endif
|
||||
#else
|
||||
#include <boost/filesystem/operations.hpp> // for create_directories, exists
|
||||
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||
#include <boost/system/error_code.hpp> // for error_code
|
||||
namespace fs = boost::filesystem;
|
||||
namespace errorlib = boost::system;
|
||||
#endif
|
||||
|
||||
TEST(MatioTest, WriteAndReadDoubles)
|
||||
{
|
||||
@ -73,7 +91,8 @@ TEST(MatioTest, WriteAndReadDoubles)
|
||||
EXPECT_DOUBLE_EQ(x[i], x_read[i]);
|
||||
}
|
||||
Mat_VarFree(matvar_read);
|
||||
ASSERT_EQ(remove(filename.c_str()), 0);
|
||||
errorlib::error_code ec;
|
||||
ASSERT_EQ(fs::remove(fs::path(filename), ec), true);
|
||||
}
|
||||
|
||||
|
||||
@ -156,5 +175,6 @@ TEST(MatioTest, WriteAndReadGrComplex)
|
||||
EXPECT_FLOAT_EQ(x_v[i].real(), x_v_read[i].real());
|
||||
EXPECT_FLOAT_EQ(x_v[i].imag(), x_v_read[i].imag());
|
||||
}
|
||||
ASSERT_EQ(remove(filename.c_str()), 0);
|
||||
errorlib::error_code ec;
|
||||
ASSERT_EQ(fs::remove(fs::path(filename), ec), true);
|
||||
}
|
||||
|
@ -32,10 +32,27 @@
|
||||
#include "nmea_printer.h"
|
||||
#include "rtklib_rtkpos.h"
|
||||
#include "rtklib_solver.h"
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
|
||||
#if HAS_STD_FILESYSTEM
|
||||
#include <system_error>
|
||||
namespace errorlib = std;
|
||||
#if HAS_STD_FILESYSTEM_EXPERIMENTAL
|
||||
#include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
#else
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#endif
|
||||
#else
|
||||
#include <boost/filesystem/operations.hpp> // for create_directories, exists
|
||||
#include <boost/filesystem/path.hpp> // for path, operator<<
|
||||
#include <boost/filesystem/path_traits.hpp> // for filesystem
|
||||
#include <boost/system/error_code.hpp> // for error_code
|
||||
namespace fs = boost::filesystem;
|
||||
namespace errorlib = boost::system;
|
||||
#endif
|
||||
|
||||
class NmeaPrinterTest : public ::testing::Test
|
||||
{
|
||||
@ -196,5 +213,6 @@ TEST_F(NmeaPrinterTest, PrintLine)
|
||||
}
|
||||
test_file.close();
|
||||
}
|
||||
EXPECT_EQ(0, remove(filename.c_str())) << "Failure deleting a temporary file.";
|
||||
errorlib::error_code ec;
|
||||
EXPECT_EQ(true, fs::remove(fs::path(filename), ec)) << "Failure deleting a temporary file.";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user