0.3.0
Loading...
Searching...
No Matches
Antenna.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
13
14#pragma once
15
16#include <Eigen/Dense>
17#include <memory>
18
19#include "CoordinateFrames.hpp"
22
23namespace NAV::trafo
24{
25
31template<typename Derived>
32[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
33 e_posMarker2ARP(const Eigen::MatrixBase<Derived>& e_posMarker,
34 const std::shared_ptr<const GnssObs>& gnssObs,
35 const Eigen::Vector3d& hen_delta = Eigen::Vector3d::Zero())
36{
37 Eigen::Vector3<typename Derived::Scalar> e_posARP = e_posMarker;
38
39 auto lla_posMarker = trafo::ecef2lla_WGS84(e_posMarker);
40 auto e_Quat_n = trafo::e_Quat_n(lla_posMarker(0), lla_posMarker(1));
41
42 if (gnssObs && gnssObs->receiverInfo)
43 {
44 Eigen::Vector3<typename Derived::Scalar> n_antennaDelta(typename Derived::Scalar(0.0),
45 typename Derived::Scalar(0.0),
46 typename Derived::Scalar(-gnssObs->receiverInfo->get().antennaDeltaNEU.z()));
47 e_posARP += e_Quat_n * n_antennaDelta;
48 }
49 return e_posARP
50 + e_Quat_n
51 * Eigen::Vector3<typename Derived::Scalar>(typename Derived::Scalar(0.0),
52 typename Derived::Scalar(0.0),
53 typename Derived::Scalar(hen_delta(0)));
54}
55
61template<typename Derived>
62[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
63 lla_posMarker2ARP(const Eigen::MatrixBase<Derived>& lla_posMarker,
64 const std::shared_ptr<const GnssObs>& gnssObs,
65 const Eigen::Vector3d& hen_delta = Eigen::Vector3d::Zero())
66{
67 Eigen::Vector3<typename Derived::Scalar> lla_posARP = lla_posMarker;
68 auto e_Quat_n = trafo::e_Quat_n(lla_posMarker(0), lla_posMarker(1));
69 if (gnssObs && gnssObs->receiverInfo)
70 {
71 lla_posARP.z() += gnssObs->receiverInfo->get().antennaDeltaNEU.z();
72 }
73 return lla_posARP
74 + e_Quat_n
75 * Eigen::Vector3<typename Derived::Scalar>(typename Derived::Scalar(0.0),
76 typename Derived::Scalar(0.0),
77 typename Derived::Scalar(hen_delta(0)));
78}
79
87template<typename Derived>
88[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
89 e_posARP2APC(const Eigen::MatrixBase<Derived>& e_posARP,
90 const std::shared_ptr<const GnssObs>& gnssObs,
91 Frequency freq,
92 const std::string& antennaType,
93 const std::string& nameId)
94{
95 Eigen::Vector3<typename Derived::Scalar> e_posAPC = e_posARP;
96 if (gnssObs)
97 {
98 if (auto neu_antennaPhaseCenterOffset = AntexReader::Get().getAntennaPhaseCenterOffsetToARP(antennaType,
99 Frequency_(freq),
100 gnssObs->insTime,
101 nameId))
102 {
103 Eigen::Vector3<typename Derived::Scalar> n_antennaPhaseCenterOffset(typename Derived::Scalar(0.0),
104 typename Derived::Scalar(0.0),
105 typename Derived::Scalar(-neu_antennaPhaseCenterOffset->z()));
106 auto lla_posARP = trafo::ecef2lla_WGS84(e_posARP);
107 if (!std::isnan(lla_posARP(0)) && !std::isnan(lla_posARP(1)))
108 {
109 e_posAPC += trafo::e_Quat_n(lla_posARP(0), lla_posARP(1)) * n_antennaPhaseCenterOffset;
110 }
111 }
112 }
113 return e_posAPC;
114}
115
123template<typename Derived>
124[[nodiscard]] Eigen::Vector3<typename Derived::Scalar>
125 lla_posARP2APC(const Eigen::MatrixBase<Derived>& lla_posARP,
126 const std::shared_ptr<const GnssObs>& gnssObs,
127 Frequency freq,
128 const std::string& antennaType,
129 const std::string& nameId)
130{
131 Eigen::Vector3<typename Derived::Scalar> lla_posAPC = lla_posARP;
132 if (gnssObs)
133 {
134 if (auto neu_antennaPhaseCenterOffset =
135 AntexReader::Get().getAntennaPhaseCenterOffsetToARP(antennaType,
136 Frequency_(freq),
137 gnssObs->insTime,
138 nameId))
139 {
140 lla_posAPC.z() += neu_antennaPhaseCenterOffset->z();
141 }
142 }
143 return lla_posAPC;
144}
145
146} // namespace NAV::trafo
Eigen::Vector3< typename Derived::Scalar > e_posMarker2ARP(const Eigen::MatrixBase< Derived > &e_posMarker, const std::shared_ptr< const GnssObs > &gnssObs, const Eigen::Vector3d &hen_delta=Eigen::Vector3d::Zero())
Converts a marker position to the antenna reference point position.
Definition Antenna.hpp:33
Eigen::Vector3< typename Derived::Scalar > lla_posARP2APC(const Eigen::MatrixBase< Derived > &lla_posARP, const std::shared_ptr< const GnssObs > &gnssObs, Frequency freq, const std::string &antennaType, const std::string &nameId)
Converts a antenna reference point position to the antenna phase center position.
Definition Antenna.hpp:125
Eigen::Vector3< typename Derived::Scalar > e_posARP2APC(const Eigen::MatrixBase< Derived > &e_posARP, const std::shared_ptr< const GnssObs > &gnssObs, Frequency freq, const std::string &antennaType, const std::string &nameId)
Converts a antenna reference point position position to the antenna phase center position.
Definition Antenna.hpp:89
Eigen::Vector3< typename Derived::Scalar > lla_posMarker2ARP(const Eigen::MatrixBase< Derived > &lla_posMarker, const std::shared_ptr< const GnssObs > &gnssObs, const Eigen::Vector3d &hen_delta=Eigen::Vector3d::Zero())
Converts a marker position to the antenna reference point position.
Definition Antenna.hpp:63
ANTEX file reader.
Transformation collection.
Eigen::Quaternion< Scalar > e_Quat_n(Scalar latitude, Scalar longitude)
Quaternion for rotations from navigation to Earth-fixed frame.
Definition CoordinateFrames.hpp:187
Frequency_
Enumerate for GNSS frequencies.
Definition Frequency.hpp:26
GNSS Observation messages.
static AntexReader & Get()
Get the static Instance of the reader.
Definition AntexReader.hpp:98
Frequency definition for different satellite systems.
Definition Frequency.hpp:59