code:parafoil_tsip
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
code:parafoil_tsip [2009/01/16 16:11] – laurenceb | code:parafoil_tsip [2009/02/26 02:19] (current) – laurenceb | ||
---|---|---|---|
Line 421: | Line 421: | ||
u08 Heightupto=1; | u08 Heightupto=1; | ||
float K; | float K; | ||
- | float b, | + | float b, |
float descent_drift_n=0; | float descent_drift_n=0; | ||
float descent_drift_e=0; | float descent_drift_e=0; | ||
Line 708: | Line 708: | ||
#endif | #endif | ||
L=(int)(Gps.altitude/ | L=(int)(Gps.altitude/ | ||
- | for(Heightupto=0; | + | if(descent_variable> |
{ | { | ||
- | K=descent_variable*(float)pgm_read_byte(& | + | for(Heightupto=0; |
- | descent_drift_e+=(s08)eeprom_read_byte((u08*)& | + | { |
- | descent_drift_n+=(s08)eeprom_read_byte((u08*)& | + | K=descent_variable*(float)pgm_read_byte(& |
+ | descent_drift_e+=(s08)eeprom_read_byte((u08*)& | ||
+ | descent_drift_n+=(s08)eeprom_read_byte((u08*)& | ||
+ | } | ||
} | } | ||
- | Heightupto++; | + | Heightupto++; |
descent_variable_noise+=DESCENT_PROCESS_NOISE; | descent_variable_noise+=DESCENT_PROCESS_NOISE; | ||
- | if(Gps.vup< | + | if(Gps.vup< |
- | { //we run if we are descending and estimate the transit time coefficient | + | { //we run if we are descending and estimate the transit time coefficient |
b=(float)pgm_read_byte(& | b=(float)pgm_read_byte(& | ||
- | K=descent_variable_noise/ | + | K=descent_variable_noise/ |
b=(-100.0)/ | b=(-100.0)/ | ||
descent_variable+=K*(b-descent_variable); | descent_variable+=K*(b-descent_variable); | ||
Line 747: | Line 750: | ||
} | } | ||
}</ | }</ | ||
- | |||
- | |||
==== Main.h ==== | ==== Main.h ==== | ||
Line 768: | Line 769: | ||
#include < | #include < | ||
#define BAUDRATE (int)9600 // | #define BAUDRATE (int)9600 // | ||
- | #define DELTA_TIME (float)0.02 //20ms | + | #define DELTA_TIME (float)0.02 //20ms |
#define DELAY _delay_loop_2((u16)((float)F_CPU/ | #define DELAY _delay_loop_2((u16)((float)F_CPU/ | ||
#define SET PORTD |= 0x10 // | #define SET PORTD |= 0x10 // | ||
Line 781: | Line 782: | ||
#define PWM_COUNT_TIME (u16)((float)F_CPU*0.0005/ | #define PWM_COUNT_TIME (u16)((float)F_CPU*0.0005/ | ||
- | #define I_C -0.001 //control loop | + | #define I_C -0.001 //control loop |
#define P_C -0.3 | #define P_C -0.3 | ||
#define D_C -0.5 | #define D_C -0.5 | ||
#define INTEGRAL_LIMIT 0.2/ | #define INTEGRAL_LIMIT 0.2/ | ||
- | #define GPS_VEL_NOISE (0.25*(6378000.0/ | + | #define GPS_VEL_NOISE (0.25*(6378000.0/ |
- | #define DESCENT_PROCESS_NOISE 1.0e-18 | + | #define DESCENT_PROCESS_NOISE 1.0e-22 // |
#define DESCENT_INIT 1.5e-8 | #define DESCENT_INIT 1.5e-8 | ||
#define DESCENT_NOISE_INIT 5.0e-17 | #define DESCENT_NOISE_INIT 5.0e-17 | ||
Line 809: | Line 810: | ||
#define battery_factor (float)0.02505 // | #define battery_factor (float)0.02505 // | ||
- | #define battery_chan 0x00 //ADC0 | + | #define battery_chan 0x00 //ADC0 |
- | #define toggle_pin PIND=0x20 //led on port D.5 | + | #define toggle_pin PIND=0x20 //led on port D.5 |
#define BAUDDIV | #define BAUDDIV |
code/parafoil_tsip.1232122272.txt.gz · Last modified: 2009/01/16 16:11 (external edit)