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 ImuPos.hpp |
10 |
|
|
/// @brief Imu Position Data |
11 |
|
|
/// @author T. Topp (topp@ins.uni-stuttgart.de) |
12 |
|
|
/// @date 2020-09-11 |
13 |
|
|
|
14 |
|
|
#pragma once |
15 |
|
|
|
16 |
|
|
#include "util/Eigen.hpp" |
17 |
|
|
|
18 |
|
|
namespace NAV |
19 |
|
|
{ |
20 |
|
|
// Forward declarations |
21 |
|
|
class Imu; |
22 |
|
|
class MultiImuFile; |
23 |
|
|
|
24 |
|
|
/// IMU Position |
25 |
|
|
class ImuPos |
26 |
|
|
{ |
27 |
|
|
public: |
28 |
|
|
/// Accelerometer position in body frame coordinates in [m] |
29 |
|
✗ |
[[nodiscard]] const Eigen::Vector3d& b_positionAccel() const |
30 |
|
|
{ |
31 |
|
✗ |
return _b_positionAccel; |
32 |
|
|
} |
33 |
|
|
/// Gyroscope position in body frame coordinates in [m] |
34 |
|
✗ |
[[nodiscard]] const Eigen::Vector3d& b_positionGyro() const |
35 |
|
|
{ |
36 |
|
✗ |
return _b_positionGyro; |
37 |
|
|
} |
38 |
|
|
/// Magnetometer position in body frame coordinates in [m] |
39 |
|
✗ |
[[nodiscard]] const Eigen::Vector3d& b_positionMag() const |
40 |
|
|
{ |
41 |
|
✗ |
return _b_positionMag; |
42 |
|
|
} |
43 |
|
|
|
44 |
|
|
/// Quaternion from accelerometer platform frame to body frame |
45 |
|
177346 |
[[nodiscard]] const Eigen::Quaterniond& b_quatAccel_p() const |
46 |
|
|
{ |
47 |
|
177346 |
return _b_quatAccel_p; |
48 |
|
|
} |
49 |
|
|
/// Quaternion from body frame to accelerometer platform frame |
50 |
|
2890774 |
[[nodiscard]] Eigen::Quaterniond p_quatAccel_b() const |
51 |
|
|
{ |
52 |
|
2890774 |
return _b_quatAccel_p.conjugate(); |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
/// Quaternion from gyroscope platform frame to body frame |
56 |
|
154162 |
[[nodiscard]] const Eigen::Quaterniond& b_quatGyro_p() const |
57 |
|
|
{ |
58 |
|
154162 |
return _b_quatGyro_p; |
59 |
|
|
} |
60 |
|
|
/// Quaternion from body frame to gyroscope platform frame |
61 |
|
2892811 |
[[nodiscard]] Eigen::Quaterniond p_quatGyro_b() const |
62 |
|
|
{ |
63 |
|
2892811 |
return _b_quatGyro_p.conjugate(); |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
/// Quaternion from magnetometer platform frame to body frame |
67 |
|
✗ |
[[nodiscard]] const Eigen::Quaterniond& b_quatMag_p() const |
68 |
|
|
{ |
69 |
|
✗ |
return _b_quatMag_p; |
70 |
|
|
} |
71 |
|
|
/// Quaternion from body frame to magnetometer platform frame |
72 |
|
✗ |
[[nodiscard]] Eigen::Quaterniond p_quatMag_b() const |
73 |
|
|
{ |
74 |
|
✗ |
return _b_quatMag_p.conjugate(); |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
private: |
78 |
|
|
/// Accelerometer position in body frame coordinates in [m] |
79 |
|
|
Eigen::Vector3d _b_positionAccel = { 0, 0, 0 }; |
80 |
|
|
/// Gyroscope position in body frame coordinates in [m] |
81 |
|
|
Eigen::Vector3d _b_positionGyro = { 0, 0, 0 }; |
82 |
|
|
/// Magnetometer position in body frame coordinates in [m] |
83 |
|
|
Eigen::Vector3d _b_positionMag = { 0, 0, 0 }; |
84 |
|
|
|
85 |
|
|
/// Quaternion from accelerometer platform frame to body frame |
86 |
|
|
Eigen::Quaterniond _b_quatAccel_p = Eigen::Quaterniond::Identity(); |
87 |
|
|
/// Quaternion from gyroscope platform frame to body frame |
88 |
|
|
Eigen::Quaterniond _b_quatGyro_p = { 1, 0, 0, 0 }; |
89 |
|
|
/// Quaternion from magnetometer platform frame to body frame |
90 |
|
|
Eigen::Quaterniond _b_quatMag_p = { 1, 0, 0, 0 }; |
91 |
|
|
|
92 |
|
|
friend class Imu; |
93 |
|
|
friend class MultiImuFile; |
94 |
|
|
friend void from_json(const json& j, ImuPos& pos); |
95 |
|
|
}; |
96 |
|
|
|
97 |
|
|
/// @brief Write info to a json object |
98 |
|
|
/// @param[out] j Json output |
99 |
|
|
/// @param[in] pos Object to read info from |
100 |
|
|
void to_json(json& j, const ImuPos& pos); |
101 |
|
|
/// @brief Read info from a json object |
102 |
|
|
/// @param[in] j Json variable to read info from |
103 |
|
|
/// @param[out] pos Output object |
104 |
|
|
void from_json(const json& j, ImuPos& pos); |
105 |
|
|
|
106 |
|
|
} // namespace NAV |
107 |
|
|
|