Add setDirection() to Encoder interface (fixes #203)
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package org.firstinspires.ftc.teamcode.util;
|
||||
|
||||
import com.qualcomm.robotcore.hardware.DcMotorController;
|
||||
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||
|
||||
public interface Encoder {
|
||||
class PositionVelocityPair {
|
||||
@ -15,4 +16,6 @@ public interface Encoder {
|
||||
PositionVelocityPair getPositionAndVelocity();
|
||||
|
||||
DcMotorController getController();
|
||||
|
||||
void setDirection(DcMotorSimple.Direction direction);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package org.firstinspires.ftc.teamcode.util;
|
||||
|
||||
import com.qualcomm.robotcore.hardware.DcMotorController;
|
||||
import com.qualcomm.robotcore.hardware.DcMotorSimple;
|
||||
import com.qualcomm.robotcore.util.ElapsedTime;
|
||||
|
||||
public final class OverflowEncoder implements Encoder {
|
||||
@ -54,4 +55,9 @@ public final class OverflowEncoder implements Encoder {
|
||||
public DcMotorController getController() {
|
||||
return encoder.getController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(DcMotorSimple.Direction direction) {
|
||||
encoder.setDirection(direction);
|
||||
}
|
||||
}
|
||||
|
@ -36,4 +36,9 @@ public final class RawEncoder implements Encoder {
|
||||
public DcMotorController getController() {
|
||||
return m.getController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(DcMotorSimple.Direction direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user