| Line | Branch | Exec | Source |
|---|---|---|---|
| 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 | #include "NodeRegistry.hpp" | ||
| 10 | |||
| 11 | #include "util/Logger.hpp" | ||
| 12 | |||
| 13 | #include "internal/Node/Node.hpp" | ||
| 14 | #include "NodeData/NodeData.hpp" | ||
| 15 | |||
| 16 | #include <string> | ||
| 17 | |||
| 18 | /* -------------------------------------------------------------------------------------------------------- */ | ||
| 19 | /* Private Members */ | ||
| 20 | /* -------------------------------------------------------------------------------------------------------- */ | ||
| 21 | |||
| 22 | namespace NAV::NodeRegistry | ||
| 23 | { | ||
| 24 | namespace | ||
| 25 | { | ||
| 26 | |||
| 27 | /// List of all registered nodes. | ||
| 28 | /// Key: category, Value: Nodes | ||
| 29 | std::map<std::string, std::vector<NodeInfo>> _registeredNodes; | ||
| 30 | |||
| 31 | /// List of all registered node data types. | ||
| 32 | /// Key: NodeData.type(), Value: parentTypes() | ||
| 33 | std::map<std::string, std::vector<std::string>> _registeredNodeDataTypes; | ||
| 34 | |||
| 35 | /* -------------------------------------------------------------------------------------------------------- */ | ||
| 36 | /* Private Function Declarations */ | ||
| 37 | /* -------------------------------------------------------------------------------------------------------- */ | ||
| 38 | |||
| 39 | /// @brief Registers a Node | ||
| 40 | /// @tparam T Node Class to register | ||
| 41 | template<std::derived_from<Node> T> | ||
| 42 | 13224 | void registerNodeType() | |
| 43 | { | ||
| 44 | 13224 | NodeInfo info; | |
| 45 | 13581 | info.constructor = []() { return new T(); }; // NOLINT(cppcoreguidelines-owning-memory) | |
| 46 |
1/2✓ Branch 1 taken 6612 times.
✗ Branch 2 not taken.
|
13224 | info.type = T::typeStatic(); |
| 47 | |||
| 48 |
1/2✓ Branch 1 taken 6612 times.
✗ Branch 2 not taken.
|
13224 | T obj; |
| 49 |
2/2✓ Branch 5 taken 4902 times.
✓ Branch 6 taken 6612 times.
|
23028 | for (const InputPin& pin : obj.inputPins) |
| 50 | { | ||
| 51 |
1/2✓ Branch 1 taken 4902 times.
✗ Branch 2 not taken.
|
9804 | info.pinInfoList.emplace_back(pin.kind, pin.type, pin.dataIdentifier); |
| 52 | } | ||
| 53 |
2/2✓ Branch 5 taken 6726 times.
✓ Branch 6 taken 6612 times.
|
26676 | for (const OutputPin& pin : obj.outputPins) |
| 54 | { | ||
| 55 |
1/2✓ Branch 1 taken 6726 times.
✗ Branch 2 not taken.
|
13452 | info.pinInfoList.emplace_back(pin.kind, pin.type, pin.dataIdentifier); |
| 56 | } | ||
| 57 | |||
| 58 |
3/6✓ Branch 1 taken 6612 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6612 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6612 times.
✗ Branch 8 not taken.
|
13224 | _registeredNodes[T::category()].push_back(info); |
| 59 | 13224 | } | |
| 60 | |||
| 61 | /// @brief Register a NodeData | ||
| 62 | /// @tparam T NodeData Class to register | ||
| 63 | template<std::derived_from<NodeData> T> | ||
| 64 | 5244 | void registerNodeDataType() | |
| 65 | { | ||
| 66 |
5/8✓ Branch 1 taken 2508 times.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2508 times.
✓ Branch 5 taken 114 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2508 times.
✗ Branch 8 not taken.
|
5244 | _registeredNodeDataTypes[T::type()] = T::parentTypes(); |
| 67 | 5244 | } | |
| 68 | |||
| 69 | } // namespace | ||
| 70 | } // namespace NAV::NodeRegistry | ||
| 71 | |||
| 72 | /* -------------------------------------------------------------------------------------------------------- */ | ||
| 73 | /* Function Definitions */ | ||
| 74 | /* -------------------------------------------------------------------------------------------------------- */ | ||
| 75 | |||
| 76 | ✗ | bool NAV::NodeRegistry::NodeInfo::hasCompatiblePin(const Pin* pin) const | |
| 77 | { | ||
| 78 | ✗ | if (pin == nullptr) | |
| 79 | { | ||
| 80 | ✗ | return true; | |
| 81 | } | ||
| 82 | |||
| 83 | ✗ | Pin::Kind searchPinKind = pin->kind == Pin::Kind::Input ? Pin::Kind::Output : Pin::Kind::Input; | |
| 84 | ✗ | for (const auto& pinInfo : this->pinInfoList) | |
| 85 | { | ||
| 86 | ✗ | const std::vector<std::string>& startPinDataIdentifier = pin->kind == Pin::Kind::Input ? pinInfo.dataIdentifier : pin->dataIdentifier; | |
| 87 | ✗ | const std::vector<std::string>& endPinDataIdentifier = pin->kind == Pin::Kind::Input ? pin->dataIdentifier : pinInfo.dataIdentifier; | |
| 88 | ✗ | const std::string& startPinParentNodeType = pin->kind == Pin::Kind::Input ? this->type : pin->parentNode->type(); | |
| 89 | |||
| 90 | ✗ | if (pinInfo.kind == searchPinKind && pinInfo.type == pin->type) | |
| 91 | { | ||
| 92 | ✗ | if ((pinInfo.type == Pin::Type::Flow | |
| 93 | ✗ | && NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(startPinDataIdentifier, endPinDataIdentifier)) | |
| 94 | ✗ | || (pinInfo.type == Pin::Type::Delegate | |
| 95 | ✗ | && std::ranges::find(endPinDataIdentifier, startPinParentNodeType) != endPinDataIdentifier.end()) | |
| 96 | ✗ | || ((pinInfo.type == Pin::Type::Object || pinInfo.type == Pin::Type::Matrix) // NOLINT(misc-redundant-expression) - false positive warning | |
| 97 | ✗ | && Pin::dataIdentifierHaveCommon(startPinDataIdentifier, endPinDataIdentifier)) | |
| 98 | ✗ | || pinInfo.type == Pin::Type::Bool || pinInfo.type == Pin::Type::Int || pinInfo.type == Pin::Type::Float || pinInfo.type == Pin::Type::String) | |
| 99 | { | ||
| 100 | ✗ | return true; | |
| 101 | } | ||
| 102 | } | ||
| 103 | ✗ | } | |
| 104 | |||
| 105 | ✗ | return false; | |
| 106 | } | ||
| 107 | |||
| 108 | 357 | const std::map<std::string, std::vector<NAV::NodeRegistry::NodeInfo>>& NAV::NodeRegistry::RegisteredNodes() | |
| 109 | { | ||
| 110 | 357 | return _registeredNodes; | |
| 111 | } | ||
| 112 | |||
| 113 | 70184705 | bool NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(const std::vector<std::string>& childTypes, const std::vector<std::string>& parentTypes) | |
| 114 | { | ||
| 115 |
2/2✓ Branch 5 taken 70182874 times.
✓ Branch 6 taken 69504931 times.
|
139680210 | for (const auto& childType : childTypes) |
| 116 | { | ||
| 117 |
2/2✓ Branch 5 taken 70186241 times.
✓ Branch 6 taken 69495505 times.
|
139469596 | for (const auto& parentType : parentTypes) |
| 118 | { | ||
| 119 |
2/2✓ Branch 1 taken 683364 times.
✓ Branch 2 taken 69503172 times.
|
70185251 | if (childType == parentType) |
| 120 | { | ||
| 121 | 683505 | return true; | |
| 122 | } | ||
| 123 |
2/2✓ Branch 7 taken 1597238468 times.
✓ Branch 8 taken 69284262 times.
|
1666602829 | for (const auto& [dataType, parentTypes] : _registeredNodeDataTypes) |
| 124 | { | ||
| 125 |
2/2✓ Branch 1 taken 69504072 times.
✓ Branch 2 taken 1527594181 times.
|
1596792792 | if (dataType == childType) |
| 126 | { | ||
| 127 |
2/2✓ Branch 5 taken 63427029 times.
✓ Branch 6 taken 69505476 times.
|
132934909 | for (const auto& parentTypeOfChild : parentTypes) |
| 128 | { | ||
| 129 |
9/16✓ Branch 1 taken 63431599 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 63431514 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 63433822 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 63432305 times.
✓ Branch 11 taken 63431275 times.
✓ Branch 14 taken 63431507 times.
✓ Branch 15 taken 63430978 times.
✓ Branch 17 taken 141 times.
✓ Branch 18 taken 63430837 times.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
|
380588538 | if (NodeDataTypeAnyIsChildOf({ parentTypeOfChild }, { parentType })) |
| 130 | { | ||
| 131 | 141 | return true; | |
| 132 | } | ||
| 133 | } | ||
| 134 | } | ||
| 135 | } | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 139 | 69504931 | return false; | |
| 140 | 126865039 | } | |
| 141 | |||
| 142 | 12 | std::vector<std::string> NAV::NodeRegistry::GetParentNodeDataTypes(const std::string& type) | |
| 143 | { | ||
| 144 | 12 | std::vector<std::string> returnTypes; | |
| 145 |
2/4✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
|
12 | if (_registeredNodeDataTypes.contains(type)) |
| 146 | { | ||
| 147 |
1/2✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
|
12 | const auto& parentTypes = _registeredNodeDataTypes.at(type); |
| 148 | |||
| 149 | // Add all the immediate parents | ||
| 150 |
2/2✓ Branch 1 taken 8 times.
✓ Branch 2 taken 4 times.
|
12 | if (!parentTypes.empty()) |
| 151 | { | ||
| 152 |
1/2✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
|
8 | returnTypes.insert(returnTypes.end(), parentTypes.begin(), parentTypes.end()); |
| 153 | } | ||
| 154 | |||
| 155 | // Add parents of parents | ||
| 156 |
2/2✓ Branch 5 taken 10 times.
✓ Branch 6 taken 12 times.
|
22 | for (const auto& parentType : parentTypes) |
| 157 | { | ||
| 158 |
1/2✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
|
10 | auto parentParentTypes = GetParentNodeDataTypes(parentType); |
| 159 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 2 taken 4 times.
|
10 | if (!parentParentTypes.empty()) |
| 160 | { | ||
| 161 |
1/2✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
|
6 | returnTypes.insert(returnTypes.end(), parentParentTypes.begin(), parentParentTypes.end()); |
| 162 | } | ||
| 163 | 10 | } | |
| 164 | } | ||
| 165 | |||
| 166 | 12 | return returnTypes; | |
| 167 | ✗ | } | |
| 168 | |||
| 169 | // Utility | ||
| 170 | #include "Nodes/Utility/Combiner.hpp" | ||
| 171 | #include "Nodes/Utility/Demo.hpp" | ||
| 172 | #include "Nodes/Utility/GroupBox.hpp" | ||
| 173 | #include "Nodes/Utility/Merger.hpp" | ||
| 174 | #include "Nodes/Utility/Terminator.hpp" | ||
| 175 | #include "Nodes/Utility/TimeWindow.hpp" | ||
| 176 | // Converter | ||
| 177 | #include "Nodes/Converter/GNSS/RtklibPosConverter.hpp" | ||
| 178 | #include "Nodes/Converter/GNSS/UartPacketConverter.hpp" | ||
| 179 | #include "Nodes/Converter/GNSS/UbloxGnssObsConverter.hpp" | ||
| 180 | #include "Nodes/Converter/GNSS/UbloxGnssOrbitCollector.hpp" | ||
| 181 | #include "Nodes/Converter/IMU/VectorNavBinaryConverter.hpp" | ||
| 182 | // Data Link | ||
| 183 | #if __linux__ || __APPLE__ | ||
| 184 | #include "Nodes/DataLink/mavlinkSend.hpp" | ||
| 185 | #endif | ||
| 186 | #include "Nodes/DataLink/udpSend.hpp" | ||
| 187 | #include "Nodes/DataLink/udpRecv.hpp" | ||
| 188 | // Data Logger | ||
| 189 | #include "Nodes/DataLogger/General/CsvLogger.hpp" | ||
| 190 | #include "Nodes/DataLogger/General/KmlLogger.hpp" | ||
| 191 | #include "Nodes/DataLogger/General/MatrixLogger.hpp" | ||
| 192 | #include "Nodes/DataLogger/GNSS/RinexObsLogger.hpp" | ||
| 193 | #include "Nodes/DataLogger/GNSS/UartDataLogger.hpp" | ||
| 194 | #include "Nodes/DataLogger/IMU/VectorNavDataLogger.hpp" | ||
| 195 | #include "Nodes/DataLogger/WiFi/WiFiObsLogger.hpp" | ||
| 196 | // Data Processor | ||
| 197 | #include "Nodes/DataProcessor/ErrorModel/AllanDeviation.hpp" | ||
| 198 | #include "Nodes/DataProcessor/ErrorModel/ErrorModel.hpp" | ||
| 199 | #include "Nodes/DataProcessor/GNSS/GnssAnalyzer.hpp" | ||
| 200 | #include "Nodes/DataProcessor/GNSS/RealTimeKinematic.hpp" | ||
| 201 | #include "Nodes/DataProcessor/GNSS/SinglePointPositioning.hpp" | ||
| 202 | #include "Nodes/DataProcessor/Integrator/ImuIntegrator.hpp" | ||
| 203 | #include "Nodes/DataProcessor/KalmanFilter/LooselyCoupledKF.hpp" | ||
| 204 | #include "Nodes/DataProcessor/SensorCombiner/ImuFusion.hpp" | ||
| 205 | #include "Nodes/DataProcessor/WiFi/WiFiPositioning.hpp" | ||
| 206 | #include "Nodes/DataProcessor/Filter/LowPassFilter.hpp" | ||
| 207 | #include "Nodes/DataProcessor/Barometer/PressToHgt.hpp" | ||
| 208 | // Data Provider | ||
| 209 | #include "Nodes/DataProvider/CSV/CsvFile.hpp" | ||
| 210 | #include "Nodes/DataProvider/GNSS/FileReader/RinexNavFile.hpp" | ||
| 211 | #include "Nodes/DataProvider/GNSS/FileReader/RinexObsFile.hpp" | ||
| 212 | #include "Nodes/DataProvider/GNSS/FileReader/EmlidFile.hpp" | ||
| 213 | #include "Nodes/DataProvider/GNSS/FileReader/RtklibPosFile.hpp" | ||
| 214 | #include "Nodes/DataProvider/GNSS/FileReader/NmeaFile.hpp" | ||
| 215 | #include "Nodes/DataProvider/GNSS/FileReader/UbloxFile.hpp" | ||
| 216 | #include "Nodes/DataProvider/GNSS/Sensors/EmlidSensor.hpp" | ||
| 217 | #include "Nodes/DataProvider/GNSS/Sensors/UbloxSensor.hpp" | ||
| 218 | #include "Nodes/DataProvider/IMU/FileReader/ImuFile.hpp" | ||
| 219 | #include "Nodes/DataProvider/IMU/FileReader/KvhFile.hpp" | ||
| 220 | #include "Nodes/DataProvider/IMU/FileReader/VectorNavFile.hpp" | ||
| 221 | #include "Nodes/DataProvider/IMU/Sensors/KvhSensor.hpp" | ||
| 222 | #include "Nodes/DataProvider/IMU/Sensors/Navio2Sensor.hpp" | ||
| 223 | #include "Nodes/DataProvider/IMU/Sensors/VectorNavSensor.hpp" | ||
| 224 | #include "Nodes/DataProvider/IMU/Sensors/Ln200Sensor.hpp" | ||
| 225 | #include "Nodes/DataProvider/IMU/FileReader/UlogFile.hpp" | ||
| 226 | #include "Nodes/DataProvider/State/PosVelAttFile.hpp" | ||
| 227 | #include "Nodes/DataProvider/IMU/FileReader/MultiImuFile.hpp" | ||
| 228 | #include "Nodes/DataProvider/WiFi/Sensors/EspressifSensor.hpp" | ||
| 229 | #include "Nodes/DataProvider/WiFi/Sensors/ArubaSensor.hpp" | ||
| 230 | #include "Nodes/DataProvider/WiFi/FileReader/WiFiObsFile.hpp" | ||
| 231 | // Data Simulator | ||
| 232 | #include "Nodes/DataProvider/IMU/Simulators/ImuSimulator.hpp" | ||
| 233 | #include "Nodes/DataProvider/Barometer/Simulators/BaroSimulator.hpp" | ||
| 234 | // Plotting | ||
| 235 | #include "Nodes/Plotting/Plot.hpp" | ||
| 236 | // State | ||
| 237 | #include "Nodes/State/PosVelAttInitializer.hpp" | ||
| 238 | // Experimental | ||
| 239 | #include "Nodes/Experimental/DataProcessor/ARMA.hpp" | ||
| 240 | #include "Nodes/Experimental/DataProvider/IMU/NetworkStream/SkydelNetworkStream.hpp" | ||
| 241 | #include "Nodes/Experimental/Simple/Delay.hpp" | ||
| 242 | |||
| 243 | 114 | void NAV::NodeRegistry::RegisterNodeTypes() | |
| 244 | { | ||
| 245 | LOG_TRACE("called"); | ||
| 246 | |||
| 247 | 114 | Node::_autostartWorker = false; | |
| 248 | |||
| 249 | // Utility | ||
| 250 | 114 | registerNodeType<Combiner>(); | |
| 251 | 114 | registerNodeType<Demo>(); | |
| 252 | 114 | registerNodeType<GroupBox>(); | |
| 253 | 114 | registerNodeType<Merger>(); | |
| 254 | 114 | registerNodeType<Terminator>(); | |
| 255 | 114 | registerNodeType<TimeWindow>(); | |
| 256 | // Converter | ||
| 257 | 114 | registerNodeType<RtklibPosConverter>(); | |
| 258 | 114 | registerNodeType<UartPacketConverter>(); | |
| 259 | 114 | registerNodeType<UbloxGnssObsConverter>(); | |
| 260 | 114 | registerNodeType<UbloxGnssOrbitCollector>(); | |
| 261 | 114 | registerNodeType<VectorNavBinaryConverter>(); | |
| 262 | // Data Link | ||
| 263 | #if __linux__ || __APPLE__ | ||
| 264 | 114 | registerNodeType<MavlinkSend>(); | |
| 265 | #endif | ||
| 266 | 114 | registerNodeType<UdpSend>(); | |
| 267 | 114 | registerNodeType<UdpRecv>(); | |
| 268 | // Data Logger | ||
| 269 | 114 | registerNodeType<CsvLogger>(); | |
| 270 | 114 | registerNodeType<KmlLogger>(); | |
| 271 | 114 | registerNodeType<MatrixLogger>(); | |
| 272 | 114 | registerNodeType<RinexObsLogger>(); | |
| 273 | 114 | registerNodeType<UartDataLogger>(); | |
| 274 | 114 | registerNodeType<VectorNavDataLogger>(); | |
| 275 | 114 | registerNodeType<WiFiObsLogger>(); | |
| 276 | // Data Processor | ||
| 277 | 114 | registerNodeType<AllanDeviation>(); | |
| 278 | 114 | registerNodeType<ErrorModel>(); | |
| 279 | 114 | registerNodeType<GnssAnalyzer>(); | |
| 280 | 114 | registerNodeType<RealTimeKinematic>(); | |
| 281 | 114 | registerNodeType<SinglePointPositioning>(); | |
| 282 | 114 | registerNodeType<ImuIntegrator>(); | |
| 283 | 114 | registerNodeType<LooselyCoupledKF>(); | |
| 284 | 114 | registerNodeType<LowPassFilter>(); | |
| 285 | 114 | registerNodeType<PressToHgt>(); | |
| 286 | 114 | registerNodeType<ImuFusion>(); | |
| 287 | 114 | registerNodeType<WiFiPositioning>(); | |
| 288 | // Data Provider | ||
| 289 | 114 | registerNodeType<CsvFile>(); | |
| 290 | 114 | registerNodeType<RinexNavFile>(); | |
| 291 | 114 | registerNodeType<RinexObsFile>(); | |
| 292 | 114 | registerNodeType<EmlidFile>(); | |
| 293 | 114 | registerNodeType<RtklibPosFile>(); | |
| 294 | 114 | registerNodeType<NmeaFile>(); | |
| 295 | 114 | registerNodeType<UbloxFile>(); | |
| 296 | 114 | registerNodeType<EmlidSensor>(); | |
| 297 | 114 | registerNodeType<UbloxSensor>(); | |
| 298 | 114 | registerNodeType<ImuFile>(); | |
| 299 | 114 | registerNodeType<KvhFile>(); | |
| 300 | 114 | registerNodeType<VectorNavFile>(); | |
| 301 | 114 | registerNodeType<KvhSensor>(); | |
| 302 | 114 | registerNodeType<Navio2Sensor>(); | |
| 303 | 114 | registerNodeType<VectorNavSensor>(); | |
| 304 | 114 | registerNodeType<Ln200Sensor>(); | |
| 305 | 114 | registerNodeType<UlogFile>(); | |
| 306 | 114 | registerNodeType<PosVelAttFile>(); | |
| 307 | 114 | registerNodeType<MultiImuFile>(); | |
| 308 | 114 | registerNodeType<EspressifSensor>(); | |
| 309 | 114 | registerNodeType<ArubaSensor>(); | |
| 310 | 114 | registerNodeType<WiFiObsFile>(); | |
| 311 | // Data Simulator | ||
| 312 | 114 | registerNodeType<ImuSimulator>(); | |
| 313 | 114 | registerNodeType<BaroSimulator>(); | |
| 314 | // Experimental | ||
| 315 | // registerNodeType<NAV::experimental::ARMA>(); | ||
| 316 | // registerNodeType<NAV::experimental::SkydelNetworkStream>(); | ||
| 317 | // registerNodeType<NAV::experimental::Delay>(); | ||
| 318 | // Plotting | ||
| 319 | 114 | registerNodeType<Plot>(); | |
| 320 | // State | ||
| 321 | 114 | registerNodeType<PosVelAttInitializer>(); | |
| 322 | |||
| 323 | 114 | Node::_autostartWorker = true; | |
| 324 | 114 | } | |
| 325 | |||
| 326 | #include "NodeData/General/DynamicData.hpp" | ||
| 327 | #include "NodeData/General/StringObs.hpp" | ||
| 328 | #include "NodeData/GNSS/EmlidObs.hpp" | ||
| 329 | #include "NodeData/GNSS/GnssCombination.hpp" | ||
| 330 | #include "NodeData/GNSS/GnssObs.hpp" | ||
| 331 | #include "NodeData/GNSS/RtklibPosObs.hpp" | ||
| 332 | #include "NodeData/GNSS/RtkSolution.hpp" | ||
| 333 | #include "NodeData/GNSS/SppSolution.hpp" | ||
| 334 | #include "NodeData/GNSS/UbloxObs.hpp" | ||
| 335 | #include "NodeData/IMU/ImuObs.hpp" | ||
| 336 | #include "NodeData/IMU/ImuObsSimulated.hpp" | ||
| 337 | #include "NodeData/IMU/ImuObsWDelta.hpp" | ||
| 338 | #include "NodeData/IMU/KvhObs.hpp" | ||
| 339 | #include "NodeData/IMU/VectorNavBinaryOutput.hpp" | ||
| 340 | #include "NodeData/State/InsGnssLCKFSolution.hpp" | ||
| 341 | #include "NodeData/State/InsGnssTCKFSolution.hpp" | ||
| 342 | #include "NodeData/State/Pos.hpp" | ||
| 343 | #include "NodeData/State/PosVel.hpp" | ||
| 344 | #include "NodeData/State/PosVelAtt.hpp" | ||
| 345 | #include "NodeData/Baro/BaroPressObs.hpp" | ||
| 346 | #include "NodeData/Baro/BaroHgt.hpp" | ||
| 347 | |||
| 348 | #include "NodeData/WiFi/WiFiObs.hpp" | ||
| 349 | #include "NodeData/WiFi/WiFiPositioningSolution.hpp" | ||
| 350 | |||
| 351 | 114 | void NAV::NodeRegistry::RegisterNodeDataTypes() | |
| 352 | { | ||
| 353 | 114 | registerNodeDataType<NodeData>(); | |
| 354 | // General | ||
| 355 | 114 | registerNodeDataType<DynamicData>(); | |
| 356 | 114 | registerNodeDataType<StringObs>(); | |
| 357 | // GNSS | ||
| 358 | 114 | registerNodeDataType<EmlidObs>(); | |
| 359 | 114 | registerNodeDataType<GnssCombination>(); | |
| 360 | 114 | registerNodeDataType<GnssObs>(); | |
| 361 | 114 | registerNodeDataType<RtklibPosObs>(); | |
| 362 | 114 | registerNodeDataType<RtkSolution>(); | |
| 363 | 114 | registerNodeDataType<SppSolution>(); | |
| 364 | 114 | registerNodeDataType<UbloxObs>(); | |
| 365 | // IMU | ||
| 366 | 114 | registerNodeDataType<ImuObs>(); | |
| 367 | 114 | registerNodeDataType<ImuObsSimulated>(); | |
| 368 | 114 | registerNodeDataType<ImuObsWDelta>(); | |
| 369 | 114 | registerNodeDataType<KvhObs>(); | |
| 370 | 114 | registerNodeDataType<VectorNavBinaryOutput>(); | |
| 371 | // State | ||
| 372 | 114 | registerNodeDataType<InsGnssLCKFSolution>(); | |
| 373 | 114 | registerNodeDataType<Pos>(); | |
| 374 | 114 | registerNodeDataType<PosVel>(); | |
| 375 | 114 | registerNodeDataType<PosVelAtt>(); | |
| 376 | // WiFi | ||
| 377 | 114 | registerNodeDataType<WiFiObs>(); | |
| 378 | 114 | registerNodeDataType<WiFiPositioningSolution>(); | |
| 379 | // Barometer | ||
| 380 | 114 | registerNodeDataType<BaroPressObs>(); | |
| 381 | 114 | registerNodeDataType<BaroHgt>(); | |
| 382 | 114 | } | |
| 383 | |||
| 384 | 624654 | std::vector<std::string> NAV::NodeRegistry::GetStaticDataDescriptors(const std::vector<std::string>& dataIdentifier) | |
| 385 | { | ||
| 386 | // ATTENTION: Entries need to be in correct inheritance order (deepest inheritance first) | ||
| 387 | |||
| 388 | // NodeData | ||
| 389 |
6/10✓ Branch 1 taken 624654 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624654 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624654 times.
✓ Branch 8 taken 624654 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 624652 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873962 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { DynamicData::type() })) { return DynamicData::GetStaticDataDescriptors(); } |
| 390 |
5/10✓ Branch 1 taken 624652 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624652 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624652 times.
✓ Branch 8 taken 624652 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 624652 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873956 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { StringObs::type() })) { return StringObs::GetStaticDataDescriptors(); } |
| 391 |
5/10✓ Branch 1 taken 624652 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624652 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624652 times.
✓ Branch 8 taken 624652 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 624652 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873956 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { GnssCombination::type() })) { return GnssCombination::GetStaticDataDescriptors(); } |
| 392 |
5/10✓ Branch 1 taken 624652 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624652 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624652 times.
✓ Branch 8 taken 624652 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 624652 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873956 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { GnssObs::type() })) { return GnssObs::GetStaticDataDescriptors(); } |
| 393 |
6/10✓ Branch 1 taken 624652 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624652 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624652 times.
✓ Branch 8 taken 624652 times.
✓ Branch 10 taken 7 times.
✓ Branch 11 taken 624645 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873956 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { VectorNavBinaryOutput::type() })) { return VectorNavBinaryOutput::GetStaticDataDescriptors(); } |
| 394 |
5/10✓ Branch 1 taken 624645 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624645 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624645 times.
✓ Branch 8 taken 624645 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 624645 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873935 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { EmlidObs::type() })) { return EmlidObs::GetStaticDataDescriptors(); } |
| 395 |
5/10✓ Branch 1 taken 624645 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624645 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624645 times.
✓ Branch 8 taken 624645 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 624645 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873935 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { UbloxObs::type() })) { return UbloxObs::GetStaticDataDescriptors(); } |
| 396 |
5/10✓ Branch 1 taken 624645 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624645 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624645 times.
✓ Branch 8 taken 624645 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 624645 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873935 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { WiFiObs::type() })) { return WiFiObs::GetStaticDataDescriptors(); } |
| 397 | // Pos | ||
| 398 |
5/10✓ Branch 1 taken 624645 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624645 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624645 times.
✓ Branch 8 taken 624645 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 624645 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873935 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { InsGnssTCKFSolution::type() })) { return InsGnssTCKFSolution::GetStaticDataDescriptors(); } |
| 399 |
6/10✓ Branch 1 taken 624645 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 624645 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 624645 times.
✓ Branch 8 taken 624645 times.
✓ Branch 10 taken 290676 times.
✓ Branch 11 taken 333969 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1873935 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { InsGnssLCKFSolution::type() })) { return InsGnssLCKFSolution::GetStaticDataDescriptors(); } |
| 400 |
6/10✓ Branch 1 taken 333969 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 333969 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 333969 times.
✓ Branch 8 taken 333969 times.
✓ Branch 10 taken 312310 times.
✓ Branch 11 taken 21659 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
1001907 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { PosVelAtt::type() })) { return PosVelAtt::GetStaticDataDescriptors(); } |
| 401 |
6/10✓ Branch 1 taken 21659 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 21659 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 21659 times.
✓ Branch 8 taken 21659 times.
✓ Branch 10 taken 7213 times.
✓ Branch 11 taken 14446 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
64977 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { RtkSolution::type() })) { return RtkSolution::GetStaticDataDescriptors(); } |
| 402 |
6/10✓ Branch 1 taken 14446 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 14446 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 14446 times.
✓ Branch 8 taken 14446 times.
✓ Branch 10 taken 7214 times.
✓ Branch 11 taken 7232 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
43338 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { SppSolution::type() })) { return SppSolution::GetStaticDataDescriptors(); } |
| 403 |
6/10✓ Branch 1 taken 7232 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 7232 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 7232 times.
✓ Branch 8 taken 7232 times.
✓ Branch 10 taken 7220 times.
✓ Branch 11 taken 12 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
21696 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { RtklibPosObs::type() })) { return RtklibPosObs::GetStaticDataDescriptors(); } |
| 404 |
5/10✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 12 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 12 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
36 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { WiFiPositioningSolution::type() })) { return WiFiPositioningSolution::GetStaticDataDescriptors(); } |
| 405 |
5/10✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 12 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 12 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
36 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { PosVel::type() })) { return PosVel::GetStaticDataDescriptors(); } |
| 406 |
5/10✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 12 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 12 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
36 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { Pos::type() })) { return Pos::GetStaticDataDescriptors(); } |
| 407 | // ImuObs | ||
| 408 |
6/10✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 12 times.
✓ Branch 8 taken 12 times.
✓ Branch 10 taken 4 times.
✓ Branch 11 taken 8 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
36 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { ImuObsSimulated::type() })) { return ImuObsSimulated::GetStaticDataDescriptors(); } |
| 409 |
5/10✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 8 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
24 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { ImuObsWDelta::type() })) { return ImuObsWDelta::GetStaticDataDescriptors(); } |
| 410 |
5/10✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 8 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
24 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { KvhObs::type() })) { return KvhObs::GetStaticDataDescriptors(); } |
| 411 |
5/10✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 8 times.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
24 | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { ImuObs::type() })) { return ImuObs::GetStaticDataDescriptors(); } |
| 412 | // Barometer | ||
| 413 | ✗ | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { BaroPressObs::type() })) { return BaroPressObs::GetStaticDataDescriptors(); } | |
| 414 | ✗ | if (NAV::NodeRegistry::NodeDataTypeAnyIsChildOf(dataIdentifier, { BaroHgt::type() })) { return BaroHgt::GetStaticDataDescriptors(); } | |
| 415 | |||
| 416 | ✗ | return {}; | |
| 417 | 6623865 | } | |
| 418 | |||
| 419 | 78 | bool NAV::NodeRegistry::TypeHasDynamicData(const std::string& type) | |
| 420 | { | ||
| 421 |
0/2✗ Branch 1 not taken.
✗ Branch 2 not taken.
|
78 | return type == DynamicData::type() |
| 422 |
3/8✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 78 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
154 | || type == GnssCombination::type() |
| 423 |
4/8✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 76 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 76 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
154 | || type == GnssObs::type() |
| 424 |
5/8✓ Branch 1 taken 76 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 75 times.
✓ Branch 5 taken 1 times.
✓ Branch 7 taken 76 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
154 | || type == RtkSolution::type() |
| 425 |
5/8✓ Branch 1 taken 75 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 73 times.
✓ Branch 5 taken 2 times.
✓ Branch 7 taken 76 times.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
153 | || type == SppSolution::type() |
| 426 |
10/14✓ Branch 1 taken 78 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 76 times.
✓ Branch 5 taken 2 times.
✓ Branch 7 taken 73 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 7 times.
✓ Branch 11 taken 66 times.
✓ Branch 12 taken 73 times.
✓ Branch 13 taken 5 times.
✓ Branch 15 taken 75 times.
✓ Branch 16 taken 3 times.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
|
232 | || type == VectorNavBinaryOutput::type(); |
| 427 | } | ||
| 428 | |||
| 429 | ✗ | std::shared_ptr<NAV::NodeData> NAV::NodeRegistry::CopyNodeData(const std::shared_ptr<const NodeData>& nodeData) | |
| 430 | { | ||
| 431 | ✗ | if (nodeData == nullptr) { return nullptr; } | |
| 432 | |||
| 433 | // General | ||
| 434 | ✗ | if (nodeData->getType() == DynamicData::type()) { return std::make_shared<DynamicData>(*std::static_pointer_cast<const DynamicData>(nodeData)); } | |
| 435 | ✗ | if (nodeData->getType() == StringObs::type()) { return std::make_shared<StringObs>(*std::static_pointer_cast<const StringObs>(nodeData)); } | |
| 436 | // GNSS | ||
| 437 | ✗ | if (nodeData->getType() == EmlidObs::type()) { return std::make_shared<EmlidObs>(*std::static_pointer_cast<const EmlidObs>(nodeData)); } | |
| 438 | ✗ | if (nodeData->getType() == GnssCombination::type()) { return std::make_shared<GnssCombination>(*std::static_pointer_cast<const GnssCombination>(nodeData)); } | |
| 439 | ✗ | if (nodeData->getType() == GnssObs::type()) { return std::make_shared<GnssObs>(*std::static_pointer_cast<const GnssObs>(nodeData)); } | |
| 440 | ✗ | if (nodeData->getType() == RtklibPosObs::type()) { return std::make_shared<RtklibPosObs>(*std::static_pointer_cast<const RtklibPosObs>(nodeData)); } | |
| 441 | ✗ | if (nodeData->getType() == RtkSolution::type()) { return std::make_shared<RtkSolution>(*std::static_pointer_cast<const RtkSolution>(nodeData)); } | |
| 442 | ✗ | if (nodeData->getType() == SppSolution::type()) { return std::make_shared<SppSolution>(*std::static_pointer_cast<const SppSolution>(nodeData)); } | |
| 443 | ✗ | if (nodeData->getType() == UbloxObs::type()) { return std::make_shared<UbloxObs>(*std::static_pointer_cast<const UbloxObs>(nodeData)); } | |
| 444 | // IMU | ||
| 445 | ✗ | if (nodeData->getType() == ImuObs::type()) { return std::make_shared<ImuObs>(*std::static_pointer_cast<const ImuObs>(nodeData)); } | |
| 446 | ✗ | if (nodeData->getType() == ImuObsSimulated::type()) { return std::make_shared<ImuObsSimulated>(*std::static_pointer_cast<const ImuObsSimulated>(nodeData)); } | |
| 447 | ✗ | if (nodeData->getType() == ImuObsWDelta::type()) { return std::make_shared<ImuObsWDelta>(*std::static_pointer_cast<const ImuObsWDelta>(nodeData)); } | |
| 448 | ✗ | if (nodeData->getType() == KvhObs::type()) { return std::make_shared<KvhObs>(*std::static_pointer_cast<const KvhObs>(nodeData)); } | |
| 449 | ✗ | if (nodeData->getType() == VectorNavBinaryOutput::type()) { return std::make_shared<VectorNavBinaryOutput>(*std::static_pointer_cast<const VectorNavBinaryOutput>(nodeData)); } | |
| 450 | // State | ||
| 451 | ✗ | if (nodeData->getType() == InsGnssLCKFSolution::type()) { return std::make_shared<InsGnssLCKFSolution>(*std::static_pointer_cast<const InsGnssLCKFSolution>(nodeData)); } | |
| 452 | ✗ | if (nodeData->getType() == InsGnssTCKFSolution::type()) { return std::make_shared<InsGnssTCKFSolution>(*std::static_pointer_cast<const InsGnssTCKFSolution>(nodeData)); } | |
| 453 | ✗ | if (nodeData->getType() == Pos::type()) { return std::make_shared<Pos>(*std::static_pointer_cast<const Pos>(nodeData)); } | |
| 454 | ✗ | if (nodeData->getType() == PosVel::type()) { return std::make_shared<PosVel>(*std::static_pointer_cast<const PosVel>(nodeData)); } | |
| 455 | ✗ | if (nodeData->getType() == PosVelAtt::type()) { return std::make_shared<PosVelAtt>(*std::static_pointer_cast<const PosVelAtt>(nodeData)); } | |
| 456 | // WiFi | ||
| 457 | ✗ | if (nodeData->getType() == WiFiObs::type()) { return std::make_shared<WiFiObs>(*std::static_pointer_cast<const WiFiObs>(nodeData)); } | |
| 458 | ✗ | if (nodeData->getType() == WiFiPositioningSolution::type()) { return std::make_shared<WiFiPositioningSolution>(*std::static_pointer_cast<const WiFiPositioningSolution>(nodeData)); } | |
| 459 | // Barometer | ||
| 460 | ✗ | if (nodeData->getType() == BaroPressObs::type()) { return std::make_shared<BaroPressObs>(*std::static_pointer_cast<const BaroPressObs>(nodeData)); } | |
| 461 | ✗ | if (nodeData->getType() == BaroHgt::type()) { return std::make_shared<BaroHgt>(*std::static_pointer_cast<const BaroHgt>(nodeData)); } | |
| 462 | |||
| 463 | ✗ | return nullptr; | |
| 464 | } | ||
| 465 |