Skip to content

Commit

Permalink
Dead wheel overflow encoders by default
Browse files Browse the repository at this point in the history
  • Loading branch information
rbrott committed Sep 19, 2023
1 parent 334252c commit 5f2fcaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.acmerobotics.roadrunner.Vector2dDual;
import com.acmerobotics.roadrunner.ftc.Encoder;
import com.acmerobotics.roadrunner.ftc.FlightRecorder;
import com.acmerobotics.roadrunner.ftc.OverflowEncoder;
import com.acmerobotics.roadrunner.ftc.PositionVelocityPair;
import com.acmerobotics.roadrunner.ftc.RawEncoder;
import com.qualcomm.robotcore.hardware.DcMotorEx;
Expand All @@ -29,9 +30,9 @@ public static class Params {
private int lastPar0Pos, lastPar1Pos, lastPerpPos;

public ThreeDeadWheelLocalizer(HardwareMap hardwareMap, double inPerTick) {
par0 = new RawEncoder(hardwareMap.get(DcMotorEx.class, "par0"));
par1 = new RawEncoder(hardwareMap.get(DcMotorEx.class, "par1"));
perp = new RawEncoder(hardwareMap.get(DcMotorEx.class, "perp"));
par0 = new OverflowEncoder(new RawEncoder(hardwareMap.get(DcMotorEx.class, "par0")));
par1 = new OverflowEncoder(new RawEncoder(hardwareMap.get(DcMotorEx.class, "par1")));
perp = new OverflowEncoder(new RawEncoder(hardwareMap.get(DcMotorEx.class, "perp")));

lastPar0Pos = par0.getPositionAndVelocity().position;
lastPar1Pos = par1.getPositionAndVelocity().position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.acmerobotics.roadrunner.Vector2dDual;
import com.acmerobotics.roadrunner.ftc.Encoder;
import com.acmerobotics.roadrunner.ftc.FlightRecorder;
import com.acmerobotics.roadrunner.ftc.OverflowEncoder;
import com.acmerobotics.roadrunner.ftc.PositionVelocityPair;
import com.acmerobotics.roadrunner.ftc.RawEncoder;
import com.qualcomm.robotcore.hardware.DcMotorEx;
Expand All @@ -34,8 +35,8 @@ public static class Params {
private final double inPerTick;

public TwoDeadWheelLocalizer(HardwareMap hardwareMap, IMU imu, double inPerTick) {
par = new RawEncoder(hardwareMap.get(DcMotorEx.class, "par"));
perp = new RawEncoder(hardwareMap.get(DcMotorEx.class, "perp"));
par = new OverflowEncoder(new RawEncoder(hardwareMap.get(DcMotorEx.class, "par")));
perp = new OverflowEncoder(new RawEncoder(hardwareMap.get(DcMotorEx.class, "perp")));
this.imu = imu;

lastParPos = par.getPositionAndVelocity().position;
Expand Down

0 comments on commit 5f2fcaf

Please sign in to comment.