From e534f46efb0f8967e102f095f5761aea60da311c Mon Sep 17 00:00:00 2001 From: Carlos Date: Tue, 17 Sep 2024 18:55:37 -0700 Subject: [PATCH] Added IMU direction --- .../org/firstinspires/ftc/teamcode/PedroConstants.java | 9 ++++++++- .../localization/localizers/ThreeWheelIMULocalizer.java | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java index 70b8c34..92c4f69 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java @@ -1,5 +1,6 @@ package org.firstinspires.ftc.teamcode; +import com.qualcomm.hardware.rev.RevHubOrientationOnRobot; import com.qualcomm.robotcore.hardware.DcMotorSimple.Direction; import org.firstinspires.ftc.teamcode.pedroPathing.localization.Encoder; @@ -25,7 +26,13 @@ public class PedroConstants { // Robot IMU configuration public static final String IMU = "imu"; - // Robot Encoders + // Robot IMU placement + public static final RevHubOrientationOnRobot.LogoFacingDirection IMU_LOGO_FACING_DIRECTION + = RevHubOrientationOnRobot.LogoFacingDirection.DOWN; + public static final RevHubOrientationOnRobot.UsbFacingDirection IMU_USB_FACING_DIRECTION + = RevHubOrientationOnRobot.UsbFacingDirection.LEFT; + + // 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"; 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 1cc8037..1503b84 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 @@ -93,7 +93,7 @@ public class ThreeWheelIMULocalizer extends Localizer { imu = hardwareMap.get(IMU.class, IMU); // TODO: replace this with your IMU's orientation - imu.initialize(new IMU.Parameters(new RevHubOrientationOnRobot(RevHubOrientationOnRobot.LogoFacingDirection.DOWN, RevHubOrientationOnRobot.UsbFacingDirection.LEFT))); + imu.initialize(new IMU.Parameters(new RevHubOrientationOnRobot(IMU_LOGO_FACING_DIRECTION, IMU_USB_FACING_DIRECTION))); // TODO: replace these with your encoder positions leftEncoderPose = new Pose(-7.625, 6.19375, 0);