0.2.0
Loading...
Searching...
No Matches
Observation.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
13
14#pragma once
15
16#include <memory>
17#include <set>
18#include <unordered_set>
19
24#include "Navigation/Transformations/Units.hpp"
26
28
30#include "util/Eigen.hpp"
31#include "util/Logger.hpp"
32
33namespace NAV
34{
35
38{
41 {
44 {
47 {
48 double estimate = 0.0;
49 double measurement = 0.0;
50 double measVar = 0.0;
51 };
52
62 ReceiverSpecificData(std::shared_ptr<const GnssObs> gnssObs,
63 size_t obsIdx,
64 const Eigen::Vector3d& e_recPos,
65 const Eigen::Vector3d& lla_recPos,
66 const Eigen::Vector3d& e_recVel,
67 const Eigen::Vector3d& e_satPos,
68 const Eigen::Vector3d& e_satVel,
70 : _gnssObs(std::move(gnssObs)), _obsIdx(obsIdx), _e_satPos(e_satPos), _e_satVel(e_satVel), _satClock(satClock)
71 {
72 _e_pLOS = e_calcLineOfSightUnitVector(e_recPos, e_satPos);
73 _e_vLOS = (e_recVel - e_satVel) / (e_recPos - e_satPos).norm();
74 Eigen::Vector3d n_lineOfSightUnitVector = trafo::n_Quat_e(lla_recPos(0), lla_recPos(1)) * _e_pLOS;
75 _satElevation = calcSatElevation(n_lineOfSightUnitVector);
76 _satAzimuth = calcSatAzimuth(n_lineOfSightUnitVector);
77
78 LOG_DATA(" e_lineOfSightUnitVector {}", _e_pLOS.transpose());
79 LOG_DATA(" n_lineOfSightUnitVector {}", n_lineOfSightUnitVector.transpose());
80 LOG_DATA(" satElevation {}°", rad2deg(_satElevation));
81 LOG_DATA(" satAzimuth {}°", rad2deg(_satAzimuth));
82 }
83
86
88 [[nodiscard]] const GnssObs::ObservationData& gnssObsData() const { return _gnssObs->data.at(_obsIdx); }
90 [[nodiscard]] const Eigen::Vector3d& e_satPos() const { return _e_satPos; }
92 [[nodiscard]] const Eigen::Vector3d& e_satVel() const { return _e_satVel; }
94 [[nodiscard]] const Eigen::Vector3d& e_pLOS() const { return _e_pLOS; }
96 [[nodiscard]] const Eigen::Vector3d& e_vLOS() const { return _e_vLOS; }
98 [[nodiscard]] const double& satElevation() const { return _satElevation; }
100 [[nodiscard]] const double& satAzimuth() const { return _satAzimuth; }
102 [[nodiscard]] const Clock::Corrections& satClock() const { return _satClock; }
103
106 {
107 double rho_r_s = 0.0;
109 double dpsr_T_r_s = 0.0;
110 double dpsr_I_r_s = 0.0;
111 double dpsr_ie_r_s = 0.0;
112 };
114
115 private:
116 std::shared_ptr<const GnssObs> _gnssObs = nullptr;
117 size_t _obsIdx = 0;
118 Eigen::Vector3d _e_satPos;
119 Eigen::Vector3d _e_satVel;
120 Eigen::Vector3d _e_pLOS;
121 Eigen::Vector3d _e_vLOS;
122 Clock::Corrections _satClock;
123 double _satElevation = 0.0;
124 double _satAzimuth = 0.0;
125 };
126
130 SignalObservation(std::shared_ptr<SatNavData> navData,
131 int8_t freqNum)
132 : _navData(std::move(navData)),
133 _freqNum(freqNum) {}
134
136 std::vector<ReceiverSpecificData> recvObs;
137
139 [[nodiscard]] const std::shared_ptr<const SatNavData>& navData() const { return _navData; }
141 [[nodiscard]] int8_t freqNum() const { return _freqNum; }
142
143 private:
144 std::shared_ptr<const SatNavData> _navData = nullptr;
145 int8_t _freqNum = -128;
146 };
147
149
150 std::set<SatelliteSystem> systems;
151 std::unordered_set<SatId> satellites;
152 std::array<size_t, GnssObs::ObservationType_COUNT> nObservables{};
153 std::array<size_t, GnssObs::ObservationType_COUNT> nObservablesUniqueSatellite{};
154
157};
158
159} // namespace NAV
Transformation collection.
Vector space operations.
GNSS helper functions.
Eigen::Vector3d e_calcLineOfSightUnitVector(const Eigen::Vector3d &e_posAnt, const Eigen::Vector3d &e_posSat)
Calculates the line-of-sight unit vector from the user antenna to the satellite.
double calcSatAzimuth(const Eigen::Vector3d &n_lineOfSightUnitVector)
Calculates the azimuth of the satellite from the antenna.
double calcSatElevation(const Eigen::Vector3d &n_lineOfSightUnitVector)
Calculates the elevation of the satellite from the antenna.
GNSS Observation messages.
Utility class for logging to console and file.
#define LOG_DATA
All output which occurs repeatedly every time observations are received.
Definition Logger.hpp:29
Satellite Navigation data (to calculate SatNavData and clock)
Structs identifying a unique satellite.
Unordered map wrapper.
ankerl::unordered_dense::map< Key, T > unordered_map
Unordered map type.
Definition Unordered_map.hpp:34
void move(std::vector< T > &v, size_t sourceIdx, size_t targetIdx)
Moves an element within a vector to a new position.
Definition Vector.hpp:26
Zenith hydrostatic and wet delay.
Satellite clock corrections.
Definition Clock.hpp:28
Stores the satellites observations.
Definition GnssObs.hpp:45
Terms used in the calculation.
Definition Observation.hpp:106
double dpsr_T_r_s
Estimated troposphere propagation error [m].
Definition Observation.hpp:109
double dpsr_ie_r_s
Sagnac correction [m].
Definition Observation.hpp:111
ZenithDelay tropoZenithDelay
Troposphere delay.
Definition Observation.hpp:108
double rho_r_s
Receiver-Satellite Range [m].
Definition Observation.hpp:107
double dpsr_I_r_s
Estimated ionosphere propagation error [m].
Definition Observation.hpp:110
double measVar
Variance of the measurement (psr [m^2], carrier [m^2], range-rate [m^2/s^2])
Definition Observation.hpp:50
double measurement
Measurement (psr [m], carrier [m], range-rate [m/s])
Definition Observation.hpp:49
double estimate
Estimate (psr [m], carrier [m], range-rate [m/s])
Definition Observation.hpp:48
Receiver specific data.
Definition Observation.hpp:44
const Eigen::Vector3d & e_satVel() const
Satellite velocity in ECEF frame coordinates [m/s].
Definition Observation.hpp:92
ReceiverSpecificData(std::shared_ptr< const GnssObs > gnssObs, size_t obsIdx, const Eigen::Vector3d &e_recPos, const Eigen::Vector3d &lla_recPos, const Eigen::Vector3d &e_recVel, const Eigen::Vector3d &e_satPos, const Eigen::Vector3d &e_satVel, Clock::Corrections satClock)
Constructor.
Definition Observation.hpp:62
const Clock::Corrections & satClock() const
Satellite clock information.
Definition Observation.hpp:102
const Eigen::Vector3d & e_vLOS() const
Velocity Line-of-sight unit vector in ECEF frame coordinates.
Definition Observation.hpp:96
const Eigen::Vector3d & e_pLOS() const
Position Line-of-sight unit vector in ECEF frame coordinates.
Definition Observation.hpp:94
CalcTerms terms
Sub terms used in the calculation.
Definition Observation.hpp:113
const double & satAzimuth() const
Satellite Azimuth [rad].
Definition Observation.hpp:100
const double & satElevation() const
Satellite Elevation [rad].
Definition Observation.hpp:98
const Eigen::Vector3d & e_satPos() const
Satellite position in ECEF frame coordinates [m].
Definition Observation.hpp:90
const GnssObs::ObservationData & gnssObsData() const
Returns the observation data.
Definition Observation.hpp:88
unordered_map< GnssObs::ObservationType, Observation > obs
Receiver observation of the signal.
Definition Observation.hpp:85
Receiver specific observation of the signal.
Definition Observation.hpp:41
int8_t freqNum() const
Frequency number. Only used for GLONASS G1 and G2.
Definition Observation.hpp:141
const std::shared_ptr< const SatNavData > & navData() const
Satellite Navigation data.
Definition Observation.hpp:139
std::vector< ReceiverSpecificData > recvObs
Receiver specific data.
Definition Observation.hpp:136
SignalObservation(std::shared_ptr< SatNavData > navData, int8_t freqNum)
Constructor.
Definition Observation.hpp:130
Observation storage type.
Definition Observation.hpp:38
void recalcObservableCounts()
Calculates/Recalculates the number of observables.
std::set< SatelliteSystem > systems
Satellite systems used.
Definition Observation.hpp:150
std::array< size_t, GnssObs::ObservationType_COUNT > nObservables
Number of observables.
Definition Observation.hpp:152
std::unordered_set< SatId > satellites
Satellites used.
Definition Observation.hpp:151
std::array< size_t, GnssObs::ObservationType_COUNT > nObservablesUniqueSatellite
Number of observables (counted once for each satellite)
Definition Observation.hpp:153
unordered_map< SatSigId, SignalObservation > signals
Observations and calculated data for each signal.
Definition Observation.hpp:148
Zenith delays and mapping factors.
Definition ZenithDelay.hpp:21