-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypedefs.h
101 lines (80 loc) · 1.68 KB
/
typedefs.h
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
/*
* typedefs.h
*
* Created on: Mar 16, 2014
* Author: Luiz
*/
#ifndef QUADGLOVEREMOTE_TYPEDEFS_H_
#define QUADGLOVEREMOTE_TYPEDEFS_H_
#include <stdint.h>
#include <stdbool.h>
// Structure with calibration offsets for an IMU
typedef struct ImuOffset {
// Accelerometer
int16_t acc_x;
int16_t acc_y;
int16_t acc_z;
// Gyroscope
int16_t gyro_x;
int16_t gyro_y;
int16_t gyro_z;
} ImuOffset;
// Structure with raw input from an IMU
typedef struct ImuRaw {
// Accelerometer
int16_t acc_x; // -512 <-> +512
int16_t acc_y;
int16_t acc_z;
// Gyroscope
int16_t gyro_x; // -32,768 <-> +32,768
int16_t gyro_y;
int16_t gyro_z;
// Compass
int16_t mag_x; // -4096 <-> +4096
int16_t mag_y;
int16_t mag_z;
} ImuRaw;
// Structure with filtered input from and IMU
typedef struct ImuFiltered {
// Rotation
float x; // -90 <-> 90
float y;
float z;
// Inverted
bool inv;
} ImuFiltered;
// Structure with control values for quadcopter
typedef struct QuadControl {
// Derivative values
int16_t pitch; // 1100 <-> 1900
int16_t roll; // 1100 <-> 1900
int16_t yaw; // 0 <-> 360
int16_t throttle; // 1100 <-> 1900
int16_t arm; // 1100 (disarm) 1900 (arm)
//int16_t hold; // 1100 (no hold) 1900 (gps hold)
} QuadControl;
// Glove State
typedef struct GloveState {
bool fist; // Making a fist
bool inverted; // Glove upside-down
bool left; //
bool right; //
bool up; //
bool down; //
} GloveState;
// Main State
typedef enum MainState {
INIT,
LAND,
ARM,
SAFE,
FLY,
HOLD
} MainState;
// RGB LED
typedef struct LedState {
enum color {OFF, BLUE, GREEN, AQUA,
RED, PURPLE, YELLOW, WHITE} color;
int16_t rate;
} LedState;
#endif /* QUADGLOVEREMOTE_TYPEDEFS_H_ */