mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
C++ CANTalon was missing SetIzone. Added SetIzone to match java, and made the set/get Izone integral.
Change-Id: I264ac8faaab0ebd208062923f6da2094e7e28b0a
This commit is contained in:
committed by
James Kuszmaul
parent
a1375e58cd
commit
8b8d7e77cd
@@ -52,6 +52,7 @@ public:
|
||||
virtual void SetI(double i) override;
|
||||
virtual void SetD(double d) override;
|
||||
void SetF(double f);
|
||||
void SetIzone(unsigned iz);
|
||||
virtual void SetPID(double p, double i, double d) override;
|
||||
void SetPID(double p, double i, double d, double f);
|
||||
virtual double GetP() override;
|
||||
@@ -100,7 +101,7 @@ public:
|
||||
void SetSensorDirection(bool reverseSensor);
|
||||
void SetCloseLoopRampRate(double rampRate);
|
||||
void SelectProfileSlot(int slotIdx);
|
||||
double GetIzone();
|
||||
int GetIzone();
|
||||
int GetIaccum();
|
||||
void ClearIaccum();
|
||||
|
||||
|
||||
@@ -220,6 +220,19 @@ void CANTalon::SetF(double f)
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Set the Izone to a nonzero value to auto clear the integral accumulator
|
||||
* when the absolute value of CloseLoopError exceeds Izone.
|
||||
*
|
||||
* @see SelectProfileSlot to choose between the two sets of gains.
|
||||
*/
|
||||
void CANTalon::SetIzone(unsigned iz)
|
||||
{
|
||||
CTR_Code status = m_impl->SetIzone(m_profile, iz);
|
||||
if(status != CTR_OKAY) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* SRX has two available slots for PID.
|
||||
* @param slotIdx one or zero depending on which slot caller wants.
|
||||
@@ -349,7 +362,7 @@ double CANTalon::GetF()
|
||||
/**
|
||||
* @see SelectProfileSlot to choose between the two sets of gains.
|
||||
*/
|
||||
double CANTalon::GetIzone()
|
||||
int CANTalon::GetIzone()
|
||||
{
|
||||
CanTalonSRX::param_t param = m_profile ? CanTalonSRX::eProfileParamSlot1_IZone: CanTalonSRX::eProfileParamSlot0_IZone;
|
||||
// Update the info in m_impl.
|
||||
@@ -364,7 +377,7 @@ double CANTalon::GetIzone()
|
||||
if(status != CTR_OKAY) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
}
|
||||
return (double)iz;
|
||||
return iz;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user