![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
2017年度の製作を開始します
Fork of Control_Main_Full_20160608 by
Revision 59:04c26e2c20bb, committed 2018-01-19
- Comitter:
- tsumagari
- Date:
- Fri Jan 19 11:07:39 2018 +0000
- Branch:
- ?????
- Parent:
- 58:0b4b842149de
- Commit message:
- rsp???input?????normedRoll drR,normedPitch drL?????????????????
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0b4b842149de -r 04c26e2c20bb main.cpp --- a/main.cpp Sat Dec 23 05:30:02 2017 +0000 +++ b/main.cpp Fri Jan 19 11:07:39 2018 +0000 @@ -3,10 +3,10 @@ ****************************************** **magic character of debug** * -*(0)i:pilot's input datas: inputR,inputL,normedPitch,normedRoll +*(0)]:pilot's input datas: inputR,inputL,normedPitch,normedRoll ,rollIC.shiftedMax,rollIC.shiftedMin,(int)drug_R,(int)drug_L *(1)g:getting datas: mpu(LR),servoV(LR) <- mbed always send this to pc(rsp) -*(2)j:data to debug what you want(joker) +*(2)_:data to debug what you want(joker) ****************************************** * */ @@ -42,9 +42,9 @@ bool flag; }; struct flaglist debugflag[]={ - {'i',0}, + {']',0}, {'g',0}, - {'j',0}, + {'_',0}, {'0',0}//footer }; //-----------------------------------(resetInterrupt def) @@ -64,10 +64,10 @@ CAN can_R(p30,p29); CAN can_L(p9,p10); Serial toKeikiSerial(p28,p27); -AnalogIn rollPin(p15); -AnalogIn pitchPin(p18); -DigitalIn drug_R(p14); -DigitalIn drug_L(p17); +AnalogIn rollPin(p15);// right hand +DigitalIn drug_R(p14);// right hand +AnalogIn pitchPin(p18);// left hand +DigitalIn drug_L(p17);// left hand DigitalIn servoOff(p26); DigitalOut led1(LED1); DigitalOut led2(LED2); @@ -81,9 +81,9 @@ char yokutanDatas_R[YOKUTAN_DATAS_NUM]; char yokutanDatas_L[YOKUTAN_DATAS_NUM]; -char inputDatas_R[INPUT_DATAS_NUM]; -char inputDatas_L[INPUT_DATAS_NUM]; - +char inputDatas_R[INPUT_DATAS_NUM+1];//for \0 space +char inputDatas_L[INPUT_DATAS_NUM+1]; +char toKeikiBufInput[(3+1)*2]; CANMessage recmsg_R(0x701,yokutanDatas_R,YOKUTAN_DATAS_NUM); CANMessage recmsg_L(0x701,yokutanDatas_L,YOKUTAN_DATAS_NUM); int to_keiki_sending_timer = 0; @@ -127,8 +127,9 @@ if(abs(inputL)==1.0){ inputL -= 0.01*SIGN(inputL); } - sprintf(inputDatas_R,"%03d%1d",(int)(inputR*100),drR); - sprintf(inputDatas_L,"%03d%1d",(int)(inputL*100),drL); + sprintf(inputDatas_R,"%03d%1d",(int)(inputR*99),drR); + sprintf(inputDatas_L,"%03d%1d",(int)(inputL*99),drL); + sprintf(toKeikiBufInput,"%03d%1d,%03d%d",(int)(normedRoll*99),drR,(int)(normedPitch*99),drL); print2pc(INPUT_DATA_DEBUG_FLAG,"inR:%5.2f inL:%5.2f nrmR:%5.2f nrmL:%5.2f sMax:%5.2f sMin:%5.2f drugR:%d drugL:%d\n" ,inputR,inputL,normedPitch,normedRoll,rollIC.shiftedMax,rollIC.shiftedMin,(int)drug_R,(int)drug_L); @@ -151,8 +152,8 @@ /*keiki*/ char *toKeikiBuf = (char*)malloc(sizeof(char)*55); int ahead = 0; - ahead += sprintf(toKeikiBuf,"i%s,%s",inputDatas_R,inputDatas_L); - +// ahead += sprintf(toKeikiBuf,"i%s,%s",inputDatas_R,inputDatas_L); + ahead += sprintf(toKeikiBuf,"i%s",toKeikiBufInput); if(can_R.read(recmsg_R)){ led3 = !led3; char mpu1[3]={recmsg_R.data[0],recmsg_R.data[1],recmsg_R.data[2]};