diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedrosConstants.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedrosConstants.java index ede9a66..5f41c6a 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedrosConstants.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedrosConstants.java @@ -8,6 +8,14 @@ public class PedrosConstants { public static final String FRONT_RIGHT_MOTOR = "Drive front rt"; public static final String BACK_RIGHT_MOTOR = "Drive back rt"; + // Robot IMU configuration + public static final String IMU = "imu"; + + // Robot Encoders + public static final String LEFT_ENCODER = "encoder left"; + public static final String RIGHT_ENCODER = "encoder right"; + public static final String BACK_ENCODER = "encoder back"; + /* Pedro's parameters */ diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelIMULocalizer.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelIMULocalizer.java index 1e9fd7b..961611f 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelIMULocalizer.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelIMULocalizer.java @@ -1,5 +1,7 @@ package org.firstinspires.ftc.teamcode.pedroPathing.localization.localizers; +import static org.firstinspires.ftc.teamcode.PedrosConstants.*; + import com.acmerobotics.dashboard.config.Config; import com.qualcomm.hardware.rev.RevHubOrientationOnRobot; import com.qualcomm.robotcore.hardware.DcMotorEx; @@ -88,7 +90,7 @@ public class ThreeWheelIMULocalizer extends Localizer { */ public ThreeWheelIMULocalizer(HardwareMap map, Pose setStartPose) { hardwareMap = map; - imu = hardwareMap.get(IMU.class, "imu"); + imu = hardwareMap.get(IMU.class, IMU); // TODO: replace this with your IMU's orientation imu.initialize(new IMU.Parameters(new RevHubOrientationOnRobot(RevHubOrientationOnRobot.LogoFacingDirection.LEFT, RevHubOrientationOnRobot.UsbFacingDirection.UP))); @@ -98,11 +100,10 @@ public class ThreeWheelIMULocalizer extends Localizer { rightEncoderPose = new Pose(-3, -5.7, 0); strafeEncoderPose = new Pose(6.9, 1, Math.toRadians(90)); - // TODO: replace these with your encoder ports - leftEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "lb")); - rightEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "lf")); - strafeEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "rf")); + leftEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, LEFT_ENCODER)); + rightEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, RIGHT_ENCODER)); + strafeEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, BACK_ENCODER)); // TODO: reverse any encoders necessary leftEncoder.setDirection(Encoder.REVERSE); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelLocalizer.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelLocalizer.java index 6814b86..649c3f1 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelLocalizer.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/ThreeWheelLocalizer.java @@ -1,5 +1,7 @@ package org.firstinspires.ftc.teamcode.pedroPathing.localization.localizers; +import static org.firstinspires.ftc.teamcode.PedrosConstants.*; + import com.acmerobotics.dashboard.config.Config; import com.qualcomm.robotcore.hardware.DcMotorEx; import com.qualcomm.robotcore.hardware.HardwareMap; @@ -85,9 +87,9 @@ public class ThreeWheelLocalizer extends Localizer { hardwareMap = map; // TODO: replace these with your encoder ports - leftEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "leftRear")); - rightEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "rightFront")); - strafeEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "strafeEncoder")); + leftEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, LEFT_ENCODER)); + rightEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, RIGHT_ENCODER)); + strafeEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, BACK_ENCODER)); // TODO: reverse any encoders necessary leftEncoder.setDirection(Encoder.REVERSE); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/TwoWheelLocalizer.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/TwoWheelLocalizer.java index 62415d6..2be7a3f 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/TwoWheelLocalizer.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/pedroPathing/localization/localizers/TwoWheelLocalizer.java @@ -1,5 +1,8 @@ package org.firstinspires.ftc.teamcode.pedroPathing.localization.localizers; +import static org.firstinspires.ftc.teamcode.PedrosConstants.BACK_ENCODER; +import static org.firstinspires.ftc.teamcode.PedrosConstants.LEFT_ENCODER; + import com.acmerobotics.dashboard.config.Config; import com.qualcomm.hardware.rev.RevHubOrientationOnRobot; import com.qualcomm.robotcore.hardware.DcMotorEx; @@ -91,8 +94,8 @@ public class TwoWheelLocalizer extends Localizer { // todo: make two wheel odo w imu.initialize(new IMU.Parameters(new RevHubOrientationOnRobot(RevHubOrientationOnRobot.LogoFacingDirection.UP, RevHubOrientationOnRobot.UsbFacingDirection.LEFT))); // TODO: replace these with your encoder ports - forwardEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "leftRear")); - strafeEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, "strafeEncoder")); + forwardEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, LEFT_ENCODER)); + strafeEncoder = new Encoder(hardwareMap.get(DcMotorEx.class, BACK_ENCODER)); // TODO: reverse any encoders necessary forwardEncoder.setDirection(Encoder.REVERSE);