mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user