This is a one axis gimbal control program that takes roll angle from an IMU and moves the gimbal brushless motor accordingly.
Dependencies: MPU6050 brushlessController_TB6612FNG ledControl2 mbed
Diff: main.cpp
- Revision:
- 6:af164f09f963
- Parent:
- 5:477eaa33eff5
- Child:
- 7:b65164847018
diff -r 477eaa33eff5 -r af164f09f963 main.cpp --- a/main.cpp Wed Jul 22 13:16:04 2015 +0000 +++ b/main.cpp Wed Jul 22 14:03:32 2015 +0000 @@ -62,8 +62,8 @@ bool stop; // to stop the motor float delay; // time delay between steps float Kp = 10; -float Ki = 0.001; -float Kd = 0; +float Ki = 0.0001; +float Kd = 5; float set_point = 0; // which angle camera should stay float proportional = 0; float last_proportional =0; @@ -84,8 +84,7 @@ filter.attach(&compFilter, 0.005); // Call the complementaryFilter func. every 5 ms (200 Hz sampling period) gimbal.attach(&gimbalPID, 0.005); // Same period with gimbalPID (important) while(1) - { - + { /* pc.printf("%.1f,%.1f\r\n",rollAngle,pitchAngle); wait_ms(40);*/ }