Two param constructor added to C++/java CANTalon so caller can optionally specify the periodMs at which the talon control frame is sent.

The param is capped in the HAL C++ class to [1ms, 95ms] so that zero and negative periods are caped to 1ms, and so that caller can't pass an absurdly large value, which causes TALON is appear disabled.

Change-Id: I4207194be25a33bbd6ad281a75301ce6684659a5
This commit is contained in:
Omar Zrien
2014-12-14 17:09:52 -05:00
parent 77997e52fb
commit 6a7e7cf611
4 changed files with 34 additions and 1 deletions

View File

@@ -76,6 +76,16 @@ public class CANTalon implements MotorSafety, PIDOutput, SpeedController {
setProfile(m_profile);
changeControlMode(ControlMode.PercentVbus);
}
public CANTalon(int deviceNumber,int controlPeriodMs) {
m_deviceNumber = deviceNumber;
m_impl = new CanTalonSRX(deviceNumber,controlPeriodMs); /* bound period to be within [1 ms,95 ms] */
m_safetyHelper = new MotorSafetyHelper(this);
m_controlEnabled = true;
m_profile = 0;
m_setPoint = 0;
setProfile(m_profile);
changeControlMode(ControlMode.PercentVbus);
}
@Override
public void pidWrite(double output)