control for robotic arm that can play chess using a granular gripper
Dependencies: Encoder mbed HIDScope Servo MODSERIAL
Fork of chessRobot by
Diff: actuators.cpp
- Revision:
- 102:b3ab436fbe8e
- Parent:
- 101:b821e89fc108
- Child:
- 103:4a37d19e8fcc
diff -r b821e89fc108 -r b3ab436fbe8e actuators.cpp --- a/actuators.cpp Thu Oct 22 09:34:31 2015 +0000 +++ b/actuators.cpp Thu Oct 22 10:12:27 2015 +0000 @@ -4,6 +4,7 @@ #include "config.h" #include "encoder.h" #include "HIDScope.h" +#include "buttons.h" // functions for controlling the motors bool motorsEnable = false; @@ -54,6 +55,11 @@ double servo_pos = 0; double servoPulsewidth = 0.0015; double servoSpeed = 0; + double scaleXSpeed = 5; + double scaleYSpeed = 10; + double scaleZSpeed = 5; + + // Set calibration values double motorCalSpeed = 10; // deg/sec @@ -119,9 +125,10 @@ void motorControl(){ // EMG signals to motor speeds - motor1SetSpeed = x_velocity*2; - motor2SetSpeed = y_velocity*20; - servoSpeed = z_velocity*20; + motor1SetSpeed = x_velocity*scaleXSpeed; + motor2SetSpeed = y_velocity*scaleYSpeed; + servoSpeed = z_velocity*scaleZSpeed; + // get encoder positions in degrees // 131.25:1 gear ratio