INSTINCT Code Coverage Report


Directory: src/
File: Navigation/GNSS/Satellite/internal/Orbit.hpp
Date: 2025-02-07 16:54:41
Exec Total Coverage
Lines: 4 4 100.0%
Functions: 4 4 100.0%
Branches: 0 0 -%

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 /// @file Orbit.hpp
10 /// @brief Abstract satellite orbit information
11 /// @author T. Topp (topp@ins.uni-stuttgart.de)
12 /// @date 2022-12-02
13
14 #pragma once
15
16 #include <cstdint>
17 #include "Navigation/Time/InsTime.hpp"
18 #include "util/Eigen.hpp"
19
20 namespace NAV
21 {
22
23 /// @brief Abstract satellite orbit information
24 class Orbit
25 {
26 public:
27 /// Satellite Position
28 struct Pos
29 {
30 Eigen::Vector3d e_pos; ///< The WGS84 ECEF position of the satellite at transmit time of the signal, in ECEF axes at the time of reception [m]
31 };
32 /// Satellite Position and Velocity
33 struct PosVel
34 {
35 Eigen::Vector3d e_pos; ///< The WGS84 ECEF position of the satellite at transmit time of the signal, in ECEF axes at the time of reception [m]
36 Eigen::Vector3d e_vel; ///< The WGS84 ECEF velocity of the satellite at transmit time of the signal, in ECEF axes at the time of reception [m]
37 };
38 /// Satellite Position, Velocity and Acceleration
39 struct PosVelAccel
40 {
41 Eigen::Vector3d e_pos; ///< The WGS84 ECEF position of the satellite at transmit time of the signal, in ECEF axes at the time of reception [m]
42 Eigen::Vector3d e_vel; ///< The WGS84 ECEF velocity of the satellite at transmit time of the signal, in ECEF axes at the time of reception [m]
43 Eigen::Vector3d e_accel; ///< The WGS84 ECEF acceleration of the satellite at transmit time of the signal, in ECEF axes at the time of reception [m]
44 };
45
46 /// @brief Default Constructor
47 41371 Orbit() = default;
48 /// @brief Destructor
49 82742 virtual ~Orbit() = default;
50 /// @brief Copy constructor
51 Orbit(const Orbit&) = default;
52 /// @brief Move constructor
53 Orbit(Orbit&&) = default;
54 /// @brief Copy assignment operator
55 Orbit& operator=(const Orbit&) = delete;
56 /// @brief Move assignment operator
57 Orbit& operator=(Orbit&&) = delete;
58
59 /// @brief Calculates position of the satellite at transmission time
60 /// @param[in] transTime Transmit time to calculate the satellite position for
61 [[nodiscard]] Pos calcSatellitePos(const InsTime& transTime) const;
62 /// @brief Calculates position and velocity of the satellite at transmission time
63 /// @param[in] transTime Transmit time to calculate the satellite position and velocity for
64 [[nodiscard]] PosVel calcSatellitePosVel(const InsTime& transTime) const;
65 /// @brief Calculates position, velocity and acceleration of the satellite at transmission time
66 /// @param[in] transTime Transmit time to calculate the satellite position, velocity and acceleration for
67 [[nodiscard]] PosVelAccel calcSatellitePosVelAccel(const InsTime& transTime) const;
68
69 /// @brief Calculates the Variance of the satellite position in [m^2]
70 [[nodiscard]] virtual double calcSatellitePositionVariance() const = 0;
71
72 protected:
73 /// @brief Calculation flags
74 enum Calc : uint8_t
75 {
76 Calc_None = 0b000, ///< None
77 Calc_Position = 0b001, ///< Position calculation flag
78 Calc_Velocity = 0b010, ///< Velocity calculation flag
79 Calc_Acceleration = 0b100, ///< Acceleration calculation flag
80 };
81
82 public:
83 friend Orbit::Calc operator|(Orbit::Calc lhs, Orbit::Calc rhs);
84 friend Orbit::Calc operator&(Orbit::Calc lhs, Orbit::Calc rhs);
85
86 protected:
87 /// @brief Calculates position, velocity and acceleration of the satellite at transmission time
88 /// @param[in] transTime Transmit time to calculate the satellite data for
89 /// @param[in] calc Flags which determine what should be calculated and returned
90 [[nodiscard]] virtual PosVelAccel calcSatelliteData(const InsTime& transTime, Calc calc) const = 0;
91 };
92
93 /// @brief Allows construction of Calc objects
94 /// @param[in] lhs Left-hand side enum value.
95 /// @param[in] rhs Right-hand side enum value.
96 /// @return The binary ORed value.
97 64596 inline Orbit::Calc operator|(Orbit::Calc lhs, Orbit::Calc rhs) { return static_cast<Orbit::Calc>(static_cast<int>(lhs) | static_cast<int>(rhs)); }
98
99 /// @brief Allows construction of Calc objects
100 /// @param[in] lhs Left-hand side enum value.
101 /// @param[in] rhs Right-hand side enum value.
102 /// @return The binary ANDed value.
103 201800 inline Orbit::Calc operator&(Orbit::Calc lhs, Orbit::Calc rhs) { return static_cast<Orbit::Calc>(static_cast<int>(lhs) & static_cast<int>(rhs)); }
104
105 } // namespace NAV
106