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