FSG / Mbed 2 deprecated 7_26_17_FSG

Dependencies:   BCEmotor Battery_Linear_Actuator Controller_ IMU_code_ LTC1298_7_14 MODSERIAL PosVelFilter System mbed

Fork of 7_21_17_FSG by FSG

Files at this revision

API Documentation at this revision

Comitter:
mdavis30
Date:
Fri Jul 28 18:58:07 2017 +0000
Parent:
11:b5cc98f154a4
Commit message:

Changed in this revision

Controller.lib Show annotated file Show diff for this revision Revisions of this file
PosVelFilter.lib Show annotated file Show diff for this revision Revisions of this file
System.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Controller.lib	Thu Jul 27 16:31:21 2017 +0000
+++ b/Controller.lib	Fri Jul 28 18:58:07 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/FSG/code/Controller_/#55085534a378
+https://developer.mbed.org/teams/FSG/code/Controller_/#29cf76bb9956
--- a/PosVelFilter.lib	Thu Jul 27 16:31:21 2017 +0000
+++ b/PosVelFilter.lib	Fri Jul 28 18:58:07 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/tnhnrl/code/PosVelFilter_7_14/#992e774dc62a
+https://developer.mbed.org/teams/FSG/code/PosVelFilter/#8107bb13278b
--- a/System.lib	Thu Jul 27 16:31:21 2017 +0000
+++ b/System.lib	Fri Jul 28 18:58:07 2017 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/teams/FSG/code/System/#8764d841a892
+https://developer.mbed.org/teams/FSG/code/System/#60b1f9e72822
--- a/main.cpp	Thu Jul 27 16:31:21 2017 +0000
+++ b/main.cpp	Fri Jul 28 18:58:07 2017 +0000
@@ -62,6 +62,8 @@
 int Pr_count = 0;
 int BCE_count = 0;
 
+AnalogIn   pressure_analog_in(A0);
+
 void IMU_ticking()
 {
     //led1 = !led1;   //flash the IMU LED
@@ -72,7 +74,7 @@
 
 void PRESSURE_ticking()
 {
-    PC.printf("pressure: %f psi \n", (0.00122*(adc().ch1_filt)*9.9542)-0.0845);    //read the analog pin
+    PC.printf("Pressure sensor (PSI)\nPRESS_PSI: %3.3f\n", 3.3*1.503*10 * pressure_analog_in.read());    //read the analog pin    //read the analog pin
     //this voltage has been checked and scaled properly (6/28/2017)
 }
 
@@ -87,16 +89,6 @@
     PC.baud(9600);          //mbed to PC serial connection speed
     hBridge().stop();       //Stop the buoyancy engine from moving
     systemTime().start();   //start the timer, needed for PID loop
-        
-    /* **************** Linear Actuator MOTOR CONTROLLER **************** */
-    Battery_Linear_Actuator BLA_object;             //create the IMU object from the imported class  
-    
-    PC.printf("%s\n", BLA_object.Keyboard_U().c_str());     //velocity = 0, motor disabled
-    
-    PC.printf("%s\n", BLA_object.Keyboard_Q().c_str());     //turn off motor
-    wait(1);
-    PC.printf("%s\n", BLA_object.Keyboard_E().c_str());     //turn on motor
-    wait(1);
     
     //setup and start the adc. This runs on a fixed interval and is interrupt driven
     adc().initialize();
@@ -105,11 +97,6 @@
     //Initialize the position velocity filter. This will consume a couple of seconds for
     //the filter to converge
     pvf().init();
-
-    //NEW 7/21  Homing the motor
-    PC.printf("### homing the device ###");
-    BLA_object.Keyboard_H();
-    wait(10); //for debugging
                 
 
     float P = 0.10;
@@ -179,68 +166,8 @@
             if(Key=='!')  //RESET THE MBED
             {
                 PC.printf("MBED RESET KEY (!) PRESSED\n");
-                PC.printf("Linear Actuator Motor disabled!\n");
-                //disable the motor
-                BLA_object.Keyboard_Q();        //DISABLE THE MOTOR
-                wait(0.5);                      //500 milliseconds
                 mbed_reset(); //reset the mbed!
-            }
-           /* else if(Key == '[')
-            {
-                BLA_object.velocity_only(-100); //send speed -100 command to linear actuator (retract)
-            }
-            else if(Key == ']')
-            {
-                BLA_object.velocity_only(100); //send speed +100 command to linear actuator (extend)
-            }  
-            else if(Key == 'u')
-            {
-                BLA_object.Keyboard_U(); //stop linear actuator
-            }  */
-            else if(Key =='H')  //homing sequence
-            {
-                PC.printf("### homing the device ###");
-                BLA_object.Keyboard_H();
-                wait(10); //for debugging
-                
-                const char *char_actual_position = BLA_object.get_pos().c_str();
-                //actual_position_string = BLA_object.get_pos().c_str();
-                
-                sscanf(char_actual_position, "%lf", &double_actual_position);
-                // 7/10/17
-                
-                PC.printf("LA actual position: %lf \n", double_actual_position); 
-             
-                //TROY NOTES on Linear Actuator commands:
-                //"pos" returns integer value "66813 for example"
-                //"hosp-100" is the setting of the motor, it retracts at 100 rpm
-                //"gohoseq" to home it, it will not give you feedback
-                //print the position after you do this to see where the LA is    
-            }
-            else if(Key=='p' or Key == 'P')
-            {
-                             
-                // 7/10/17
-                //actual_position_string = BLA_object.get_pos();
-                //actual_position_string = BLA_object.get_pos().c_str();
-                //const char *char_actual_position = string_actual_position.c_str();
-                
-                const char *char_actual_position = BLA_object.get_pos().c_str();
-                //actual_position_string = BLA_object.get_pos().c_str();
-                
-                sscanf(char_actual_position, "%lf", &double_actual_position);
-                // 7/10/17
-                
-                PC.printf("### L.A. position is\nLA_AP: %lf ###\n", double_actual_position);     //flip this back and forth
-                
-                if (double_actual_position > 180000)
-                    PC.printf(" <<<< REACHED MAXIMUM L.A. POSITION! >>>>\n");    
-                else if (double_actual_position < 0)
-                    PC.printf(" <<<< REACHED MINIMUM L.A. POSITION! >>>>\n");    
-                
-                wait(1); //for debugging      
-                // "-999999" means it is not working  
-            }
+            } 
             else if (Key == '3' or Key == '#')
             {
                 PC.printf("Ticker Sensor Step Size\n");
@@ -501,133 +428,13 @@
                     PC.printf("ERROR: LA already in manual mode\n");
                 }
             }
