1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-05 01:26:24 +00:00

hotfix: fix Uhd_Signal_Source building with GCC 10

Fix out-of-bound access in debug mode
This commit is contained in:
Carles Fernandez 2020-07-29 13:47:00 +02:00
parent 2a7731135f
commit 0b1befd128
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
3 changed files with 11 additions and 12 deletions

View File

@ -978,7 +978,7 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
this->set_time_offset_s(rx_position_and_time[3]); this->set_time_offset_s(rx_position_and_time[3]);
DLOG(INFO) << "RTKLIB Position at RX TOW = " << gnss_observables_map.cbegin()->second.RX_time DLOG(INFO) << "RTKLIB Position at RX TOW = " << gnss_observables_map.cbegin()->second.RX_time
<< " in ECEF (X,Y,Z,t[meters]) = " << rx_position_and_time[0] << ", " << rx_position_and_time[1] << ", " << rx_position_and_time[2] << ", " << rx_position_and_time[4]; << " in ECEF (X,Y,Z,t[meters]) = " << rx_position_and_time[0] << ", " << rx_position_and_time[1] << ", " << rx_position_and_time[2] << ", " << rx_position_and_time[3];
// gtime_t rtklib_utc_time = gpst2utc(pvt_sol.time); // Corrected RX Time (Non integer multiply of 1 ms of granularity) // gtime_t rtklib_utc_time = gpst2utc(pvt_sol.time); // Corrected RX Time (Non integer multiply of 1 ms of granularity)
// Uncorrected RX Time (integer multiply of 1 ms and the same observables time reported in RTCM and RINEX) // Uncorrected RX Time (integer multiply of 1 ms and the same observables time reported in RTCM and RINEX)

View File

@ -23,7 +23,6 @@
#include "GPS_L1_CA.h" #include "GPS_L1_CA.h"
#include "configuration_interface.h" #include "configuration_interface.h"
#include "gnss_sdr_valve.h" #include "gnss_sdr_valve.h"
#include <boost/format.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <cstdint> #include <cstdint>
#include <iostream> #include <iostream>

View File

@ -149,8 +149,8 @@ UhdSignalSource::UhdSignalSource(const ConfigurationInterface* configuration,
// 2.2 set the sample rate for the usrp device // 2.2 set the sample rate for the usrp device
uhd_source_->set_samp_rate(sample_rate_); uhd_source_->set_samp_rate(sample_rate_);
// the actual sample rate may differ from the rate set // the actual sample rate may differ from the rate set
std::cout << boost::format("Sampling Rate for the USRP device: %f [sps]...") % (uhd_source_->get_samp_rate()) << '\n'; std::cout << "Sampling Rate for the USRP device: " << uhd_source_->get_samp_rate() << " [sps]...\n";
LOG(INFO) << boost::format("Sampling Rate for the USRP device: %f [sps]...") % (uhd_source_->get_samp_rate()); LOG(INFO) << "Sampling Rate for the USRP device: " << uhd_source_->get_samp_rate() << " [sps]...";
std::vector<std::string> sensor_names; std::vector<std::string> sensor_names;
@ -159,20 +159,20 @@ UhdSignalSource::UhdSignalSource(const ConfigurationInterface* configuration,
std::cout << "UHD RF CHANNEL #" << i << " SETTINGS\n"; std::cout << "UHD RF CHANNEL #" << i << " SETTINGS\n";
// 3. Tune the usrp device to the desired center frequency // 3. Tune the usrp device to the desired center frequency
uhd_source_->set_center_freq(freq_.at(i), i); uhd_source_->set_center_freq(freq_.at(i), i);
std::cout << boost::format("Actual USRP center freq.: %f [Hz]...") % (uhd_source_->get_center_freq(i)) << '\n'; std::cout << "Actual USRP center freq.: " << uhd_source_->get_center_freq(i) << " [Hz]...\n";
LOG(INFO) << boost::format("Actual USRP center freq. set to: %f [Hz]...") % (uhd_source_->get_center_freq(i)); LOG(INFO) << "Actual USRP center freq. set to: " << uhd_source_->get_center_freq(i) << " [Hz]...";
// TODO: Assign the remnant IF from the PLL tune error // TODO: Assign the remnant IF from the PLL tune error
std::cout << boost::format("PLL Frequency tune error %f [Hz]...") % (uhd_source_->get_center_freq(i) - freq_.at(i)) << '\n'; std::cout << "PLL Frequency tune error: " << uhd_source_->get_center_freq(i) - freq_.at(i) << " [Hz]...\n";
LOG(INFO) << boost::format("PLL Frequency tune error %f [Hz]...") % (uhd_source_->get_center_freq(i) - freq_.at(i)); LOG(INFO) << "PLL Frequency tune error: " << uhd_source_->get_center_freq(i) - freq_.at(i) << " [Hz]...";
// 4. set the gain for the daughterboard // 4. set the gain for the daughterboard
uhd_source_->set_gain(gain_.at(i), i); uhd_source_->set_gain(gain_.at(i), i);
std::cout << boost::format("Actual daughterboard gain set to: %f dB...") % uhd_source_->get_gain(i) << '\n'; std::cout << "Actual daughterboard gain set to: " << uhd_source_->get_gain(i) << " dB...\n";
LOG(INFO) << boost::format("Actual daughterboard gain set to: %f dB...") % uhd_source_->get_gain(i); LOG(INFO) << "Actual daughterboard gain set to: " << uhd_source_->get_gain(i) << " dB...";
// 5. Set the bandpass filter on the RF frontend // 5. Set the bandpass filter on the RF frontend
std::cout << boost::format("Setting RF bandpass filter bandwidth to: %f [Hz]...") % IF_bandwidth_hz_.at(i) << '\n'; std::cout << "Setting RF bandpass filter bandwidth to: " << IF_bandwidth_hz_.at(i) << " [Hz]...\n";
uhd_source_->set_bandwidth(IF_bandwidth_hz_.at(i), i); uhd_source_->set_bandwidth(IF_bandwidth_hz_.at(i), i);
// set the antenna (optional) // set the antenna (optional)
@ -186,7 +186,7 @@ UhdSignalSource::UhdSignalSource(const ConfigurationInterface* configuration,
if (std::find(sensor_names.begin(), sensor_names.end(), "lo_locked") != sensor_names.end()) if (std::find(sensor_names.begin(), sensor_names.end(), "lo_locked") != sensor_names.end())
{ {
uhd::sensor_value_t lo_locked = uhd_source_->get_sensor("lo_locked", i); uhd::sensor_value_t lo_locked = uhd_source_->get_sensor("lo_locked", i);
std::cout << boost::format("Check for front-end %s ...") % lo_locked.to_pp_string() << " is "; std::cout << "Check for front-end " << lo_locked.to_pp_string() << " is ... ";
if (lo_locked.to_bool() == true) if (lo_locked.to_bool() == true)
{ {
std::cout << "Locked\n"; std::cout << "Locked\n";