Skyward boardcore
Loading...
Searching...
No Matches
SensorDataExtra.h
Go to the documentation of this file.
1/* Copyright (c) 2020 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/* This header file defines operators << and >> from some types
24 * of SensorData.
25 *
26 * This way you can write for example:
27 *
28 * GenericSensorData data;
29 * data << Vector3f{0.f, 0.f, 0.f};
30 *
31 * Vector3f vec;
32 * data >> vec;
33 *
34 * That works if GenericSensorData is any of AccelerometerData, GyroscopeData
35 * and MagnetometerData
36 */
37
38#pragma once
39
40#include <sensors/SensorData.h>
41
42#include <Eigen/Core>
43
44namespace Boardcore
45{
46
47void operator<<(AccelerometerData& lhs, const Eigen::Vector3f& rhs);
48
49void operator<<(Eigen::Vector3f& lhs, const AccelerometerData& rhs);
50
51void operator<<(GyroscopeData& lhs, const Eigen::Vector3f& rhs);
52
53void operator<<(Eigen::Vector3f& lhs, const GyroscopeData& rhs);
54
55void operator<<(MagnetometerData& lhs, const Eigen::Vector3f& rhs);
56
57void operator<<(Eigen::Vector3f& lhs, const MagnetometerData& rhs);
58
59void operator>>(const AccelerometerData& lhs, Eigen::Vector3f& rhs);
60
61void operator>>(const Eigen::Vector3f& lhs, AccelerometerData& rhs);
62
63void operator>>(const GyroscopeData& lhs, Eigen::Vector3f& rhs);
64
65void operator>>(const Eigen::Vector3f& lhs, GyroscopeData& rhs);
66
67void operator>>(const MagnetometerData& lhs, Eigen::Vector3f& rhs);
68
69void operator>>(const Eigen::Vector3f& lhs, MagnetometerData& rhs);
70
71} // 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