2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2019-09-14 15:22:54 -05:00
|
|
|
/* Copyright (c) 2008-2019 FIRST. All Rights Reserved. */
|
2013-12-15 18:30:16 -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. */
|
2013-12-15 18:30:16 -05:00
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include "frc/Victor.h"
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2018-07-20 00:03:45 -07:00
|
|
|
#include <hal/HAL.h>
|
2017-08-27 00:11:52 -07:00
|
|
|
|
2019-09-14 15:22:54 -05:00
|
|
|
#include "frc/smartdashboard/SendableRegistry.h"
|
|
|
|
|
|
2016-11-01 22:33:12 -07:00
|
|
|
using namespace frc;
|
|
|
|
|
|
2016-09-06 00:01:45 -07:00
|
|
|
Victor::Victor(int channel) : PWMSpeedController(channel) {
|
2015-06-29 02:43:44 -07:00
|
|
|
/* Note that the Victor uses the following bounds for PWM values. These
|
|
|
|
|
* values were determined empirically and optimized for the Victor 888. These
|
|
|
|
|
* values should work reasonably well for Victor 884 controllers as well but
|
|
|
|
|
* if users experience issues such as asymmetric behaviour around the deadband
|
|
|
|
|
* or inability to saturate the controller in either direction, calibration is
|
|
|
|
|
* recommended. The calibration procedure can be found in the Victor 884 User
|
|
|
|
|
* Manual available from IFI.
|
|
|
|
|
*
|
|
|
|
|
* 2.027ms = full "forward"
|
|
|
|
|
* 1.525ms = the "high end" of the deadband range
|
|
|
|
|
* 1.507ms = center of the deadband range (off)
|
|
|
|
|
* 1.49ms = the "low end" of the deadband range
|
|
|
|
|
* 1.026ms = full "reverse"
|
|
|
|
|
*/
|
2015-06-25 15:07:55 -04:00
|
|
|
SetBounds(2.027, 1.525, 1.507, 1.49, 1.026);
|
|
|
|
|
SetPeriodMultiplier(kPeriodMultiplier_2X);
|
2016-07-08 21:29:29 -07:00
|
|
|
SetSpeed(0.0);
|
2015-06-25 15:07:55 -04:00
|
|
|
SetZeroLatch();
|
2013-12-15 18:30:16 -05:00
|
|
|
|
2019-10-29 21:34:10 -07:00
|
|
|
HAL_Report(HALUsageReporting::kResourceType_Victor, GetChannel() + 1);
|
2019-09-14 15:22:54 -05:00
|
|
|
SendableRegistry::GetInstance().SetName(this, "Victor", GetChannel());
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|