Skyward boardcore
Loading...
Searching...
No Matches
SensorDataExtra.cpp
Go to the documentation of this file.
1/* Copyright (c) 2021 Skyward Experimental Rocketry
2 * Author: Riccardo Musso
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#include "SensorDataExtra.h"
24
25using namespace Eigen;
26
27namespace Boardcore
28{
29
30void operator<<(AccelerometerData& lhs, const Vector3f& rhs)
31{
32 lhs.accelerationX = rhs[0];
33 lhs.accelerationY = rhs[1];
34 lhs.accelerationZ = rhs[2];
35}
36
37void operator<<(Eigen::Vector3f& lhs, const AccelerometerData& rhs)
38{
39 lhs[0] = rhs.accelerationX;
40 lhs[1] = rhs.accelerationY;
41 lhs[2] = rhs.accelerationZ;
42}
43
44void operator<<(GyroscopeData& lhs, const Vector3f& rhs)
45{
46 lhs.angularSpeedX = rhs[0];
47 lhs.angularSpeedY = rhs[1];
48 lhs.angularSpeedZ = rhs[2];
49}
50
51void operator<<(Eigen::Vector3f& lhs, const GyroscopeData& rhs)
52{
53 lhs[0] = rhs.angularSpeedX;
54 lhs[1] = rhs.angularSpeedY;
55 lhs[2] = rhs.angularSpeedZ;
56}
57
58void operator<<(MagnetometerData& lhs, const Vector3f& rhs)
59{
60 lhs.magneticFieldX = rhs[0];
61 lhs.magneticFieldY = rhs[1];
62 lhs.magneticFieldZ = rhs[2];
63}
64
65void operator<<(Eigen::Vector3f& lhs, const MagnetometerData& rhs)
66{
67 lhs[0] = rhs.magneticFieldX;
68 lhs[1] = rhs.magneticFieldY;
69 lhs[2] = rhs.magneticFieldZ;
70}
71
72void operator>>(const AccelerometerData& lhs, Eigen::Vector3f& rhs)
73{
74 rhs << lhs;
75}
76
77void operator>>(const Eigen::Vector3f& lhs, AccelerometerData& rhs)
78{
79 rhs << lhs;
80}
81
82void operator>>(const GyroscopeData& lhs, Eigen::Vector3f& rhs) { rhs << lhs; }
83
84void operator>>(const Eigen::Vector3f& lhs, GyroscopeData& rhs) { rhs << lhs; }
85
86void operator>>(const MagnetometerData& lhs, Eigen::Vector3f& rhs)
87{
88 rhs << lhs;
89}
90
91void operator>>(const Eigen::Vector3f& lhs, MagnetometerData& rhs)
92{
93 rhs << lhs;
94}
95
96} // namespace Boardcore
This file includes all the types the logdecoder script will decode.
void operator>>(const AccelerometerData &lhs, Eigen::Vector3f &rhs)
std::ostream & operator<<(std::ostream &o, const GammaConf &conf)
Definition GammaTypes.h:98
Structure to handle accelerometer data.
Definition SensorData.h:121
Structure to handle gyroscope data.
Definition SensorData.h:207
Structure to handle magnetometer data.
Definition SensorData.h:249