![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
エルロン調節 自動着陸やり直し搭載
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_26 by
Diff: main.cpp
- Revision:
- 22:438bedf24707
- Parent:
- 21:18fe7bf9e187
diff -r 18fe7bf9e187 -r 438bedf24707 main.cpp --- a/main.cpp Wed Sep 19 05:34:41 2018 +0000 +++ b/main.cpp Wed Sep 19 06:37:31 2018 +0000 @@ -581,6 +581,7 @@ }else{ output_status = Manual; led1 = 0; + zeroTHR=1; } } @@ -1290,7 +1291,7 @@ targetAngle[ROLL] = g_rightloopROLL; targetAngle[PITCH] = g_rightloopPITCH ; autopwm[RUD]=g_rightloopRUD; //RUD固定 - if(autopwm[AIL_R]>trimpwm[AIL_R]){ //エルロン上がりやすさ調節 + 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; } else {autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; @@ -1307,7 +1308,7 @@ targetAngle[ROLL] = g_leftloopROLL; targetAngle[PITCH] = g_leftloopPITCH; autopwm[RUD]=g_leftloopRUD; - if(autopwm[AIL_R]>trimpwm[AIL_R]){ + 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; } else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; @@ -1408,7 +1409,7 @@ targetAngle[PITCH] = g_rightloopPITCH ; autopwm[RUD]=g_rightloopRUD; //RUD固定 autopwm[THR] = SetTHRinRatio(0.5); //手動スロットル記憶 - if(autopwm[AIL_R]>trimpwm[AIL_R]){ //エルロン上がりやすさ調節 + 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; } else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; @@ -1424,7 +1425,7 @@ targetAngle[ROLL] = g_rightloopROLL; targetAngle[PITCH] = g_rightloopPITCH ; autopwm[RUD]=g_rightloopRUD; //RUD固定 - if(autopwm[AIL_R]>trimpwm[AIL_R]){ //エルロン上がりやすさ調節 + 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; } else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; @@ -1440,7 +1441,7 @@ targetAngle[PITCH] = g_rightloopPITCHshort; autopwm[RUD]=g_rightloopshortRUD; autopwm[THR] = SetTHRinRatio(0.5); - if(autopwm[AIL_R]>trimpwm[AIL_R]){ + 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; } else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloopshort+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; @@ -1455,7 +1456,7 @@ targetAngle[PITCH] = g_leftloopPITCH; autopwm[RUD]=g_leftloopRUD; autopwm[THR] = SetTHRinRatio(0.5); - if(autopwm[AIL_R]>trimpwm[AIL_R]){ + 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; } else autopwm[AIL_L]=trimpwm[AIL_L]+g_AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; @@ -1471,7 +1472,7 @@ targetAngle[PITCH] = g_leftloopPITCH; autopwm[RUD]=g_leftloopRUD; autopwm[THR] = minpwm[THR]; - if(autopwm[AIL_R]>trimpwm[AIL_R]){ + 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; } else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; @@ -1487,7 +1488,7 @@ targetAngle[PITCH] = g_leftloopPITCHshort; autopwm[RUD]=g_leftloopRUD; autopwm[THR] = SetTHRinRatio(0.5); - if(autopwm[AIL_R]>trimpwm[AIL_R]){ + 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; } else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionleftloopshort+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent;