Dependencies:   ESP8266Interface MPU6050 PID StepperMotor WebSocketClient mbed

Fork of irys by Kamil Foryszewski

Files at this revision

API Documentation at this revision

Comitter:
HangL
Date:
Tue Nov 08 21:19:59 2016 +0000
Parent:
0:af77f3d24e4a
Commit message:

Changed in this revision

PID.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/PID.lib	Thu Nov 03 17:17:32 2016 +0000
+++ b/PID.lib	Tue Nov 08 21:19:59 2016 +0000
@@ -1,1 +1,1 @@
-https://developer.mbed.org/users/kfforex/code/PID/#0ffb635770b3
+https://developer.mbed.org/users/HangL/code/PID/#7f0ed54318df
--- a/main.cpp	Thu Nov 03 17:17:32 2016 +0000
+++ b/main.cpp	Tue Nov 08 21:19:59 2016 +0000
@@ -43,7 +43,8 @@
 AnalogIn shfront(D3); 
 MPU6050 imu; 
 Ticker loop;
-PID controll(120.0,0.004,0.0007,0.01);
+//PID controll(120.0,0.004,0.0007,0.01);
+PID controll(0.01);
 ESP8266Interface wifi(D1,D0,D6,"WLAN_Staszic","st@szicwifi5",115200);
 
 int i; 
@@ -51,6 +52,8 @@
 float roll;
 float frontdistance; 
 double speed; 
+double Stepper_speed;
+double Target_speed=0;//6.0(it is a good paraments with 6.0!! very good! nearly to be static !);//0.0;
 char str[10];
 
 
@@ -59,8 +62,13 @@
         imu.complementaryFilter(&pitch, &roll);
         controll.setProcessValue(pitch); 
         speed = controll.compute(); 
+      //  Stepper_speed=controll.Speedcompute(speed,Target_speed);        
         left.step(speed); 
         right.step(-speed);
+        
+        Stepper_speed=controll.Speedcompute(speed,Target_speed); 
+        left.step(Stepper_speed); 
+        right.step(-Stepper_speed);
 }
 
 
@@ -95,7 +103,6 @@
 
     loop.attach_us(pid_thread,10000); 
     controll.setSetPoint(-14.1);
-        
         while(1) {
             // string with a message
             //sprintf(str,"%f",pitch);