Corrected header file include guards.

Fork of HipControl by Bradley Perry

HipControl.h

Committer:
perr1940
Date:
2014-11-19
Revision:
0:911517b34248
Child:
1:d87dac5c3658

File content as of revision 0:911517b34248:



#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
*/