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.
Revision 11:8faa068940f1, committed 2015-12-05
- Comitter:
- jasonliujc
- Date:
- Sat Dec 05 02:07:16 2015 +0000
- Parent:
- 10:332a4ad5911d
- Commit message:
- parameters to be adjusted!
Changed in this revision
--- a/main.cpp Sat Dec 05 00:41:23 2015 +0000 +++ b/main.cpp Sat Dec 05 02:07:16 2015 +0000 @@ -54,7 +54,7 @@ Systicker.attach_us(&systick,1000); //loop(); - + // pc.printf("test\n"); return 0;
--- a/pid.cpp Sat Dec 05 00:41:23 2015 +0000 +++ b/pid.cpp Sat Dec 05 02:07:16 2015 +0000 @@ -1,29 +1,3 @@ -//#include "pid.h" -// -//void PIDController::onLoop() -//{ -// float error = (m_error)(); -// (m_out)(m_Kp * error + m_Ki * iController(error) + m_Kd * dController(error)); -// wait(m_dt); -//} -// -//float PIDController::iController(float error) -//{ -// m_integral += error; -// return m_integral; -//} -// -//float PIDController::dController(float error) -//{ -// float derivative = error - m_pError; -// m_pError = error; -// return derivative; -//} -// -//void PIDController::reset() -//{ -// m_integral = 0; -//} #include "pid.h" @@ -133,4 +107,31 @@ float ctrl::getR(){ return RErr; - } \ No newline at end of file + } + +//#include "pid.h" +// +//void PIDController::onLoop() +//{ +// float error = (m_error)(); +// (m_out)(m_Kp * error + m_Ki * iController(error) + m_Kd * dController(error)); +// wait(m_dt); +//} +// +//float PIDController::iController(float error) +//{ +// m_integral += error; +// return m_integral; +//} +// +//float PIDController::dController(float error) +//{ +// float derivative = error - m_pError; +// m_pError = error; +// return derivative; +//} +// +//void PIDController::reset() +//{ +// m_integral = 0; +//}
--- a/pid.h Sat Dec 05 00:41:23 2015 +0000 +++ b/pid.h Sat Dec 05 02:07:16 2015 +0000 @@ -1,38 +1,3 @@ -//#ifndef PID_H -//#define PID_H -// -//#include "mbed.h" -// -//class PIDController -//{ -//public: -// PIDController(void (*output)(float), float (*error)(void), -// float Kp, float Ki, float Kd, -// float dt = .1) : -// m_Kp(Kp), m_Ki(Ki), m_Kd(Kd), -// m_dt(dt), m_integral(0), m_pError(0) -// { -// m_out = output; -// m_error = error; -// }; -// -// void onLoop(); -// void reset(); -//private: -// float iController(float error); -// float dController(float error); -// -// float m_integral; -// float m_pError; -// -// float m_dt; -// -// float m_Kp, m_Ki, m_Kd; -// void (*m_out)(float); -// float (*m_error)(void); -//}; -// -// #ifndef PID_H @@ -95,3 +60,41 @@ }; #endif //PID_H + + +//#ifndef PID_H +//#define PID_H +// +//#include "mbed.h" +// +//class PIDController +//{ +//public: +// PIDController(void (*output)(float), float (*error)(void), +// float Kp, float Ki, float Kd, +// float dt = .1) : +// m_Kp(Kp), m_Ki(Ki), m_Kd(Kd), +// m_dt(dt), m_integral(0), m_pError(0) +// { +// m_out = output; +// m_error = error; +// }; +// +// void onLoop(); +// void reset(); +//private: +// float iController(float error); +// float dController(float error); +// +// float m_integral; +// float m_pError; +// +// float m_dt; +// +// float m_Kp, m_Ki, m_Kd; +// void (*m_out)(float); +// float (*m_error)(void); +//}; +// +// +