mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-01 02:41:48 +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:
@@ -24,7 +24,24 @@ CANTalon::CANTalon(int deviceNumber)
|
||||
SetControlMode(m_controlMode);
|
||||
m_impl->SetProfileSlotSelect(m_profile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for the CANTalon device.
|
||||
* @param deviceNumber The CAN ID of the Talon SRX
|
||||
* @param controlPeriodMs The period in ms to send the CAN control frame.
|
||||
* Period is bounded to [1ms, 95ms].
|
||||
*/
|
||||
CANTalon::CANTalon(int deviceNumber,int controlPeriodMs)
|
||||
: m_deviceNumber(deviceNumber)
|
||||
, m_impl(new CanTalonSRX(deviceNumber,controlPeriodMs)) /* bounded underneath to be within [1 ms,95 ms] */
|
||||
, m_safetyHelper(new MotorSafetyHelper(this))
|
||||
, m_profile(0)
|
||||
, m_controlEnabled(true)
|
||||
, m_controlMode(kPercentVbus)
|
||||
, m_setPoint(0)
|
||||
{
|
||||
SetControlMode(m_controlMode);
|
||||
m_impl->SetProfileSlotSelect(m_profile);
|
||||
}
|
||||
CANTalon::~CANTalon() {
|
||||
delete m_impl;
|
||||
delete m_safetyHelper;
|
||||
|
||||
Reference in New Issue
Block a user