Carbon Fibre / Mbed 2 deprecated Motor_test_harness

Dependencies:   Classic_PID iC_MU mbed-rtos mbed

Revision:
4:4dafa4113982
Parent:
3:f8a5c1cee1fa
--- a/ServiceKeyboard.cpp	Wed May 27 10:07:39 2015 +0000
+++ b/ServiceKeyboard.cpp	Thu Jun 25 09:41:26 2015 +0000
@@ -15,6 +15,8 @@
 extern float fade_tilt;
 extern float fade_time;
 extern float D;
+extern float T;
+extern float ts;
 extern int DoMove;
 extern float T_Position;
 extern float T_Kp;
@@ -24,6 +26,8 @@
 
 extern float Joy_Zoom;
 
+extern double drive;
+
 // Returns the new set point entered via the keyboard
 int ServiceKeyboard ()
 {
@@ -36,7 +40,7 @@
 // List keypresses used:
         case 'q':
             pc.printf("\n\r Toggle joystick = j \n\r Scope = s \n\r Fade = f \n\r Stop = c \n\r Set POS gains k, v, \n\r Set Vel Vff, kp: l, m \n\r Set fade time: t \n\r Save Shot = 1");
-            pc.printf("\n\r Zoom Value (1-10) = z");
+            pc.printf("\n\r Zoom Value (1-10) = z  \n\r Drive const speed = d");
             break;
 // Save a shot position:
         case '1':
@@ -61,8 +65,9 @@
         case 's':
             if (!scoping) {
                 Time = 0;
-                pc.printf("\n\r Time, Tilt_JoyStickDem, P_Error, T_Position, P");
-                scoping = true;                
+                pc.printf("\n\r Time, Tilt_JoyStickDem, P_Error, T_Position, P, Motor_Speed, Demand_Speed");
+
+                scoping = true;
             } else {
                 scoping = false;
             }
@@ -71,9 +76,10 @@
 // Calling A Fade:
         case 'f':
             if (DoMove == 0) {
-                fade_time = 15;
+                //fade_time = 15;
                 Profile();
-                pc.printf("\n\r Fade Distance: %f", D);                
+                pc.printf("\n\r Fade Distance: %f", D);
+                pc.printf("\n\r Fade Time = %f,  Ramp segment =  %f",T, ts);
                 DoMove = 1;
             }
             break;
@@ -182,6 +188,22 @@
             Joy_Zoom = (setting);
             pc.printf("\n\r");
             break;
+            // We are going to set Pos Feedforward gain for tilt...
+        case 'd':
+            pc.printf("\n\r Drive const speed (Multiply by 100): ");
+            key = pc.getc();
+            do {
+                key = pc.getc();                            // Wait for a keypress
+                if(key >= '0' && key <= '9') {              // Check it is a number
+                    value *= 10;                            // Index the old number
+                    value += (key - '0');                   // Add on the new number
+                    pc.printf("%c",key);                    // Display the new number
+                }
+            } while(key != 0x0D);
+            setting = value;
+            drive = setting;
+            pc.printf("\n\r New Speed is = %f", (drive/100));
+            break;
     }
     return(1);
 }
@@ -190,3 +212,4 @@
 
 
 
+