Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: buttoncontrol includeair includeair Oudverslag
Diff: controlandadjust.h
- Revision:
- 17:666505754e3f
- Parent:
- 15:a1a29db96f4f
- Child:
- 19:e3585d3c5a85
--- a/controlandadjust.h Fri Oct 23 12:13:00 2015 +0000
+++ b/controlandadjust.h Mon Oct 26 12:25:31 2015 +0000
@@ -54,8 +54,9 @@
*
*Constructs a controller no don't put () after your controller
*@param errorband : float Width of the band at of allowable error
+ *@param controlfrequency : float Frequency of the controller in Hz
*/
- controlandadjust(float errorband);
+ controlandadjust(float errorband, float controlfrequency);
/** P controller
* @param error1 : float Error from motor 1
@@ -75,7 +76,7 @@
* @param &error2_int : float Error for the integral from motor 2
* @return void
*/
- void PI(float error1, float error2, float Kp, float Ki,float Ts, float &error1_int, float &error2_int);
+ void PI(float error1, float error2, float Kp, float Ki);
/** PID controller
* @param error1 : float Error from motor 1
@@ -90,8 +91,23 @@
* @param &error2_prev : float Previous error from motor 2 for the derivative
* @return void
*/
- void PID(float error1, float error2, float Kp, float Ki,float Kd,float Ts,
- float &error1_int, float &error2_int, float &error1_prev, float &error2_prev);
+ void PID(float error1, float error2, float Kp, float Ki, float Kd );
+
+ /** PID controller with low pass
+ * @param error1 : float Error from motor 1
+ * @param error2 : float Error from motor 2
+ * @param Kp : float Desired value of Kp for your controller
+ * @param Ki : float Desired value of Ki for your controller
+ * @param Kd : float Desired value of Kd for your controller
+ * @param Ts : float Sampling time of your controller (1/Fs)
+ * @param &error1_int : float Error for the integral from motor 1
+ * @param &error2_int : float Error for the integral from motor 2
+ * @param &error1_prev : float Previous error from motor 1 for the derivative
+ * @param &error2_prev : float Previous error from motor 2 for the derivative
+ * @param tau_p : float Value of tau p (for the low pass filter)
+ * @return void
+ */
+ void PIDLowPass(float error1, float error2, float Kp, float Ki,float Kd, float tau_p);
/** Read the PWM signal to motor 1
* @return PWM signal to motor 1