Parker Schuh | d3b7a887 | 2018-02-19 16:42:27 -0800 | [diff] [blame] | 1 | /*----------------------------------------------------------------------------*/ |
| 2 | /* Copyright (c) FIRST 2008-2017. All Rights Reserved. */ |
| 3 | /* 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 "frc971/wpilib/ahal/VictorSP.h" |
| 9 | |
Austin Schuh | f6b9463 | 2019-02-02 22:11:27 -0800 | [diff] [blame] | 10 | #include "hal/HAL.h" |
Parker Schuh | d3b7a887 | 2018-02-19 16:42:27 -0800 | [diff] [blame] | 11 | |
| 12 | using namespace frc; |
| 13 | |
| 14 | /** |
| 15 | * Constructor for a VictorSP. |
| 16 | * |
| 17 | * @param channel The PWM channel that the VictorSP is attached to. 0-9 are |
| 18 | * on-board, 10-19 are on the MXP port |
| 19 | */ |
| 20 | VictorSP::VictorSP(int channel) : PWM(channel) { |
| 21 | /** |
| 22 | * Note that the VictorSP uses the following bounds for PWM values. These |
| 23 | * values should work reasonably well for most controllers, but if users |
| 24 | * experience issues such as asymmetric behavior around the deadband or |
| 25 | * inability to saturate the controller in either direction, calibration is |
| 26 | * recommended. The calibration procedure can be found in the VictorSP User |
| 27 | * Manual available from Vex. |
| 28 | * |
| 29 | * 2.004ms = full "forward" |
| 30 | * 1.52ms = the "high end" of the deadband range |
| 31 | * 1.50ms = center of the deadband range (off) |
| 32 | * 1.48ms = the "low end" of the deadband range |
| 33 | * 0.997ms = full "reverse" |
| 34 | */ |
| 35 | SetBounds(2.004, 1.52, 1.50, 1.48, .997); |
| 36 | SetPeriodMultiplier(kPeriodMultiplier_1X); |
| 37 | SetSpeed(0.0); |
| 38 | SetZeroLatch(); |
| 39 | |
| 40 | HAL_Report(HALUsageReporting::kResourceType_VictorSP, GetChannel()); |
| 41 | } |