control for robotic arm that can play chess using a granular gripper
Dependencies: Encoder mbed HIDScope Servo MODSERIAL
Fork of chessRobot by
Revision 97:0f67952051e5, committed 2015-10-21
- Comitter:
- annesteenbeek
- Date:
- Wed Oct 21 13:50:38 2015 +0200
- Parent:
- 93:a8898eb80edc
- Commit message:
- working calibration
Changed in this revision
--- a/actuators.cpp Wed Oct 21 13:16:24 2015 +0200 +++ b/actuators.cpp Wed Oct 21 13:50:38 2015 +0200 @@ -47,13 +47,12 @@ double timechange; bool pidOut = 0; - // for Calibration: + // calibration bool calibrating1 = true; bool calibrating2 = false; double motorCalSpeed = 10; // deg/sec double returnSpeed = -10; bool springHit = false; - float lastCall = 0; // Create object instances @@ -211,12 +210,9 @@ } } } - now = t.read(); // call motor using timer instead of wait - if(now - lastCall > motorCall){ - writeMotors(); - lastCall = now; - } - + writeMotors(); + wait(motorCall); + } safetyOn = true; // turn safety on after callibration }
--- a/actuators.h Wed Oct 21 13:16:24 2015 +0200 +++ b/actuators.h Wed Oct 21 13:50:38 2015 +0200 @@ -5,7 +5,11 @@ #include "mbed.h" #include "config.h" #include "encoder.h" +#include "buttons.h" +extern DigitalOut redLed; +extern DigitalOut greenLed; +extern DigitalOut blueLed; extern bool motorsEnable; extern bool safetyOn;
--- a/main.cpp Wed Oct 21 13:16:24 2015 +0200 +++ b/main.cpp Wed Oct 21 13:50:38 2015 +0200 @@ -27,6 +27,7 @@ int main(){ motorInit(); calibrateMotors(); // start calibration procedure +calibrateEMG(); switchesTick.attach(&switches_activate, 0.02f); debugTick.attach(&debug_activate, 0.03f);