From e959e80c58ac017d0c0005a35fd99c350c39c074 Mon Sep 17 00:00:00 2001 From: GreenBlitz Date: Sat, 15 Jun 2024 19:58:28 +0300 Subject: [PATCH] Gil - changes --- .../ftc/teamcode/subsystems/launcher/Launcher.java | 14 +++++--------- .../subsystems/launcher/LauncherConstants.java | 2 -- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/Launcher.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/Launcher.java index 942eb5e..9182a24 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/Launcher.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/Launcher.java @@ -1,20 +1,16 @@ package org.firstinspires.ftc.teamcode.subsystems.launcher; import com.arcrobotics.ftclib.command.SubsystemBase; -import com.arcrobotics.ftclib.hardware.SimpleServo; import com.qualcomm.robotcore.hardware.HardwareMap; +import com.qualcomm.robotcore.hardware.Servo; import org.firstinspires.ftc.robotcore.external.Telemetry; public class Launcher extends SubsystemBase { - private SimpleServo servo; + private final Servo servo; public Launcher(HardwareMap hardwareMap) { - this.servo = new SimpleServo(hardwareMap, - LauncherConstants.SERVO_ID, - LauncherConstants.MIN_ANGLE, - LauncherConstants.MAX_ANGLE - ); + this.servo = hardwareMap.servo.get(LauncherConstants.SERVO_ID); servo.setPosition(LauncherConstants.CLOSED_POSITION); } @@ -26,7 +22,7 @@ protected void launchPlane() { servo.setPosition(LauncherConstants.RELEASED_POSITION); } - public boolean isFullyReleased() { + public boolean isPlaneLaunched() { return getPosition() == LauncherConstants.RELEASED_POSITION; } @@ -36,7 +32,7 @@ public boolean isClosed() { public void telemetry(Telemetry telemetry) { telemetry.addData("launcher servo currentPos: ", getPosition()); - telemetry.addData("is launcher fully released: ", isFullyReleased()); + telemetry.addData("is launcher fully released: ", isPlaneLaunched()); telemetry.addData("is launcher closed: ", isClosed()); } } diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/LauncherConstants.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/LauncherConstants.java index bafc472..dce17e0 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/LauncherConstants.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/launcher/LauncherConstants.java @@ -4,6 +4,4 @@ class LauncherConstants { protected static final String SERVO_ID = "launcher_servo"; protected static final double RELEASED_POSITION = 0; protected static final double CLOSED_POSITION = 0.5; - protected static final double MIN_ANGLE = 0; - protected static final double MAX_ANGLE = 360; }