-
Notifications
You must be signed in to change notification settings - Fork 11
/
aircraft.hpp
99 lines (82 loc) · 3.29 KB
/
aircraft.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#ifndef MAVLINK_TO_FRSKY_AIRCRAFT_HPP_INCLUDED
#define MAVLINK_TO_FRSKY_AIRCRAFT_HPP_INCLUDED
/*
Copyright (c) 2012 - 2013 Andy Little
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#include <cstdint>
#include <quan/stm32f4/config.hpp>
#include <quan/time.hpp>
#include <quan/length.hpp>
#include <quan/velocity.hpp>
#include <quan/voltage.hpp>
#include <quan/current.hpp>
#include <quan/angle.hpp>
struct location_t{
/*
quan::angle_<float>::deg lat;
quan::angle_<float>::deg lon;
quan::length_<float>::m alt;
location_t():lat{0},lon{0},alt{0}{}
*/
quan::time_<uint64_t>::us gps_time_stamp;
quan::angle_<int32_t>::deg10e7 gps_lat;
quan::angle_<int32_t>::deg10e7 gps_lon;
quan::velocity_<uint16_t>::cm_per_s gps_vog;
quan::angle_<uint16_t>::cdeg gps_cog;
quan::length_<int32_t>::mm gps_alt;
quan::length_<uint16_t>::cm gps_hdop;
quan::length_<uint16_t>::cm gps_vdop;
quan::length_<float>::m baro_alt;
// add timestamp and other info
};
struct gps_t{
uint8_t num_sats;
uint8_t fix_type;
bool has_home;
};
struct attitude_t{
quan::angle_<float>::deg pitch;
quan::angle_<float>::deg roll;
quan::angle_<float>::deg yaw;
attitude_t():pitch{0},roll{0},yaw{0}{}
};
struct aircraft{
location_t location;
// location_t home_location;
attitude_t attitude;
float throttle;
quan::angle_<float>::deg heading;
quan::velocity_<float>::m_per_s airspeed;
quan::velocity_<float>::m_per_s groundspeed;
quan::voltage_<float>::V battery_voltage;
quan::current_<float>::A battery_current;
float battery_remaining;
// quan::length_<float>::m get_distance_from_home();
// quan::angle_<float>::deg get_bearing_to_home();
uint16_t nav_mode;
uint8_t custom_mode;
gps_t gps;
aircraft():
throttle{0},
heading{0},
airspeed{0},
groundspeed{0},
battery_voltage{0},
battery_current{0},
battery_remaining{0},
nav_mode{0},
custom_mode{0}
{}
};
extern aircraft the_aircraft;
#endif // MAVLINK_TO_FRSKY_AIRCRAFT_HPP_INCLUDED