control for robotic arm that can play chess using a granular gripper

Dependencies:   Encoder mbed HIDScope Servo MODSERIAL

Fork of chessRobot by a steenbeek

Revision:
110:a6439e13be8b
Parent:
109:026abd708dce
Child:
111:43c0881fe7e7
Child:
115:d8d2968981f3
--- a/actuators.cpp	Mon Oct 26 12:45:41 2015 +0000
+++ b/actuators.cpp	Tue Oct 27 14:45:15 2015 +0000
@@ -50,6 +50,7 @@
 double timechange;
 
 // Set servo values
+double servoSpeed = 0;
 const int servoStartPos = 1300; // Servo ranges from 600ms(-90) to 2000ms(90), 1300 is 0 deg
 
 // Set calibration values
@@ -116,10 +117,10 @@
 void motorControl(){
     #ifndef SETPOS // if not tuning with potmeters, switch to EMG
         // EMG signals to motor speeds
-        const double scaleVel = 20;
-        motor1SetSpeed = x_velocity*scaleVel;
-        motor2SetSpeed = y_velocity*scaleVel;
-        servoSpeed = z_velocity*scaleVel;
+//        const double scaleVel = 20;
+//        motor1SetSpeed = x_velocity*scaleVel;
+//        motor2SetSpeed = y_velocity*scaleVel;
+//        servoSpeed = z_velocity*scaleVel;
     #endif
     // get encoder positions in degrees
         // 131.25:1 gear ratio
@@ -192,6 +193,7 @@
    redLed.write(0); greenLed.write(1); blueLed.write(1);
    while (calibrating1 || calibrating2){
        if (calibrating1){
+            motor1SetSpeed = motorCalSpeed;
             redLed.write(1); greenLed.write(0); blueLed.write(1);
            if(safetyIn.read() !=1){ // check if arm reached safety position
                encoder1.setPosition(0); // set motor 1 cal angle
@@ -230,7 +232,7 @@
    }
     motorsEnable = false; // turn motor's off again
     safetyOn = true; // turn safety on after callibration
-    return true; // return true wehn finished
+    return true; // return true when finished
 }