-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuadCopterControl.h
41 lines (38 loc) · 1 KB
/
QuadCopterControl.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
#ifndef QUAD_COPTER_CONTROL
#define QUAD_COPTER_CONTROL
#include "Sensors.h"
#include "MultiMotorControl.h"
#include "QuadCopterTypes.h"
#include "Coordinates.h"
#include "ControlModel.h"
#include "PIDModel.h"
#include "ControlErrors.h"
#include "MathFunctions.h"
#include "ConstConfig.h"
class QuadCopterControl
{
public:
QuadCopterControl(uint8_t *motorPins);
void Initilize();
void Roll(int8_t degrees);
void Pitch(int8_t degrees);
void Yaw(int8_t degrees);
void Thrust(int8_t power);
void RunControlLoop();
private:
void ApplyPitch(float controlPitch);
void ApplyYaw(float controlYaw);
void ApplyRoll(float controlRoll);
void ApplyThrottle();
ControlErrors GetControlErrors();
float CalculateGravityCompensation(float pitch, float roll);
Sensors *sensors;
MultiMotorControl *motors;
ControlModel imuControlValues;
ControlModel remoteControlValues;
PIDModel *rollPid;
PIDModel *pitchPid;
PIDModel *yawPid;
float *motorThrottles;
};
#endif