Octopus!!
Dependencies: 2017NHKpin_config FEP HMC6352 PID QEI R1307 ikarashiMDC omni_wheel
Fork of KANIv3 by
Diff: bot/bot.cpp
- Revision:
- 37:6b6616008e78
- Parent:
- 36:c1398ea8f604
- Child:
- 39:07180d39a030
--- a/bot/bot.cpp Mon Oct 09 09:22:44 2017 +0900 +++ b/bot/bot.cpp Wed Oct 18 19:32:26 2017 +0900 @@ -8,10 +8,10 @@ quadOmni(&RS485Controller, &RS485), slider(&RS485Controller, &RS485), armMotor({ - ikarashiMDC({&RS485Controller, 1, 1, SM, &RS485}), - ikarashiMDC({&RS485Controller, 1, 2, SM, &RS485}), - ikarashiMDC({&RS485Controller, 1, 3, SM, &RS485}) - }), + ikarashiMDC({&RS485Controller, 1, 1, SM, &RS485}), + ikarashiMDC({&RS485Controller, 1, 2, SM, &RS485}), + ikarashiMDC({&RS485Controller, 1, 3, SM, &RS485}) + }), receiveSuccessed(0), frontDegree(0), led({DebugLED3, DebugLED4, DebugLED5}), @@ -57,12 +57,12 @@ plane.confirm(); } quadOmni.moveXY( - pad.getStick(0), - -pad.getStick(1), - 0, - 0, - - pad.getStick(2) / 3.0 // PIDC::calculationResult - ); + pad.getStick(0), + -pad.getStick(1), + 0, + 0, + - pad.getStick(2) / 3.0 // PIDC::calculationResult + ); } else { quadOmni.moveXY(0, 0, 0); } @@ -94,12 +94,12 @@ if(receiveSuccessed) { led[1] = !led[1]; quadOmni.moveCircular( - pad.getNorm(0), - pad.getRadian(0) - axis.getCurrentDegree() / 10.0 * (M_PI / 180.0) + M_PI, - 0.5, - 0.5, - -moment - ); + pad.getNorm(0), + pad.getRadian(0) - axis.getCurrentDegree() / 10.0 * (M_PI / 180.0) + M_PI, + 0.2, + 0.2, + -moment + ); } else { quadOmni.moveXY(0, 0, 0); } @@ -135,24 +135,24 @@ plane.confirm(); quadOmni.moveXY( - pad.getStick(0), - -pad.getStick(1), - 0.5, - 0.5, - -plane.getCalculationResult() - ); + pad.getStick(0), + -pad.getStick(1), + 0.5, + 0.5, + -plane.getCalculationResult() + ); } if(mode == 2) { plane.setPoint(90.0 + frontDegree); plane.confirm(); quadOmni.moveXY( - -pad.getStick(1), - -pad.getStick(0), - 0.5, - 0.5, - -plane.getCalculationResult() - ); + -pad.getStick(1), + -pad.getStick(0), + 0.5, + 0.5, + -plane.getCalculationResult() + ); } } else { quadOmni.moveXY(0, 0, 0); @@ -175,7 +175,7 @@ if(!pad.getButton1(0)) { debugSerial.printf("FUKUDA\n\r"); - armMotor[SWORD].setSpeed(0.6); + armMotor[SWORD].setSpeed(1.0); } if(pad.getButton1(0)) armMotor[SWORD].setSpeed(0.0); @@ -187,21 +187,21 @@ } else { armMotor[DESTROY].setSpeed(0.0); } - } else { - slider.slide(0); - for(int i = 0; i < 3; i++) { - armMotor[i].setSpeed(0); - } - } + } else { + slider.slide(0); + for(int i = 0; i < 3; i++) { + armMotor[i].setSpeed(0); + } + } } void Bot::calibrate() { if(receiveSuccessed && - !pad.getButton2(0) && - !pad.getButton2(1) - ) { + !pad.getButton2(0) && + !pad.getButton2(1) + ) { t.start(); t.reset(); plane.calibration(HMC6352_ENTER_CALIB);