Corrected header file include guards.
Fork of HipControl by
Diff: HipControl.h
- Revision:
- 0:911517b34248
- Child:
- 1:d87dac5c3658
diff -r 000000000000 -r 911517b34248 HipControl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HipControl.h Wed Nov 19 22:11:34 2014 +0000 @@ -0,0 +1,111 @@ + + +#ifndef HIPCONTROL_H +#define HIPCONTROL_H + +/** +* Copyright (c) 2012-2014 +* All rights reserved. +* + * + * by Bradley Perry + * +*/ + + +/** +* Control strategys for Daniel's Device +* +* @file control.h +* @author Bradley Perry +* +* @brief Control algorithms +*/ + +#include "mbed.h" +#include "filter.h" + +class HipControl +{ +public: + HipControl(PinName pwm, PinName dirpin); + void FL(float ref, float pos); + void FL_new(float ref, float pos); + void PD(float ref, float pos); + void P(float ref, float pos); + void setGains(float P, float D); + void setSat(float limit); + void sampleTime(float time); + void openLoop(float input); + float read(); + void off(); + void flip(); + void clear(); + void pwmPeriod(float a); +private: + //Controller Parameters + //const float Kp=.05; + PwmOut _pwm; + DigitalOut _dir; + float Kp; + const float Kp0; + float Kd; + float sat; + float u; + float u_prev; + float error[2]; + float T; + 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 +*/ +/** +* Vector to store error data +*/ + +/** +* Cosine magnitude for gain scheduling +*/ +/** +* Cosine frequency for gain scheduling +*/ +/** +* Offset for gain scheduling +*/ + +#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