Subversion Repositories FlightCtrl

Rev

Rev 1102 | 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
1096 salvo 7
#define GIER_GRAD_FAKTOR 1291L // Abhängigkeit zwischen GyroIntegral und Winkel
855 hbuss 8
#define STICK_GAIN 4
1102 salvo 9
//Salvo 30.12.2007 
10
#define ACC_WAAGRECHT_LIMIT 200 // Nick und Roll kleiner als dieser Wert gelten als Kriterium fuer waagrechte Lage
1103 salvo 11
#define GIER_COMP_MAX 10 // Maximalwert der Giergyrodriftkompensation via Kompass
1102 salvo 12
//Salvo End
921 hbuss 13
 
1086 salvo 14
 
15
 
921 hbuss 16
#define FLAG_MOTOR_RUN  1
17
#define FLAG_FLY        2
18
#define FLAG_CALIBRATE  4
19
#define FLAG_START      8
20
extern unsigned char MikroKopterFlags;
21
 
173 holgerb 22
extern volatile unsigned int I2CTimeout;
1 ingob 23
extern unsigned char Sekunde,Minute;
693 hbuss 24
extern long IntegralNick,IntegralNick2;
25
extern long IntegralRoll,IntegralRoll2;
26
extern long Mess_IntegralNick,Mess_IntegralNick2;
27
extern long Mess_IntegralRoll,Mess_IntegralRoll2;
28
extern long IntegralAccNick,IntegralAccRoll;
1 ingob 29
extern volatile long Mess_Integral_Hoch;
693 hbuss 30
extern long Integral_Gier,Mess_Integral_Gier,Mess_Integral_Gier2;
1 ingob 31
extern volatile int  KompassValue;
32
extern volatile int  KompassStartwert;
33
extern volatile int  KompassRichtung;
717 hbuss 34
extern long  ErsatzKompass;
35
extern int   ErsatzKompassInGrad; // Kompasswert in Grad
1 ingob 36
extern int HoehenWert;
37
extern int SollHoehe;
38
extern volatile int MesswertNick,MesswertRoll,MesswertGier;
927 hbuss 39
extern int AdNeutralNick,AdNeutralRoll,AdNeutralGier, Mittelwert_AccNick, Mittelwert_AccRoll;
40
extern int NeutralAccX, NeutralAccY,Mittelwert_AccHoch;
1 ingob 41
extern volatile float NeutralAccZ;
396 hbuss 42
extern long Umschlag180Nick, Umschlag180Roll;
492 hbuss 43
extern signed int ExternStickNick,ExternStickRoll,ExternStickGier;
513 hbuss 44
extern unsigned char Parameter_UserParam1,Parameter_UserParam2,Parameter_UserParam3,Parameter_UserParam4,Parameter_UserParam5,Parameter_UserParam6,Parameter_UserParam7,Parameter_UserParam8;
805 hbuss 45
extern int NaviAccNick,NaviAccRoll,NaviCntAcc;
871 hbuss 46
extern unsigned int modell_fliegt;
1 ingob 47
void MotorRegler(void);
48
void SendMotorData(void);
49
void CalibrierMittelwert(void);
50
void Mittelwert(void);
51
void SetNeutral(void);
304 ingob 52
void Piep(unsigned char Anzahl);
53
extern void DefaultKonstanten(void);
54
void DefaultKonstanten1(void);
55
void DefaultKonstanten2(void);
1 ingob 56
 
304 ingob 57
extern unsigned char h,m,s;
58
extern volatile unsigned char Timeout ;
59
extern unsigned char CosinusNickWinkel, CosinusRollWinkel;
60
extern volatile int  DiffNick,DiffRoll;
1 ingob 61
extern int  Poti1, Poti2, Poti3, Poti4;
304 ingob 62
extern volatile unsigned char Motor_Vorne,Motor_Hinten,Motor_Rechts,Motor_Links, Count;
63
extern volatile unsigned char SenderOkay;
64
extern int StickNick,StickRoll,StickGier;
65
extern char MotorenEin;
396 hbuss 66
extern void DefaultKonstanten1(void);
67
extern void DefaultKonstanten2(void);
1 ingob 68
 
