mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-03 03:01:44 +00:00
Added PIDController::GetAvgError() back in (#749)
It got removed during the LinearDigitalFilter change (#38) instead of deprecated by mistake.
This commit is contained in:
committed by
Peter Johnson
parent
d214b36786
commit
259461aee9
@@ -373,6 +373,16 @@ double PIDController::GetError() const {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current average of the error over the past few iterations.
|
||||
*
|
||||
* You can specify the number of iterations to average with SetToleranceBuffer()
|
||||
* (defaults to 1). This is the same value that is used for OnTarget().
|
||||
*
|
||||
* @return the average error
|
||||
*/
|
||||
double PIDController::GetAvgError() const { return GetError(); }
|
||||
|
||||
/**
|
||||
* Sets what type of input the PID controller will use.
|
||||
*/
|
||||
|
||||
@@ -65,6 +65,9 @@ class PIDController : public LiveWindowSendable, public PIDInterface {
|
||||
|
||||
virtual double GetError() const;
|
||||
|
||||
WPI_DEPRECATED("Use GetError() instead, which is now already filtered.")
|
||||
virtual double GetAvgError() const;
|
||||
|
||||
virtual void SetPIDSourceType(PIDSourceType pidSource);
|
||||
virtual PIDSourceType GetPIDSourceType() const;
|
||||
|
||||
|
||||
@@ -515,6 +515,19 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll
|
||||
return getContinuousError(getSetpoint() - m_pidInput.pidGet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current difference of the error over the past few iterations. You can specify the
|
||||
* number of iterations to average with setToleranceBuffer() (defaults to 1). getAvgError() is
|
||||
* used for the onTarget() function.
|
||||
*
|
||||
* @deprecated Use getError(), which is now already filtered.
|
||||
* @return the current average of the error
|
||||
*/
|
||||
@Deprecated
|
||||
public synchronized double getAvgError() {
|
||||
return getError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets what type of input the PID controller will use.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user