2015-12-11 16:37:53 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2017-08-23 22:06:13 -07:00
|
|
|
/* Copyright (c) 2008-2017 FIRST. All Rights Reserved. */
|
2015-12-11 16:37:53 -05:00
|
|
|
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
2016-01-02 03:02:34 -08:00
|
|
|
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
|
|
|
|
/* the project. */
|
2015-12-11 16:37:53 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
#include "SD540.h"
|
|
|
|
|
|
2017-08-27 00:11:52 -07:00
|
|
|
#include <HAL/HAL.h>
|
|
|
|
|
|
2015-12-11 16:37:53 -05:00
|
|
|
#include "LiveWindow/LiveWindow.h"
|
|
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
using namespace frc;
|
|
|
|
|
|
2015-12-11 16:37:53 -05:00
|
|
|
/**
|
|
|
|
|
* Note that the SD540 uses the following bounds for PWM values. These values
|
2016-05-20 17:30:37 -07:00
|
|
|
* 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.
|
2015-12-11 16:37:53 -05:00
|
|
|
* The calibration procedure can be found in the SD540 User Manual available
|
|
|
|
|
* from Mindsensors.
|
|
|
|
|
*
|
|
|
|
|
* 2.05ms = full "forward"
|
|
|
|
|
* 1.55ms = the "high end" of the deadband range
|
|
|
|
|
* 1.50ms = center of the deadband range (off)
|
|
|
|
|
* 1.44ms = the "low end" of the deadband range
|
|
|
|
|
* 0.94ms = full "reverse"
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2016-05-20 17:30:37 -07:00
|
|
|
* Constructor for a SD540.
|
|
|
|
|
*
|
2015-12-11 16:37:53 -05:00
|
|
|
* @param channel The PWM channel that the SD540 is attached to. 0-9 are
|
2016-05-20 17:30:37 -07:00
|
|
|
* on-board, 10-19 are on the MXP port
|
2015-12-11 16:37:53 -05:00
|
|
|
*/
|
2016-09-06 00:01:45 -07:00
|
|
|
SD540::SD540(int channel) : PWMSpeedController(channel) {
|
2015-12-11 16:37:53 -05:00
|
|
|
SetBounds(2.05, 1.55, 1.50, 1.44, .94);
|
|
|
|
|
SetPeriodMultiplier(kPeriodMultiplier_1X);
|
2016-07-08 21:29:29 -07:00
|
|
|
SetSpeed(0.0);
|
2015-12-11 16:37:53 -05:00
|
|
|
SetZeroLatch();
|
|
|
|
|
|
2016-07-09 00:24:26 -07:00
|
|
|
HAL_Report(HALUsageReporting::kResourceType_MindsensorsSD540, GetChannel());
|
2015-12-11 16:37:53 -05:00
|
|
|
LiveWindow::GetInstance()->AddActuator("SD540", GetChannel(), this);
|
|
|
|
|
}
|