1086 salvo 69
//Salvo 2.1.2008 Debugvariablens
70
extern int debug_gp_0,debug_gp_1,debug_gp_2,debug_gp_3,debug_gp_4,debug_gp_5,debug_gp_6,debug_gp_7; //Allgemeine Debugvariablen
71
//Salvo End
72
 
73
//Salvo 2.9.2007 Ersatzkompass
74
extern long GyroKomp_Int;
75
extern long int GyroGier_Comp;
76
extern int GyroKomp_Inc_Grad;
77
extern int GyroKomp_Value; //  Der ermittelte Kompasswert aus Gyro und Magnetkompass
78
// Salvo End
79
 
993 hbuss 80
#define  STRUCT_PARAM_LAENGE  86
1 ingob 81
struct mk_param_struct
82
 {
921 hbuss 83
   unsigned char Kanalbelegung[8];       // GAS[0], GIER[1],NICK[2], ROLL[3], POTI1, POTI2, POTI3
84
   unsigned char GlobalConfig;           // 0x01=Höhenregler aktiv,0x02=Kompass aktiv, 0x04=GPS aktiv, 0x08=Heading Hold aktiv
85
   unsigned char Hoehe_MinGas;           // Wert : 0-100
86
   unsigned char Luftdruck_D;            // Wert : 0-250
87
   unsigned char MaxHoehe;               // Wert : 0-32
88
   unsigned char Hoehe_P;                // Wert : 0-32
89
   unsigned char Hoehe_Verstaerkung;     // Wert : 0-50
1 ingob 90
   unsigned char Hoehe_ACC_Wirkung;      // Wert : 0-250
91
   unsigned char Stick_P;                // Wert : 1-6
92
   unsigned char Stick_D;                // Wert : 0-64
93
   unsigned char Gier_P;                 // Wert : 1-20
94
   unsigned char Gas_Min;                // Wert : 0-32
95
   unsigned char Gas_Max;                // Wert : 33-250
96
   unsigned char GyroAccFaktor;          // Wert : 1-64
97
   unsigned char KompassWirkung;         // Wert : 0-32
98
   unsigned char Gyro_P;                 // Wert : 10-250
99
   unsigned char Gyro_I;                 // Wert : 0-250
100
   unsigned char UnterspannungsWarnung;  // Wert : 0-250
101
   unsigned char NotGas;                 // Wert : 0-250     //Gaswert bei Empängsverlust
102
   unsigned char NotGasZeit;             // Wert : 0-250     // Zeitbis auf NotGas geschaltet wird, wg. Rx-Problemen
103
   unsigned char UfoAusrichtung;         // X oder + Formation
104
   unsigned char I_Faktor;               // Wert : 0-250
105
   unsigned char UserParam1;             // Wert : 0-250
106
   unsigned char UserParam2;             // Wert : 0-250
107
   unsigned char UserParam3;             // Wert : 0-250
108
   unsigned char UserParam4;             // Wert : 0-250
109
   unsigned char ServoNickControl;       // Wert : 0-250     // Stellung des Servos
110
   unsigned char ServoNickComp;          // Wert : 0-250     // Einfluss Gyro/Servo
111
   unsigned char ServoNickMin;           // Wert : 0-250     // Anschlag
112
   unsigned char ServoNickMax;           // Wert : 0-250     // Anschlag
173 holgerb 113
   unsigned char ServoNickRefresh;       //
114
   unsigned char LoopGasLimit;           // Wert: 0-250  max. Gas während Looping
115
   unsigned char LoopThreshold;          // Wert: 0-250  Schwelle für Stickausschlag
396 hbuss 116
   unsigned char LoopHysterese;          // Wert: 0-250  Hysterese für Stickausschlag
117
   unsigned char AchsKopplung1;          // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick koppelt (NickRollMitkopplung)
118
   unsigned char AchsGegenKopplung1;     // Wert: 0-250  Faktor, mit dem Gier die Achsen Roll und Nick Gegenkoppelt (NickRollGegenkopplung)
119
   unsigned char WinkelUmschlagNick;     // Wert: 0-250  180°-Punkt
120
   unsigned char WinkelUmschlagRoll;     // Wert: 0-250  180°-Punkt
121
   unsigned char GyroAccAbgleich;        // 1/k  (Koppel_ACC_Wirkung)
499 hbuss 122
   unsigned char Driftkomp;              
123
   unsigned char DynamicStability;
124
   unsigned char UserParam5;             // Wert : 0-250
125
   unsigned char UserParam6;             // Wert : 0-250
126
   unsigned char UserParam7;             // Wert : 0-250
127
   unsigned char UserParam8;             // Wert : 0-250
921 hbuss 128
//---Output ---------------------------------------------
129
   unsigned char J16Bitmask;             // for the J16 Output
130
   unsigned char J16Timing;              // for the J16 Output
131
   unsigned char J17Bitmask;             // for the J17 Output
132
   unsigned char J17Timing;              // for the J17 Output
133
//---NaviCtrl---------------------------------------------
134
   unsigned char NaviGpsModeControl;     // Parameters for the Naviboard
135
   unsigned char NaviGpsGain;    
136
   unsigned char NaviGpsP;        
137
   unsigned char NaviGpsI;        
138
   unsigned char NaviGpsD;        
139
   unsigned char NaviGpsACC;        
140
   unsigned char NaviGpsMinSat;        
141
   unsigned char NaviStickThreshold;        
993 hbuss 142
   unsigned char NaviWindCorrection;        
143
   unsigned char NaviSpeedCompensation;        
994 hbuss 144
   unsigned char NaviOperatingRadius;        
1064 hbuss 145
   unsigned char NaviAngleLimitation;
921 hbuss 146
//---Ext.Ctrl---------------------------------------------
147
   unsigned char ExternalControl;        // for serial Control
173 holgerb 148
//------------------------------------------------
995 hbuss 149
   unsigned char BitConfig;             // (war Loop-Cfg) Bitcodiert: 0x01=oben, 0x02=unten, 0x04=links, 0x08=rechts / wird getrennt behandelt
173 holgerb 150
   unsigned char ServoNickCompInvert;    // Wert : 0-250   0 oder 1  // WICHTIG!!! am Ende lassen
151
   unsigned char Reserved[4];
1 ingob 152
   char Name[12];
153
 };
