[wpilib] Move motor controllers to motorcontrol package (#3302)

Also deprecate SpeedController in favor of motorcontrol.MotorController and
SpeedControllerGroup in favor of motorcontrol.MotorControllerGroup.

The MotorController interface is derived from the SpeedController interface
so that code such as SpeedController x = new VictorSP(1) continues to
compile (just with a warning).

SpeedControllerGroup and MotorControllerGroup are independent classes;
both implement the MotorController interface.
This commit is contained in:
Peter Johnson
2021-04-17 11:27:16 -07:00
committed by GitHub
parent b7b178f49c
commit 0abf6c9045
194 changed files with 1096 additions and 696 deletions

View File

@@ -239,7 +239,7 @@ public class PWM implements Sendable, AutoCloseable {
}
}
protected void setZeroLatch() {
public void setZeroLatch() {
PWMJNI.latchPWMZero(m_handle);
}

View File

@@ -4,17 +4,22 @@
package edu.wpi.first.wpilibj;
/** Interface for speed controlling devices. */
/**
* Interface for motor controlling devices.
*
* @deprecated Use {@link edu.wpi.first.wpilibj.motorcontrol.MotorController}.
*/
@Deprecated(since = "2022", forRemoval = true)
public interface SpeedController {
/**
* Common interface for setting the speed of a speed controller.
* Common interface for setting the speed of a motor controller.
*
* @param speed The speed to set. Value should be between -1.0 and 1.0.
*/
void set(double speed);
/**
* Sets the voltage output of the SpeedController. Compensates for the current bus voltage to
* Sets the voltage output of the MotorController. Compensates for the current bus voltage to
* ensure that the desired voltage is output even if the battery voltage is below 12V - highly
* useful when the voltage outputs are "meaningful" (e.g. they come from a feedforward
* calculation).
@@ -29,27 +34,27 @@ public interface SpeedController {
}
/**
* Common interface for getting the current set speed of a speed controller.
* Common interface for getting the current set speed of a motor controller.
*
* @return The current set speed. Value is between -1.0 and 1.0.
*/
double get();
/**
* Common interface for inverting direction of a speed controller.
* Common interface for inverting direction of a motor controller.
*
* @param isInverted The state of inversion true is inverted.
*/
void setInverted(boolean isInverted);
/**
* Common interface for returning if a speed controller is in the inverted state or not.
* Common interface for returning if a motor controller is in the inverted state or not.
*
* @return isInverted The state of the inversion true is inverted.
*/
boolean getInverted();
/** Disable the speed controller. */
/** Disable the motor controller. */
void disable();
/**

View File

@@ -4,12 +4,19 @@
package edu.wpi.first.wpilibj;
import edu.wpi.first.wpilibj.motorcontrol.MotorController;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
import java.util.Arrays;
/** Allows multiple {@link SpeedController} objects to be linked together. */
public class SpeedControllerGroup implements SpeedController, Sendable, AutoCloseable {
/**
* Allows multiple {@link SpeedController} objects to be linked together.
*
* @deprecated Use {@link edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup}.
*/
@Deprecated(since = "2022", forRemoval = true)
@SuppressWarnings("removal")
public class SpeedControllerGroup implements MotorController, Sendable, AutoCloseable {
private boolean m_isInverted;
private final SpeedController[] m_speedControllers;
private static int instances;
@@ -40,7 +47,7 @@ public class SpeedControllerGroup implements SpeedController, Sendable, AutoClos
SendableRegistry.addChild(this, controller);
}
instances++;
SendableRegistry.addLW(this, "SpeedControllerGroup", instances);
SendableRegistry.addLW(this, "MotorControllerGroup", instances);
}
@Override
@@ -89,7 +96,7 @@ public class SpeedControllerGroup implements SpeedController, Sendable, AutoClos
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("Speed Controller");
builder.setSmartDashboardType("Motor Controller");
builder.setActuator(true);
builder.setSafeState(this::stopMotor);
builder.addDoubleProperty("Value", this::get, this::set);

View File

@@ -9,7 +9,6 @@ import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.SpeedController;
import edu.wpi.first.wpilibj.SpeedControllerGroup;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
import edu.wpi.first.wpiutil.math.MathUtil;
@@ -20,21 +19,21 @@ import java.util.StringJoiner;
* base, "tank drive", or West Coast Drive.
*
* <p>These drive bases typically have drop-center / skid-steer with two or more wheels per side
* (e.g., 6WD or 8WD). This class takes a SpeedController per side. For four and six motor
* drivetrains, construct and pass in {@link edu.wpi.first.wpilibj.SpeedControllerGroup} instances
* as follows.
* (e.g., 6WD or 8WD). This class takes a MotorController per side. For four and six motor
* drivetrains, construct and pass in {@link
* edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup} instances as follows.
*
* <p>Four motor drivetrain:
*
* <pre><code>
* public class Robot {
* SpeedController m_frontLeft = new PWMVictorSPX(1);
* SpeedController m_rearLeft = new PWMVictorSPX(2);
* SpeedControllerGroup m_left = new SpeedControllerGroup(m_frontLeft, m_rearLeft);
* MotorController m_frontLeft = new PWMVictorSPX(1);
* MotorController m_rearLeft = new PWMVictorSPX(2);
* MotorControllerGroup m_left = new MotorControllerGroup(m_frontLeft, m_rearLeft);
*
* SpeedController m_frontRight = new PWMVictorSPX(3);
* SpeedController m_rearRight = new PWMVictorSPX(4);
* SpeedControllerGroup m_right = new SpeedControllerGroup(m_frontRight, m_rearRight);
* MotorController m_frontRight = new PWMVictorSPX(3);
* MotorController m_rearRight = new PWMVictorSPX(4);
* MotorControllerGroup m_right = new MotorControllerGroup(m_frontRight, m_rearRight);
*
* DifferentialDrive m_drive = new DifferentialDrive(m_left, m_right);
* }
@@ -44,15 +43,15 @@ import java.util.StringJoiner;
*
* <pre><code>
* public class Robot {
* SpeedController m_frontLeft = new PWMVictorSPX(1);
* SpeedController m_midLeft = new PWMVictorSPX(2);
* SpeedController m_rearLeft = new PWMVictorSPX(3);
* SpeedControllerGroup m_left = new SpeedControllerGroup(m_frontLeft, m_midLeft, m_rearLeft);
* MotorController m_frontLeft = new PWMVictorSPX(1);
* MotorController m_midLeft = new PWMVictorSPX(2);
* MotorController m_rearLeft = new PWMVictorSPX(3);
* MotorControllerGroup m_left = new MotorControllerGroup(m_frontLeft, m_midLeft, m_rearLeft);
*
* SpeedController m_frontRight = new PWMVictorSPX(4);
* SpeedController m_midRight = new PWMVictorSPX(5);
* SpeedController m_rearRight = new PWMVictorSPX(6);
* SpeedControllerGroup m_right = new SpeedControllerGroup(m_frontRight, m_midRight, m_rearRight);
* MotorController m_frontRight = new PWMVictorSPX(4);
* MotorController m_midRight = new PWMVictorSPX(5);
* MotorController m_rearRight = new PWMVictorSPX(6);
* MotorControllerGroup m_right = new MotorControllerGroup(m_frontRight, m_midRight, m_rearRight);
*
* DifferentialDrive m_drive = new DifferentialDrive(m_left, m_right);
* }
@@ -94,6 +93,7 @@ import java.util.StringJoiner;
* drive(double, double) with the addition of a quick turn mode. However, it is not designed to give
* exactly the same response.
*/
@SuppressWarnings("removal")
public class DifferentialDrive extends RobotDriveBase implements Sendable, AutoCloseable {
public static final double kDefaultQuickStopThreshold = 0.2;
public static final double kDefaultQuickStopAlpha = 0.1;
@@ -112,8 +112,9 @@ public class DifferentialDrive extends RobotDriveBase implements Sendable, AutoC
/**
* Construct a DifferentialDrive.
*
* <p>To pass multiple motors per side, use a {@link SpeedControllerGroup}. If a motor needs to be
* inverted, do so before passing it in.
* <p>To pass multiple motors per side, use a {@link
* edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup}. If a motor needs to be inverted, do
* so before passing it in.
*/
public DifferentialDrive(SpeedController leftMotor, SpeedController rightMotor) {
verify(leftMotor, rightMotor);

View File

@@ -39,6 +39,7 @@ import java.util.StringJoiner;
* points down. Rotations follow the right-hand rule, so clockwise rotation around the Z axis is
* positive.
*/
@SuppressWarnings("removal")
public class KilloughDrive extends RobotDriveBase implements Sendable, AutoCloseable {
public static final double kDefaultLeftMotorAngle = 60.0;
public static final double kDefaultRightMotorAngle = 120.0;

View File

@@ -57,6 +57,7 @@ import java.util.StringJoiner;
* {@link #drivePolar(double, double, double)} is equivalent to RobotDrive's
* mecanumDrive_Polar(double, double, double)} if a deadband of 0 is used.
*/
@SuppressWarnings("removal")
public class MecanumDrive extends RobotDriveBase implements Sendable, AutoCloseable {
private static int instances;

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Digilent DMC 60 Speed Controller.
* Digilent DMC 60 Motor Controller.
*
* <p>Note that the DMC uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.997ms = full "reverse"
* </ul>
*/
public class DMC60 extends PWMSpeedController {
public class DMC60 extends PWMMotorController {
/**
* Constructor.
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Texas Instruments / Vex Robotics Jaguar Speed Controller as a PWM device.
* Texas Instruments / Vex Robotics Jaguar Motor Controller as a PWM device.
*
* <p>Note that the Jaguar uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -23,7 +24,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.697ms = full "reverse"
* </ul>
*/
public class Jaguar extends PWMSpeedController {
public class Jaguar extends PWMMotorController {
/**
* Constructor.
*

View File

@@ -0,0 +1,11 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.wpilibj.SpeedController;
/** Interface for motor controlling devices. */
@SuppressWarnings("removal")
public interface MotorController extends SpeedController {}

View File

@@ -0,0 +1,98 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
import java.util.Arrays;
/** Allows multiple {@link MotorController} objects to be linked together. */
public class MotorControllerGroup implements MotorController, Sendable, AutoCloseable {
private boolean m_isInverted;
private final MotorController[] m_motorControllers;
private static int instances;
/**
* Create a new MotorControllerGroup with the provided MotorControllers.
*
* @param motorControllers The MotorControllers to add
*/
@SuppressWarnings("PMD.AvoidArrayLoops")
public MotorControllerGroup(
MotorController motorController, MotorController... motorControllers) {
m_motorControllers = new MotorController[motorControllers.length + 1];
m_motorControllers[0] = motorController;
for (int i = 0; i < motorControllers.length; i++) {
m_motorControllers[i + 1] = motorControllers[i];
}
init();
}
public MotorControllerGroup(MotorController[] motorControllers) {
m_motorControllers = Arrays.copyOf(motorControllers, motorControllers.length);
init();
}
private void init() {
for (MotorController controller : m_motorControllers) {
SendableRegistry.addChild(this, controller);
}
instances++;
SendableRegistry.addLW(this, "MotorControllerGroup", instances);
}
@Override
public void close() {
SendableRegistry.remove(this);
}
@Override
public void set(double speed) {
for (MotorController motorController : m_motorControllers) {
motorController.set(m_isInverted ? -speed : speed);
}
}
@Override
public double get() {
if (m_motorControllers.length > 0) {
return m_motorControllers[0].get() * (m_isInverted ? -1 : 1);
}
return 0.0;
}
@Override
public void setInverted(boolean isInverted) {
m_isInverted = isInverted;
}
@Override
public boolean getInverted() {
return m_isInverted;
}
@Override
public void disable() {
for (MotorController motorController : m_motorControllers) {
motorController.disable();
}
}
@Override
public void stopMotor() {
for (MotorController motorController : m_motorControllers) {
motorController.stopMotor();
}
}
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("Motor Controller");
builder.setActuator(true);
builder.setSafeState(this::stopMotor);
builder.addDoubleProperty("Value", this::get, this::set);
}
}

View File

@@ -2,16 +2,20 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.DigitalOutput;
import edu.wpi.first.wpilibj.MotorSafety;
import edu.wpi.first.wpilibj.PWM;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
/** Nidec Brushless Motor. */
public class NidecBrushless extends MotorSafety
implements SpeedController, Sendable, AutoCloseable {
implements MotorController, Sendable, AutoCloseable {
private boolean m_isInverted;
private final DigitalOutput m_dio;
private final PWM m_pwm;

View File

@@ -2,14 +2,17 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.wpilibj.MotorSafety;
import edu.wpi.first.wpilibj.PWM;
import edu.wpi.first.wpilibj.Sendable;
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
/** Common base class for all PWM Speed Controllers. */
public abstract class PWMSpeedController extends MotorSafety
implements SpeedController, Sendable, AutoCloseable {
/** Common base class for all PWM Motor Controllers. */
public abstract class PWMMotorController extends MotorSafety
implements MotorController, Sendable, AutoCloseable {
private boolean m_isInverted;
protected PWM m_pwm;
@@ -20,7 +23,7 @@ public abstract class PWMSpeedController extends MotorSafety
* @param channel The PWM channel that the controller is attached to. 0-9 are on-board, 10-19 are
* on the MXP port
*/
protected PWMSpeedController(final String name, final int channel) {
protected PWMMotorController(final String name, final int channel) {
m_pwm = new PWM(channel, false);
SendableRegistry.addLW(this, name, channel);
}
@@ -48,7 +51,7 @@ public abstract class PWMSpeedController extends MotorSafety
/**
* Get the recently set value of the PWM. This value is affected by the inversion property. If you
* want the value that is sent directly to the SpeedController, use {@link
* want the value that is sent directly to the MotorController, use {@link
* edu.wpi.first.wpilibj.PWM#getSpeed()} instead.
*
* @return The most recently set value for the PWM between -1.0 and 1.0.
@@ -94,7 +97,7 @@ public abstract class PWMSpeedController extends MotorSafety
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("Speed Controller");
builder.setSmartDashboardType("Motor Controller");
builder.setActuator(true);
builder.setSafeState(this::disable);
builder.addDoubleProperty("Value", this::get, this::set);

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* REV Robotics SPARK MAX Speed Controller with PWM control.
* REV Robotics SPARK MAX Motor Controller with PWM control.
*
* <p>Note that the SPARK MAX uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.999ms = full "reverse"
* </ul>
*/
public class PWMSparkMax extends PWMSpeedController {
public class PWMSparkMax extends PWMMotorController {
/** Common initialization code called by all constructors. */
public PWMSparkMax(final int channel) {
super("PWMSparkMax", channel);

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Talon FX Speed Controller with PWM control.
* Cross the Road Electronics (CTRE) Talon FX Motor Controller with PWM control.
*
* <p>Note that the TalonFX uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.997ms = full "reverse"
* </ul>
*/
public class PWMTalonFX extends PWMSpeedController {
public class PWMTalonFX extends PWMMotorController {
/**
* Constructor for a TalonFX connected via PWM.
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Talon SRX Speed Controller with PWM control.
* Cross the Road Electronics (CTRE) Talon SRX Motor Controller with PWM control.
*
* <p>Note that the TalonSRX uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.997ms = full "reverse"
* </ul>
*/
public class PWMTalonSRX extends PWMSpeedController {
public class PWMTalonSRX extends PWMMotorController {
/**
* Constructor for a TalonSRX connected via PWM.
*

View File

@@ -2,10 +2,11 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Playing with Fusion Venom Smart Motor with PWM control.
@@ -23,7 +24,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.997ms = full "reverse"
* </ul>
*/
public class PWMVenom extends PWMSpeedController {
public class PWMVenom extends PWMMotorController {
/**
* Constructor for a Venom connected via PWM.
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Victor SPX Speed Controller with PWM control.
* Cross the Road Electronics (CTRE) Victor SPX Motor Controller with PWM control.
*
* <p>Note that the Victor SPX uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.997ms = full "reverse"
* </ul>
*/
public class PWMVictorSPX extends PWMSpeedController {
public class PWMVictorSPX extends PWMMotorController {
/**
* Constructor for a Victor SPX connected via PWM.
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Mindsensors SD540 Speed Controller.
* Mindsensors SD540 Motor Controller.
*
* <p>Note that the SD540 uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.94ms = full "reverse"
* </ul>
*/
public class SD540 extends PWMSpeedController {
public class SD540 extends PWMMotorController {
/**
* Constructor.
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* REV Robotics SPARK Speed Controller.
* REV Robotics SPARK Motor Controller.
*
* <p>Note that the SPARK uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.999ms = full "reverse"
* </ul>
*/
public class Spark extends PWMSpeedController {
public class Spark extends PWMMotorController {
/**
* Constructor.
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* Cross the Road Electronics (CTRE) Talon and Talon SR Speed Controller.
* Cross the Road Electronics (CTRE) Talon and Talon SR Motor Controller.
*
* <p>Note that the Talon uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -23,7 +24,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.989ms = full "reverse"
* </ul>
*/
public class Talon extends PWMSpeedController {
public class Talon extends PWMMotorController {
/**
* Constructor for a Talon (original or Talon SR).
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* VEX Robotics Victor 888 Speed Controller The Vex Robotics Victor 884 Speed Controller can also be
* VEX Robotics Victor 888 Motor Controller The Vex Robotics Victor 884 Motor Controller can also be
* used with this class but may need to be calibrated per the Victor 884 user manual.
*
* <p>Note that the Victor uses the following bounds for PWM values. These values were determined
@@ -26,7 +27,7 @@ import edu.wpi.first.hal.HAL;
* <li>1.026ms = full "reverse"
* </ul>
*/
public class Victor extends PWMSpeedController {
public class Victor extends PWMMotorController {
/**
* Constructor.
*

View File

@@ -2,13 +2,14 @@
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package edu.wpi.first.wpilibj;
package edu.wpi.first.wpilibj.motorcontrol;
import edu.wpi.first.hal.FRCNetComm.tResourceType;
import edu.wpi.first.hal.HAL;
import edu.wpi.first.wpilibj.PWM;
/**
* VEX Robotics Victor SP Speed Controller.
* VEX Robotics Victor SP Motor Controller.
*
* <p>Note that the VictorSP uses the following bounds for PWM values. These values should work
* reasonably well for most controllers, but if users experience issues such as asymmetric behavior
@@ -24,7 +25,7 @@ import edu.wpi.first.hal.HAL;
* <li>0.997ms = full "reverse"
* </ul>
*/
public class VictorSP extends PWMSpeedController {
public class VictorSP extends PWMMotorController {
/**
* Constructor.
*

View File

@@ -245,27 +245,27 @@ public enum BuiltInWidgets implements WidgetType {
*/
kEncoder("Encoder"),
/**
* Displays a {@link edu.wpi.first.wpilibj.SpeedController SpeedController}. The speed controller
* will be controllable from the dashboard when test mode is enabled, but will otherwise be
* view-only. <br>
* Displays a {@link edu.wpi.first.wpilibj.motorcontrol.MotorController MotorController}. The
* speed controller will be controllable from the dashboard when test mode is enabled, but will
* otherwise be view-only. <br>
* Supported types:
*
* <ul>
* <li>{@link edu.wpi.first.wpilibj.PWMSpeedController}
* <li>{@link edu.wpi.first.wpilibj.DMC60}
* <li>{@link edu.wpi.first.wpilibj.Jaguar}
* <li>{@link edu.wpi.first.wpilibj.PWMSparkMax}
* <li>{@link edu.wpi.first.wpilibj.PWMTalonFX}
* <li>{@link edu.wpi.first.wpilibj.PWMTalonSRX}
* <li>{@link edu.wpi.first.wpilibj.PWMVenom}
* <li>{@link edu.wpi.first.wpilibj.PWMVictorSPX}
* <li>{@link edu.wpi.first.wpilibj.SD540}
* <li>{@link edu.wpi.first.wpilibj.Spark}
* <li>{@link edu.wpi.first.wpilibj.Talon}
* <li>{@link edu.wpi.first.wpilibj.Victor}
* <li>{@link edu.wpi.first.wpilibj.VictorSP}
* <li>{@link edu.wpi.first.wpilibj.SpeedControllerGroup}
* <li>Any custom subclass of {@code SpeedController}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMMotorController}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.DMC60}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Jaguar}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMSparkMax}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMTalonFX}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMTalonSRX}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMVenom}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.PWMVictorSPX}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.SD540}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Spark}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Talon}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.Victor}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.VictorSP}
* <li>{@link edu.wpi.first.wpilibj.motorcontrol.MotorControllerGroup}
* <li>Any custom subclass of {@code MotorController}
* </ul>
*
* <br>
@@ -277,7 +277,7 @@ public enum BuiltInWidgets implements WidgetType {
* <td>One of {@code ["HORIZONTAL", "VERTICAL"]}</td></tr>
* </table>
*/
kSpeedController("Speed Controller"),
kMotorController("Motor Controller"),
/**
* Displays a command with a toggle button. Pressing the button will start the command, and the
* button will automatically release when the command completes. <br>