Subversion Repositories FlightCtrl

Rev

Rev 886 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 ingob 1
/*#######################################################################################
2
Flight Control
3
#######################################################################################*/
4
 
5
#ifndef _FC_H
6
#define _FC_H
886 killagreg 7
 
8
#include <inttypes.h>
9
 
10
#define YAW_GYRO_DEG_FACTOR 1550L // Factor between Yaw Gyro Integral and HeadingAngle in deg
855 hbuss 11
#define STICK_GAIN 4
886 killagreg 12
 
13
typedef struct
14
{
15
        uint8_t Height_D;
16
        uint8_t MaxHeight;
17
        uint8_t Height_P;
18
        uint8_t Height_ACC_Effect;
19
        uint8_t CompassYawEffect;
20
        uint8_t Gyro_P;
21
        uint8_t Gyro_I;
22
        uint8_t Gier_P;
23
        uint8_t I_Factor;
24
        uint8_t UserParam1;
25
        uint8_t UserParam2;
26
        uint8_t UserParam3;
27
        uint8_t UserParam4;
28
        uint8_t UserParam5;
29
        uint8_t UserParam6;
30
        uint8_t UserParam7;
31
        uint8_t UserParam8;
32
        uint8_t ServoPitchControl;
33
        uint8_t LoopThrustLimit;
34
        uint8_t Yaw_PosFeedback;
35
        uint8_t Yaw_NegFeedback;
36
        uint8_t DynamicStability;
37
} fc_param_t;
38
 
39
extern fc_param_t FCParam;
40
 
41
extern volatile uint16_t I2CTimeout;
42
 
43
// attitude
44
extern volatile int32_t IntegralPitch, IntegralRoll, IntegralYaw;
45
extern volatile int16_t Reading_GyroPitch, Reading_GyroRoll, Reading_GyroYaw;
46
 
47
// offsets
48
extern volatile int16_t AdNeutralPitch, AdNeutralRoll, AdNeutralYaw;
49
extern volatile int16_t NeutralAccX, NeutralAccY;
1 ingob 50
extern volatile float NeutralAccZ;
886 killagreg 51
 
52
 
53
extern volatile int32_t Reading_Integral_Top; // calculated in analog.c
54
 
55
// compass navigation
56
extern volatile int16_t CompassHeading;
57
extern volatile int16_t CompassCourse;
58
extern volatile int16_t CompassOffCourse;
59
extern volatile uint8_t CompassCalState;
60
extern int32_t YawGyroHeading;
61
extern int16_t YawGyroHeadingInDeg;
62
 
63
// hight control
64
extern int ReadingHeight;
65
extern int SetPointHeight;
66
 
67
// mean accelerations
68
extern volatile int16_t Mean_AccPitch, Mean_AccRoll, Mean_AccTop;
69
 
70
// acceleration send to navi board
71
extern int16_t NaviAccPitch, NaviAccRoll, NaviCntAcc;
72
 
73
 
74
// looping params
75
extern long TurnOver180Pitch, TurnOver180Roll;
76
 
77
// external control
78
extern int16_t ExternStickPitch, ExternStickRoll, ExternStickYaw;
79
 
80
 
81
void MotorControl(void);
1 ingob 82
void SendMotorData(void);
886 killagreg 83
void CalibMean(void);
84
void Mean(void);
1 ingob 85
void SetNeutral(void);
886 killagreg 86
void Beep(uint8_t numbeeps);
1 ingob 87
 
88
 
886 killagreg 89
extern int16_t  Poti1, Poti2, Poti3, Poti4, Poti5, Poti6, Poti7, Poti8;
499 hbuss 90
 
886 killagreg 91
// setpoints for motors
903 pangu 92
#ifdef HEXAKOPTER
93
extern volatile uint8_t Motor_FrontLeft, Motor_FrontRight, Motor_RearLeft, Motor_RearRight, Motor_Right, Motor_Left;
94
#else
886 killagreg 95
extern volatile uint8_t Motor_Front, Motor_Rear, Motor_Right, Motor_Left; //used by twimaster isr
903 pangu 96
#endif
1 ingob 97
 
886 killagreg 98
// current stick values
99
extern int16_t StickPitch;
100
extern int16_t StickRoll;
101
extern int16_t StickYaw;
102
extern int16_t GPS_Pitch;
103
extern int16_t GPS_Roll;
396 hbuss 104
 
886 killagreg 105
// current stick elongations
106
extern int16_t MaxStickPitch, MaxStickRoll, MaxStickYaw;
107
extern uint8_t MotorsOn;
108
extern uint8_t EmergencyLanding;
109
extern uint16_t Model_Is_Flying;
1 ingob 110
 
111
 
112
#endif //_FC_H
113