diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/constants/ServoVars.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/constants/ServoVars.java new file mode 100644 index 0000000..9ffd71b --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/constants/ServoVars.java @@ -0,0 +1,16 @@ +package org.firstinspires.ftc.teamcode.constants; + +import com.acmerobotics.dashboard.config.Config; + +@Config +public class ServoVars { + + + //Standard Naming Convention: servoName_VarInSentenceCase + + public static double turret_Range = 355; //In Degrees + public static double turret_GearRatio = 0.9974; + + public static double rejecter_Out = 1.0; + public static double rejecter_In = 0.0; +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Drivetrain.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Drivetrain.java index d975600..319b6da 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Drivetrain.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Drivetrain.java @@ -13,17 +13,17 @@ import java.util.Objects; public class Drivetrain implements Subsystem { - private GamepadEx gamepad; + private final GamepadEx gamepad; public MultipleTelemetry TELE; private String Mode = "Default"; - private DcMotorEx fl; + private final DcMotorEx fl; - private DcMotorEx fr; - private DcMotorEx bl; - private DcMotorEx br; + private final DcMotorEx fr; + private final DcMotorEx bl; + private final DcMotorEx br; private double defaultSpeed = 0.7; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Intake.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Intake.java index 0175714..77ad54a 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Intake.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Intake.java @@ -1,27 +1,56 @@ package org.firstinspires.ftc.teamcode.subsystems; +import static org.firstinspires.ftc.teamcode.constants.ServoVars.*; + import com.acmerobotics.dashboard.telemetry.MultipleTelemetry; import com.arcrobotics.ftclib.gamepad.GamepadEx; import com.qualcomm.robotcore.hardware.DcMotorEx; import com.qualcomm.robotcore.hardware.Gamepad; -import com.rowanmcalpin.nextftc.core.Subsystem; +import com.qualcomm.robotcore.hardware.Servo; import org.firstinspires.ftc.teamcode.utils.Robot; -public class Intake extends Subsystem { - - private GamepadEx gamepad; +public class Intake implements Subsystem { public MultipleTelemetry TELE; - private DcMotorEx intake; + private final DcMotorEx intake; + private final Servo kicker; - public Intake (Robot robot, MultipleTelemetry telemetry, GamepadEx gamepad){ + private double intakePower = 0.0; + private double kickerPos = 0.0; + public Intake (Robot robot, MultipleTelemetry telemetry){ + this.intake = robot.intake; + this.kicker = robot.rejecter; } + + public void setIntakePower (double pow){ + this.intakePower = pow; + } + + public double getIntakePower() { + return this.intakePower; + } + + public void kickOut (){ + this.kickerPos = rejecter_Out; + } + + public void kickIn (){ + this.kickerPos = rejecter_In; + } + + @Override + public void update() { + kicker.setPosition(kickerPos); + intake.setPower(intakePower); + } } + + diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Shooter.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Shooter.java index ab33e6d..bb5977d 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Shooter.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/Shooter.java @@ -1,5 +1,7 @@ package org.firstinspires.ftc.teamcode.subsystems; +import static org.firstinspires.ftc.teamcode.constants.ServoVars.*; + import com.acmerobotics.dashboard.telemetry.MultipleTelemetry; import com.acmerobotics.roadrunner.Pose2d; import com.arcrobotics.ftclib.controller.PIDController; @@ -210,7 +212,6 @@ public class Shooter implements Subsystem { - //0.9974 * 355 } @@ -224,7 +225,7 @@ public class Shooter implements Subsystem { deltaAngle +=360; } - deltaAngle /= (0.9974*355); + deltaAngle /= (turret_GearRatio*turret_Range); return (0.5+deltaAngle) ;