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:
- 51:1e6334b993a3
- Parent:
- 50:b0cf07ca53cf
- Child:
- 52:2ac9dee099ce
diff -r b0cf07ca53cf -r 1e6334b993a3 actuators.cpp --- a/actuators.cpp Fri Oct 09 10:49:56 2015 +0200 +++ b/actuators.cpp Fri Oct 09 13:32:29 2015 +0200 @@ -69,11 +69,11 @@ motor1.period(1/pwm_frequency); motor2.period(1/pwm_frequency); - PIDmotor1.setSetPoint(motorSetSpeed1); - PIDmotor2.setSetPoint(motorSetSpeed2); + PIDmotor1.setSetPoint(&abs(motorSetSpeed1)); + PIDmotor2.setSetPoint(&abs(motorSetSpeed2)); - PIDmotor1.setProcessValue(motorSpeed1); - PIDmotor2.setProcessValue(motorSpeed2); + PIDmotor1.setProcessValue(&abs(motorSpeed1)); + PIDmotor2.setProcessValue(&abs(motorSpeed2)); // set limits for PID output to avoid integrator build up. PIDmotor1.setInputLimits(0, 300); @@ -122,11 +122,11 @@ } void writeMotors(){ - PIDmotor1.setSetPoint(abs(motorSetSpeed1)); - PIDmotor2.setSetPoint(abs(motorSetSpeed2)); + // PIDmotor1.setSetPoint(abs(motorSetSpeed1)); + // PIDmotor2.setSetPoint(abs(motorSetSpeed2)); - PIDmotor1.setProcessValue(abs(motorSpeed1)); - PIDmotor2.setProcessValue(abs(motorSpeed2)); + // PIDmotor1.setProcessValue(abs(motorSpeed1)); + // PIDmotor2.setProcessValue(abs(motorSpeed2)); motorPWM1 = PIDmotor1.compute(); motorPWM2 = PIDmotor2.compute();