/** * Common initialization code called by all constructors. * * Note that the Talon uses the following bounds for PWM values. These values should work reasonably well for * most controllers, but if users experience issues such as asymmetric behavior around * the deadband or inability to saturate the controller in either direction, calibration is recommended. * The calibration procedure can be found in the Talon User Manual available from CTRE. * * 2.037ms = full "forward" * 1.539ms = the "high end" of the deadband range * 1.513ms = center of the deadband range (off) * 1.487ms = the "low end" of the deadband range * 0.989ms = full "reverse" */ void Talon::InitTalon() { SetBounds(2.037, 1.539, 1.513, 1.487, .989); SetPeriodMultiplier(kPeriodMultiplier_1X); SetRaw(m_centerPwm); SetZeroLatch(); HALReport(HALUsageReporting::kResourceType_Talon, GetChannel()); LiveWindow::GetInstance()->AddActuator("Talon", GetChannel(), this); }
/** * Constructor for a Spark * @param channel The PWM channel that the Spark is attached to. 0-9 are * on-board, 10-19 are on the MXP port */ Spark::Spark(uint32_t channel) : PWMSpeedController(channel) { SetBounds(2.003, 1.55, 1.50, 1.46, .999); SetPeriodMultiplier(kPeriodMultiplier_1X); SetRaw(m_centerPwm); SetZeroLatch(); HALReport(HALUsageReporting::kResourceType_RevSPARK, GetChannel()); LiveWindow::GetInstance()->AddActuator("Spark", GetChannel(), this); }
/** * Constructor for a SD540 * @param channel The PWM channel that the SD540 is attached to. 0-9 are * on-board, 10-19 are on the MXP port */ SD540::SD540(uint32_t channel) : SafePWM(channel) { SetBounds(2.05, 1.55, 1.50, 1.44, .94); SetPeriodMultiplier(kPeriodMultiplier_1X); SetRaw(m_centerPwm); SetZeroLatch(); HALReport(HALUsageReporting::kResourceType_MindsensorsSD540, GetChannel()); LiveWindow::GetInstance()->AddActuator("SD540", GetChannel(), this); }
/** * Constructor for a VictorSP * @param channel The PWM channel that the VictorSP is attached to. 0-9 are * on-board, 10-19 are on the MXP port */ VictorSP::VictorSP(uint32_t channel) : SafePWM(channel) { SetBounds(2.004, 1.52, 1.50, 1.48, .997); SetPeriodMultiplier(kPeriodMultiplier_1X); SetRaw(m_centerPwm); SetZeroLatch(); HALReport(HALUsageReporting::kResourceType_VictorSP, GetChannel()); LiveWindow::GetInstance()->AddActuator("VictorSP", GetChannel(), this); }
/** * Constructor for a Jaguar connected via PWM * @param channel The PWM channel that the Jaguar is attached to. 0-9 are * on-board, 10-19 are on the MXP port */ Jaguar::Jaguar(uint32_t channel) : PWMSpeedController(channel) { /** * Input profile defined by Luminary Micro. * * Full reverse ranges from 0.671325ms to 0.6972211ms * Proportional reverse ranges from 0.6972211ms to 1.4482078ms * Neutral ranges from 1.4482078ms to 1.5517922ms * Proportional forward ranges from 1.5517922ms to 2.3027789ms * Full forward ranges from 2.3027789ms to 2.328675ms */ SetBounds(2.31, 1.55, 1.507, 1.454, .697); SetPeriodMultiplier(kPeriodMultiplier_1X); SetRaw(m_centerPwm); SetZeroLatch(); HALReport(HALUsageReporting::kResourceType_Jaguar, GetChannel()); LiveWindow::GetInstance()->AddActuator("Jaguar", GetChannel(), this); }
/** * Construct a TalonSRX connected via PWM * @param channel The PWM channel that the TalonSRX is attached to. 0-9 are * on-board, 10-19 are on the MXP port */ TalonSRX::TalonSRX(uint32_t channel) : SafePWM(channel) { /* Note that the TalonSRX uses the following bounds for PWM values. These * values should work reasonably well for most controllers, but if users * experience issues such as asymmetric behavior around the deadband or * inability to saturate the controller in either direction, calibration is * recommended. The calibration procedure can be found in the TalonSRX User * Manual available from Cross The Road Electronics. * 2.004ms = full "forward" * 1.52ms = the "high end" of the deadband range * 1.50ms = center of the deadband range (off) * 1.48ms = the "low end" of the deadband range * 0.997ms = full "reverse" */ SetBounds(2.004, 1.52, 1.50, 1.48, .997); SetPeriodMultiplier(kPeriodMultiplier_1X); SetRaw(m_centerPwm); SetZeroLatch(); HALReport(HALUsageReporting::kResourceType_TalonSRX, GetChannel()); LiveWindow::GetInstance()->AddActuator("TalonSRX", GetChannel(), this); }
/** * Constructor for a Talon (original or Talon SR) * @param channel The PWM channel number that the Talon is attached to. 0-9 are * on-board, 10-19 are on the MXP port */ Talon::Talon(uint32_t channel) : SafePWM(channel) { /* Note that the Talon uses the following bounds for PWM values. These values * should work reasonably well for most controllers, but if users experience * issues such as asymmetric behavior around the deadband or inability to * saturate the controller in either direction, calibration is recommended. * The calibration procedure can be found in the Talon User Manual available * from CTRE. * * 2.037ms = full "forward" * 1.539ms = the "high end" of the deadband range * 1.513ms = center of the deadband range (off) * 1.487ms = the "low end" of the deadband range * 0.989ms = full "reverse" */ SetBounds(2.037, 1.539, 1.513, 1.487, .989); SetPeriodMultiplier(kPeriodMultiplier_1X); SetRaw(m_centerPwm); SetZeroLatch(); HALReport(HALUsageReporting::kResourceType_Talon, GetChannel()); LiveWindow::GetInstance()->AddActuator("Talon", GetChannel(), this); }
/** * Constructor for a Victor * @param channel The PWM channel number that the Victor is attached to. 0-9 are * on-board, 10-19 are on the MXP port */ Victor::Victor(uint32_t channel) : SafePWM(channel) { /* Note that the Victor uses the following bounds for PWM values. These * values were determined empirically and optimized for the Victor 888. These * values should work reasonably well for Victor 884 controllers as well but * if users experience issues such as asymmetric behaviour around the deadband * or inability to saturate the controller in either direction, calibration is * recommended. The calibration procedure can be found in the Victor 884 User * Manual available from IFI. * * 2.027ms = full "forward" * 1.525ms = the "high end" of the deadband range * 1.507ms = center of the deadband range (off) * 1.49ms = the "low end" of the deadband range * 1.026ms = full "reverse" */ SetBounds(2.027, 1.525, 1.507, 1.49, 1.026); SetPeriodMultiplier(kPeriodMultiplier_2X); SetRaw(m_centerPwm); SetZeroLatch(); LiveWindow::GetInstance()->AddActuator("Victor", GetChannel(), this); HALReport(HALUsageReporting::kResourceType_Victor, GetChannel()); }