0.5.0
Loading...
Searching...
No Matches
UbloxGnssOrbitCollector.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
9/// @file UbloxGnssOrbitCollector.hpp
10/// @brief Collects UBX-RXM-SFRBX messages and provides the Orbit information
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2024-02-05
13
14#pragma once
15
16#include <mutex>
17#include <bitset>
18#include <memory>
19#include <unordered_map>
20#include <set>
21
25
27
28namespace ubx = NAV::vendor::ublox;
29
30namespace NAV
31{
32/// Collects UBX-RXM-SFRBX messages and provides the Orbit information
34{
35 public:
36 /// @brief Default constructor
38 /// @brief Destructor
39 ~UbloxGnssOrbitCollector() override;
40 /// @brief Copy constructor
42 /// @brief Move constructor
44 /// @brief Copy assignment operator
46 /// @brief Move assignment operator
48
49 /// @brief String representation of the Class Type
50 [[nodiscard]] static std::string typeStatic();
51
52 /// @brief String representation of the Class Type
53 [[nodiscard]] std::string type() const override;
54
55 /// @brief String representation of the Class Category
56 [[nodiscard]] static std::string category();
57
58 /// @brief ImGui config window which is shown on double click
59 /// @attention Don't forget to set _hasConfig to true in the constructor of the node
60 void guiConfig() override;
61
62 private:
63 constexpr static size_t INPUT_PORT_INDEX_UBLOX_OBS = 0; ///< @brief Flow (UbloxObs)
64 constexpr static size_t OUTPUT_PORT_INDEX_GNSS_NAV_INFO = 0; ///< @brief Object
65
66 /// @brief Initialize the node
67 bool initialize() override;
68
69 /// @brief Called when a link is to be deleted
70 /// @param[in] startPin Pin where the link starts
71 /// @param[in] endPin Pin where the link ends
72 void onDeleteLink(OutputPin& startPin, InputPin& endPin) override;
73
74 /// @brief Data object to share over the output pin
76
77 /// Mutex to lock if the connected ublox obs provider is a file reader
78 std::optional<std::unique_lock<std::mutex>> _postProcessingLock;
79
80 /// @brief Ephemeris builder to store unfinished ephemeris data till all subframes are collected
82 {
83 /// @brief Constructor
84 /// @param[in] satId Satellite identifier
85 /// @param[in] navData Nav data to store
86 EphemerisBuilder(const SatId& satId, std::shared_ptr<SatNavData> navData)
88 {
89 subframes.reset();
90 }
91
92 SatId satId; ///< Satellite Identifier
93 std::shared_ptr<SatNavData> navData; ///< Navigation data pointer
94 std::bitset<5> subframes; ///< Flags for which subframes were received already. e.g. Subframes 1, 2, 3 for GPS
95 };
96
97 /// @brief Map of ephemeris build helper for each satellite
98 std::vector<EphemerisBuilder> _ephemerisBuilder;
99
100 /// @brief List of IOD for each satellite
101 std::unordered_map<SatId, size_t> _lastAccessedBuilder;
102
103 /// List of satellite systems to emit warnings because conversion is not implemented yet
104 std::set<SatelliteSystem> _warningsNotImplemented;
105
106 /// @brief Searches the ephemeris builder for the given satellite and time. If nothing found returns a new instance.
107 /// @param[in] satId Satellite identifier
108 /// @param[in] insTime Time to search for (either time of ephemeris or time of clock)
109 /// @param[in] IOD Issue of Data (Ephemeris, Nav, ...)
110 /// @return Reference to the ephemeris builder
111 EphemerisBuilder& getEphemerisBuilder(const SatId& satId, const InsTime& insTime, size_t IOD = 0);
112
113 /// @brief Searches the ephemeris builder for the given Issue of Data Ephemeris
114 /// @param[in] satId Satellite Identifier
115 /// @param[in] IOD Issue of Data (Ephemeris, Nav, ...)
116 /// @return Reference to the ephemeris builder if it was found
117 std::optional<std::reference_wrapper<EphemerisBuilder>> getEphemerisBuilder(const SatId& satId, size_t IOD);
118
119 /// @brief Searches the most recent ephemeris builder for the given satellite
120 /// @param[in] satId Satellite identifier
121 /// @return Reference to the ephemeris builder if it was found
122 std::optional<std::reference_wrapper<EphemerisBuilder>> getLastEphemerisBuilder(const SatId& satId);
123
124 /// @brief Data receive function
125 /// @param[in] queue Queue with all the received data messages
126 /// @param[in] pinIdx Index of the pin the data is received on
127 void receiveObs(InputPin::NodeDataQueue& queue, size_t pinIdx);
128
129 /// @brief Decrypt the GPS SFRBX message
130 /// @param[in] satId Satellite Identifier
131 /// @param[in] sfrbx RAWX-SFRBX message
132 /// @param[in] insTime Time of the message
133 void decryptGPS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
134
135 /// @brief Decrypt the Galileo SFRBX message
136 /// @param[in] satId Satellite Identifier
137 /// @param[in] sfrbx RAWX-SFRBX message
138 /// @param[in] insTime Time of the message
139 void decryptGalileo(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
140
141 /// @brief Decrypt the GLONASS SFRBX message
142 /// @param[in] satId Satellite Identifier
143 /// @param[in] sfrbx RAWX-SFRBX message
144 /// @param[in] insTime Time of the message
145 void decryptGLONASS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
146
147 /// @brief Decrypt the BeiDou SFRBX message
148 /// @param[in] satId Satellite Identifier
149 /// @param[in] sfrbx RAWX-SFRBX message
150 /// @param[in] insTime Time of the message
151 void decryptBeiDou(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
152
153 /// @brief Decrypt the QZSS SFRBX message
154 /// @param[in] satId Satellite Identifier
155 /// @param[in] sfrbx RAWX-SFRBX message
156 /// @param[in] insTime Time of the message
157 void decryptQZSS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
158
159 /// @brief Decrypt the IRNSS SFRBX message
160 /// @param[in] satId Satellite Identifier
161 /// @param[in] sfrbx RAWX-SFRBX message
162 /// @param[in] insTime Time of the message
163 void decryptIRNSS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
164
165 /// @brief Decrypt the SBAS SFRBX message
166 /// @param[in] satId Satellite Identifier
167 /// @param[in] sfrbx RAWX-SFRBX message
168 /// @param[in] insTime Time of the message
169 void decryptSBAS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
170};
171
172} // namespace NAV
Navigation message information.
Node Class.
Satellite Navigation data (to calculate SatNavData and clock)
ublox Observation Class
GNSS Navigation message information.
Input pins of nodes.
Definition Pin.hpp:491
TsDeque< std::shared_ptr< const NAV::NodeData > > NodeDataQueue
Node data queue type.
Definition Pin.hpp:707
The class is responsible for all time-related tasks.
Definition InsTime.hpp:710
Node(std::string name)
Constructor.
Definition Node.cpp:30
Output pins of nodes.
Definition Pin.hpp:338
std::optional< std::reference_wrapper< EphemerisBuilder > > getLastEphemerisBuilder(const SatId &satId)
Searches the most recent ephemeris builder for the given satellite.
static std::string typeStatic()
String representation of the Class Type.
std::vector< EphemerisBuilder > _ephemerisBuilder
Map of ephemeris build helper for each satellite.
GnssNavInfo _gnssNavInfo
Data object to share over the output pin.
UbloxGnssOrbitCollector & operator=(const UbloxGnssOrbitCollector &)=delete
Copy assignment operator.
void receiveObs(InputPin::NodeDataQueue &queue, size_t pinIdx)
Data receive function.
static std::string category()
String representation of the Class Category.
void decryptGPS(const SatId &satId, const ubx::UbxRxmSfrbx &sfrbx, const InsTime &insTime)
Decrypt the GPS SFRBX message.
void guiConfig() override
ImGui config window which is shown on double click.
void decryptSBAS(const SatId &satId, const ubx::UbxRxmSfrbx &sfrbx, const InsTime &insTime)
Decrypt the SBAS SFRBX message.
void decryptGalileo(const SatId &satId, const ubx::UbxRxmSfrbx &sfrbx, const InsTime &insTime)
Decrypt the Galileo SFRBX message.
bool initialize() override
Initialize the node.
UbloxGnssOrbitCollector(UbloxGnssOrbitCollector &&)=delete
Move constructor.
void decryptGLONASS(const SatId &satId, const ubx::UbxRxmSfrbx &sfrbx, const InsTime &insTime)
Decrypt the GLONASS SFRBX message.
static constexpr size_t INPUT_PORT_INDEX_UBLOX_OBS
Flow (UbloxObs)
void decryptQZSS(const SatId &satId, const ubx::UbxRxmSfrbx &sfrbx, const InsTime &insTime)
Decrypt the QZSS SFRBX message.
EphemerisBuilder & getEphemerisBuilder(const SatId &satId, const InsTime &insTime, size_t IOD=0)
Searches the ephemeris builder for the given satellite and time. If nothing found returns a new insta...
void decryptIRNSS(const SatId &satId, const ubx::UbxRxmSfrbx &sfrbx, const InsTime &insTime)
Decrypt the IRNSS SFRBX message.
std::set< SatelliteSystem > _warningsNotImplemented
List of satellite systems to emit warnings because conversion is not implemented yet.
static constexpr size_t OUTPUT_PORT_INDEX_GNSS_NAV_INFO
Object.
UbloxGnssOrbitCollector()
Default constructor.
std::unordered_map< SatId, size_t > _lastAccessedBuilder
List of IOD for each satellite.
UbloxGnssOrbitCollector & operator=(UbloxGnssOrbitCollector &&)=delete
Move assignment operator.
void onDeleteLink(OutputPin &startPin, InputPin &endPin) override
Called when a link is to be deleted.
~UbloxGnssOrbitCollector() override
Destructor.
std::string type() const override
String representation of the Class Type.
void decryptBeiDou(const SatId &satId, const ubx::UbxRxmSfrbx &sfrbx, const InsTime &insTime)
Decrypt the BeiDou SFRBX message.
std::optional< std::unique_lock< std::mutex > > _postProcessingLock
Mutex to lock if the connected ublox obs provider is a file reader.
UbloxGnssOrbitCollector(const UbloxGnssOrbitCollector &)=delete
Copy constructor.
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:27
Identifies a satellite (satellite system and number)
Ephemeris builder to store unfinished ephemeris data till all subframes are collected.
std::shared_ptr< SatNavData > navData
Navigation data pointer.
std::bitset< 5 > subframes
Flags for which subframes were received already. e.g. Subframes 1, 2, 3 for GPS.
EphemerisBuilder(const SatId &satId, std::shared_ptr< SatNavData > navData)
Constructor.
Broadcast Navigation Data Subframe.