154
 
173 holgerb 155
 
1 ingob 156
extern struct mk_param_struct EE_Parameter;
157
 
158
extern unsigned char Parameter_Luftdruck_D;
159
extern unsigned char Parameter_MaxHoehe;
160
extern unsigned char Parameter_Hoehe_P;
161
extern unsigned char Parameter_Hoehe_ACC_Wirkung;
162
extern unsigned char Parameter_KompassWirkung;
163
extern unsigned char Parameter_Gyro_P;
164
extern unsigned char Parameter_Gyro_I;
165
extern unsigned char Parameter_Gier_P;
166
extern unsigned char Parameter_ServoNickControl;
396 hbuss 167
extern unsigned char Parameter_AchsKopplung1;
168
extern unsigned char Parameter_AchsGegenKopplung1;
921 hbuss 169
extern unsigned char Parameter_J16Bitmask;             // for the J16 Output
170
extern unsigned char Parameter_J16Timing;              // for the J16 Output
171
extern unsigned char Parameter_J17Bitmask;             // for the J17 Output
172
extern unsigned char Parameter_J17Timing;              // for the J17 Output
1086 salvo 173
 
921 hbuss 174
extern unsigned char Parameter_NaviGpsModeControl;     // Parameters for the Naviboard
175
extern unsigned char Parameter_NaviGpsGain;    
176
extern unsigned char Parameter_NaviGpsP;        
177
extern unsigned char Parameter_NaviGpsI;        
178
extern unsigned char Parameter_NaviGpsD;        
993 hbuss 179
extern unsigned char Parameter_NaviGpsACC;  
180
extern unsigned char Parameter_NaviOperatingRadius;
181
extern unsigned char Parameter_NaviWindCorrection;
182
extern unsigned char Parameter_NaviSpeedCompensation;
1086 salvo 183
 
1 ingob 184
#endif //_FC_H
185