Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: DriveConroller IMU MDD Mycan Odometer PID RotaryEncoder UART USS mbed
Fork of AR_MastarNode by
Diff: main.cpp
- Revision:
- 6:a102603c99fd
- Parent:
- 5:7c5e07260e1e
- Child:
- 7:1ee46b2e8dce
--- a/main.cpp Sun Aug 12 02:26:00 2018 +0000 +++ b/main.cpp Fri Aug 17 08:00:09 2018 +0000 @@ -15,27 +15,27 @@ //(X, Y, θ, speed, angle, injection, 補給昇降) float position[19][6] = {{0.0, 0.0, 0.0, 0, 90, 0},//初期位置 - {-3.825, 0.0, 0.0, 0, 82, 0},//x移動, 角度変化 + {-1.825, 0.0, 0.0, 0, 82, 0},//x移動, 角度変化 + {-1.825, 18.0, 0.0, 0, 82, 0},//y移動 + {-1.825, 18.0, 0.0, 35, 82, 0},//発射 + {-1.825, 0.0, 0.0, 0, 88, 1},//y移動,角度戻す, P上昇 + + {-2.825, 0.0, 0.0, 0, 88, 1},//x移動, 角度変化, 下降&バットマン駆動 + {-2.825, 18.0, 0.0, 0, 82, 0},//y移動 + {-2.825, 18.0, 0.0, 35, 82, 0},//発射 + {-2.825, 0.0, 0.0, 0, 88, 1},//y移動,角度戻す, P上昇 + + {-3.825, 0.0, 0.0, 0, 88, 1},//x移動, 角度変化, 下降&バットマン駆動 {-3.825, 18.0, 0.0, 0, 82, 0},//y移動 {-3.825, 18.0, 0.0, 35, 82, 0},//発射 {-3.825, 0.0, 0.0, 0, 88, 1},//y移動,角度戻す, P上昇 - {-4.825, 0.0, 0.0, 0, 82, 0},//x移動, 角度変化, 下降&バットマン駆動 - {-4.825, 18.0, 0.0, 0, 82, 0},//y移動 - {-4.825, 18.0, 0.0, 35, 82, 0},//発射 - {-4.825, 0.0, 0.0, 0, 88, 1},//y移動,角度戻す, P上昇 - - {-5.825, 0.0, 0.0, 0, 82, 0},//x移動, 角度変化, 下降&バットマン駆動 - {-5.825, 18.0, 0.0, 0, 82, 0},//y移動 - {-5.825, 18.0, 0.0, 35, 82, 0},//発射 - {-5.825, 0.0, 0.0, 0, 88, 0},//y移動,角度戻す, P上昇 - - {-1.825, 0.0, 0.0, 0, 88, 1},//x移動, 角度変化, 下降&バットマン駆動 - {-1.825, 18.0, 0.0, 0, 82, 0},//y移動 - {-1.825, 18.0, 0.0, 18, 82, 0},//下段に発射 - {-1.825, 18.0, 0.0, 0, 88, 1},//角度戻す, P上昇 - {-1.825, 18.0, 0.0, 0, 85, 0},//角度変化, 下降&バットマン駆動 - {-1.825, 18.0, 0.0, 18, 85, 0},//上段に発射 + {-0.825, 0.0, 0.0, 0, 88, 1},//x移動, 角度変化, 下降&バットマン駆動 + {-0.825, 18.0, 0.0, 0, 82, 0},//y移動 + {-0.825, 18.0, 0.0, 18, 82, 0},//下段に発射 + {-0.825, 18.0, 0.0, 0, 88, 1},//角度戻す, P上昇 + {-0.825, 18.0, 0.0, 0, 85, 0},//角度変化, 下降&バットマン駆動 + {-0.825, 18.0, 0.0, 18, 85, 0},//上段に発射 }; controller getPropoData(); @@ -112,7 +112,7 @@ sw1.mode(PullUp); sw2.mode(PullUp); - while(1) + while(1) { controller cmd = getPropoData(); @@ -122,18 +122,20 @@ while(can.send() == 0); can.read(); - int supply_pid = can.get(2, 1); + //int supply_pid = can.get(2, 1); if(pidRobotX.isConvergence(1) == 1 && pidRobotYow.isConvergence(1) == 1) { + //超音波で近づくとき if(position[posi_num][1] >= 10) { if(pidUss.isConvergence(1) == 1 && isConvergetnceTops() == 1) posi_num++; } - else if(pidRobotY.isConvergence(1) == 1 && supply_pid == 1) + //超音波使わないとき + else if(pidRobotY.isConvergence(1) == 1) posi_num++; }