Corrected header file include guards.
Fork of HipControl by
Diff: HipControl.h
- Revision:
- 1:d87dac5c3658
- Parent:
- 0:911517b34248
- Child:
- 2:18e264a5b71d
diff -r 911517b34248 -r d87dac5c3658 HipControl.h --- a/HipControl.h Wed Nov 19 22:11:34 2014 +0000 +++ b/HipControl.h Wed Jun 24 01:07:55 2015 +0000 @@ -22,6 +22,8 @@ * @brief Control algorithms */ +//TODO: (Brad) Port to base-class structure + #include "mbed.h" #include "filter.h" @@ -29,18 +31,47 @@ { public: HipControl(PinName pwm, PinName dirpin); + + /** + * Feedback linearization and gain scheduling controller. Used for all hip trajectory following. + * @param ref Reference point to track. + * @param pos Current position in degrees + * @param Kp Proportional gain + * @param Kd Derivative gain + * @param sat Commanded current saturation + */ + //class void FL(float ref, float pos); - void FL_new(float ref, float pos); + + /** + * Vanilla PD controller for set-point tracking. Mostly used for haptics. + * @param ref Reference point to track. + * @param pos Current position in degrees + * @param Kp Proportional gain + * @param Kd Derivative gain + * @param sat Commanded current saturation + */ + //class void PD(float ref, float pos); +//class void P(float ref, float pos); + //base method void setGains(float P, float D); + //base method void setSat(float limit); + //base method void sampleTime(float time); + //class void openLoop(float input); - float read(); + //base method + float readPWM(); + //class void off(); + //base method void flip(); + //base method void clear(); + //base method void pwmPeriod(float a); private: //Controller Parameters @@ -48,31 +79,30 @@ PwmOut _pwm; DigitalOut _dir; float Kp; + /** + * Initial proportional gain before cosine gain schedule + */ const float Kp0; + /** + * Derivative gain + */ float Kd; + /** + * Commanded current saturation + */ float sat; float u; float u_prev; float error[2]; - float T; + //sample period + float _sample_period; int sign; filter controlFilter; }; //Controller Parameters -/** -* Proportional gain after cosine gain schedule -*/ -/** -* Initial proportional gain before cosine gain schedule -*/ -/** -* Derivative gain -*/ -/** -* Commanded current soft stop -*/ + /** * Counter for proportional gain cosine gain scheduling */ @@ -92,20 +122,5 @@ #endif -/** -* Feedback linearization and gain scheduling controller. Used for all hip trajectory following. -* @param ref Reference point to track. -* @param pos Current position in degrees -* @param Kp Proportional gain -* @param Kd Derivative gain -* @param sat Commanded current saturation -*/ -/** -* Vanilla PD controller for set-point tracking. Mostly used for haptics. -* @param ref Reference point to track. -* @param pos Current position in degrees -* @param Kp Proportional gain -* @param Kd Derivative gain -* @param sat Commanded current saturation -*/ \ No newline at end of file +