-            else if (Key == '0' or Key == ')')
-            {
-                PC.printf(") recieved\n");
-                if (la_step == 0.5)
-                {
-                    la_step = 1.0;
-                }
-                else if (la_step == 1.0)
-                {
-                    la_step = 5.0;
-                }
-                else if (la_step == 5.0)
-                {
-                    la_step = 10.0;
-                }
-                else if (la_step == 10.0)
-                {
-                    la_step = 15.0;
-                }
-                else if (la_step == 15.0)
-                {
-                    la_step = 0.5;
-                }
-                PC.printf("LA Step Size Now %f\n", la_step);
-            }
             
-            else if (Key=='-' or Key == '_')
-            {
-                if (LA_auto == true)
-                {
-                    la_setPoint_temp -= la_step; //IMU_yaw_angle -= 1.0;
-                    PC.printf("- recieved\n");
-                    PC.printf("LA auto step size: %f\n", la_step);
-                    PC.printf("LA angle changed to\nLA_ANG: %f\n", la_setPoint_temp);
-                }
-                else
-                {
-                    PC.printf("ERROR: LA in manual mode!\n"); 
-                }
-            }
-            
-            else if (Key =='=' or Key == '+')
-            { 
-                if (LA_auto == true)
-                {
-                    la_setPoint_temp += la_step; //IMU_yaw_angle += 1.0; 
-                    PC.printf("+ recieved\n");
-                    PC.printf("LA auto step size: %f\n", la_step);
-                    PC.printf("LA angle changed to\nLA_ANG: %f\n", la_setPoint_temp);
-                }
-                else
-                {
-                    PC.printf("ERROR: LA in manual mode!\n"); 
-                }
-            }
-            
-            else if (Key == 'A' or Key == 'a')
-             {
-                if (LA_auto == true)
-                {
-                    PC.printf("A recieved\n");
-                    la_setPoint=la_setPoint_temp;
-                    PC.printf("LA angle now set to\nLA_A_SND: %f\n", la_setPoint);
-                }
-                else
-                {
-                    PC.printf("ERROR: LA in manual mode!\n"); 
-                }
-            } 
-
-            
-            else if(Key == 'n' or Key == 'N')
-             {
-                if (LA_auto == false)
-                {
-                    PC.printf("N key pressed. \n");
-                    PC.printf("%s\n", BLA_object.Keyboard_DASH_KEY().c_str());
-                }
                 
                 else
                 {
                     PC.printf("ERROR: In LA in Auto Mode, this is a manual command\n");
                 }
             }
-            
-            else if(Key == 'm' or Key == 'M')
-            {
-                if (LA_auto == false)
-                {
-                    PC.printf("M key pressed. \n");
-                    PC.printf("%s\n", BLA_object.Keyboard_EQUAL_KEY().c_str());
-                }
-                
-                else
-                {
-                    PC.printf("ERROR: In LA in Auto Mode, this is a manual command\n");
-                }  
-            }
-            
-            else if(Key == 'j' or Key == 'J')
-            {
-                if (LA_auto == false)
-                {
-                    PC.printf("J key pressed. \n");
-                    PC.printf("%s\n", BLA_object.Keyboard_A().c_str());
-                }
-                
-                else
-                {
-                    PC.printf("ERROR: In LA in Auto Mode, this is a manual command\n");
-                }
-            }
-            
-            else if(Key == 'k' or Key == 'K')
-            {
-                if (LA_auto == false)
-                {
-                    PC.printf("K key pressed. \n");
-                    PC.printf("%s\n", BLA_object.Keyboard_D().c_str());
-                }
-                
-                else
-                {
-                    PC.printf("ERROR: In LA in Auto Mode, this is a manual command\n");
-                }
-            }
-
             else 
             {
                 PC.printf("\n%c received!\n", Key);
@@ -640,8 +447,6 @@
         }
         //end of PC readBLE       
             
-        //MC readable   
-        MC_readable_string = BLA_object.MC_readable_redux();
         //PC.printf("CHECK_MC_readable:\n%s\n", MC_readable_string);
         
     /*    if (LA_auto == false)
@@ -660,7 +465,7 @@
         {
             //PC.printf("LA_auto true\n");
             //PC.printf("%s\n", BLA_object.PID_velocity_control(la_setPoint, IMU_pitch_angle, la_P_gain, la_I_gain, la_D_gain).c_str());  //get output string
-            BLA_object.PID_velocity_control(la_setPoint, IMU_pitch_angle, la_P_gain, la_I_gain, la_D_gain).c_str();
+
             //wait_us(100); //for PC readable (0.1 ms)
         }
         else if (LA_auto == false)
@@ -729,4 +534,4 @@
         }
                 
     }
-}
\ No newline at end of file
+