001/*----------------------------------------------------------------------------*/
002/* Copyright (c) FIRST 2008-2017. All Rights Reserved.                        */
003/* Open Source Software - may be modified and shared by FRC teams. The code   */
004/* must be accompanied by the FIRST BSD license file in the root directory of */
005/* the project.                                                               */
006/*----------------------------------------------------------------------------*/
007
008package edu.wpi.first.wpilibj;
009
010import edu.wpi.first.wpilibj.hal.FRCNetComm.tResourceType;
011import edu.wpi.first.wpilibj.hal.HAL;
012import edu.wpi.first.wpilibj.livewindow.LiveWindow;
013
014/**
015 * VEX Robotics Victor 888 Speed Controller The Vex Robotics Victor 884 Speed Controller can also
016 * be used with this class but may need to be calibrated per the Victor 884 user manual.
017 */
018public class Victor extends PWMSpeedController {
019
020  /**
021   * Constructor.
022   *
023   * <p>Note that the Victor uses the following bounds for PWM values. These values were determined
024   * empirically and optimized for the Victor 888. These values should work reasonably well for
025   * Victor 884 controllers also but if users experience issues such as asymmetric behaviour around
026   * the deadband or inability to saturate the controller in either direction, calibration is
027   * recommended. The calibration procedure can be found in the Victor 884 User Manual available
028   * from VEX Robotics: http://content.vexrobotics.com/docs/ifi-v884-users-manual-9-25-06.pdf
029   *
030   * <p>- 2.027ms = full "forward" - 1.525ms = the "high end" of the deadband range - 1.507ms =
031   * center of the deadband range (off) - 1.49ms = the "low end" of the deadband range - 1.026ms =
032   * full "reverse"
033   *
034   * @param channel The PWM channel that the Victor is attached to. 0-9 are
035   *        on-board, 10-19 are on the MXP port
036   */
037  public Victor(final int channel) {
038    super(channel);
039
040    setBounds(2.027, 1.525, 1.507, 1.49, 1.026);
041    setPeriodMultiplier(PeriodMultiplier.k2X);
042    setSpeed(0.0);
043    setZeroLatch();
044
045    LiveWindow.addActuator("Victor", getChannel(), this);
046    HAL.report(tResourceType.kResourceType_Victor, getChannel());
047  }
048}