Skyward boardcore
Loading...
Searching...
No Matches
NASState.h
Go to the documentation of this file.
1/* Copyright (c) 2022 Skyward Experimental Rocketry
2 * Author: Alberto Nidasio
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
25#include <Eigen/Core>
26
27namespace Boardcore
28{
29
31{
32 uint64_t timestamp;
33
34 // 13 extended kalman states
35
36 // Position [m]
37 float n = 0;
38 float e = 0;
39 float d = 0;
40
41 // Velocity [m/s]
42 float vn = 0;
43 float ve = 0;
44 float vd = 0;
45
46 // Attitude as quaternion, from body to NED frame
47 float qx = 0;
48 float qy = 0;
49 float qz = 0;
50 float qw = 1;
51
52 // Gyroscope bias
53 float bx = 0;
54 float by = 0;
55 float bz = 0;
56
58
59 NASState(uint64_t timestamp, Eigen::Matrix<float, 13, 1> x)
60 : timestamp(timestamp), n(x(0)), e(x(1)), d(x(2)), vn(x(3)), ve(x(4)),
61 vd(x(5)), qx(x(6)), qy(x(7)), qz(x(8)), qw(x(9)), bx(x(10)),
62 by(x(11)), bz(x(12))
63 {
64 }
65
66 Eigen::Matrix<float, 13, 1> getX() const
67 {
68 return Eigen::Matrix<float, 13, 1>(n, e, d, vn, ve, vd, qx, qy, qz, qw,
69 bx, by, bz);
70 }
71
72 static std::string header()
73 {
74 return "timestamp,n,e,d,vn,ve,vd,qx,qy,qz,qw,bx,by,bz\n";
75 }
76
77 void print(std::ostream& os) const
78 {
79 os << timestamp << "," << n << "," << e << "," << d << "," << vn << ","
80 << ve << "," << vd << "," << qx << "," << qy << "," << qz << ","
81 << qw << "," << bx << "," << by << "," << bz << "\n";
82 }
83};
84
85} // namespace Boardcore
This file includes all the types the logdecoder script will decode.
void print(std::ostream &os) const
Definition NASState.h:77
float qz
Quaternion z.
Definition NASState.h:49
float n
North (x)
Definition NASState.h:37
static std::string header()
Definition NASState.h:72
float qx
Quaternion x.
Definition NASState.h:47
NASState(uint64_t timestamp, Eigen::Matrix< float, 13, 1 > x)
Definition NASState.h:59
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
Eigen::Matrix< float, 13, 1 > getX() const
Definition NASState.h:66
float ve
Velocity East (y)
Definition NASState.h:43
float vn
Velocity North (x)
Definition NASState.h:42
uint64_t timestamp
Definition NASState.h:32
float bz
Gyroscope bias z.
Definition NASState.h:55