Subversion Repositories FlightCtrl

Rev

Rev 507 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 507 Rev 537
Line 68... Line 68...
68
unsigned char blinkcount_LED2 = 0; //Hilfszähler für die blinkende LED (010907Kr)
68
unsigned char blinkcount_LED2 = 0; //Hilfszähler für die blinkende LED (010907Kr)
Line 69... Line 69...
69
 
69
 
70
#define GPS_Limit 35            //(031207Kr)
70
#define GPS_Limit 35            //(031207Kr)
Line -... Line 71...
-
 
71
#define Limit_D_Anteil 30       //(031207Kr)
-
 
72
 
71
#define Limit_D_Anteil 30       //(031207Kr)
73
 
72
 
74
 
Line 73... Line 75...
73
//**************************** MIRCOS DEFINITIONSANFANG FÜR DIE FILTERUNG
75
//**************************** MIRCOS DEFINITIONSANFANG FÜR DIE FILTERUNG
74
// Filterung der GPS Messwerte vom Ublox-Empfänger. Es wird der gleitende Durchschnitt aus n Messwerten gebildet
76
// Filterung der GPS Messwerte vom Ublox-Empfänger. Es wird der gleitende Durchschnitt aus n Messwerten gebildet
Line 98... Line 100...
98
FILTER_EAST filter_east;
100
FILTER_EAST filter_east;
Line 99... Line 101...
99
 
101
 
Line -... Line 102...
-
 
102
//**************************** MIRCOS DEFINITIONSENDE FÜR DIE FILTERUNG
100
//**************************** MIRCOS DEFINITIONSENDE FÜR DIE FILTERUNG
103
 
101
 
104
 
Line 102... Line 105...
102
 
105
 
103
void gps_main(void)
106
void gps_main(void)
Line 279... Line 282...
279
                // Dieses Limit wirkt nur, wenn sich der MK im HOMING Modus befindet und sich noch weit (>2,5m) von der Home-Position weg befindet.
282
                // Dieses Limit wirkt nur, wenn sich der MK im HOMING Modus befindet und sich noch weit (>2,5m) von der Home-Position weg befindet.
280
                if (Poti3 >= 150 && GPS_Home_North != 0 && GPS_Home_East != 0 && (abs(GPS_Positionsabweichung_North) > 250 || abs(GPS_Positionsabweichung_East) > 250))
283
                if (Poti3 >= 150 && GPS_Home_North != 0 && GPS_Home_East != 0 && (abs(GPS_Positionsabweichung_North) > 250 || abs(GPS_Positionsabweichung_East) > 250))
281
                {
284
                {
282
                        if (D_Einfluss_North > Limit_D_Anteil) D_Einfluss_North = Limit_D_Anteil;
285
                        if (D_Einfluss_North > Limit_D_Anteil) D_Einfluss_North = Limit_D_Anteil;
283
                        if (D_Einfluss_East > Limit_D_Anteil) D_Einfluss_East = Limit_D_Anteil;
286
                        if (D_Einfluss_East > Limit_D_Anteil) D_Einfluss_East = Limit_D_Anteil;
284
                        if (D_Einfluss_North < -1 * Limit_D_Anteil) D_Einfluss_North = -1 * Limit_D_Anteil;
287
                        if (D_Einfluss_North < -Limit_D_Anteil) D_Einfluss_North = -Limit_D_Anteil;
285
                        if (D_Einfluss_East < -1 * Limit_D_Anteil) D_Einfluss_East = -1 * Limit_D_Anteil;
288
                        if (D_Einfluss_East < -Limit_D_Anteil) D_Einfluss_East = -Limit_D_Anteil;
286
                }
289
                }
Line 287... Line 290...
287
               
290
               
288
                // PD-Regler
291
                // PD-Regler
289
                GPS_North = (-P_Einfluss_North + D_Einfluss_North);
292
                GPS_North = (-P_Einfluss_North + D_Einfluss_North);
Line 294... Line 297...
294
                GPS_Roll = (c_cos[KompassValue]*0.001*GPS_East + c_sin[KompassValue]*0.001*GPS_North); // die "0" kann später durch den Messwert des Kompasssensors (KompassValue/180*3.1415926535) ersetzt werden
297
                GPS_Roll = (c_cos[KompassValue]*0.001*GPS_East + c_sin[KompassValue]*0.001*GPS_North); // die "0" kann später durch den Messwert des Kompasssensors (KompassValue/180*3.1415926535) ersetzt werden
Line 295... Line 298...
295
               
298
               
296
                // Begrenzung des maximalen GPS Einflusses für positive und negative Werte
299
                // Begrenzung des maximalen GPS Einflusses für positive und negative Werte
297
                if (GPS_Nick > GPS_Limit) GPS_Nick = GPS_Limit;
300
                if (GPS_Nick > GPS_Limit) GPS_Nick = GPS_Limit;
298
                if (GPS_Roll > GPS_Limit) GPS_Roll = GPS_Limit;
301
                if (GPS_Roll > GPS_Limit) GPS_Roll = GPS_Limit;
299
                if (GPS_Nick < -1 * GPS_Limit) GPS_Nick = -1 * GPS_Limit;
302
                if (GPS_Nick < -GPS_Limit) GPS_Nick = -GPS_Limit;
Line 300... Line 303...
300
                if (GPS_Roll < -1 * GPS_Limit) GPS_Roll = -1 * GPS_Limit;
303
                if (GPS_Roll < -GPS_Limit) GPS_Roll = -GPS_Limit;
301
               
304
               
302
                //Funktion wird dadurch nur alle 250 ms aufgerufen, wenn neue Mittelwerte aus den GPS-Daten vorliegen.
305
                //Funktion wird dadurch nur alle 250 ms aufgerufen, wenn neue Mittelwerte aus den GPS-Daten vorliegen.
303
                //FUNKTIONIERT MOMENTAN NOCH NICHT, DA STÄNDIG OHNE UNTERBRECHUNG NEUE MITTELWERTE BERECHNET WERDEN.
306
                //FUNKTIONIERT MOMENTAN NOCH NICHT, DA STÄNDIG OHNE UNTERBRECHUNG NEUE MITTELWERTE BERECHNET WERDEN.