blob: a1335d642318ae2ce01a7ed7c6e47f96f2cffad9 [file] [log] [blame]
Brian Silvermanf7f267a2017-02-04 16:16:08 -08001/*----------------------------------------------------------------------------*/
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 "VictorSP.h"
9
10#include "HAL/HAL.h"
11#include "LiveWindow/LiveWindow.h"
12
13using namespace frc;
14
15/**
16 * Constructor for a VictorSP.
17 *
18 * @param channel The PWM channel that the VictorSP is attached to. 0-9 are
19 * on-board, 10-19 are on the MXP port
20 */
21VictorSP::VictorSP(int channel) : PWMSpeedController(channel) {
22 /**
23 * Note that the VictorSP uses the following bounds for PWM values. These
24 * values should work reasonably well for most controllers, but if users
25 * experience issues such as asymmetric behavior around the deadband or
26 * inability to saturate the controller in either direction, calibration is
27 * recommended. The calibration procedure can be found in the VictorSP User
28 * Manual available from Vex.
29 *
30 * 2.004ms = full "forward"
31 * 1.52ms = the "high end" of the deadband range
32 * 1.50ms = center of the deadband range (off)
33 * 1.48ms = the "low end" of the deadband range
34 * 0.997ms = full "reverse"
35 */
36 SetBounds(2.004, 1.52, 1.50, 1.48, .997);
37 SetPeriodMultiplier(kPeriodMultiplier_1X);
38 SetSpeed(0.0);
39 SetZeroLatch();
40
41 HAL_Report(HALUsageReporting::kResourceType_VictorSP, GetChannel());
42 LiveWindow::GetInstance()->AddActuator("VictorSP", GetChannel(), this);
43}