Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_50 by
Revision 40:f03b62a3b495, committed 2018-09-26
- Comitter:
- HARUKIDELTA
- Date:
- Wed Sep 26 04:02:25 2018 +0000
- Parent:
- 39:b8d5be233b70
- Commit message:
- g_rightloopPITCH_approach; g_leftloopPITCH_approach???
Changed in this revision
config/falfalla.h | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/config/falfalla.h Tue Sep 25 10:27:21 2018 +0000 +++ b/config/falfalla.h Wed Sep 26 04:02:25 2018 +0000 @@ -17,9 +17,11 @@ static float g_rightloopROLL=-17.0; static float g_rightloopROLL_approach=-17.0; static float g_rightloopPITCH=-6.3; +static float g_rightloopPITCH_approach = -15.0; static float g_leftloopROLL=16.0; static float g_leftloopROLL_approach=16.0; static float g_leftloopPITCH=-6.0; +static float g_leftloopPITCH_approach=-13.0; static float g_gostraightROLL=2.0; static float g_gostraightPITCH=-3.0; static float g_takeoffTHR=1.0;
--- a/main.cpp Tue Sep 25 10:27:21 2018 +0000 +++ b/main.cpp Wed Sep 26 04:02:25 2018 +0000 @@ -1192,7 +1192,6 @@ static int groundcount = 0; targetAngle[ROLL] = g_glideloopROLL; - targetAngle[PITCH] = g_glideloopPITCH; autopwm[RUD]=g_glideloopRUD; // autopwm[THR]=oldTHR; @@ -1241,8 +1240,14 @@ else THRcount = 0; NVIC_EnableIRQ(EXTI9_5_IRQn); - if(flg_ground == true) autopwm[THR] = SetTHRinRatio(0.6); - else autopwm[THR] = minpwm[THR]; + if(flg_ground == true) { + autopwm[THR] = SetTHRinRatio(0.6); + targetAngle[PITCH] = g_gostraightPITCH; + } + else { + autopwm[THR] = minpwm[THR]; + targetAngle[PITCH] = g_glideloopPITCH; + } NVIC_DisableIRQ(USART1_IRQn); if(!CheckSW_Up(Ch7)){ @@ -1411,8 +1416,8 @@ } else{ targetAngle[ROLL] = g_rightloopROLL_approach; - targetAngle[PITCH] = g_rightloopPITCH ; - autopwm[RUD]=g_rightloopRUD_approach; //RUD固定 + targetAngle[PITCH] = g_rightloopPITCH_approach ; + autopwm[RUD]=g_rightloopRUD_approach; //RUD固定 if(autopwm[AIL_R]<trimpwm[AIL_R]){ //エルロン上がりやすさ調節 autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; } @@ -1429,7 +1434,7 @@ } else{ targetAngle[ROLL] = g_leftloopROLL_approach; - targetAngle[PITCH] = g_leftloopPITCH; + targetAngle[PITCH] = g_leftloopPITCH_approach; autopwm[RUD]=g_leftloopRUD_approach; if(autopwm[AIL_R]<trimpwm[AIL_R]){ autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; @@ -1541,7 +1546,7 @@ targetAngle[PITCH] = g_rightloopPITCH ; autopwm[RUD]=g_rightloopRUD; //RUD固定 - autopwm[THR] = SetTHRinRatio(0.5); //手動スロットル記憶 + autopwm[THR] = SetTHRinRatio(0.45); //手動スロットル記憶 /* if (nowAngle[ROLL]>20.0||nowAngle[ROLL]<-20.0){ @@ -1574,7 +1579,7 @@ void UpdateTargetAngle_Rightloop_zero(float targetAngle[3]){ //右旋回 autopwm[THR]=minpwm[THR]; targetAngle[ROLL] = g_rightloopROLL_approach; - targetAngle[PITCH] = g_rightloopPITCH ; + targetAngle[PITCH] = g_rightloopPITCH_approach ; autopwm[RUD]=g_rightloopRUD_approach; //RUD固定 if(autopwm[AIL_R]<trimpwm[AIL_R]){ //エルロン上がりやすさ調節 autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; @@ -1591,7 +1596,7 @@ targetAngle[ROLL] = g_rightloopROLLshort; targetAngle[PITCH] = g_rightloopPITCHshort; autopwm[RUD]=g_rightloopshortRUD; - autopwm[THR] = SetTHRinRatio(0.5); + autopwm[THR] = SetTHRinRatio(0.45); if(autopwm[AIL_R]<trimpwm[AIL_R]){ autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloopshort+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; } @@ -1606,7 +1611,7 @@ targetAngle[ROLL] = g_leftloopROLL; targetAngle[PITCH] = g_leftloopPITCH; autopwm[RUD]=g_leftloopRUD; - autopwm[THR] = SetTHRinRatio(0.5); + autopwm[THR] = SetTHRinRatio(0.45); if(autopwm[AIL_R]<trimpwm[AIL_R]){ autopwm[AIL_L]=trimpwm[AIL_L]+g_AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; } @@ -1620,7 +1625,7 @@ void UpdateTargetAngle_Leftloop_zero(float targetAngle[3]){ targetAngle[ROLL] = g_leftloopROLL_approach; - targetAngle[PITCH] = g_leftloopPITCH; + targetAngle[PITCH] = g_leftloopPITCH_approach; autopwm[RUD]=g_leftloopRUD_approach; autopwm[THR] = minpwm[THR]; if(autopwm[AIL_R]<trimpwm[AIL_R]){ @@ -1638,7 +1643,7 @@ targetAngle[ROLL] = g_leftloopROLLshort; targetAngle[PITCH] = g_leftloopPITCHshort; autopwm[RUD]=g_leftloopRUD; - autopwm[THR] = SetTHRinRatio(0.5); + autopwm[THR] = SetTHRinRatio(0.45); if(autopwm[AIL_R]<trimpwm[AIL_R]){ autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloopshort+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioRising; } @@ -1673,10 +1678,10 @@ //pc.printf("%d\t",autopwm[AIL_L]); //pc.printf("%d\t",autopwm[RUD]); //pc.printf("%d",g_distance); - //NVIC_DisableIRQ(EXTI9_5_IRQn); - //pc.printf("g_distance = %d",g_distance); - //NVIC_EnableIRQ(EXTI9_5_IRQn); + NVIC_DisableIRQ(EXTI9_5_IRQn); + pc.printf("g_distance = %d",g_distance); + NVIC_EnableIRQ(EXTI9_5_IRQn); //pc.printf("Mode: %c: ",g_buf[0]); //if(g_buf[0] == 'Y') pc.printf(" %3.1f",g_SerialTargetYAW); - //pc.printf("\r\n"); + pc.printf("\r\n"); } \ No newline at end of file