| 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 "PosVelAttFile.hpp" | ||
| 10 | |||
| 11 | #include "util/Logger.hpp" | ||
| 12 | #include "util/StringUtil.hpp" | ||
| 13 | |||
| 14 | #include "Navigation/Transformations/CoordinateFrames.hpp" | ||
| 15 | #include "Navigation/Transformations/Units.hpp" | ||
| 16 | |||
| 17 | #include "internal/NodeManager.hpp" | ||
| 18 | #include <Eigen/src/Core/DiagonalMatrix.h> | ||
| 19 | namespace nm = NAV::NodeManager; | ||
| 20 | #include "internal/FlowManager.hpp" | ||
| 21 | |||
| 22 | #include "NodeData/State/PosVelAtt.hpp" | ||
| 23 | |||
| 24 | 115 | NAV::PosVelAttFile::PosVelAttFile() | |
| 25 |
3/6✓ Branch 1 taken 115 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 115 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 115 times.
✗ Branch 9 not taken.
|
115 | : Node(typeStatic()) |
| 26 | { | ||
| 27 | LOG_TRACE("{}: called", name); | ||
| 28 | |||
| 29 | 115 | _hasConfig = true; | |
| 30 | 115 | _guiConfigDefaultWindowSize = { 488, 248 }; | |
| 31 | |||
| 32 |
4/8✓ Branch 1 taken 115 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 115 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 345 times.
✓ Branch 9 taken 115 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
575 | nm::CreateOutputPin(this, "PosVelAtt", Pin::Type::Flow, { Pos::type(), PosVel::type(), PosVelAtt::type() }, &PosVelAttFile::pollData); |
| 33 |
2/4✓ Branch 2 taken 115 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 115 times.
✗ Branch 7 not taken.
|
230 | nm::CreateOutputPin(this, "Header Columns", Pin::Type::Object, { "std::vector<std::string>" }, &_headerColumns); |
| 34 | 230 | } | |
| 35 | |||
| 36 | 232 | NAV::PosVelAttFile::~PosVelAttFile() | |
| 37 | { | ||
| 38 | LOG_TRACE("{}: called", nameId()); | ||
| 39 | 232 | } | |
| 40 | |||
| 41 | 229 | std::string NAV::PosVelAttFile::typeStatic() | |
| 42 | { | ||
| 43 |
1/2✓ Branch 1 taken 229 times.
✗ Branch 2 not taken.
|
458 | return "PosVelAttFile"; |
| 44 | } | ||
| 45 | |||
| 46 | ✗ | std::string NAV::PosVelAttFile::type() const | |
| 47 | { | ||
| 48 | ✗ | return typeStatic(); | |
| 49 | } | ||
| 50 | |||
| 51 | 114 | std::string NAV::PosVelAttFile::category() | |
| 52 | { | ||
| 53 |
1/2✓ Branch 1 taken 114 times.
✗ Branch 2 not taken.
|
228 | return "Data Provider"; |
| 54 | } | ||
| 55 | |||
| 56 | ✗ | void NAV::PosVelAttFile::guiConfig() | |
| 57 | { | ||
| 58 | ✗ | if (auto res = FileReader::guiConfig(".csv,.*", { ".csv" }, size_t(id), nameId())) | |
| 59 | { | ||
| 60 | ✗ | LOG_DEBUG("{}: Path changed to {}", nameId(), _path); | |
| 61 | ✗ | flow::ApplyChanges(); | |
| 62 | ✗ | if (res == FileReader::PATH_CHANGED) | |
| 63 | { | ||
| 64 | ✗ | doReinitialize(); | |
| 65 | } | ||
| 66 | else | ||
| 67 | { | ||
| 68 | ✗ | doDeinitialize(); | |
| 69 | } | ||
| 70 | } | ||
| 71 | |||
| 72 | // Header info | ||
| 73 | ✗ | if (ImGui::BeginTable(fmt::format("##PvaHeaders ({})", id.AsPointer()).c_str(), 4, | |
| 74 | ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) | ||
| 75 | { | ||
| 76 | ✗ | ImGui::TableSetupColumn("Time", ImGuiTableColumnFlags_WidthFixed); | |
| 77 | ✗ | ImGui::TableSetupColumn("Position", ImGuiTableColumnFlags_WidthFixed); | |
| 78 | ✗ | ImGui::TableSetupColumn("Velocity", ImGuiTableColumnFlags_WidthFixed); | |
| 79 | ✗ | ImGui::TableSetupColumn("Attitude", ImGuiTableColumnFlags_WidthFixed); | |
| 80 | ✗ | ImGui::TableHeadersRow(); | |
| 81 | |||
| 82 | ✗ | auto TextColoredIfExists = [this](int index, const std::vector<const char*>& searchTexts) { | |
| 83 | ✗ | ImGui::TableSetColumnIndex(index); | |
| 84 | ✗ | for (const auto& text : searchTexts) | |
| 85 | { | ||
| 86 | ✗ | if (std::ranges::find(_headerColumns, text) != _headerColumns.end()) | |
| 87 | { | ||
| 88 | ✗ | ImGui::TextUnformatted(text); | |
| 89 | ✗ | return; | |
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | ✗ | ImGui::TextDisabled("%s", searchTexts.front()); | |
| 94 | ✗ | }; | |
| 95 | |||
| 96 | ✗ | ImGui::TableNextRow(); | |
| 97 | ✗ | TextColoredIfExists(0, { "GpsCycle" }); | |
| 98 | ✗ | TextColoredIfExists(1, { "X-ECEF [m]", "Pos ECEF X [m]" }); | |
| 99 | ✗ | TextColoredIfExists(2, { "X velocity ECEF [m/s]", "Vel ECEF X [m/s]" }); | |
| 100 | ✗ | TextColoredIfExists(3, { "n_Quat_b w" }); | |
| 101 | ✗ | ImGui::TableNextRow(); | |
| 102 | ✗ | TextColoredIfExists(0, { "GpsWeek" }); | |
| 103 | ✗ | TextColoredIfExists(1, { "Y-ECEF [m]", "Pos ECEF Y [m]" }); | |
| 104 | ✗ | TextColoredIfExists(2, { "Y velocity ECEF [m/s]", "Vel ECEF Y [m/s]" }); | |
| 105 | ✗ | TextColoredIfExists(3, { "n_Quat_b x" }); | |
| 106 | ✗ | ImGui::TableNextRow(); | |
| 107 | ✗ | TextColoredIfExists(0, { "GpsToW [s]" }); | |
| 108 | ✗ | TextColoredIfExists(1, { "Z-ECEF [m]", "Pos ECEF Z [m]" }); | |
| 109 | ✗ | TextColoredIfExists(2, { "Z velocity ECEF [m/s]", "Vel ECEF Z [m/s]" }); | |
| 110 | ✗ | TextColoredIfExists(3, { "n_Quat_b y" }); | |
| 111 | ✗ | ImGui::TableNextRow(); | |
| 112 | ✗ | TextColoredIfExists(1, { "Latitude [deg]" }); | |
| 113 | ✗ | TextColoredIfExists(2, { "North velocity [m/s]", "Vel N [m/s]" }); | |
| 114 | ✗ | TextColoredIfExists(3, { "n_Quat_b z" }); | |
| 115 | ✗ | ImGui::TableNextRow(); | |
| 116 | ✗ | TextColoredIfExists(1, { "Longitude [deg]" }); | |
| 117 | ✗ | TextColoredIfExists(2, { "East velocity [m/s]", "Vel E [m/s]" }); | |
| 118 | ✗ | TextColoredIfExists(3, { "Roll [deg]" }); | |
| 119 | ✗ | ImGui::TableNextRow(); | |
| 120 | ✗ | TextColoredIfExists(1, { "Altitude [m]" }); | |
| 121 | ✗ | TextColoredIfExists(2, { "Down velocity [m/s]", "Vel D [m/s]" }); | |
| 122 | ✗ | TextColoredIfExists(3, { "Pitch [deg]" }); | |
| 123 | ✗ | ImGui::TableNextRow(); | |
| 124 | ✗ | TextColoredIfExists(3, { "Yaw [deg]" }); | |
| 125 | |||
| 126 | ✗ | ImGui::EndTable(); | |
| 127 | } | ||
| 128 | ✗ | } | |
| 129 | |||
| 130 | ✗ | [[nodiscard]] json NAV::PosVelAttFile::save() const | |
| 131 | { | ||
| 132 | LOG_TRACE("{}: called", nameId()); | ||
| 133 | |||
| 134 | ✗ | json j; | |
| 135 | |||
| 136 | ✗ | j["FileReader"] = FileReader::save(); | |
| 137 | ✗ | j["pinType"] = outputPins[OUTPUT_PORT_INDEX_PVA].dataIdentifier; | |
| 138 | |||
| 139 | ✗ | return j; | |
| 140 | ✗ | } | |
| 141 | |||
| 142 | 1 | void NAV::PosVelAttFile::restore(json const& j) | |
| 143 | { | ||
| 144 | LOG_TRACE("{}: called", nameId()); | ||
| 145 | |||
| 146 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | if (j.contains("FileReader")) |
| 147 | { | ||
| 148 | 1 | FileReader::restore(j.at("FileReader")); | |
| 149 | } | ||
| 150 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | if (j.contains("pinType")) |
| 151 | { | ||
| 152 | 1 | j.at("pinType").get_to(outputPins[OUTPUT_PORT_INDEX_PVA].dataIdentifier); | |
| 153 | } | ||
| 154 | 1 | } | |
| 155 | |||
| 156 | 1 | bool NAV::PosVelAttFile::initialize() | |
| 157 | { | ||
| 158 | LOG_TRACE("{}: called", nameId()); | ||
| 159 | |||
| 160 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | if (FileReader::initialize()) |
| 161 | { | ||
| 162 |
2/2✓ Branch 4 taken 13 times.
✓ Branch 5 taken 1 times.
|
14 | for (auto& col : _headerColumns) |
| 163 | { | ||
| 164 |
3/6✓ Branch 1 taken 13 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 13 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 13 times.
✗ Branch 8 not taken.
|
52 | str::replace(col, "GpsTow [s]", "GpsToW [s]"); |
| 165 | } | ||
| 166 | |||
| 167 | 19 | auto hasCol = [&](const char* text) { | |
| 168 |
1/2✓ Branch 2 taken 19 times.
✗ Branch 3 not taken.
|
19 | return std::ranges::find(_headerColumns, text) != _headerColumns.end(); |
| 169 | 1 | }; | |
| 170 | |||
| 171 |
7/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 1 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✓ Branch 14 taken 1 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 1 times.
|
1 | if (!hasCol("GpsCycle") || !hasCol("GpsWeek") || !hasCol("GpsToW [s]")) |
| 172 | { | ||
| 173 | ✗ | LOG_ERROR("{}: A PosVelAtt File needs a time. Please add columns 'GpsCycle', 'GpsWeek' and 'GpsToW [s]'.", nameId()); | |
| 174 | ✗ | return false; | |
| 175 | } | ||
| 176 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | if (!((hasCol("X-ECEF [m]") || hasCol("Pos ECEF X [m]")) |
| 177 |
4/8✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
1 | && (hasCol("Y-ECEF [m]") || hasCol("Pos ECEF Y [m]")) |
| 178 |
4/8✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | && (hasCol("Z-ECEF [m]") || hasCol("Pos ECEF Z [m]"))) |
| 179 |
2/16✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✓ Branch 18 taken 1 times.
|
2 | && !(hasCol("Latitude [deg]") && hasCol("Longitude [deg]") && hasCol("Altitude [m]"))) |
| 180 | { | ||
| 181 | ✗ | LOG_ERROR("{}: A PosVelAtt File needs a position. Please provide" | |
| 182 | " either 'X-ECEF [m]', 'Y-ECEF [m]', 'Z-ECEF [m]'" | ||
| 183 | " or 'Latitude [deg]', 'Longitude [deg]', 'Altitude [m]'.", | ||
| 184 | nameId()); | ||
| 185 | ✗ | return false; | |
| 186 | } | ||
| 187 | 1 | _fileContent = FileContent::Pos; | |
| 188 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
3 | outputPins[OUTPUT_PORT_INDEX_PVA].dataIdentifier = std::vector{ Pos::type() }; |
| 189 | |||
| 190 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
2 | if (((hasCol("X velocity ECEF [m/s]") || hasCol("Vel ECEF X [m/s]")) |
| 191 |
4/8✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
1 | && (hasCol("Y velocity ECEF [m/s]") || hasCol("Vel ECEF Y [m/s]")) |
| 192 |
4/8✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
1 | && (hasCol("Z velocity ECEF [m/s]") || hasCol("Vel ECEF Z [m/s]"))) |
| 193 |
2/12✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
|
2 | || ((hasCol("North velocity [m/s]") || hasCol("Vel N [m/s]")) |
| 194 | ✗ | && (hasCol("East velocity [m/s]") || hasCol("Vel E [m/s]")) | |
| 195 | ✗ | && (hasCol("Down velocity [m/s]") || hasCol("Vel D [m/s]")))) | |
| 196 | { | ||
| 197 | 1 | _fileContent = FileContent::PosVel; | |
| 198 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
3 | outputPins[OUTPUT_PORT_INDEX_PVA].dataIdentifier = std::vector{ PosVel::type() }; |
| 199 | |||
| 200 |
1/14✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
1 | if ((hasCol("n_Quat_b w") && hasCol("n_Quat_b x") && hasCol("n_Quat_b y") && hasCol("n_Quat_b z")) |
| 201 |
8/16✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 1 times.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 1 times.
✗ Branch 18 not taken.
|
1 | || (hasCol("Roll [deg]") && hasCol("Pitch [deg]") && hasCol("Yaw [deg]"))) |
| 202 | { | ||
| 203 | 1 | _fileContent = FileContent::PosVelAtt; | |
| 204 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 6 taken 1 times.
✓ Branch 7 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
|
3 | outputPins[OUTPUT_PORT_INDEX_PVA].dataIdentifier = std::vector{ PosVelAtt::type() }; |
| 205 | } | ||
| 206 | } | ||
| 207 | |||
| 208 |
2/2✓ Branch 6 taken 2 times.
✓ Branch 7 taken 1 times.
|
3 | for (auto& link : outputPins[OUTPUT_PORT_INDEX_PVA].links) |
| 209 | { | ||
| 210 |
2/4✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
|
2 | if (auto* pin = link.getConnectedPin()) |
| 211 | { | ||
| 212 |
1/2✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | outputPins[OUTPUT_PORT_INDEX_PVA].recreateLink(*pin); |
| 213 | } | ||
| 214 | } | ||
| 215 | |||
| 216 | 1 | return true; | |
| 217 | } | ||
| 218 | |||
| 219 | ✗ | outputPins[OUTPUT_PORT_INDEX_PVA].dataIdentifier = { Pos::type(), PosVel::type(), PosVelAtt::type() }; | |
| 220 | ✗ | return false; | |
| 221 | 3 | } | |
| 222 | |||
| 223 | 1 | void NAV::PosVelAttFile::deinitialize() | |
| 224 | { | ||
| 225 | LOG_TRACE("{}: called", nameId()); | ||
| 226 | |||
| 227 | 1 | FileReader::deinitialize(); | |
| 228 | 1 | } | |
| 229 | |||
| 230 | 2 | bool NAV::PosVelAttFile::resetNode() | |
| 231 | { | ||
| 232 | 2 | FileReader::resetReader(); | |
| 233 | |||
| 234 | 2 | return true; | |
| 235 | } | ||
| 236 | |||
| 237 | 6003 | std::shared_ptr<const NAV::NodeData> NAV::PosVelAttFile::pollData() | |
| 238 | { | ||
| 239 | 6003 | std::shared_ptr<Pos> obs; | |
| 240 |
1/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 6003 times.
✗ Branch 3 not taken.
|
6003 | switch (_fileContent) |
| 241 | { | ||
| 242 | ✗ | case FileContent::Pos: | |
| 243 | ✗ | obs = std::make_shared<Pos>(); | |
| 244 | ✗ | break; | |
| 245 | ✗ | case FileContent::PosVel: | |
| 246 | ✗ | obs = std::make_shared<PosVel>(); | |
| 247 | ✗ | break; | |
| 248 | 6003 | case FileContent::PosVelAtt: | |
| 249 |
1/2✓ Branch 1 taken 6003 times.
✗ Branch 2 not taken.
|
6003 | obs = std::make_shared<PosVelAtt>(); |
| 250 | 6003 | break; | |
| 251 | } | ||
| 252 | |||
| 253 | // Read line | ||
| 254 | 12006 | std::string line; | |
| 255 |
1/2✓ Branch 1 taken 6003 times.
✗ Branch 2 not taken.
|
6003 | getline(line); |
| 256 | // Remove any starting non text characters | ||
| 257 |
2/4✓ Branch 1 taken 6003 times.
✗ Branch 2 not taken.
✓ Branch 7 taken 6003 times.
✗ Branch 8 not taken.
|
12005 | line.erase(line.begin(), std::ranges::find_if(line, [](int ch) { return std::isgraph(ch); })); |
| 258 | |||
| 259 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 6002 times.
|
6003 | if (line.empty()) |
| 260 | { | ||
| 261 | 1 | return nullptr; | |
| 262 | } | ||
| 263 | |||
| 264 | // Convert line into stream | ||
| 265 |
1/2✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
|
12004 | std::stringstream lineStream(line); |
| 266 | 12004 | std::string cell; | |
| 267 | |||
| 268 | 6002 | std::optional<uint16_t> gpsCycle = 0; | |
| 269 | 6002 | std::optional<uint16_t> gpsWeek; | |
| 270 | 6002 | std::optional<long double> gpsToW; | |
| 271 | 6002 | std::optional<double> e_position_x; | |
| 272 | 6002 | std::optional<double> e_position_y; | |
| 273 | 6002 | std::optional<double> e_position_z; | |
| 274 | 6002 | std::optional<double> e_positionStdDev_x; | |
| 275 | 6002 | std::optional<double> e_positionStdDev_y; | |
| 276 | 6002 | std::optional<double> e_positionStdDev_z; | |
| 277 | 6002 | std::optional<double> lla_position_x; | |
| 278 | 6002 | std::optional<double> lla_position_y; | |
| 279 | 6002 | std::optional<double> lla_position_z; | |
| 280 | 6002 | std::optional<double> n_positionStdDev_n; | |
| 281 | 6002 | std::optional<double> n_positionStdDev_e; | |
| 282 | 6002 | std::optional<double> n_positionStdDev_d; | |
| 283 | 6002 | std::optional<double> e_velocity_x; | |
| 284 | 6002 | std::optional<double> e_velocity_y; | |
| 285 | 6002 | std::optional<double> e_velocity_z; | |
| 286 | 6002 | std::optional<double> e_velocityStdDev_x; | |
| 287 | 6002 | std::optional<double> e_velocityStdDev_y; | |
| 288 | 6002 | std::optional<double> e_velocityStdDev_z; | |
| 289 | 6002 | std::optional<double> n_velocity_n; | |
| 290 | 6002 | std::optional<double> n_velocity_e; | |
| 291 | 6002 | std::optional<double> n_velocity_d; | |
| 292 | 6002 | std::optional<double> n_velocityStdDev_n; | |
| 293 | 6002 | std::optional<double> n_velocityStdDev_e; | |
| 294 | 6002 | std::optional<double> n_velocityStdDev_d; | |
| 295 | 6002 | std::optional<double> n_Quat_b_w; | |
| 296 | 6002 | std::optional<double> n_Quat_b_x; | |
| 297 | 6002 | std::optional<double> n_Quat_b_y; | |
| 298 | 6002 | std::optional<double> n_Quat_b_z; | |
| 299 | 6002 | std::optional<double> roll; | |
| 300 | 6002 | std::optional<double> pitch; | |
| 301 | 6002 | std::optional<double> yaw; | |
| 302 | |||
| 303 | // Split line at comma | ||
| 304 |
2/2✓ Branch 5 taken 78026 times.
✓ Branch 6 taken 6002 times.
|
84028 | for (const auto& column : _headerColumns) |
| 305 | { | ||
| 306 |
3/6✓ Branch 1 taken 78026 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 78026 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 78026 times.
✗ Branch 7 not taken.
|
78026 | if (std::getline(lineStream, cell, ',')) |
| 307 | { | ||
| 308 | // Remove any trailing non text characters | ||
| 309 |
2/4✓ Branch 3 taken 78026 times.
✗ Branch 4 not taken.
✓ Branch 7 taken 78026 times.
✗ Branch 8 not taken.
|
607423 | cell.erase(std::ranges::find_if(cell, [](int ch) { return std::iscntrl(ch); }), cell.end()); |
| 310 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 78026 times.
|
78026 | if (cell.empty()) |
| 311 | { | ||
| 312 | ✗ | continue; | |
| 313 | } | ||
| 314 | |||
| 315 |
4/6✓ Branch 1 taken 78026 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6002 times.
✓ Branch 4 taken 72024 times.
✓ Branch 6 taken 6002 times.
✗ Branch 7 not taken.
|
78026 | if (column == "GpsCycle") { gpsCycle = static_cast<uint16_t>(std::stoul(cell)); } |
| 316 |
4/6✓ Branch 1 taken 72024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6002 times.
✓ Branch 4 taken 66022 times.
✓ Branch 6 taken 6002 times.
✗ Branch 7 not taken.
|
72024 | else if (column == "GpsWeek") { gpsWeek = static_cast<uint16_t>(std::stoul(cell)); } |
| 317 |
4/6✓ Branch 1 taken 66022 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6002 times.
✓ Branch 4 taken 60020 times.
✓ Branch 6 taken 6002 times.
✗ Branch 7 not taken.
|
66022 | else if (column == "GpsToW [s]") { gpsToW = std::stold(cell); } |
| 318 | |||
| 319 |
8/12✓ Branch 1 taken 60020 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 60020 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 60020 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6002 times.
✓ Branch 9 taken 54018 times.
✓ Branch 10 taken 6002 times.
✓ Branch 11 taken 54018 times.
✓ Branch 13 taken 6002 times.
✗ Branch 14 not taken.
|
60020 | else if (column == "X-ECEF [m]" || column == "Pos ECEF X [m]") { e_position_x = std::stod(cell); } |
| 320 |
8/12✓ Branch 1 taken 54018 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 54018 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 54018 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6002 times.
✓ Branch 9 taken 48016 times.
✓ Branch 10 taken 6002 times.
✓ Branch 11 taken 48016 times.
✓ Branch 13 taken 6002 times.
✗ Branch 14 not taken.
|
54018 | else if (column == "Y-ECEF [m]" || column == "Pos ECEF Y [m]") { e_position_y = std::stod(cell); } |
| 321 |
8/12✓ Branch 1 taken 48016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 48016 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 48016 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6002 times.
✓ Branch 9 taken 42014 times.
✓ Branch 10 taken 6002 times.
✓ Branch 11 taken 42014 times.
✓ Branch 13 taken 6002 times.
✗ Branch 14 not taken.
|
48016 | else if (column == "Z-ECEF [m]" || column == "Pos ECEF Z [m]") { e_position_z = std::stod(cell); } |
| 322 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "X-ECEF StDev [m]") { e_positionStdDev_x = std::stod(cell); } |
| 323 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "Y-ECEF StDev [m]") { e_positionStdDev_y = std::stod(cell); } |
| 324 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "Z-ECEF StDev [m]") { e_positionStdDev_z = std::stod(cell); } |
| 325 | |||
| 326 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "Latitude [deg]") { lla_position_x = deg2rad(std::stod(cell)); } |
| 327 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "Longitude [deg]") { lla_position_y = deg2rad(std::stod(cell)); } |
| 328 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "Altitude [m]") { lla_position_z = std::stod(cell); } |
| 329 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "North StDev [m]") { n_positionStdDev_n = deg2rad(std::stod(cell)); } |
| 330 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "East StDev [m]") { n_positionStdDev_e = deg2rad(std::stod(cell)); } |
| 331 |
2/6✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 42014 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
42014 | else if (column == "Down StDev [m]") { n_positionStdDev_d = std::stod(cell); } |
| 332 | |||
| 333 |
8/12✓ Branch 1 taken 42014 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 42014 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 42014 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6002 times.
✓ Branch 9 taken 36012 times.
✓ Branch 10 taken 6002 times.
✓ Branch 11 taken 36012 times.
✓ Branch 13 taken 6002 times.
✗ Branch 14 not taken.
|
42014 | else if (column == "X velocity ECEF [m/s]" || column == "Vel ECEF X [m/s]") { e_velocity_x = std::stod(cell); } |
| 334 |
8/12✓ Branch 1 taken 36012 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36012 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 36012 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6002 times.
✓ Branch 9 taken 30010 times.
✓ Branch 10 taken 6002 times.
✓ Branch 11 taken 30010 times.
✓ Branch 13 taken 6002 times.
✗ Branch 14 not taken.
|
36012 | else if (column == "Y velocity ECEF [m/s]" || column == "Vel ECEF Y [m/s]") { e_velocity_y = std::stod(cell); } |
| 335 |
8/12✓ Branch 1 taken 30010 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 30010 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 30010 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6002 times.
✓ Branch 9 taken 24008 times.
✓ Branch 10 taken 6002 times.
✓ Branch 11 taken 24008 times.
✓ Branch 13 taken 6002 times.
✗ Branch 14 not taken.
|
30010 | else if (column == "Z velocity ECEF [m/s]" || column == "Vel ECEF Z [m/s]") { e_velocity_z = std::stod(cell); } |
| 336 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "X velocity ECEF StdDev [m/s]") { e_velocityStdDev_x = std::stod(cell); } |
| 337 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "Y velocity ECEF StdDev [m/s]") { e_velocityStdDev_y = std::stod(cell); } |
| 338 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "Z velocity ECEF StdDev [m/s]") { e_velocityStdDev_z = std::stod(cell); } |
| 339 | |||
| 340 |
5/12✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24008 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24008 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 24008 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24008 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
24008 | else if (column == "North velocity [m/s]" || column == "Vel N [m/s]") { n_velocity_n = std::stod(cell); } |
| 341 |
5/12✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24008 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24008 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 24008 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24008 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
24008 | else if (column == "East velocity [m/s]" || column == "Vel E [m/s]") { n_velocity_e = std::stod(cell); } |
| 342 |
5/12✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24008 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 24008 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 24008 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 24008 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
|
24008 | else if (column == "Down velocity [m/s]" || column == "Vel D [m/s]") { n_velocity_d = std::stod(cell); } |
| 343 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "North velocity StDev [m/s]") { n_velocityStdDev_n = std::stod(cell); } |
| 344 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "East velocity StDev [m/s]") { n_velocityStdDev_e = std::stod(cell); } |
| 345 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "Down velocity StDev [m/s]") { n_velocityStdDev_d = std::stod(cell); } |
| 346 | |||
| 347 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "n_Quat_b w") { n_Quat_b_w = std::stod(cell); } |
| 348 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "n_Quat_b x") { n_Quat_b_x = std::stod(cell); } |
| 349 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "n_Quat_b y") { n_Quat_b_y = std::stod(cell); } |
| 350 |
2/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 24008 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
24008 | else if (column == "n_Quat_b z") { n_Quat_b_z = std::stod(cell); } |
| 351 | |||
| 352 |
4/6✓ Branch 1 taken 24008 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6002 times.
✓ Branch 4 taken 18006 times.
✓ Branch 6 taken 6002 times.
✗ Branch 7 not taken.
|
24008 | else if (column == "Roll [deg]") { roll = deg2rad(std::stod(cell)); } |
| 353 |
4/6✓ Branch 1 taken 18006 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6002 times.
✓ Branch 4 taken 12004 times.
✓ Branch 6 taken 6002 times.
✗ Branch 7 not taken.
|
18006 | else if (column == "Pitch [deg]") { pitch = deg2rad(std::stod(cell)); } |
| 354 |
4/6✓ Branch 1 taken 12004 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6002 times.
✓ Branch 4 taken 6002 times.
✓ Branch 6 taken 6002 times.
✗ Branch 7 not taken.
|
12004 | else if (column == "Yaw [deg]") { yaw = deg2rad(std::stod(cell)); } |
| 355 | } | ||
| 356 | } | ||
| 357 | |||
| 358 |
4/8✓ Branch 1 taken 6002 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6002 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6002 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6002 times.
✗ Branch 10 not taken.
|
6002 | if (gpsCycle.has_value() && gpsWeek.has_value() && gpsToW.has_value()) |
| 359 | { | ||
| 360 |
4/8✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6002 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6002 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 6002 times.
✗ Branch 12 not taken.
|
6002 | obs->insTime = InsTime(gpsCycle.value(), gpsWeek.value(), gpsToW.value()); |
| 361 | } | ||
| 362 | else | ||
| 363 | { | ||
| 364 | ✗ | LOG_WARN("{}: A PosVelAtt File needs a time.", nameId()); | |
| 365 | ✗ | return nullptr; | |
| 366 | } | ||
| 367 | |||
| 368 |
2/4✓ Branch 0 taken 6002 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
|
6002 | if (_fileContent == FileContent::PosVel || _fileContent == FileContent::PosVelAtt) |
| 369 | { | ||
| 370 |
4/8✓ Branch 1 taken 6002 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6002 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6002 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6002 times.
✗ Branch 10 not taken.
|
6002 | if (e_velocity_x.has_value() && e_velocity_y.has_value() && e_velocity_z.has_value()) |
| 371 | { | ||
| 372 |
0/4✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
6002 | auto lla_pos = lla_position_x.has_value() && lla_position_y.has_value() && lla_position_z.has_value() |
| 373 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6002 times.
|
6002 | ? Eigen::Vector3d(*lla_position_x, *lla_position_y, *lla_position_z) |
| 374 |
2/6✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 7 taken 6002 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6002 times.
✗ Branch 11 not taken.
|
6002 | : trafo::ecef2lla_WGS84(Eigen::Vector3d(*e_position_x, *e_position_y, *e_position_z)); |
| 375 |
5/10✓ Branch 4 taken 6002 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6002 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 6002 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 6002 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 6002 times.
✗ Branch 17 not taken.
|
6002 | auto n_vel = trafo::n_Quat_e(lla_pos.x(), lla_pos.y()) * Eigen::Vector3d(*e_velocity_x, *e_velocity_y, *e_velocity_z); |
| 376 |
1/2✓ Branch 1 taken 6002 times.
✗ Branch 2 not taken.
|
6002 | n_velocity_n = n_vel.x(); |
| 377 |
1/2✓ Branch 1 taken 6002 times.
✗ Branch 2 not taken.
|
6002 | n_velocity_e = n_vel.y(); |
| 378 |
1/2✓ Branch 1 taken 6002 times.
✗ Branch 2 not taken.
|
6002 | n_velocity_d = n_vel.z(); |
| 379 | } | ||
| 380 | ✗ | else if (n_velocity_n.has_value() && n_velocity_e.has_value() && n_velocity_d.has_value()) | |
| 381 | { | ||
| 382 | ✗ | auto lla_pos = lla_position_x.has_value() && lla_position_y.has_value() && lla_position_z.has_value() | |
| 383 | ✗ | ? Eigen::Vector3d(*lla_position_x, *lla_position_y, *lla_position_z) | |
| 384 | ✗ | : trafo::ecef2lla_WGS84(Eigen::Vector3d(*e_position_x, *e_position_y, *e_position_z)); | |
| 385 | ✗ | auto e_vel = trafo::e_Quat_n(lla_pos.x(), lla_pos.y()) * Eigen::Vector3d(*e_velocity_x, *e_velocity_y, *e_velocity_z); | |
| 386 | ✗ | e_velocity_x = e_vel.x(); | |
| 387 | ✗ | e_velocity_y = e_vel.y(); | |
| 388 | ✗ | e_velocity_z = e_vel.z(); | |
| 389 | } | ||
| 390 | |||
| 391 |
2/4✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6002 times.
✗ Branch 6 not taken.
|
12004 | if (e_position_x.has_value() && e_position_y.has_value() && e_position_z.has_value() |
| 392 |
5/10✓ Branch 0 taken 6002 times.
✗ Branch 1 not taken.
✓ Branch 3 taken 6002 times.
✗ Branch 4 not taken.
✓ Branch 6 taken 6002 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 6002 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 6002 times.
✗ Branch 12 not taken.
|
12004 | && e_velocity_x.has_value() && e_velocity_y.has_value() && e_velocity_z.has_value()) |
| 393 | { | ||
| 394 |
1/2✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
|
6002 | if (auto posVel = std::reinterpret_pointer_cast<PosVel>(obs)) |
| 395 | { | ||
| 396 |
0/4✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
|
6002 | if (e_positionStdDev_x.has_value() && e_positionStdDev_y.has_value() && e_positionStdDev_z.has_value() |
| 397 |
2/10✗ Branch 0 not taken.
✓ Branch 1 taken 6002 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✓ Branch 12 taken 6002 times.
|
6002 | && e_velocityStdDev_x.has_value() && e_velocityStdDev_y.has_value() && e_velocityStdDev_z.has_value()) |
| 398 | { | ||
| 399 | ; | ||
| 400 | ✗ | posVel->setPosVelAndCov_e(Eigen::Vector3d{ e_position_x.value(), e_position_y.value(), e_position_z.value() }, | |
| 401 | ✗ | Eigen::Vector3d{ e_velocity_x.value(), e_velocity_y.value(), e_velocity_z.value() }, | |
| 402 | ✗ | (Eigen::Vector6d() << e_positionStdDev_x.value(), e_positionStdDev_y.value(), e_positionStdDev_z.value(), | |
| 403 | ✗ | e_velocityStdDev_x.value(), e_velocityStdDev_y.value(), e_velocityStdDev_z.value()) | |
| 404 | ✗ | .finished() | |
| 405 | ✗ | .asDiagonal() | |
| 406 | ✗ | .toDenseMatrix()); | |
| 407 | } | ||
| 408 | else | ||
| 409 | { | ||
| 410 |
5/10✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6002 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6002 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 6002 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 6002 times.
✗ Branch 15 not taken.
|
6002 | posVel->setPosition_e(Eigen::Vector3d{ e_position_x.value(), e_position_y.value(), e_position_z.value() }); |
| 411 |
5/10✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6002 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6002 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 6002 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 6002 times.
✗ Branch 15 not taken.
|
6002 | posVel->setVelocity_e(Eigen::Vector3d{ e_velocity_x.value(), e_velocity_y.value(), e_velocity_z.value() }); |
| 412 | } | ||
| 413 | 6002 | } | |
| 414 | } | ||
| 415 | ✗ | else if (lla_position_x.has_value() && lla_position_y.has_value() && lla_position_z.has_value() | |
| 416 | ✗ | && n_velocity_n.has_value() && n_velocity_e.has_value() && n_velocity_d.has_value()) | |
| 417 | { | ||
| 418 | ✗ | if (auto posVel = std::reinterpret_pointer_cast<PosVel>(obs)) | |
| 419 | { | ||
| 420 | ✗ | if (n_positionStdDev_n.has_value() && n_positionStdDev_e.has_value() && n_positionStdDev_d.has_value() | |
| 421 | ✗ | && n_velocityStdDev_n.has_value() && n_velocityStdDev_e.has_value() && n_velocityStdDev_d.has_value()) | |
| 422 | { | ||
| 423 | ✗ | posVel->setPosVelAndCov_n(Eigen::Vector3d{ lla_position_x.value(), lla_position_y.value(), lla_position_z.value() }, | |
| 424 | ✗ | Eigen::Vector3d{ n_velocity_n.value(), n_velocity_e.value(), n_velocity_d.value() }, | |
| 425 | ✗ | (Eigen::Vector6d() << n_positionStdDev_n.value(), n_positionStdDev_e.value(), n_positionStdDev_d.value(), | |
| 426 | ✗ | n_velocityStdDev_n.value(), n_velocityStdDev_e.value(), n_velocityStdDev_d.value()) | |
| 427 | ✗ | .finished() | |
| 428 | ✗ | .asDiagonal() | |
| 429 | ✗ | .toDenseMatrix()); | |
| 430 | } | ||
| 431 | else | ||
| 432 | { | ||
| 433 | ✗ | posVel->setPosition_lla(Eigen::Vector3d{ lla_position_x.value(), lla_position_y.value(), lla_position_z.value() }); | |
| 434 | ✗ | posVel->setVelocity_n(Eigen::Vector3d{ n_velocity_n.value(), n_velocity_e.value(), n_velocity_d.value() }); | |
| 435 | } | ||
| 436 | ✗ | } | |
| 437 | } | ||
| 438 | else | ||
| 439 | { | ||
| 440 | ✗ | LOG_WARN("{}: A PosVel/PosVelAtt file needs a position and velocity.", nameId()); | |
| 441 | ✗ | return nullptr; | |
| 442 | } | ||
| 443 | 6002 | } | |
| 444 | ✗ | else if (_fileContent == FileContent::Pos) | |
| 445 | { | ||
| 446 | ✗ | if (e_position_x.has_value() && e_position_y.has_value() && e_position_z.has_value()) | |
| 447 | { | ||
| 448 | ✗ | if (e_positionStdDev_x.has_value() && e_positionStdDev_y.has_value() && e_positionStdDev_z.has_value()) | |
| 449 | { | ||
| 450 | ✗ | obs->setPositionAndCov_e(Eigen::Vector3d{ e_position_x.value(), e_position_y.value(), e_position_z.value() }, | |
| 451 | ✗ | Eigen::DiagonalMatrix<double, 3>{ e_positionStdDev_x.value(), e_positionStdDev_y.value(), e_positionStdDev_z.value() }.toDenseMatrix()); | |
| 452 | } | ||
| 453 | else | ||
| 454 | { | ||
| 455 | ✗ | obs->setPosition_e(Eigen::Vector3d{ e_position_x.value(), e_position_y.value(), e_position_z.value() }); | |
| 456 | } | ||
| 457 | } | ||
| 458 | ✗ | else if (lla_position_x.has_value() && lla_position_y.has_value() && lla_position_z.has_value()) | |
| 459 | { | ||
| 460 | ✗ | if (n_positionStdDev_n.has_value() && n_positionStdDev_e.has_value() && n_positionStdDev_d.has_value()) | |
| 461 | { | ||
| 462 | ✗ | obs->setPositionAndCov_n(Eigen::Vector3d{ lla_position_x.value(), lla_position_y.value(), lla_position_z.value() }, | |
| 463 | ✗ | Eigen::DiagonalMatrix<double, 3>{ n_positionStdDev_n.value(), n_positionStdDev_e.value(), n_positionStdDev_d.value() }.toDenseMatrix()); | |
| 464 | } | ||
| 465 | else | ||
| 466 | { | ||
| 467 | ✗ | obs->setPosition_lla(Eigen::Vector3d{ lla_position_x.value(), lla_position_y.value(), lla_position_z.value() }); | |
| 468 | } | ||
| 469 | } | ||
| 470 | else | ||
| 471 | { | ||
| 472 | ✗ | LOG_WARN("{}: A Pos file needs a position.", nameId()); | |
| 473 | ✗ | return nullptr; | |
| 474 | } | ||
| 475 | } | ||
| 476 | |||
| 477 |
1/2✓ Branch 0 taken 6002 times.
✗ Branch 1 not taken.
|
6002 | if (_fileContent == FileContent::PosVelAtt) |
| 478 | { | ||
| 479 |
2/10✗ Branch 1 not taken.
✓ Branch 2 taken 6002 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 6002 times.
|
6002 | if (n_Quat_b_w.has_value() && n_Quat_b_x.has_value() && n_Quat_b_y.has_value() && n_Quat_b_z.has_value()) |
| 480 | { | ||
| 481 | ✗ | if (auto posVelAtt = std::reinterpret_pointer_cast<PosVelAtt>(obs)) | |
| 482 | { | ||
| 483 | ✗ | posVelAtt->setAttitude_n_Quat_b(Eigen::Quaterniond{ n_Quat_b_w.value(), n_Quat_b_x.value(), n_Quat_b_y.value(), n_Quat_b_z.value() }); | |
| 484 | ✗ | } | |
| 485 | } | ||
| 486 |
4/8✓ Branch 1 taken 6002 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 6002 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 6002 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6002 times.
✗ Branch 10 not taken.
|
6002 | else if (roll.has_value() && pitch.has_value() && yaw.has_value()) |
| 487 | { | ||
| 488 |
1/2✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
|
6002 | if (auto posVelAtt = std::reinterpret_pointer_cast<PosVelAtt>(obs)) |
| 489 | { | ||
| 490 |
5/10✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 6002 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 6002 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 6002 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 6002 times.
✗ Branch 15 not taken.
|
6002 | posVelAtt->setAttitude_n_Quat_b(trafo::n_Quat_b(roll.value(), pitch.value(), yaw.value())); |
| 491 | 6002 | } | |
| 492 | } | ||
| 493 | } | ||
| 494 | |||
| 495 |
1/2✓ Branch 2 taken 6002 times.
✗ Branch 3 not taken.
|
6002 | invokeCallbacks(OUTPUT_PORT_INDEX_PVA, obs); |
| 496 | 6002 | return obs; | |
| 497 | 6003 | } | |
| 498 |