artf4127: Implemented velocity PID controller

Change-Id: I8c0f84422f7ca0ac5c50fddb282fb3452ee1d491
This commit is contained in:
Tyler Veness
2015-07-14 20:37:52 -07:00
parent f0e3bb5164
commit d5922bb037
43 changed files with 532 additions and 241 deletions

View File

@@ -475,17 +475,6 @@ int Encoder::GetSamplesToAverage() const {
return result;
}
/**
* Set which parameter of the encoder you are using as a process control
* variable.
*
* @param pidSource An enum to select the parameter.
*/
void Encoder::SetPIDSourceParameter(PIDSourceParameter pidSource) {
if (StatusIsFatal()) return;
m_pidSource = pidSource;
}
/**
* Implement the PIDSource interface.
*
@@ -493,10 +482,10 @@ void Encoder::SetPIDSourceParameter(PIDSourceParameter pidSource) {
*/
double Encoder::PIDGet() const {
if (StatusIsFatal()) return 0.0;
switch (m_pidSource) {
case kDistance:
switch (GetPIDSourceType()) {
case PIDSourceType::kDisplacement:
return GetDistance();
case kRate:
case PIDSourceType::kRate:
return GetRate();
default:
return 0.0;