ECE 4333 / Mbed 2 deprecated Lab3

Dependencies:   mbed

Revision:
7:241bde733699
Parent:
6:1d16cc833e0d
Child:
8:9609a50ea076
diff -r 1d16cc833e0d -r 241bde733699 Lab3.cpp
--- a/Lab3.cpp	Fri Feb 26 21:55:31 2016 +0000
+++ b/Lab3.cpp	Sat Feb 27 18:36:43 2016 +0000
@@ -163,7 +163,7 @@
    
    signed int input;
    
-   Bluetooth.printf("\n\r Please enter a desired angular speed for the left motor (rad/sec) >> ");
+   Bluetooth.printf("\n\r Please enter a desired angular speed for the left motor (m/sec) >> ");
    Bluetooth.scanf("%i",&input);
    
    Bluetooth.printf("\n\r Your setpoint is >> %i\n\r",input);
@@ -180,7 +180,7 @@
       
    signed int input;
    
-   Bluetooth.printf("\n\r Please enter a desired angular speed for the right motor (rad/sec) >> ");
+   Bluetooth.printf("\n\r Please enter a desired angular speed for the right motor (m/sec) >> ");
    Bluetooth.scanf("%i",&input);
    
    Bluetooth.printf("\n\r Your setpoint is >> %i\n\r",input);
@@ -319,12 +319,12 @@
    
    // Specify Setpoint ( rads/sec )
 
-    L_setpoint = InputLeft();
-    R_setpoint = InputRight();
+    L_setpoint = InputLeft()/0.05093;  //The 0.05093 converts from a m/s input to a rad/s control calculation
+    R_setpoint = InputRight()/0.05093; //The 0.05093 converts from a m/s input to a rad/s control calculation
     
    // Display Global Variables to Console
    Bluetooth.printf("\n\r ========= LEFT =======       ========= RIGHT =======");
-   Bluetooth.printf("\n\r   US    VE    IS   CS          US    VE    IS   CS "); 
+   Bluetooth.printf("\n\r    US    VE     IS    CS         US    VE    IS   CS "); 
    
    while(1){
        
@@ -334,8 +334,10 @@
        float R_error_t = R_e;
        float R_u_t = R_u;
        
+       float L_setpoint_m = L_setpoint*0.05093; //Setpoints in meters per second float values for display
+       float R_setpoint_m = L_setpoint*0.05093; //Setpoints in meters per second float values for display
 
-       Bluetooth.printf("\n\r   %i    %2.1f  %i  %2.2f          %i    %2.1f  %i  %2.2f",L_setpoint,L_error_t,L_integrator,L_u_t,R_setpoint,R_error_t,R_integrator,R_u_t);
+       Bluetooth.printf("\n\r   %2.2f   %2.1f    %i  %2.2f      %2.2f    %2.1f  %i  %2.2f",L_setpoint_m,L_error_t*0.05093,L_integrator,L_u_t,R_setpoint_m,R_error_t*0.05093,R_integrator,R_u_t);
        wait(0.75);
    }