Project Paint / Mbed 2 deprecated arm_control

Dependencies:   mbed QEI biquadFilter

Revision:
12:8295c02d740f
Parent:
7:a80cb6b06320
Child:
18:1c9dc6caab9d
--- a/robot.cpp	Wed Nov 02 16:29:13 2016 +0000
+++ b/robot.cpp	Thu Nov 03 13:08:44 2016 +0000
@@ -18,13 +18,16 @@
 
 const float initialArmLength = L_min;
 
+const float maxUpperArmVelocity = 1; // Rad/s
+const float maxLowerArmVelocity = 3; // Rad/s
+
 /*
     Constructor
 */
 
 Robot::Robot():
-    upperArm(initialArmLength, upperMotorPWM, upperMotorDir, upperEncoderPin1, upperEncoderPin2),
-    lowerArm(initialArmLength, lowerMotorPWM, lowerMotorDir, lowerEncoderPin1, lowerEncoderPin2) {
+    upperArm(initialArmLength, maxUpperArmVelocity, upperMotorPWM, upperMotorDir, upperEncoderPin1, upperEncoderPin2),
+    lowerArm(initialArmLength, maxLowerArmVelocity, lowerMotorPWM, lowerMotorDir, lowerEncoderPin1, lowerEncoderPin2) {
     killed = false;
 }
 
@@ -38,6 +41,16 @@
     lowerArm.update();
 }
 
+// Get upper arm encoder velocity
+float Robot::getUpperArmEncoderVelocity()  {
+    return upperArm.getEncoderVelocity();
+}
+
+// Get lower arm encoder velocity
+float Robot::getLowerArmEncoderVelocity()  {
+    return lowerArm.getEncoderVelocity();
+}
+
 // Set upper arm velocity (rad/s)
 void Robot::setUpperArmVelocity(float referenceVelocity) {
     if (!killed) {