![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
control for robotic arm that can play chess using a granular gripper
Dependencies: Encoder mbed HIDScope Servo MODSERIAL
Fork of chessRobot by
debug.cpp@124:f67ce69557db, 2015-10-29 (annotated)
- Committer:
- annesteenbeek
- Date:
- Thu Oct 29 18:23:08 2015 +0100
- Revision:
- 124:f67ce69557db
- Parent:
- 121:6d8f1bdcda05
added serial communication interface
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
annesteenbeek | 14:0c0d1bfd94ea | 1 | #include "mbed.h" |
annesteenbeek | 14:0c0d1bfd94ea | 2 | #include "debug.h" |
annesteenbeek | 25:874675516927 | 3 | #include "HIDScope.h" |
annesteenbeek | 25:874675516927 | 4 | #include "buttons.h" |
annesteenbeek | 25:874675516927 | 5 | #include "actuators.h" |
annesteenbeek | 25:874675516927 | 6 | #include "config.h" |
annesteenbeek | 1:80f098c05d4b | 7 | // all the debugging functions |
annesteenbeek | 25:874675516927 | 8 | |
annesteenbeek | 98:25528494287d | 9 | // #define TUNEPID // set to switch between normal opperation or tuning PID |
annesteenbeek | 110:a6439e13be8b | 10 | // #define TUNEEMG // set hdiscope for EMG |
annesteenbeek | 110:a6439e13be8b | 11 | #define TUNEPWM // set hidscope for rest |
annesteenbeek | 57:43f707648f2b | 12 | |
annesteenbeek | 57:43f707648f2b | 13 | #ifdef TUNEPID |
annesteenbeek | 57:43f707648f2b | 14 | HIDScope scope(5); |
annesteenbeek | 57:43f707648f2b | 15 | |
annesteenbeek | 57:43f707648f2b | 16 | void debugProcess(){ |
annesteenbeek | 60:20945383ad1b | 17 | scope.set(0, motor2PID.getKp()); |
annesteenbeek | 60:20945383ad1b | 18 | scope.set(1, motor2PID.getKi()); |
annesteenbeek | 60:20945383ad1b | 19 | scope.set(2, motor2PID.getKd()); |
annesteenbeek | 57:43f707648f2b | 20 | scope.set(3, motor2SetSpeed); |
annesteenbeek | 57:43f707648f2b | 21 | scope.set(4, motor2Speed); |
annesteenbeek | 62:6c566e6f9664 | 22 | scope.set(5, motor2PWM); |
annesteenbeek | 57:43f707648f2b | 23 | scope.send(); |
annesteenbeek | 57:43f707648f2b | 24 | } |
annesteenbeek | 57:43f707648f2b | 25 | |
annesteenbeek | 78:0cc7c64ba94c | 26 | #endif |
annesteenbeek | 78:0cc7c64ba94c | 27 | #ifdef TUNEPWM |
annesteenbeek | 124:f67ce69557db | 28 | HIDScope scope(6); |
annesteenbeek | 1:80f098c05d4b | 29 | |
annesteenbeek | 1:80f098c05d4b | 30 | void debugProcess(){ |
annesteenbeek | 121:6d8f1bdcda05 | 31 | scope.set(0, motor1SetSpeed); |
annesteenbeek | 52:2ac9dee099ce | 32 | scope.set(1, motor2SetSpeed); |
annesteenbeek | 121:6d8f1bdcda05 | 33 | scope.set(2, setXSpeed); |
annesteenbeek | 121:6d8f1bdcda05 | 34 | scope.set(3, motor1PWM); |
annesteenbeek | 121:6d8f1bdcda05 | 35 | scope.set(4, motor2PWM); |
annesteenbeek | 124:f67ce69557db | 36 | scope.set(5, Xpos); |
annesteenbeek | 25:874675516927 | 37 | scope.send(); |
annesteenbeek | 57:43f707648f2b | 38 | } |
annesteenbeek | 57:43f707648f2b | 39 | |
annesteenbeek | 78:0cc7c64ba94c | 40 | #endif |
annesteenbeek | 78:0cc7c64ba94c | 41 | |
annesteenbeek | 78:0cc7c64ba94c | 42 | #ifdef TUNEEMG |
annesteenbeek | 100:222c27f55b85 | 43 | HIDScope scope(5); // Number of scopes |
annesteenbeek | 78:0cc7c64ba94c | 44 | |
annesteenbeek | 78:0cc7c64ba94c | 45 | void debugProcess(){ |
annesteenbeek | 100:222c27f55b85 | 46 | scope.set(0,y_velocity); |
annesteenbeek | 100:222c27f55b85 | 47 | scope.set(1,motor2SetSpeed); |
annesteenbeek | 100:222c27f55b85 | 48 | scope.set(2,z_velocity); |
annesteenbeek | 100:222c27f55b85 | 49 | scope.set(3,mode); |
annesteenbeek | 100:222c27f55b85 | 50 | scope.set(4,DOF); |
annesteenbeek | 100:222c27f55b85 | 51 | scope.set(5,motorsEnable); |
annesteenbeek | 78:0cc7c64ba94c | 52 | scope.send(); |
annesteenbeek | 78:0cc7c64ba94c | 53 | } |
annesteenbeek | 57:43f707648f2b | 54 | #endif |