From d2c64a7d916c64f8a91e4be07d26a47d8b45ee0d Mon Sep 17 00:00:00 2001 From: Carlos Rivas Date: Sun, 10 Nov 2024 19:41:58 -0800 Subject: [PATCH] Moved device names to constants file --- .../ftc/teamcode/PedroConstants.java | 51 +++++++++++++------ .../subsystem/ArmActionsSubsystem.java | 3 +- .../subsystem/ClawActionsSubsystem.java | 5 +- .../subsystem/LiftActionsSubsystem.java | 3 +- .../teamcode/subsystem/WristSubsystem.java | 3 +- 5 files changed, 45 insertions(+), 20 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 9699cf6..0ad4cfd 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/PedroConstants.java @@ -8,43 +8,64 @@ import org.firstinspires.ftc.teamcode.pedroPathing.localization.Encoder; public class PedroConstants { /* - Robot parameters + Motor configuration names */ - // Turn localizer - -0.003 - - - // Robot motor configurations - public static final String BRAIN_ROT = "Sikidi rizz 360 no teleop tf2 mama mia 2cool 4skool yasyasy yasyasyasyasyasyasyaysy ohio yes heh me is moar skeebeedee than u walked and got tripped on by your aunt my very educaded mother just served us nine what? just kydinfoiwfowefwofwioefoiejfeoiwjfomdsklfnslefknesfklnkfenfenkfeknfenkfeknfenkefnk"; public static final String FRONT_LEFT_MOTOR = "Drive front lt"; - public static final String BACK_LEFT_MOTOR = "Drive back lt"; - public static final String FRONT_RIGHT_MOTOR = "Drive front rt"; - public static final String BACK_RIGHT_MOTOR = "Drive back rt"; + public static final String BACK_LEFT_MOTOR = "Drive back lt"; + public static final String FRONT_RIGHT_MOTOR = "Drive front rt"; + public static final String BACK_RIGHT_MOTOR = "Drive back rt"; - // Robot motor direction + /* + Motor directions + */ public static final Direction FRONT_LEFT_MOTOR_DIRECTION = Direction.REVERSE; public static final Direction BACK_LEFT_MOTOR_DIRECTION = Direction.REVERSE; public static final Direction FRONT_RIGHT_MOTOR_DIRECTION = Direction.FORWARD; public static final Direction BACK_RIGHT_MOTOR_DIRECTION = Direction.FORWARD; - // Robot IMU configuration + /* + IMU + */ public static final String IMU = "imu"; - - // 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 + /* + Dead wheels + */ public static final String LEFT_ENCODER = "encoder left"; public static final String RIGHT_ENCODER = "encoder right"; public static final String BACK_ENCODER = "encoder back"; - // Robot encoder direction + /* + Dead wheel directions + */ public static final double LEFT_ENCODER_DIRECTION = Encoder.FORWARD; public static final double RIGHT_ENCODER_DIRECTION = Encoder.FORWARD; public static final double BACK_ENCODER_DIRECTION = Encoder.FORWARD; + /* + Arm configuration name + */ + public static final String ARM_NAME = "arm-servo"; + + /* + Claw configuration name + */ + public static final String CLAW_NAME = "claw-servo"; + + /* + Lift configuration name + */ + public static final String LIFT_NAME = "lift-motor"; + + /* + Wrist configuration name + */ + public static final String WRIST_NAME = "wrist-servo"; + /* Pedro's parameters */ diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ArmActionsSubsystem.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ArmActionsSubsystem.java index 71c0eaa..86c535c 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ArmActionsSubsystem.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ArmActionsSubsystem.java @@ -1,5 +1,6 @@ package org.firstinspires.ftc.teamcode.subsystem; +import static org.firstinspires.ftc.teamcode.PedroConstants.ARM_NAME; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.armBucket; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.armFloor; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.armPark; @@ -23,7 +24,7 @@ public class ArmActionsSubsystem { private ArmState state; public ArmActionsSubsystem(HardwareMap hardwareMap) { - this.arm = hardwareMap.get(ServoImplEx.class, "arm-servo"); + this.arm = hardwareMap.get(ServoImplEx.class, ARM_NAME); } public class MoveToPosition implements Action { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ClawActionsSubsystem.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ClawActionsSubsystem.java index 071f746..42e54bc 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ClawActionsSubsystem.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/ClawActionsSubsystem.java @@ -1,5 +1,6 @@ package org.firstinspires.ftc.teamcode.subsystem; +import static org.firstinspires.ftc.teamcode.PedroConstants.CLAW_NAME; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.clawClose; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.clawOpen; @@ -21,7 +22,7 @@ public class ClawActionsSubsystem { private ClawState state; public ClawActionsSubsystem(HardwareMap hardwareMap) { - this.claw = hardwareMap.get(Servo.class, "claw-servo"); + this.claw = hardwareMap.get(Servo.class, CLAW_NAME); } public class MoveToPosition implements Action { @@ -37,7 +38,7 @@ public class ClawActionsSubsystem { public boolean run(@NonNull TelemetryPacket telemetryPacket) { setState(positionState); claw.setPosition(positionValue); - telemetryPacket.put("Arm State", positionState); + telemetryPacket.put("Claw State", positionState); return false; } } diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/LiftActionsSubsystem.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/LiftActionsSubsystem.java index ec4fe83..f4994cc 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/LiftActionsSubsystem.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/LiftActionsSubsystem.java @@ -1,5 +1,6 @@ package org.firstinspires.ftc.teamcode.subsystem; +import static org.firstinspires.ftc.teamcode.PedroConstants.LIFT_NAME; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftPower; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftToFloorPos; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.liftToHighBucketPos; @@ -25,7 +26,7 @@ public class LiftActionsSubsystem { private LiftState liftState; public LiftActionsSubsystem(HardwareMap hardwareMap) { - lift = hardwareMap.get(DcMotor.class, "lift-motor"); + lift = hardwareMap.get(DcMotor.class, LIFT_NAME); } public class MoveToPosition implements Action { diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/WristSubsystem.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/WristSubsystem.java index cb89071..9c64e03 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/WristSubsystem.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystem/WristSubsystem.java @@ -1,5 +1,6 @@ package org.firstinspires.ftc.teamcode.subsystem; +import static org.firstinspires.ftc.teamcode.PedroConstants.WRIST_NAME; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristBucket; import static org.firstinspires.ftc.teamcode.configs.RobotConstants.wristFloor; @@ -22,7 +23,7 @@ public class WristSubsystem { public Telemetry telemetry; public WristSubsystem(HardwareMap hardwareMap, Telemetry telemetry) { - this.wrist = hardwareMap.get(ServoImplEx.class, "wrist-servo"); + this.wrist = hardwareMap.get(ServoImplEx.class, WRIST_NAME); this.telemetry = telemetry; toBucketPosition = new RunAction(this::toBucketPosition); toFloorPosition = new RunAction(this::toFloorPosition);