mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2026-11-24 16:17:22 +00:00
Merge branch 'joebre-fix/pvt-combined-flag-ionoopt' into next
This commit is contained in:
6 files changed
+194
-73
No files matched your search
@@ -56,8 +56,14 @@ message MonitorPvt {
|
||||
// One tracked satellite/signal with its azimuth/elevation, whether it was
|
||||
// combined with another signal of the same satellite (e.g. Galileo E1+E5a
|
||||
// iono-free combination), and whether it was actually used in this fix.
|
||||
// Signals are listed individually, not merged: a combined satellite
|
||||
// appears as two entries, both with combined = true. A satellite can have
|
||||
// Signals are listed individually, not merged, and combined/used are set
|
||||
// per signal. In a single-point fix with PVT.iono_model=Iono-Free-LC, the
|
||||
// two signals of the iono-free pair have combined = used = true, and any
|
||||
// other band of the same satellite has used = false; with any other iono
|
||||
// model, only the one signal that enters the solution has used = true.
|
||||
// In a DGPS/RTK fix, used marks each band the relative solution
|
||||
// differenced. In a PPP fix, every signal carries the satellite-level used
|
||||
// flag and combined = false. A satellite can have
|
||||
// azimuth_deg/elevation_deg populated with used = false when it was
|
||||
// tracked and had az/el computed but excluded from the fix itself (e.g.
|
||||
// below PVT.elevation_mask, or by RAIM FDE). The healthy flag carries the
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "matlab_writter_helper.h"
|
||||
#include "ntrip_rtcm_client.h"
|
||||
#include "ntrip_rtk_signals.h"
|
||||
#include "rtklib_pntpos.h"
|
||||
#include "rtklib_rtkcmn.h"
|
||||
#include "rtklib_rtkpos.h"
|
||||
#include "signal_enabled_flags.h"
|
||||
@@ -3135,11 +3136,11 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
|
||||
// USED SATELLITES: per-satellite azimuth/elevation and which
|
||||
// signal(s) contributed to this fix. Signals are listed
|
||||
// individually (one entry per satellite per signal); a
|
||||
// satellite whose signals were combined (e.g. Galileo E1+E5a
|
||||
// iono-free combination -- see the "dual-frequency" branch of
|
||||
// prange() in rtklib_pntpos.cc) gets one entry per signal, all
|
||||
// flagged combined = true.
|
||||
// individually (one entry per satellite per signal); the two
|
||||
// signals of an iono-free pair (e.g. Galileo E1+E5a -- see the
|
||||
// "dual-frequency" branch of prange() in rtklib_pntpos.cc) are
|
||||
// both flagged combined = true, and a third band of the same
|
||||
// satellite is not.
|
||||
//
|
||||
// pntpos() fills ssat[].azel for every observation; only
|
||||
// ssat[].vs is gated by PVT.elevation_mask / RAIM FDE. A
|
||||
@@ -3150,6 +3151,27 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
// NaN az/el (corrupt ephemeris/almanac) is deliberately
|
||||
// reported as-is for consumers to handle; rescode()
|
||||
// already keeps NaN out of the position solve.
|
||||
//
|
||||
// combined/used below come from d_obs_data's own record, not from configuration.
|
||||
// Bounded to rover_observation_count to skip any base-station entries past it.
|
||||
// Which bands entered the fix depends on the estimator that produced it:
|
||||
// pntpos()/prange() for a single-point fix, relpos() for DGPS/RTK.
|
||||
// pntpos() forces the broadcast iono model when it runs as the pre-pass
|
||||
// of a precise mode, so a single-point fix there never combines bands.
|
||||
const bool spp_solution = d_rtk.opt.mode == PMODE_SINGLE ||
|
||||
pvt_sol.stat == SOLQ_SINGLE || pvt_sol.stat == SOLQ_SBAS;
|
||||
const bool relative_solution = !spp_solution && d_rtk.opt.mode <= PMODE_FIXED;
|
||||
const int spp_ionoopt = (d_rtk.opt.mode == PMODE_SINGLE || use_single_fallback) ? d_rtk.opt.ionoopt : IONOOPT_BRDC;
|
||||
std::array<int, MAXSAT> sat_to_obs_index{};
|
||||
sat_to_obs_index.fill(-1);
|
||||
for (int obs_idx = 0; obs_idx < rover_observation_count; obs_idx++)
|
||||
{
|
||||
const int sat = d_obs_data[obs_idx].sat;
|
||||
if (sat > 0 && sat <= MAXSAT)
|
||||
{
|
||||
sat_to_obs_index[sat - 1] = obs_idx;
|
||||
}
|
||||
}
|
||||
d_monitor_pvt.tracked_satellites.clear();
|
||||
for (int sat_idx = 0; sat_idx < MAXSAT; sat_idx++)
|
||||
{
|
||||
@@ -3194,7 +3216,20 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
contributing_signals.push_back(&synchro);
|
||||
}
|
||||
}
|
||||
const bool combined = contributing_signals.size() > 1;
|
||||
// Band pair prange() itself reads for this satellite this epoch.
|
||||
int prange_i = 0;
|
||||
int prange_j = 1;
|
||||
bool both_bands_present = false;
|
||||
int picked_slot = -1;
|
||||
const int obs_idx = sat_to_obs_index[sat_idx];
|
||||
const obsd_t *obs_record = obs_idx >= 0 ? &d_obs_data[obs_idx] : nullptr;
|
||||
if (obs_record != nullptr)
|
||||
{
|
||||
prange_band_pair(obs_record, &prange_i, &prange_j);
|
||||
both_bands_present = prange_i != prange_j &&
|
||||
obs_record->P[prange_i] != 0.0 && obs_record->P[prange_j] != 0.0;
|
||||
picked_slot = obs_record->code[prange_i] != CODE_NONE ? prange_i : prange_j;
|
||||
}
|
||||
// satazel() (rtklib_rtkcmn.cc) returns azimuth in [0, 2*pi); wrap to
|
||||
// (-180, 180] deg, the convention expected downstream (monitor sky plot).
|
||||
double az_deg = pvt_ssat[sat_idx].azel[0] * R2D;
|
||||
@@ -3210,8 +3245,47 @@ bool Rtklib_Solver::get_PVT(const std::map<int, Gnss_Synchro> &gnss_observables_
|
||||
info.signal = std::string(synchro->Signal, 2);
|
||||
info.azimuth_deg = az_deg;
|
||||
info.elevation_deg = pvt_ssat[sat_idx].azel[1] * R2D;
|
||||
info.combined = combined;
|
||||
info.used = used;
|
||||
const auto band_it = d_rtklib_band_index.find(info.signal);
|
||||
const int signal_slot = band_it != d_rtklib_band_index.cend() ? band_it->second : -1;
|
||||
// The slot must hold this signal's own code: a signal left out of the
|
||||
// solver input (B1I next to B1C, the non-selected E5, E6 per
|
||||
// PVT.use_e6_for_pvt) or dropped by the fixed-base path fails this.
|
||||
const bool in_record = obs_record != nullptr && signal_slot >= 0 && signal_slot < NFREQ &&
|
||||
obs_record->code[signal_slot] == rtklib_obs_code(sys_char, info.signal, signal_slot);
|
||||
info.combined = false;
|
||||
info.used = false;
|
||||
if (in_record && spp_solution)
|
||||
{
|
||||
if (spp_ionoopt == IONOOPT_IFLC)
|
||||
{
|
||||
info.combined = used && both_bands_present &&
|
||||
(signal_slot == prange_i || signal_slot == prange_j);
|
||||
info.used = info.combined;
|
||||
}
|
||||
else
|
||||
{
|
||||
info.used = used && signal_slot == picked_slot;
|
||||
}
|
||||
}
|
||||
else if (in_record && relative_solution)
|
||||
{
|
||||
// relpos() flags each band it differenced in vsat[]; with
|
||||
// Iono-Free-LC it differences one L1/L2 combination, flagged in vsat[0].
|
||||
if (d_rtk.opt.ionoopt == IONOOPT_IFLC)
|
||||
{
|
||||
info.combined = pvt_ssat[sat_idx].vsat[0] != 0 && signal_slot <= 1;
|
||||
info.used = info.combined;
|
||||
}
|
||||
else
|
||||
{
|
||||
info.used = pvt_ssat[sat_idx].vsat[signal_slot] != 0;
|
||||
}
|
||||
}
|
||||
else if (in_record)
|
||||
{
|
||||
// PPP: its band pairing (ifmeas()) is not modelled here.
|
||||
info.used = used;
|
||||
}
|
||||
// Broadcast health of this signal, as reported by the
|
||||
// navigation message that carries it (true when no health
|
||||
// information is available). Independent of `used`.
|
||||
|
||||
@@ -166,6 +166,66 @@ static int32_t gps_cnav_ura_to_rtklib_sva(int32_t uraed, int32_t uraned0)
|
||||
}
|
||||
|
||||
|
||||
unsigned char rtklib_obs_code(char system, const std::string& signal, int band)
|
||||
{
|
||||
auto code = static_cast<unsigned char>(CODE_NONE);
|
||||
switch (band)
|
||||
{
|
||||
case 0:
|
||||
code = static_cast<unsigned char>(CODE_L1C);
|
||||
break;
|
||||
case 1:
|
||||
code = static_cast<unsigned char>(CODE_L2S);
|
||||
break;
|
||||
case 2:
|
||||
code = static_cast<unsigned char>(CODE_L5X);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (system)
|
||||
{
|
||||
case 'E':
|
||||
if (signal == "7X")
|
||||
{
|
||||
code = static_cast<unsigned char>(CODE_L7X);
|
||||
}
|
||||
if (signal == "E6")
|
||||
{
|
||||
code = static_cast<unsigned char>(CODE_L6B);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
if (signal == "2G")
|
||||
{
|
||||
code = static_cast<unsigned char>(CODE_L2C);
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
if (signal == "B1")
|
||||
{
|
||||
code = static_cast<unsigned char>(CODE_L2I);
|
||||
}
|
||||
else if (signal == "B3")
|
||||
{
|
||||
code = static_cast<unsigned char>(CODE_L6I);
|
||||
}
|
||||
else if (signal == "1D")
|
||||
{
|
||||
code = static_cast<unsigned char>(CODE_L1P);
|
||||
}
|
||||
else if (signal == "5D")
|
||||
{
|
||||
code = static_cast<unsigned char>(CODE_L5D);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
|
||||
obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs,
|
||||
const Gnss_Synchro& gnss_synchro,
|
||||
const std::map<std::string, std::map<int, HAS_obs_corrections>>& has_obs_corr,
|
||||
@@ -194,18 +254,7 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs,
|
||||
rtklib_obs.LLI[band] = static_cast<unsigned char>(
|
||||
(gnss_synchro.Flag_cycle_slip || gnss_synchro.Flag_half_cycle_slip) ? 1U : 0U);
|
||||
|
||||
switch (band)
|
||||
{
|
||||
case 0:
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L1C);
|
||||
break;
|
||||
case 1:
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L2S);
|
||||
break;
|
||||
case 2:
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L5X);
|
||||
break;
|
||||
}
|
||||
rtklib_obs.code[band] = rtklib_obs_code(gnss_synchro.System, sig_, band);
|
||||
double CN0_dB_Hz_est = gnss_synchro.CN0_dB_hz;
|
||||
if (CN0_dB_Hz_est > 63.75)
|
||||
{
|
||||
@@ -225,42 +274,12 @@ obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs,
|
||||
break;
|
||||
case 'E':
|
||||
rtklib_obs.sat = gnss_synchro.PRN + NSATGPS + NSATGLO;
|
||||
if (sig_ == "7X")
|
||||
{
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L7X);
|
||||
}
|
||||
if (sig_ == "E6")
|
||||
{
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L6B);
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
rtklib_obs.sat = satno(SYS_GLO, gnss_synchro.PRN);
|
||||
if (sig_ == "2G")
|
||||
{
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L2C);
|
||||
}
|
||||
break;
|
||||
case 'C':
|
||||
rtklib_obs.sat = gnss_synchro.PRN + NSATGPS + NSATGLO + NSATGAL + NSATQZS;
|
||||
// Update signal code
|
||||
if (sig_ == "B1")
|
||||
{
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L2I);
|
||||
}
|
||||
else if (sig_ == "B3")
|
||||
{
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L6I);
|
||||
}
|
||||
else if (sig_ == "1D")
|
||||
{
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L1P);
|
||||
}
|
||||
else if (sig_ == "5D")
|
||||
{
|
||||
rtklib_obs.code[band] = static_cast<unsigned char>(CODE_L5D);
|
||||
}
|
||||
|
||||
break;
|
||||
case 'J':
|
||||
rtklib_obs.sat = satno(SYS_QZS, gnss_synchro.PRN);
|
||||
|
||||
@@ -146,6 +146,15 @@ bool glonass_gnav_is_healthy(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, boo
|
||||
*/
|
||||
geph_t eph_to_rtklib(const Glonass_Gnav_Ephemeris& glonass_gnav_eph, const Glonass_Gnav_Utc_Model& gnav_clock_model, bool glonass_strict_health = true);
|
||||
|
||||
/*!
|
||||
* \brief RTKLIB observation code that insert_obs_to_rtklib() stores for a signal
|
||||
* \param system GNSS-SDR system identifier ('G', 'E', 'R', 'C', 'J', 'S')
|
||||
* \param signal GNSS-SDR two-character signal identifier (e.g. "1C", "5X", "B3")
|
||||
* \param band RTKLIB band slot the signal is stored in
|
||||
* \return observation code, CODE_NONE if the signal has no code for that slot
|
||||
*/
|
||||
unsigned char rtklib_obs_code(char system, const std::string& signal, int band);
|
||||
|
||||
obsd_t insert_obs_to_rtklib(obsd_t& rtklib_obs,
|
||||
const Gnss_Synchro& gnss_synchro,
|
||||
const std::map<std::string, std::map<int, HAS_obs_corrections>>& has_obs_corr,
|
||||
|
||||
@@ -289,6 +289,36 @@ double getiscl5q(int sat, const nav_t *nav)
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* band pair read by prange() for a satellite --------------------------------*/
|
||||
void prange_band_pair(const obsd_t *obs, int *i, int *j)
|
||||
{
|
||||
*i = 0;
|
||||
*j = 1;
|
||||
const int sys = satsys(obs->sat, nullptr);
|
||||
|
||||
/* L1-L2 for GPS/GLO/QZS, L1-L5 for GAL/SBS;
|
||||
* BDS: select from the measured bands, preferring B2a as the IF partner. */
|
||||
if (sys == SYS_GAL || sys == SYS_SBS)
|
||||
{
|
||||
*j = 2;
|
||||
}
|
||||
else if (sys == SYS_BDS)
|
||||
{
|
||||
bds_observation_slots(obs, i, j);
|
||||
}
|
||||
else if (sys == SYS_GPS || sys == SYS_GLO || sys == SYS_QZS)
|
||||
{
|
||||
if (obs->code[1] != CODE_NONE)
|
||||
{
|
||||
*j = 1;
|
||||
}
|
||||
else if (obs->code[2] != CODE_NONE)
|
||||
{
|
||||
*j = 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* psendorange with code bias correction -------------------------------------
|
||||
* iono_scale (O) is the multiplier the caller must apply to the modeled L1
|
||||
* ionospheric delay so that it is consistent with the returned pseudorange:
|
||||
@@ -323,27 +353,7 @@ double prange(const obsd_t *obs, const nav_t *nav, const double *azel,
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/* L1-L2 for GPS/GLO/QZS, L1-L5 for GAL/SBS;
|
||||
* BDS: select from the measured bands, preferring B2a as the IF partner. */
|
||||
if (sys == SYS_GAL || sys == SYS_SBS)
|
||||
{
|
||||
j = 2;
|
||||
}
|
||||
else if (sys == SYS_BDS)
|
||||
{
|
||||
bds_observation_slots(obs, &i, &j);
|
||||
}
|
||||
else if (sys == SYS_GPS || sys == SYS_GLO || sys == SYS_QZS)
|
||||
{
|
||||
if (obs->code[1] != CODE_NONE)
|
||||
{
|
||||
j = 1;
|
||||
}
|
||||
else if (obs->code[2] != CODE_NONE)
|
||||
{
|
||||
j = 2;
|
||||
}
|
||||
}
|
||||
prange_band_pair(obs, &i, &j);
|
||||
|
||||
if (lam[i] == 0.0 || lam[j] == 0.0)
|
||||
{
|
||||
|
||||
@@ -62,6 +62,9 @@ double getiscl2(int sat, const nav_t *nav);
|
||||
double getiscl5i(int sat, const nav_t *nav);
|
||||
double getiscl5q(int sat, const nav_t *nav);
|
||||
|
||||
/* band pair read by prange() for a satellite --------------------------------*/
|
||||
void prange_band_pair(const obsd_t *obs, int *i, int *j);
|
||||
|
||||
/* psendorange with code bias correction -------------------------------------
|
||||
* iono_scale (O) is the multiplier the caller must apply to the modeled L1
|
||||
* ionospheric delay so that it is consistent with the returned pseudorange:
|
||||
|
||||
Reference in new issue
Block a user