mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
[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:
@@ -8,8 +8,8 @@ import edu.wpi.first.wpilibj.Counter;
|
||||
import edu.wpi.first.wpilibj.DigitalInput;
|
||||
import edu.wpi.first.wpilibj.Encoder;
|
||||
import edu.wpi.first.wpilibj.PWM;
|
||||
import edu.wpi.first.wpilibj.SpeedController;
|
||||
import edu.wpi.first.wpilibj.Timer;
|
||||
import edu.wpi.first.wpilibj.motorcontrol.MotorController;
|
||||
import edu.wpi.first.wpilibj.test.TestBench;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
import java.util.logging.Logger;
|
||||
@@ -22,7 +22,7 @@ import java.util.logging.Logger;
|
||||
* fixture. This allows tests to be mailable so that you can easily reconfigure the physical testbed
|
||||
* without breaking the tests.
|
||||
*/
|
||||
public abstract class MotorEncoderFixture<T extends SpeedController> implements ITestFixture {
|
||||
public abstract class MotorEncoderFixture<T extends MotorController> implements ITestFixture {
|
||||
private static final Logger logger = Logger.getLogger(MotorEncoderFixture.class.getName());
|
||||
private boolean m_initialized = false;
|
||||
private boolean m_tornDown = false;
|
||||
@@ -39,12 +39,12 @@ public abstract class MotorEncoderFixture<T extends SpeedController> implements
|
||||
|
||||
/**
|
||||
* Where the implementer of this class should pass the speed controller Constructor should only be
|
||||
* called from outside this class if the Speed controller is not also an implementation of PWM
|
||||
* called from outside this class if the Motor controller is not also an implementation of PWM
|
||||
* interface.
|
||||
*
|
||||
* @return SpeedController
|
||||
* @return MotorController
|
||||
*/
|
||||
protected abstract T giveSpeedController();
|
||||
protected abstract T giveMotorController();
|
||||
|
||||
/**
|
||||
* Where the implementer of this class should pass one of the digital inputs.
|
||||
@@ -76,7 +76,7 @@ public abstract class MotorEncoderFixture<T extends SpeedController> implements
|
||||
m_counters[0] = new Counter(m_alphaSource);
|
||||
m_counters[1] = new Counter(m_betaSource);
|
||||
logger.fine("Creating the speed controller!");
|
||||
m_motor = giveSpeedController();
|
||||
m_motor = giveMotorController();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user