![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
今までのジョイスティックの入力を段階分けしていた方式から、アナログ値をできる限りそのまま使用する方式に変更しました。
Fork of ControlMain2017 by
Diff: main.cpp
- Revision:
- 30:eb7b7af1070a
- Parent:
- 29:8bff47ab602d
- Child:
- 31:3a6be197e98f
diff -r 8bff47ab602d -r eb7b7af1070a main.cpp --- a/main.cpp Tue Mar 21 19:47:11 2017 +0000 +++ b/main.cpp Tue Mar 21 23:23:32 2017 +0000 @@ -80,6 +80,7 @@ neutralDiff = pitchNeutral - rollNeutral; //ピッチの初期値の方がい小さいと仮定 rollNeutral += neutralDiff; + rollUpperDiff = 0; } void setMaxAndMin(InputType it,float value) @@ -167,8 +168,9 @@ return PHASE_NUM; } -float SetRollPitchRacio(float pitch,float roll){ -return (roll + pitch * PITCHPERROLL) / (1.0 + PITCHPERROLL); +float SetRollPitchRacio(float pitch,float roll) +{ + return (roll + pitch * PITCHPERROLL) / (1.0 + PITCHPERROLL); } void InputControlValues() @@ -176,7 +178,7 @@ setMaxAndMin(enumRoll, rollPin.read()); setMaxAndMin(enumPitch, pitchPin.read()); - // pc.printf("rollN:%f rollMax:%f rollMin:%f pitchN:%f pitchMax:%f pitchUpper:%f pitchMin:%f pitchLo:%f raw:%f\r\n",rollNeutral,rollNeutral+rollUpperDiff,rollNeutral+rollLowerDiff,pitchNeutral,pitchNeutral+pitchUpperDiff,pitchUpperDiff,pitchNeutral+pitchLowerDiff,pitchLowerDiff,pitchPin.read()); +// pc.printf("rollN:%f rollMax:%f rollMin:%f pitchN:%f pitchMax:%f pitchUpper:%f pitchMin:%f pitchLo:%f raw:%f\r\n",rollNeutral,rollNeutral+rollUpperDiff,rollNeutral+rollLowerDiff,pitchNeutral,pitchNeutral+pitchUpperDiff,pitchUpperDiff,pitchNeutral+pitchLowerDiff,pitchLowerDiff,pitchPin.read()); float MatchedRoll = MatchUpperAndLower(enumRoll, rollNeutral + rollUpperDiff,rollLowerDiff + rollLowerDiff,rollNeutral,rollPin.read() + neutralDiff); float MatchedPitch = MatchUpperAndLower(enumPitch, pitchNeutral + pitchUpperDiff,pitchNeutral + pitchLowerDiff,pitchNeutral,pitchPin.read()); @@ -196,7 +198,7 @@ else if(*(int *)inputDatas_L > PHASE_NUM) *(int *)inputDatas_L =PHASE_NUM; - pc.printf("input_R:%d input_L:%d\n\r",*(int *)inputDatas_R,*(int *)inputDatas_L); + pc.printf("input_R:%d input_L:%d\n\r",*(int *)inputDatas_R,*(int *)inputDatas_L); inputDatas_R[4] = (char)drug_R; led4 =! led4; // pc.printf("%c",*(char *)inputDatas_R[4]); @@ -211,6 +213,7 @@ can_L.write(CANMessage(SEND_DATAS_CAN_ID, inputDatas_L, INPUT_DATAS_NUM)); toKeikiSerial.putc(';'); for(int i = 0; i < YOKUTAN_DATAS_NUM; i++) { + toKeikiSerial.putc(yokutanDatas_R[i]); toKeikiSerial.putc(yokutanDatas_L[i]); }