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

Dependencies:   Encoder mbed HIDScope Servo MODSERIAL

Fork of chessRobot by a steenbeek

Files at this revision

API Documentation at this revision

Comitter:
MartijnGJ
Date:
Thu Oct 22 14:26:08 2015 +0000
Parent:
102:b3ab436fbe8e
Child:
104:750d7e13137d
Commit message:
Changed speeds

Changed in this revision

actuators.cpp Show annotated file Show diff for this revision Revisions of this file
buttons.cpp Show annotated file Show diff for this revision Revisions of this file
config.h Show annotated file Show diff for this revision Revisions of this file
debug.cpp Show annotated file Show diff for this revision Revisions of this file
debug.h Show annotated file Show diff for this revision Revisions of this file
--- a/actuators.cpp	Thu Oct 22 10:12:27 2015 +0000
+++ b/actuators.cpp	Thu Oct 22 14:26:08 2015 +0000
@@ -54,10 +54,10 @@
     const double servo_inc = servo_vel * motorCall;     // Servo postion increment per cycle
     double servo_pos = 0;
     double servoPulsewidth = 0.0015;
-    double servoSpeed = 0;
-    double scaleXSpeed = 5;
-    double scaleYSpeed = 10;
-    double scaleZSpeed = 5;
+    double servoSpeed = 15;
+    double scaleXSpeed = 10;
+    double scaleYSpeed = 20;
+    double scaleZSpeed = 1;
     
     
     
@@ -125,9 +125,9 @@
 
 void motorControl(){
     // EMG signals to motor speeds
-        motor1SetSpeed = x_velocity*scaleXSpeed;
-        motor2SetSpeed = y_velocity*scaleYSpeed;
-        servoSpeed = z_velocity*scaleZSpeed;
+//        motor1SetSpeed = x_velocity*scaleXSpeed;
+//        motor2SetSpeed = y_velocity*scaleYSpeed;
+//        servoSpeed = z_velocity*scaleZSpeed;
 
 
     // get encoder positions in degrees
--- a/buttons.cpp	Thu Oct 22 10:12:27 2015 +0000
+++ b/buttons.cpp	Thu Oct 22 14:26:08 2015 +0000
@@ -5,7 +5,7 @@
 #include "PID.h"
 
 //#define TUNEPID // enable tuning PID parameters with potmeters
-//#define SETPOS // enable position tuning with potmeters
+#define SETPOS // enable position tuning with potmeters
 // functions for reading all the buttons and switches 
 AnalogIn pot2(pot2Pin);
 AnalogIn pot1(pot1Pin);
--- a/config.h	Thu Oct 22 10:12:27 2015 +0000
+++ b/config.h	Thu Oct 22 14:26:08 2015 +0000
@@ -4,8 +4,6 @@
 #define EMG1in          A0
 #define EMG2in          A1
 
-#define startPin		PTC6
-
 // Analog inputs for potmeters
 #define pot1Pin         A2
 #define pot2Pin         A3
@@ -16,7 +14,7 @@
 #define button2Pin      D1
 
 // Servo
-#define servoPin        D9
+#define servoPin        D3
 
 // MOTORS
 #define motor2DirPin    D4
--- a/debug.cpp	Thu Oct 22 10:12:27 2015 +0000
+++ b/debug.cpp	Thu Oct 22 14:26:08 2015 +0000
@@ -44,8 +44,8 @@
     scope.set(0,x_velocity);
     scope.set(1,motor1SetSpeed);
     scope.set(2,motor1Speed);
-    scope.set(3,motor1PWM);
-    scope.set(4,mode);
+    scope.set(3,servoPulsewidth*100);
+    scope.set(4,servoSpeed);
     scope.set(5,DOF);
     scope.send();
 }
--- a/debug.h	Thu Oct 22 10:12:27 2015 +0000
+++ b/debug.h	Thu Oct 22 14:26:08 2015 +0000
@@ -12,6 +12,8 @@
 extern double motor1SetSpeed;
 extern double motor1Speed;
 extern double motor1Pos;
+extern double servoSpeed;
+extern double servoPulsewidth;
 extern double motor1PWM;
 extern bool motorsEnable;
 
@@ -32,7 +34,7 @@
 extern bool pump;
 extern int DOF;
 extern bool mode;
-
+extern double servo_pos;
 
 void debugProcess();