Octopus!!

Dependencies:   2017NHKpin_config FEP HMC6352 PID QEI R1307 ikarashiMDC omni_wheel

Fork of KANIv3 by NagaokaRoboticsClub_mbedTeam

Revision:
45:a3ff2bc0574b
Parent:
44:3466b8e98fd9
Child:
46:9b714d4acdac
diff -r 3466b8e98fd9 -r a3ff2bc0574b bot/bot.cpp
--- a/bot/bot.cpp	Mon Oct 23 18:40:00 2017 +0900
+++ b/bot/bot.cpp	Fri Oct 27 16:14:50 2017 +0900
@@ -73,6 +73,7 @@
     plane.confirm();
     axis.confirm();
     float moment = 0;
+    float norm = 0;
     static float beforestick = pad.getStick(2);
 
     if(!pad.getButton2(4)) {
@@ -80,21 +81,25 @@
         debugSerial.printf("Force RESeT\n\r");
     }
 
-    if((beforestick >= 0.5 && pad.getStick(2) < 0.5) || (beforestick <= -0.5 && pad.getStick(2) > -0.5)) {
+    if((beforestick >= 0.2 && pad.getStick(2) < 0.2) || (beforestick <= -0.2 && pad.getStick(2) > -0.2)) {
         plane.setSetPoint(0.0);
         plane.resetOffset();
     }
 
-    if(pad.getStick(2) > 0.5 || pad.getStick(2) < -0.5) {
-        moment = pad.getStick(2) / 2.0;
+    if(pad.getStick(2) > 0.2 || pad.getStick(2) < -0.2) {
+        moment = pad.getStick(2) / 4.0;
     } else  {
         moment = plane.getCalculationResult();
     }
-
+    if(pad.getButton1(0)) {
+        norm = pad.getNorm(0) / 2.0;
+    } else {
+        norm = pad.getNorm(0);
+    }
     if(receiveSuccessed) {
         led[1] = !led[1];
         quadOmni.moveCircular(
-                pad.getNorm(0),
+                norm,
                 pad.getRadian(0) + axis.getCurrentDegree() / 10.0 * (M_PI / 180.0) + M_PI,
                 0.0,
                 0.0,
@@ -191,9 +196,13 @@
             debugSerial.printf("FUKUDA\n\r");
             armMotor[SWORD].setSpeed(1.0);
         }
-        if(pad.getButton2(3)) armMotor[SWORD].setSpeed(0.0);
+        if(!pad.getButton2(2)) {
+            debugSerial.printf("FUKUDA\n\r");
+            armMotor[SWORD].setSpeed(-1.0);
+        }
+        if(pad.getButton2(3) && pad.getButton2(2)) armMotor[SWORD].setSpeed(0.0);
 
-        slider.slide(pad.getStick(3));
+        slider.slide(-pad.getStick(3));
 
         if(!pad.getButton2(1)) {
             debugSerial.printf("DESTROYYY\n\r");