Oliver Wenzel / Mbed 2 deprecated mbed_amf_controlsystem_iO_copy

Dependencies:   mbed-rtos mbed

Fork of mbed_amf_controlsystem by Matti Borchers

Files at this revision

API Documentation at this revision

Comitter:
OWenzel
Date:
Sun Feb 07 10:41:16 2016 +0000
Parent:
13:34f7f783ad24
Commit message:
1. COmmit;

Changed in this revision

Controller/MachineDirectionController.cpp Show annotated file Show diff for this revision Revisions of this file
Controller/MachineDirectionController.h 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/MachineDirectionController.cpp	Fri Feb 05 16:06:44 2016 +0000
+++ b/Controller/MachineDirectionController.cpp	Sun Feb 07 10:41:16 2016 +0000
@@ -27,27 +27,34 @@
 
 void MachineDirectionController::cylic_control() {
     check_queues();
+    if( velocity_set < 0.1)
+    {
+        velocity_set=velocity_set_alt;
+        }
+        else if(velocity_set > 1.0){
+            velocity_set=1.0;
+        }
     
     Vorsteuerung=88.316*velocity_set+175.17;
-    l_e = velocity_set-velocity_current;
-    l_esum = l_esum + l_e;
+    //l_e = velocity_set-velocity_current;
+//l_esum = l_esum + l_e;
 
-    PI_Regler =l_Kp*l_e+l_Ki * l_esum;
+  //  PI_Regler =l_Kp*l_e+l_Ki * l_esum;
 
-    l_output=Vorsteuerung+PI_Regler;
+   // l_output=Vorsteuerung+PI_Regler;
+
 
-    l_PWM = 1500+l_output;
-
+   // l_PWM = 1500+l_output;
+    l_PWM=1500+Vorsteuerung;
     if(l_PWM<1500) {
         l_PWM = 1500;
         l_esum = l_esum-2*l_e;
     } else if(l_PWM>2000) {
         l_PWM = 2000;
         l_esum = l_esum-2*l_e;
-    } else if(velocity_set < 0.1) {
-        l_PWM = 1500;
     }
+    velocity_set_alt=velocity_set;
     
-    pwmOut->pulsewidth_us(1700);
-    //pwmOut.pulsewidth_us(l_PWM);
+    //pwmOut->pulsewidth_us(1700);
+    pwmOut->pulsewidth_us(l_PWM);
 }
\ No newline at end of file
--- a/Controller/MachineDirectionController.h	Fri Feb 05 16:06:44 2016 +0000
+++ b/Controller/MachineDirectionController.h	Sun Feb 07 10:41:16 2016 +0000
@@ -23,7 +23,7 @@
     float velocity_set;
     float velocity_current;
     float l_esum, Vorsteuerung, PI_Regler, l_output, l_PWM, l_e, l_Kp, l_Ki;
-    
+    float velocity_set_alt;
     void init();
     void check_queues();
 public:
--- a/main.cpp	Fri Feb 05 16:06:44 2016 +0000
+++ b/main.cpp	Sun Feb 07 10:41:16 2016 +0000
@@ -72,6 +72,14 @@
             ptr = (char*)receive_buffer;
             x = 22;
         }
+        if(rc_valid != 0)
+        {
+            serialMinnow.putc('a');//Aktiviert
+            }
+            else
+            {
+                serialMinnow.putc('d');//Deaktiviert
+                }
         
         //Thread::wait(100);
     }
@@ -101,7 +109,7 @@
     Thread machineDirectionControl(serial_thread);
     Thread hearbeatThread(hearbeat_thread);
     
-    RtosTimer machine_direction_control_timer(redirect_quadrature_controller);
+    RtosTimer machine_direction_control_timer(redirect_machine_direction_controller);
     RtosTimer quadrature_control_timer(redirect_quadrature_controller);
 
     // Konfiguration AMF-IMU