
2021 rcj
Dependencies: _sensorGen ui Robot omni_wheel PID jy901 solenoid IRsensor aqm0802 camera beep kohiMD linesSnsor lpf RCJESC
Revision 3:f763ce2f35db, committed 2021-03-05
- Comitter:
- piroro4560
- Date:
- Fri Mar 05 05:05:42 2021 +0000
- Parent:
- 2:540f68b1a40e
- Child:
- 4:b9d156177b88
- Commit message:
- can move
Changed in this revision
--- a/Robot.lib Fri Mar 05 00:01:18 2021 +0000 +++ b/Robot.lib Fri Mar 05 05:05:42 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/Quadrifoglio/code/Robot/#39f44a1dc256 +https://os.mbed.com/teams/Quadrifoglio/code/Robot/#19149697667d
--- a/lib/jy901.lib Fri Mar 05 00:01:18 2021 +0000 +++ b/lib/jy901.lib Fri Mar 05 05:05:42 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/Quadrifoglio/code/jy901/#9fa716a2100a +https://os.mbed.com/teams/Quadrifoglio/code/jy901/#a5ce2d3c49ac
--- a/lib/kohiMD.lib Fri Mar 05 00:01:18 2021 +0000 +++ b/lib/kohiMD.lib Fri Mar 05 05:05:42 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/Quadrifoglio/code/kohiMD/#ba7b31b888f2 +https://os.mbed.com/teams/Quadrifoglio/code/kohiMD/#f8af7b48531c
--- a/main.cpp Fri Mar 05 00:01:18 2021 +0000 +++ b/main.cpp Fri Mar 05 05:05:42 2021 +0000 @@ -1,13 +1,11 @@ #include "main.h" #include "robot.h" -//#include "sensorGen.h" #include "ui.h" -//#include "kohiMD.h" Robot robo; UI ui; Thread displaythread; -sensorgen sensor_; +sensorgen sensor; BufferedSerial pc(USBTX, USBRX, 115200); KohiMD *md[4] = {new KohiMD(PA_15), new KohiMD(PA_6), new KohiMD(PA_7), new KohiMD(PB_6)}; @@ -22,38 +20,47 @@ if(ui.displayst == 0){ strcpy(lcdname1, "gyr"); strcpy(lcdname2, "bal"); - lcdvalue[0] = sensor_.angle; + if(sensor.angle >= 0)lcdvalue[0] = sensor.angle; + else lcdvalue[0] = 360+sensor.angle; } else if(ui.displayst == 1) { strcpy(lcdname1, "bar"); strcpy(lcdname2, "bax"); - lcdvalue[0] = sensor_.ballAngle; - lcdvalue[1] = sensor_.ballRange; + if(sensor.ballAngle >= 0)lcdvalue[0] = sensor.ballAngle; + else lcdvalue[0] = 360+sensor.ballAngle; + lcdvalue[1] = sensor.ballRange; } else if(ui.displayst == 2) { strcpy(lcdname1, "ylr"); strcpy(lcdname2, "ylx"); - lcdvalue[0] = sensor_.yellowAngle; - lcdvalue[1] = sensor_.yellowRange; + if(sensor.yellowAngle >= 0)lcdvalue[0] = sensor.yellowAngle; + else lcdvalue[0] = 360+sensor.yellowAngle; + lcdvalue[1] = sensor.yellowRange; } else if(ui.displayst == 3) { strcpy(lcdname1, "blr"); strcpy(lcdname2, "blx"); - lcdvalue[0] = sensor_.yellowAngle; - lcdvalue[1] = sensor_.yellowRange; + if(sensor.blueAngle >= 0)lcdvalue[0] = sensor.blueAngle; + else lcdvalue[0] = 360+sensor.blueAngle; + lcdvalue[1] = sensor.yellowRange; } else if(ui.displayst == 4) { strcpy(lcdname1, "mt0"); strcpy(lcdname2, "mt1"); - temp[0] = robo.omni.wheel[0]; - temp[1] = robo.omni.wheel[1]; - lcdvalue[0] = temp[0] * 100; - lcdvalue[1] = temp[1] * 100; +// temp[0] = robo.omni.wheel[0]; +// temp[1] = robo.omni.wheel[1]; +// lcdvalue[0] = temp[0] * 100; +// lcdvalue[1] = temp[1] * 100; + lcdvalue[0] = 0; + lcdvalue[1] = 0; } else if(ui.displayst == 5) { strcpy(lcdname1, "mt2"); strcpy(lcdname2, "mt3"); - temp[0] = robo.omni.wheel[2]; - temp[1] = robo.omni.wheel[3]; - lcdvalue[0] = temp[0] * 100; - lcdvalue[1] = temp[1] * 100; +// temp[0] = robo.omni.wheel[2]; +// temp[1] = robo.omni.wheel[3]; +// lcdvalue[0] = temp[0] * 100; +// lcdvalue[1] = temp[1] * 100; + lcdvalue[0] = 0; + lcdvalue[1] = 0; /*} else if(ui.displayst == 6) { - strcpy(lcdname1, "ln1"); + strcpy(lcdname1, " + ln1"); strcpy(lcdname2, "ln2"); lcdvalue[2] = sensor.; lcdvalue[3] = sensor.; @@ -75,15 +82,19 @@ displaythread.start(main2ui); uint8_t motorChecknum, uibt[4]; bool startflag; +// robo.pidtest(); while(1){ - robo.motorStop(0.0); -// for (int i=0; i < 4; i++) md[i]->setSpeed(0.0); - /* - ui.returnbt(uibt); -// printf("%d %d %d %d %d\r\n", uibt[0], uibt[1], uibt[2], uibt[3], ui.start); + printf("ball: x %5d,r %6d | yellow: x %5d,r %6d | blue: x %5d,r %6d gyro %4d | \r\n" + , (int)(sensor.ballRange), (int)(sensor.ballAngle), (int)(sensor.yellowRange), (int)(sensor.yellowAngle), (int)(sensor.blueRange), (int)(sensor.blueAngle), (int)(sensor.tempAngle)); +// printf("gyro : %d\r\n",(int)sensor.angle); + +// ui.returnbt(uibt); +// printf("%d %d %d %d %d\r\n", ui.flag[0], ui.flag[1], ui.flag[2], ui.flag[3], ui.start); if(ui.mode == 0){ -// if(ui.b[3]) robo.start(ui.team, ui.algorithm); -// else robo.motorStop(); +// printf("ball: x %d,r %d | yellow: x %d,r %d | blue: x %d,r %d gyro %d | \r\n" +// , (int)(100*sensor.ballRange), (int)(100*sensor.ballAngle), (int)(100*sensor.yellowRange), (int)(100*sensor.yellowAngle), (int)(100*sensor.blueRange), (int)(100*sensor.blueAngle), (int)(sensor.rawAngle)); + if(ui.flag[3]) robo.pidtest();//robo.start(ui.team, ui.algorithm); + else robo.motorStop(0.0); } else if(ui.mode == 1){ // motorChecknum = (8*ui.b[3])+(4*ui.b[2])+(2*ui.b[1])+(ui.b[0]); if(ui.b[0]){ @@ -94,24 +105,25 @@ robo.motorCheck(2, 0.3); }else if(ui.b[3]){ robo.motorCheck(3, 0.3); + }else{ + robo.motorStop(0.0); } } else if(ui.mode == 2){ if(ui.start){ robo.kickCheck(); } - robo.motorStop(); + robo.motorStop(0.0); } else if(ui.mode == 3){ if(ui.start){ robo.dribbleCheck(0.4); } else { robo.dribbleCheck(0); } - robo.motorStop(); + robo.motorStop(0.0); } else if(ui.mode == 4){ - if(ui.b[3] - ui.b_[3]){ - sensor_.jy.jyroReset(); + if(ui.flag[3]){ + sensor.jy.yawcalibrate(); } - - }*/ + } } } \ No newline at end of file
--- a/sensorGen.lib Fri Mar 05 00:01:18 2021 +0000 +++ b/sensorGen.lib Fri Mar 05 05:05:42 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/users/THtakahiro702286/code/_sensorGen/#8ed76df0196b +https://os.mbed.com/teams/Quadrifoglio/code/sensorGen_21/#41c2f80bf005
--- a/ui.lib Fri Mar 05 00:01:18 2021 +0000 +++ b/ui.lib Fri Mar 05 05:05:42 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/Quadrifoglio/code/ui/#a5e8e6156172 +https://os.mbed.com/teams/Quadrifoglio/code/ui/#1f322deb75d8