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