Beispiel #1
0
PID::PID(float Kc, float tauI, float tauD, float interval) {
 
    usingFeedForward = false;
    inAuto           = false;
 
    //Default the limits to the full range of I/O: 3.3V
    //Make sure to set these to more appropriate limits for
    //your application.
    setInputLimits(0.0, 3.3);
    setOutputLimits(0.0, 3.3);
 
    tSample_ = interval;
 
    setTunings(Kc, tauI, tauD);
 
    setPoint_             = 0.0;
    processVariable_      = 0.0;
    prevProcessVariable_  = 0.0;
    controllerOutput_     = 0.0;
    prevControllerOutput_ = 0.0;
 
    accError_ = 0.0;
    bias_     = 0.0;
    
    realOutput_ = 0.0;
 
}
PID::PID(double kp, double ki, double kd, uint8_t direction, uint32_t period, uint32_t time){
	setOutputLimits(0, 255);
	setPeriod(100);
	setDirection(direction);
	setTunings(kp, ki, kd);

	if (time > period) lastTime = time - period;
	else lastTime = 0;
}
Beispiel #3
0
/**Specify a maximum output. If a single parameter is specified, the minimum is 
 * set to (-maximum).
 * @param output 
 */
void MiniPID::setOutputLimits(double output){ setOutputLimits(-output,output);}