Rev 613 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 613 | Rev 615 | ||
---|---|---|---|
Line 65... | Line 65... | ||
65 | static uint8_t *ptr_pac_status; |
65 | static uint8_t *ptr_pac_status; |
66 | long int dist_flown; |
66 | long int dist_flown; |
67 | unsigned int int_ovfl_cnt; // Zaehler fuer Overflows des Integrators |
67 | unsigned int int_ovfl_cnt; // Zaehler fuer Overflows des Integrators |
68 | signed int int_east,int_north; //Integrierer |
68 | signed int int_east,int_north; //Integrierer |
69 | signed int diff_east_f,diff_north_f; // Differenzierer, gefiltert |
69 | signed int diff_east_f,diff_north_f; // Differenzierer, gefiltert |
70 | signed int diff_v; |
70 | //signed int diff_v; |
71 | signed long dist; |
71 | signed long dist; |
Line 72... | Line 72... | ||
72 | 72 | ||
Line 73... | Line 73... | ||
73 | short int Get_GPS_data(void); |
73 | short int Get_GPS_data(void); |
Line 304... | Line 304... | ||
304 | static signed int diff_east,diff_north; // Differenzierer (Differenz zum vorhergehenden x bzw. y Wert) |
304 | static signed int diff_east,diff_north; // Differenzierer (Differenz zum vorhergehenden x bzw. y Wert) |
305 | signed int n; |
305 | signed int n; |
306 | static signed int gps_g2t_act_v; // Aktuelle Geschwindigkeitsvorgabe fuer Home Funktion |
306 | static signed int gps_g2t_act_v; // Aktuelle Geschwindigkeitsvorgabe fuer Home Funktion |
307 | long signed int dev,n_l; |
307 | long signed int dev,n_l; |
308 | signed int dist_frm_start_east,dist_frm_start_north; |
308 | signed int dist_frm_start_east,dist_frm_start_north; |
- | 309 | int diff_v_east,diff_v_north; //Verstaerkungsfaktoren fuer Differenzierer |
|
Line 309... | Line 310... | ||
309 | 310 | ||
310 | switch (cmd) |
311 | switch (cmd) |
Line 311... | Line 312... | ||
311 | { |
312 | { |
Line 515... | Line 516... | ||
515 | diff_east += dist_east; // Differenz zur vorhergehenden East Position |
516 | diff_east += dist_east; // Differenz zur vorhergehenden East Position |
516 | diff_north += dist_north; // Differenz zur vorhergehenden North Position |
517 | diff_north += dist_north; // Differenz zur vorhergehenden North Position |
Line 517... | Line 518... | ||
517 | 518 | ||
518 | if (hold_fast > 0) // wegen Sollpositionsspruengen im Fast Mode Differenzierer daempfen |
519 | if (hold_fast > 0) // wegen Sollpositionsspruengen im Fast Mode Differenzierer daempfen |
519 | { |
520 | { |
520 | diff_east_f = ((diff_east_f *2)/3) + (diff_east *1/3); //Differenzierer filtern |
521 | diff_east_f = (((diff_east_f *2)/3) + ((diff_east *1*10)/3)); //Differenzierer filtern |
521 | diff_north_f = ((diff_north_f *2)/3) + (diff_north*1/3); //Differenzierer filtern |
522 | diff_north_f = (((diff_north_f *2)/3) + ((diff_north*1*10)/3)); //Differenzierer filtern |
522 | } |
523 | } |
523 | else // schwache Filterung |
524 | else // schwache Filterung |
524 | { |
525 | { |
525 | diff_east_f = ((diff_east_f * 2)/4) + ((diff_east *2)/4); //Differenzierer filtern |
526 | diff_east_f = (((diff_east_f * 2)/4) + ((diff_east *2*10)/4)); //Differenzierer filtern |
526 | diff_north_f = ((diff_north_f * 2)/4) + ((diff_north*2)/4); //Differenzierer filtern |
527 | diff_north_f = (((diff_north_f * 2)/4) + ((diff_north*2*10)/4)); //Differenzierer filtern |
Line 527... | Line 528... | ||
527 | } |
528 | } |
528 | 529 | ||
529 | #define GPSINT_MAX 3000 // Neues Verfahren ab 30.12.2007 bei Integratoroverflow |
530 | #define GPSINT_MAX 3000 // Neues Verfahren ab 30.12.2007 bei Integratoroverflow |
Line 544... | Line 545... | ||
544 | { |
545 | { |
545 | int_east = 0; |
546 | int_east = 0; |
546 | int_north = 0; |
547 | int_north = 0; |
547 | } |
548 | } |
Line 548... | Line -... | ||
548 | - | ||
549 | 549 | ||
550 | // Variable Verstarkung fuer Differenzierer ermitteln. Je weiter vom Ziel wir entfernt sind |
550 | // Variable Verstarkung fuer Differenzierer ermitteln. Je weiter vom Ziel wir entfernt sind |
551 | // desto groesser wird der Faktor. Es gibt aber einen Maximalwert. Bei 0 ist die Verstaerkung immer 1 |
551 | // desto groesser wird der Faktor. Es gibt aber einen Maximalwert. Bei 0 ist die Verstaerkung immer 1 |
Line 552... | Line 552... | ||
552 | signed long int_east1,int_north1; |
552 | signed long int_east1,int_north1; |
Line 557... | Line 557... | ||
557 | 557 | ||
558 | if (hold_fast == 0) // je Nach Modus andere Verstaerkungskurve fuer Differenzierer |
558 | if (hold_fast == 0) // je Nach Modus andere Verstaerkungskurve fuer Differenzierer |
559 | { |
559 | { |
560 | // diff_v = (int)((dist * (GPS_DIFF_NRML_MAX_V - 10)) / GPS_DIFF_NRML_MAX_D) +10; //Verstaerkung * 10 |
560 | // diff_v = (int)((dist * (GPS_DIFF_NRML_MAX_V - 10)) / GPS_DIFF_NRML_MAX_D) +10; //Verstaerkung * 10 |
561 | // if (diff_v > GPS_DIFF_NRML_MAX_V) diff_v = GPS_DIFF_NRML_MAX_V; //begrenzen |
561 | // if (diff_v > GPS_DIFF_NRML_MAX_V) diff_v = GPS_DIFF_NRML_MAX_V; //begrenzen |
562 | diff_v = GPS_DIFF_NRML_MAX_V ; //variable Versterkung raus 31.12.2007 |
562 | // diff_v = GPS_DIFF_NRML_MAX_V ; //variable Versterkung raus 31.12.2007 |
563 | } |
563 | } |
564 | else |
564 | else |
565 | { |
565 | { |
566 | // diff_v = (int)((dist * (GPS_DIFF_FAST_MAX_V - 10)) / GPS_DIFF_FAST_MAX_D) +10; //Verstaerkung * 10 |
566 | // diff_v = (int)((dist * (GPS_DIFF_FAST_MAX_V - 10)) / GPS_DIFF_FAST_MAX_D) +10; //Verstaerkung * 10 |
567 | // if (diff_v > GPS_DIFF_FAST_MAX_V) diff_v = GPS_DIFF_FAST_MAX_V; //begrenzen |
567 | // if (diff_v > GPS_DIFF_FAST_MAX_V) diff_v = GPS_DIFF_FAST_MAX_V; //begrenzen |
568 | diff_v = GPS_DIFF_FAST_MAX_V ; //variable Versterkung raus 31.12.2007 |
568 | // diff_v = GPS_DIFF_FAST_MAX_V ; //variable Versterkung raus 31.12.2007 |
- | 569 | } |
|
- | 570 | diff_v_east = (((abs(diff_east_f)) *(DIFF_Y_MAX-1))/DIFF_X_MAX) +10; |
|
- | 571 | diff_v_north = (((abs(diff_north_f))*(DIFF_Y_MAX-1))/DIFF_X_MAX) +10; |
|
- | 572 | if (diff_v_east > (DIFF_Y_MAX *10)) diff_v_east = DIFF_Y_MAX *10; // Begrenzung |
|
- | 573 | if (diff_v_north > (DIFF_Y_MAX *10)) diff_v_north = DIFF_Y_MAX *10; // Begrenzung |
|
- | 574 | diff_v_east *= 2; |
|
- | 575 | diff_v_north *= 2; |
|
- | 576 | ||
- | 577 | debug_gp_2 = diff_v_east; // zum Debuggen |
|
- | 578 | debug_gp_3 = diff_v_north; // zum Debuggen |
|
- | 579 | debug_gp_4 = diff_east_f; // zum Debuggen |
|
Line 569... | Line 580... | ||
569 | } |
580 | debug_gp_5 = diff_north_f; // zum Debuggen |
570 | 581 | ||
571 | 582 | ||
Line 581... | Line 592... | ||
581 | else if (int_east1 < -INT1_MAX) int_east1 = -INT1_MAX; |
592 | else if (int_east1 < -INT1_MAX) int_east1 = -INT1_MAX; |
582 | if (int_north1 > INT1_MAX) int_north1 = INT1_MAX; //begrenzen |
593 | if (int_north1 > INT1_MAX) int_north1 = INT1_MAX; //begrenzen |
583 | else if (int_north1 < -INT1_MAX) int_north1 = -INT1_MAX; |
594 | else if (int_north1 < -INT1_MAX) int_north1 = -INT1_MAX; |
Line 584... | Line 595... | ||
584 | 595 | ||
585 | //PID Regler Werte aufsummieren |
596 | //PID Regler Werte aufsummieren |
586 | gps_reg_x = ((int)int_east1 + ((dist_east * (Parameter_UserParam1/GPS_USR_PAR_FKT) * diff_p)/(8*2))+ ((diff_east_f * diff_v * (Parameter_UserParam3/GPS_USR_PAR_FKT))/10)); // I + P +D Anteil X Achse |
597 | gps_reg_x = ((int)int_east1 + ((dist_east * (Parameter_UserParam1/GPS_USR_PAR_FKT) * diff_p)/(8*2))+ ((diff_east_f * diff_v_east * (Parameter_UserParam3/GPS_USR_PAR_FKT))/100)); // I + P +D Anteil X Achse |
- | 598 | gps_reg_y = ((int)int_north1 + ((dist_north * (Parameter_UserParam1/GPS_USR_PAR_FKT) * diff_p)/(8*2))+ ((diff_north_f * diff_v_north * (Parameter_UserParam3/GPS_USR_PAR_FKT))/100)); // I + P +D Anteil Y Achse |
|
- | 599 | debug_gp_0 = gps_reg_x; // zum Debuggen |
|
Line 587... | Line 600... | ||
587 | gps_reg_y = ((int)int_north1 + ((dist_north * (Parameter_UserParam1/GPS_USR_PAR_FKT) * diff_p)/(8*2))+ ((diff_north_f * diff_v * (Parameter_UserParam3/GPS_USR_PAR_FKT))/10)); // I + P +D Anteil Y Achse |
600 | debug_gp_1 = gps_reg_y; // zum Debuggen |
588 | 601 | ||
Line 589... | Line 602... | ||
589 | //Ziel-Richtung bezogen auf Nordpol bestimmen |
602 | //Ziel-Richtung bezogen auf Nordpol bestimmen |