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