INSTINCT Code Coverage Report


Directory: src/
File: Nodes/Converter/GNSS/RtklibPosConverter.cpp
Date: 2025-02-07 16:54:41
Exec Total Coverage
Lines: 12 24 50.0%
Functions: 4 7 57.1%
Branches: 12 34 35.3%

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 "RtklibPosConverter.hpp"
10
11 #include "util/Logger.hpp"
12
13 #include "internal/NodeManager.hpp"
14 namespace nm = NAV::NodeManager;
15 #include "internal/FlowManager.hpp"
16
17 #include "NodeData/State/PosVel.hpp"
18 #include "NodeData/GNSS/RtklibPosObs.hpp"
19
20 112 NAV::RtklibPosConverter::RtklibPosConverter()
21
2/4
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 112 times.
✗ Branch 5 not taken.
112 : Node(typeStatic())
22 {
23 LOG_TRACE("{}: called", name);
24 112 _hasConfig = false;
25
26
4/8
✓ Branch 2 taken 112 times.
✗ Branch 3 not taken.
✓ Branch 6 taken 112 times.
✗ Branch 7 not taken.
✓ Branch 9 taken 112 times.
✓ Branch 10 taken 112 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
448 nm::CreateOutputPin(this, "PosVel", Pin::Type::Flow, { NAV::PosVel::type() });
27
28
4/8
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 112 times.
✗ Branch 6 not taken.
✓ Branch 8 taken 112 times.
✓ Branch 9 taken 112 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
336 nm::CreateInputPin(this, "RtklibPosObs", Pin::Type::Flow, { NAV::RtklibPosObs::type() }, &RtklibPosConverter::receiveObs);
29 336 }
30
31 224 NAV::RtklibPosConverter::~RtklibPosConverter()
32 {
33 LOG_TRACE("{}: called", nameId());
34 224 }
35
36 224 std::string NAV::RtklibPosConverter::typeStatic()
37 {
38
1/2
✓ Branch 1 taken 224 times.
✗ Branch 2 not taken.
448 return "RtklibPosConverter";
39 }
40
41 std::string NAV::RtklibPosConverter::type() const
42 {
43 return typeStatic();
44 }
45
46 112 std::string NAV::RtklibPosConverter::category()
47 {
48
1/2
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
224 return "Converter";
49 }
50
51 bool NAV::RtklibPosConverter::initialize()
52 {
53 LOG_TRACE("{}: called", nameId());
54
55 return true;
56 }
57
58 void NAV::RtklibPosConverter::receiveObs(NAV::InputPin::NodeDataQueue& queue, size_t /* pinIdx */)
59 {
60 auto rtklibPosObs = std::static_pointer_cast<const RtklibPosObs>(queue.extract_front());
61
62 auto posVelObs = std::make_shared<PosVel>();
63
64 posVelObs->insTime = rtklibPosObs->insTime;
65 posVelObs->setPosition_e(rtklibPosObs->e_position());
66 posVelObs->setVelocity_e(rtklibPosObs->e_velocity());
67
68 invokeCallbacks(OUTPUT_PORT_INDEX_POSVEL, posVelObs);
69 }
70