Skyward boardcore
Loading...
Searching...
No Matches
PropagatorData.h
Go to the documentation of this file.
1/* Copyright (c) 2024 Skyward Experimental Rocketry
2 * Author: Emilio Corigliano
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#pragma once
24
26
27#include <Eigen/Core>
28#include <ostream>
29
30namespace Boardcore
31{
32
40{
41 uint64_t timestamp;
42 uint32_t nPropagations;
44
45 float az = 0;
46 static constexpr float ax = 0,
47 ay = 0;
49
51 NASState nasState)
53 {
54 }
55
56 static std::string header()
57 {
58 return "timestamp,nPropagations,n,e,d,vn,ve,vd,qx,qy,qz,qw,bx,by,bz,ax,"
59 "ay,az\n";
60 }
61
62 void print(std::ostream& os) const
63 {
64 os << timestamp << "," << nPropagations << "," << nas.n << "," << nas.e
65 << "," << nas.d << "," << nas.vn << "," << nas.ve << "," << nas.vd
66 << "," << nas.qx << "," << nas.qy << "," << nas.qz << "," << nas.qw
67 << "," << nas.bx << "," << nas.by << "," << nas.bz << "," << ax
68 << "," << ay << "," << az << "\n";
69 }
70
71 NASState getNasState() const { return nas; }
72
78 Eigen::Vector3f getPosition()
79 {
80 return Eigen::Vector3f(nas.n, nas.e, nas.d);
81 }
82
86 void setPosition(Eigen::Vector3f xProp)
87 {
88 nas.n = xProp(0);
89 nas.e = xProp(1);
90 nas.d = xProp(2);
91 }
92
98 Eigen::Vector3f getVelocity()
99 {
100 return Eigen::Vector3f(nas.vn, nas.ve, nas.vd);
101 }
102
106 void setVelocity(Eigen::Vector3f vProp)
107 {
108 nas.vn = vProp(0);
109 nas.ve = vProp(1);
110 nas.vd = vProp(2);
111 }
112
116 void setZAcceleration(Eigen::Vector3f acc) { az = acc(2); }
117
123 Eigen::Vector3f getAcceleration() const
124 {
125 Eigen::Vector3f acc;
126 acc(0) = ax;
127 acc(1) = ay;
128 acc(2) = az;
129 return acc;
130 }
131
137 Eigen::Vector4f getQProp()
138 {
139 return Eigen::Vector4f(nas.qx, nas.qy, nas.qz, nas.qw);
140 }
141
145 void setQProp(Eigen::Vector4f qProp)
146 {
147 nas.qx = qProp(0);
148 nas.qy = qProp(1);
149 nas.qz = qProp(2);
150 nas.qw = qProp(3);
151 }
152
158 Eigen::Vector3f getBProp() { return Eigen::Vector3f(nas.n, nas.e, nas.d); }
159
163 void setBProp(Eigen::Vector3f bProp)
164 {
165 nas.bx = bProp(0);
166 nas.by = bProp(1);
167 nas.bz = bProp(2);
168 }
169};
170
171} // namespace Boardcore
This file includes all the types the logdecoder script will decode.
float qz
Quaternion z.
Definition NASState.h:49
float n
North (x)
Definition NASState.h:37
float qx
Quaternion x.
Definition NASState.h:47
float e
East (y)
Definition NASState.h:38
float vd
Velocity Down (z)
Definition NASState.h:44
float d
Down (z)
Definition NASState.h:39
float bx
Gyroscope bias x.
Definition NASState.h:53
float qy
Quaternion y.
Definition NASState.h:48
float qw
Quaternion w.
Definition NASState.h:50
float by
Gyroscope bias y.
Definition NASState.h:54
float ve
Velocity East (y)
Definition NASState.h:43
float vn
Velocity North (x)
Definition NASState.h:42
float bz
Gyroscope bias z.
Definition NASState.h:55
State of the propagator, taking into account the prediction steps (0 if true NAS state) and the propa...
PropagatorState(uint64_t timestamp, uint32_t nPropagations, NASState nasState)
void setBProp(Eigen::Vector3f bProp)
Setter for the vector of quaternions' bias.
NASState getNasState() const
Eigen::Vector3f getVelocity()
Getter for the vector of velocities NED.
Eigen::Vector4f getQProp()
Getter for the vector of quaternions.
void setZAcceleration(Eigen::Vector3f acc)
Setter for the vector acceleration(only z-axis)
Eigen::Vector3f getPosition()
Getter for the vector of positions NED.
static std::string header()
void setPosition(Eigen::Vector3f xProp)
Setter for the vector of positions NED.
void setVelocity(Eigen::Vector3f vProp)
Setter for the vector of velocities NED.
static constexpr float ax
Eigen::Vector3f getBProp()
Getter for the vector of quaternions' bias.
void print(std::ostream &os) const
uint32_t nPropagations
Predictions from last received NAS state.
void setQProp(Eigen::Vector4f qProp)
Setter for the vector of quaternions.
uint64_t timestamp
Prediction timestamp (ARP timestamp) [ms].
Eigen::Vector3f getAcceleration() const
Getter for the vector acceleration.
static constexpr float ay
only az is used by the propagator