0.4.1
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 private:
59 constexpr static size_t INPUT_PORT_INDEX_UBLOX_OBS = 0; ///< @brief Flow (UbloxObs)
60 constexpr static size_t OUTPUT_PORT_INDEX_GNSS_NAV_INFO = 0; ///< @brief Object
61
62 /// @brief Initialize the node
63 bool initialize() override;
64
65 /// @brief Called when a link is to be deleted
66 /// @param[in] startPin Pin where the link starts
67 /// @param[in] endPin Pin where the link ends
68 void onDeleteLink(OutputPin& startPin, InputPin& endPin) override;
69
70 /// @brief Data object to share over the output pin
72
73 /// Mutex to lock if the connected ublox obs provider is a file reader
74 std::optional<std::unique_lock<std::mutex>> _postProcessingLock;
75
76 /// @brief Ephemeris builder to store unfinished ephemeris data till all subframes are collected
78 {
79 /// @brief Constructor
80 /// @param[in] satId Satellite identifier
81 /// @param[in] navData Nav data to store
82 EphemerisBuilder(const SatId& satId, std::shared_ptr<SatNavData> navData)
84 {
85 subframes.reset();
86 }
87
88 SatId satId; ///< Satellite Identifier
89 std::shared_ptr<SatNavData> navData; ///< Navigation data pointer
90 std::bitset<5> subframes; ///< Flags for which subframes were received already. e.g. Subframes 1, 2, 3 for GPS
91 };
92
93 /// @brief Map of ephemeris build helper for each satellite
94 std::vector<EphemerisBuilder> _ephemerisBuilder;
95
96 /// @brief List of IOD for each satellite
97 std::unordered_map<SatId, size_t> _lastAccessedBuilder;
98
99 /// List of satellite systems to emit warnings because conversion is not implemented yet
100 std::set<SatelliteSystem> _warningsNotImplemented;
101
102 /// @brief Searches the ephemeris builder for the given satellite and time. If nothing found returns a new instance.
103 /// @param[in] satId Satellite identifier
104 /// @param[in] insTime Time to search for (either time of ephemeris or time of clock)
105 /// @param[in] IOD Issue of Data (Ephemeris, Nav, ...)
106 /// @return Reference to the ephemeris builder
107 EphemerisBuilder& getEphemerisBuilder(const SatId& satId, const InsTime& insTime, size_t IOD = 0);
108
109 /// @brief Searches the ephemeris builder for the given Issue of Data Ephemeris
110 /// @param[in] satId Satellite Identifier
111 /// @param[in] IOD Issue of Data (Ephemeris, Nav, ...)
112 /// @return Reference to the ephemeris builder if it was found
113 std::optional<std::reference_wrapper<EphemerisBuilder>> getEphemerisBuilder(const SatId& satId, size_t IOD);
114
115 /// @brief Searches the most recent ephemeris builder for the given satellite
116 /// @param[in] satId Satellite identifier
117 /// @return Reference to the ephemeris builder if it was found
118 std::optional<std::reference_wrapper<EphemerisBuilder>> getLastEphemerisBuilder(const SatId& satId);
119
120 /// @brief Data receive function
121 /// @param[in] queue Queue with all the received data messages
122 /// @param[in] pinIdx Index of the pin the data is received on
123 void receiveObs(InputPin::NodeDataQueue& queue, size_t pinIdx);
124
125 /// @brief Decrypt the GPS SFRBX message
126 /// @param[in] satId Satellite Identifier
127 /// @param[in] sfrbx RAWX-SFRBX message
128 /// @param[in] insTime Time of the message
129 void decryptGPS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
130
131 /// @brief Decrypt the Galileo SFRBX message
132 /// @param[in] satId Satellite Identifier
133 /// @param[in] sfrbx RAWX-SFRBX message
134 /// @param[in] insTime Time of the message
135 void decryptGalileo(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
136
137 /// @brief Decrypt the GLONASS SFRBX message
138 /// @param[in] satId Satellite Identifier
139 /// @param[in] sfrbx RAWX-SFRBX message
140 /// @param[in] insTime Time of the message
141 void decryptGLONASS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
142
143 /// @brief Decrypt the BeiDou SFRBX message
144 /// @param[in] satId Satellite Identifier
145 /// @param[in] sfrbx RAWX-SFRBX message
146 /// @param[in] insTime Time of the message
147 void decryptBeiDou(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
148
149 /// @brief Decrypt the QZSS SFRBX message
150 /// @param[in] satId Satellite Identifier
151 /// @param[in] sfrbx RAWX-SFRBX message
152 /// @param[in] insTime Time of the message
153 void decryptQZSS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
154
155 /// @brief Decrypt the IRNSS SFRBX message
156 /// @param[in] satId Satellite Identifier
157 /// @param[in] sfrbx RAWX-SFRBX message
158 /// @param[in] insTime Time of the message
159 void decryptIRNSS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
160
161 /// @brief Decrypt the SBAS SFRBX message
162 /// @param[in] satId Satellite Identifier
163 /// @param[in] sfrbx RAWX-SFRBX message
164 /// @param[in] insTime Time of the message
165 void decryptSBAS(const SatId& satId, const ubx::UbxRxmSfrbx& sfrbx, const InsTime& insTime);
166};
167
168} // 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 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.