
2021 rcj
Dependencies: _sensorGen ui Robot omni_wheel PID jy901 solenoid IRsensor aqm0802 camera beep kohiMD linesSnsor lpf RCJESC
Revision 0:304a5472ddd8, committed 2021-03-04
- Comitter:
- piroro4560
- Date:
- Thu Mar 04 12:03:30 2021 +0000
- Child:
- 1:e8c3c7f14070
- Commit message:
- dekinai---
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Robot.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/Robot/#904dac75a729
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/PID.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/aberk/code/PID/#6e12a3e5af19
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/RCJESC.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/RCJESC/#5f1959f9d2db
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/aqm0802.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/piroro4560/code/aqm0802/#d2dce9901580
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/beep.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/beep/#ed6c6a4e6101
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/camera.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/camera/#12ef615ee47f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/jy901.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/jy901/#9fa716a2100a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/kohiMD.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/kohiMD/#d4d97efd8881
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/lineSensor.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/linesSnsor/#2d25db124969
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/lpf.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/lpf/#f252bd51e899
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/omni_wheel.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/teams/NHK-Robocon2016_Nagaoka_B_Team/code/omni_wheel/#cfec945ea421
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lib/solenoid.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/solenoid/#028d1164ff74
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,114 @@ +#include "main.h" +#include "robot.h" +#include "sensorGen.h" +#include "ui.h" + +Robot robo; +UI ui; +Thread displaythread; +sensorgen sensor_; +BufferedSerial pc(USBTX, USBRX, 115200); + + +void main2ui() +{ + char lcdname1[4] = {}, lcdname2[4] = {}; + int lcdvalue[2] = {}; + double temp[2] = {}; + while(1){ +// printf("test\r\n"); + if(ui.displayst == 0){ + strcpy(lcdname1, "gyr"); + strcpy(lcdname2, "bal"); + lcdvalue[0] = sensor_.angle; + } else if(ui.displayst == 1) { + strcpy(lcdname1, "bar"); + strcpy(lcdname2, "bax"); + lcdvalue[0] = 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; + } else if(ui.displayst == 3) { + strcpy(lcdname1, "blr"); + strcpy(lcdname2, "blx"); + lcdvalue[0] = sensor_.yellowAngle; + 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; + } else if(ui.displayst == 5) { + strcpy(lcdname1, "mt2"); + strcpy(lcdname2, "mt3"); + temp[0] = robo.omni.wheel[2]; + temp[1] = robo.omni.wheel[3]; + lcdvalue[2] = temp[0] * 100; + lcdvalue[3] = temp[1] * 100; + /*} else if(ui.displayst == 6) { + strcpy(lcdname1, "ln1"); + strcpy(lcdname2, "ln2"); + lcdvalue[2] = sensor.; + lcdvalue[3] = sensor.; + break; + } else if(ui.displayst == 7) { + strcpy(lcdname1, "ln3"); + strcpy(lcdname2, "ln4"); + lcdvalue[2] = sensor.; + lcdvalue[3] = sensor.; + break;*/ + } + ui.change(lcdname1, lcdname2, lcdvalue); + thread_sleep_for(3); + } +} + +int main(){ + + displaythread.start(main2ui); + uint8_t motorChecknum, uibt[4]; + bool startflag; + while(1){ + robo.motorStop(0.0); + /* + ui.returnbt(uibt); +// printf("%d %d %d %d %d\r\n", uibt[0], uibt[1], uibt[2], uibt[3], ui.start); + if(ui.mode == 0){ +// if(ui.b[3]) robo.start(ui.team, ui.algorithm); +// else robo.motorStop(); + } 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]){ + robo.motorCheck(0, 0.3); + }else if(ui.b[1]){ + robo.motorCheck(1, 0.3); + }else if(ui.b[2]){ + robo.motorCheck(2, 0.3); + }else if(ui.b[3]){ + robo.motorCheck(3, 0.3); + } + } else if(ui.mode == 2){ + if(ui.start){ + robo.kickCheck(); + } + robo.motorStop(); + } else if(ui.mode == 3){ + if(ui.start){ + robo.dribbleCheck(0.4); + } else { + robo.dribbleCheck(0); + } + robo.motorStop(); + } else if(ui.mode == 4){ + if(ui.b[3] - ui.b_[3]){ + sensor_.jy.jyroReset(); + } + + }*/ + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.h Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,48 @@ +#ifndef MAIN_H +#define MAIN_H + +#include "mbed.h" + +#define PI 3.1415926535897932 + + +static PinName const US1trig = PC_8; +static PinName const US1echo = PC_6; +static PinName const US2trig = PC_5; +static PinName const US2echo = PA_12; +static PinName const US3trig = PA_11; +static PinName const US3echo = PB_12; +static PinName const US4trig = PB_2; +static PinName const US4echo = PB_1; +static PinName const jyscl = PA_8; +static PinName const jysda = PB_4; +static PinName const IR = PC_2; + +static PinName const motor0 = PA_15; +static PinName const motor1 = PA_6; +static PinName const motor2 = PA_7; +static PinName const motor3 = PB_6; +static PinName const kicker = PA_10; +static PinName const ESCpin = PC_9; + +static PinName const buzz = PC_7; +static PinName const lcdscl = PB_8; +static PinName const lcdsda = PB_9; +static PinName const button = PC_3; +static PinName const toggle1 = PA_9; +static PinName const toggle2 = PB_10; +static PinName const toggle3 = PB_5; + +static PinName const line1 = A0; +static PinName const line2 = A1; +static PinName const line3 = A2; +static PinName const line4 = A3; +static PinName const line5 = A4; +static PinName const line6 = A5; + +static PinName const pixysclk = PB_13; +static PinName const pixymiso = PB_14; +static PinName const pixymosi = PB_15; + + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#bfde5aa1e74802771eaeacfa74789f71677325cb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sensorGen.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/piroro4560/code/sensorGen_0202/#f651e59a9805
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ui.lib Thu Mar 04 12:03:30 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Quadrifoglio/code/ui/#a5e8e6156172