blob: 0bbc5b9cedb687089832e2f4c547d0107769e395 [file] [log] [blame]
Brian Silverman41cdd3e2019-01-19 19:48:58 -08001/*----------------------------------------------------------------------------*/
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -08002/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
Brian Silverman41cdd3e2019-01-19 19:48:58 -08003/* Open Source Software - may be modified and shared by FRC teams. The code */
4/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
6/*----------------------------------------------------------------------------*/
7
8#include "frc/PWMTalonSRX.h"
9
10#include <hal/HAL.h>
11
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080012#include "frc/smartdashboard/SendableRegistry.h"
13
Brian Silverman41cdd3e2019-01-19 19:48:58 -080014using namespace frc;
15
16PWMTalonSRX::PWMTalonSRX(int channel) : PWMSpeedController(channel) {
17 /* Note that the PWMTalonSRX uses the following bounds for PWM values. These
18 * values should work reasonably well for most controllers, but if users
19 * experience issues such as asymmetric behavior around the deadband or
20 * inability to saturate the controller in either direction, calibration is
21 * recommended. The calibration procedure can be found in the TalonSRX User
22 * Manual available from Cross The Road Electronics.
23 * 2.004ms = full "forward"
24 * 1.52ms = the "high end" of the deadband range
25 * 1.50ms = center of the deadband range (off)
26 * 1.48ms = the "low end" of the deadband range
27 * 0.997ms = full "reverse"
28 */
29 SetBounds(2.004, 1.52, 1.50, 1.48, .997);
30 SetPeriodMultiplier(kPeriodMultiplier_1X);
31 SetSpeed(0.0);
32 SetZeroLatch();
33
34 HAL_Report(HALUsageReporting::kResourceType_PWMTalonSRX, GetChannel());
James Kuszmaul4f3ad3c2019-12-01 16:35:21 -080035 SendableRegistry::GetInstance().SetName(this, "PWMTalonSRX", GetChannel());
Brian Silverman41cdd3e2019-01-19 19:48:58 -080036}