Fix building in old environments

This commit is contained in:
Carles Fernandez
2026-09-23 16:16:36 +02:00
parent 3e3d730b13
commit 4e91e99a8c
3 changed files with 31 additions and 21 deletions
+6 -6
View File
@@ -63,7 +63,6 @@
#include <iterator> // for insert_iterator, inserter
#include <map> // for std::map
#include <memory> // for std::shared_ptr
#include <optional> // for std::optional
#include <set> // for set
#include <sstream> // for std::stringstream
#include <stdexcept> // for invalid_argument
@@ -1837,10 +1836,11 @@ void GNSSFlowgraph::acquisition_manager(unsigned int who)
// prediction from ephemeris/almanac (SatelliteVisibility), if
// this is the primary signal of a satellite already classified
// visible and a live PVT fix currently exists. No-op (stays
// nullopt) unless visibility-aware search is enabled --
// false) unless visibility-aware search is enabled --
// PredictedDopplerHz() itself requires a live fix for now; the
// AGNSS-reference (no-fix) case is a follow-up.
std::optional<double> predicted_doppler_hz;
bool doppler_predicted = false;
double predicted_doppler_hz = 0.0;
if (is_primary_freq && satellite_visibility_ && satellite_visibility_->enabled())
{
const auto pvt_ptr = get_pvt();
@@ -1848,12 +1848,12 @@ void GNSSFlowgraph::acquisition_manager(unsigned int who)
if (pvt_ptr && satellite_visibility_->IsVisible(sat))
{
const Monitor_Pvt fix_status = channels_status_->get_current_status_pvt();
predicted_doppler_hz = satellite_visibility_->PredictedDopplerHz(pvt_ptr, fix_status, sat, channels_[current_channel]->get_signal().get_signal_str());
doppler_predicted = satellite_visibility_->PredictedDopplerHz(pvt_ptr, fix_status, sat, channels_[current_channel]->get_signal().get_signal_str(), predicted_doppler_hz);
}
}
if (predicted_doppler_hz.has_value())
if (doppler_predicted)
{
channels_[current_channel]->assist_acquisition_doppler(*predicted_doppler_hz, 1);
channels_[current_channel]->assist_acquisition_doppler(predicted_doppler_hz, 1);
}
else
{
+17 -8
View File
@@ -1059,12 +1059,13 @@ bool SatelliteVisibility::IsSearchExcluded(const Gnss_Satellite& sat) const
}
std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_ptr<PvtInterface>& pvt_ptr,
const Monitor_Pvt& fix_status, const Gnss_Satellite& sat, const std::string& signal) const
bool SatelliteVisibility::PredictedDopplerHz(const std::shared_ptr<PvtInterface>& pvt_ptr,
const Monitor_Pvt& fix_status, const Gnss_Satellite& sat, const std::string& signal,
double& doppler_hz) const
{
if (!enabled_ || !pvt_ptr || fix_status.RX_time < 0.0)
{
return std::nullopt;
return false;
}
// Gnss_Ephemeris::predicted_doppler()/Gnss_Almanac::predicted_doppler()'s
@@ -1080,7 +1081,7 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
const auto freq_it = SIGNAL_FREQ_MAP.find(signal);
if (band_it == kBandForSignal.cend() || freq_it == SIGNAL_FREQ_MAP.cend())
{
return std::nullopt;
return false;
}
const int band = band_it->second;
const double carrier_freq_hz = freq_it->second;
@@ -1098,7 +1099,8 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
const std::string system = sat.get_system();
const auto prn = static_cast<int>(sat.get_PRN());
std::optional<double> geometric_doppler_hz;
bool geometric_available = false;
double geometric_doppler_hz = 0.0;
if (system == "GPS")
{
const auto eph_map = pvt_ptr->get_gps_ephemeris();
@@ -1106,6 +1108,7 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
if (eph_it != eph_map.cend() && std::abs(timediff(gps_gtime, eph_to_rtklib(eph_it->second, ref_gps_week).toe)) <= MAXDTOE)
{
geometric_doppler_hz = eph_it->second.predicted_doppler(rx_time_s, lat_deg, lon_deg, h_m, ve_mps, vn_mps, vu_mps, band);
geometric_available = true;
}
else
{
@@ -1114,6 +1117,7 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
if (alm_it != alm_map.cend() && std::abs(timediff(gps_gtime, alm_to_rtklib(alm_it->second, ref_gps_week).toa)) <= almanac_max_age_s_)
{
geometric_doppler_hz = alm_it->second.predicted_doppler(rx_time_s, lat_deg, lon_deg, h_m, ve_mps, vn_mps, vu_mps, band);
geometric_available = true;
}
}
}
@@ -1124,6 +1128,7 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
if (eph_it != eph_map.cend() && std::abs(timediff(gps_gtime, eph_to_rtklib(eph_it->second).toe)) <= MAXDTOE_GAL)
{
geometric_doppler_hz = eph_it->second.predicted_doppler(rx_time_s, lat_deg, lon_deg, h_m, ve_mps, vn_mps, vu_mps, band);
geometric_available = true;
}
else
{
@@ -1132,6 +1137,7 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
if (alm_it != alm_map.cend() && std::abs(timediff(gps_gtime, alm_to_rtklib(alm_it->second, ref_gps_week).toa)) <= almanac_max_age_s_)
{
geometric_doppler_hz = alm_it->second.predicted_doppler(rx_time_s, lat_deg, lon_deg, h_m, ve_mps, vn_mps, vu_mps, band);
geometric_available = true;
}
}
}
@@ -1142,6 +1148,7 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
if (eph_it != eph_map.cend() && std::abs(timediff(gps_gtime, eph_to_rtklib(eph_it->second).toe)) <= MAXDTOE_BDS)
{
geometric_doppler_hz = eph_it->second.predicted_doppler(rx_time_s, lat_deg, lon_deg, h_m, ve_mps, vn_mps, vu_mps, band);
geometric_available = true;
}
else
{
@@ -1150,13 +1157,14 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
if (alm_it != alm_map.cend() && std::abs(timediff(gps_gtime, alm_to_rtklib(alm_it->second).toa)) <= almanac_max_age_s_)
{
geometric_doppler_hz = alm_it->second.predicted_doppler(rx_time_s, lat_deg, lon_deg, h_m, ve_mps, vn_mps, vu_mps, band);
geometric_available = true;
}
}
}
if (!geometric_doppler_hz.has_value())
if (!geometric_available)
{
return std::nullopt;
return false;
}
// Live PVT-solved clock drift, shared by every satellite's observed
@@ -1166,5 +1174,6 @@ std::optional<double> SatelliteVisibility::PredictedDopplerHz(const std::shared_
// geometric - clock_offset matched to within noise, geometric +
// clock_offset was off by 2x it.
const double clock_offset_hz = fix_status.user_clk_drift_ppm * 1.0e-6 * carrier_freq_hz;
return *geometric_doppler_hz - clock_offset_hz;
doppler_hz = geometric_doppler_hz - clock_offset_hz;
return true;
}
+8 -7
View File
@@ -26,7 +26,6 @@
#include <limits>
#include <map>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <tuple>
@@ -167,16 +166,18 @@ public:
// from whichever of sat's ephemeris/almanac is usable (same freshness
// rules as compute_visible_satellites()), plus the receiver's live
// solved clock drift (fix_status.user_clk_drift_ppm) scaled to this
// signal's carrier. Only meaningful with a live PVT fix -- std::nullopt
// when disabled, no fix is currently valid, the signal isn't a
// recognized carrier, or neither ephemeris nor almanac is currently
// usable for sat. No AGNSS-reference fallback yet: that's deferred to a
// signal's carrier. On success, writes the prediction to doppler_hz and
// returns true. Only meaningful with a live PVT fix -- returns false
// (leaving doppler_hz untouched) when disabled, no fix is currently
// valid, the signal isn't a recognized carrier, or neither ephemeris nor
// almanac is currently usable for sat. No AGNSS-reference fallback yet: that's deferred to a
// follow-up (needs the pre-fix clock/velocity uncertainty this signal's
// Doppler tolerance can't absorb from a single search bin -- see
// GNSS-SDR.clock_frequency_max_error_ppm / receiver_max_velocity_m_s in
// the follow-up PR).
std::optional<double> PredictedDopplerHz(const std::shared_ptr<PvtInterface>& pvt_ptr,
const Monitor_Pvt& fix_status, const Gnss_Satellite& sat, const std::string& signal) const;
bool PredictedDopplerHz(const std::shared_ptr<PvtInterface>& pvt_ptr,
const Monitor_Pvt& fix_status, const Gnss_Satellite& sat, const std::string& signal,
double& doppler_hz) const;
private:
enum class SearchVisibility