自動着陸の右旋回を修正
Dependencies: HCSR04_2 MPU6050_2 mbed SDFileSystem3
Fork of Autoflight2018_24 by
Revision 20:9393b0cfa44d, committed 2018-09-19
- Comitter:
- taknokolat
- Date:
- Wed Sep 19 00:05:30 2018 +0000
- Parent:
- 19:0955311b0db6
- Commit message:
- a
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0955311b0db6 -r 9393b0cfa44d main.cpp --- a/main.cpp Mon Sep 17 13:11:53 2018 +0000 +++ b/main.cpp Wed Sep 19 00:05:30 2018 +0000 @@ -1045,7 +1045,7 @@ if(bufcounter==5 && SFbuf[4]=='F'){ g_landingcommand = SFbuf[1]; - wait_ms(8); + wait_ms(80); if(g_landingcommand=='Y')g_SerialTargetYAW = ConvertByteintoFloat(SFbuf[2], SFbuf[3]); bufcounter = 0; memset(SFbuf, 0, strlen(SFbuf)); @@ -1291,11 +1291,12 @@ 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; + else {autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; autopwm[AIL_R]=autopwm[AIL_R]+AIL_R_correctionrightloop; - + } + } break; - } + case 'L': //左旋回セヨ if(zeroTHR==0){ UpdateTargetAngle_Leftloop_zero(targetAngle); @@ -1417,15 +1418,15 @@ //右旋回(着陸時スロットル0の時) void UpdateTargetAngle_Rightloop_zero(float targetAngle[3]){ //右旋回 - + autopwm[THR]=minpwm[THR]; targetAngle[ROLL] = g_rightloopROLL; targetAngle[PITCH] = g_rightloopPITCH ; - autopwm[RUD]=g_rightloopRUD; - autopwm[THR] = minpwm[THR];//SetTHRinRatio(g_loopTHR); - 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; + autopwm[RUD]=g_rightloopRUD; //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; + } + else autopwm[AIL_L]=trimpwm[AIL_L]+AIL_L_correctionrightloop+(autopwm[AIL_R]-trimpwm[AIL_R])*AIL_L_RatioDescent; + autopwm[AIL_R]=autopwm[AIL_R]+AIL_R_correctionrightloop; //checkHeight(targetAngle); //pc.printf("Roll = %f, PITCH = %f, THR = %d \r\n", targetAngle[ROLL], targetAngle[PITCH], autopwm[THR]);