001/*----------------------------------------------------------------------------*/
002/* Copyright (c) 2008-2018 FIRST. 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;
012
013/**
014 * VEX Robotics Victor 888 Speed Controller The Vex Robotics Victor 884 Speed Controller can also
015 * be used with this class but may need to be calibrated per the Victor 884 user manual.
016 */
017public class Victor extends PWMSpeedController {
018  /**
019   * Constructor.
020   *
021   * <p>Note that the Victor uses the following bounds for PWM values. These values were determined
022   * empirically and optimized for the Victor 888. These values should work reasonably well for
023   * Victor 884 controllers also but if users experience issues such as asymmetric behaviour around
024   * the deadband or inability to saturate the controller in either direction, calibration is
025   * recommended. The calibration procedure can be found in the Victor 884 User Manual available
026   * from VEX Robotics: http://content.vexrobotics.com/docs/ifi-v884-users-manual-9-25-06.pdf
027   *
028   * <p>- 2.027ms = full "forward" - 1.525ms = the "high end" of the deadband range - 1.507ms =
029   * center of the deadband range (off) - 1.49ms = the "low end" of the deadband range - 1.026ms =
030   * full "reverse"
031   *
032   * @param channel The PWM channel that the Victor is attached to. 0-9 are
033   *        on-board, 10-19 are on the MXP port
034   */
035  public Victor(final int channel) {
036    super(channel);
037
038    setBounds(2.027, 1.525, 1.507, 1.49, 1.026);
039    setPeriodMultiplier(PeriodMultiplier.k2X);
040    setSpeed(0.0);
041    setZeroLatch();
042
043    HAL.report(tResourceType.kResourceType_Victor, getChannel());
044    setName("Victor", getChannel());
045  }
046}