From 97185db38ade7016382b811d0274fa9a3bf97692 Mon Sep 17 00:00:00 2001 From: 535tobor <535tobor@gmail.com> Date: Fri, 26 Jan 2024 19:59:49 -0500 Subject: [PATCH] 1.2 --- .../gamecode/autonomous/BlueBoardSide.java | 8 +-- .../gamecode/autonomous/BlueFarSide.java | 3 +- .../gamecode/autonomous/RedBoardSide.java | 5 +- .../gamecode/autonomous/RedFarSide.java | 1 + .../gamecode/autonomous/TeamProp_Find.java | 16 +++--- .../gamecode/autonomous/TeamProp_Guessed.java | 2 + .../gamecode/teleop/DriverControlled.java | 50 ++++++++----------- .../teamcode/operations/inOut/Gamepad2.java | 32 ------------ .../operations/inOut/Target_inOut.java | 5 -- .../ftc/teamcode/operations/inOut/readme.md | 4 -- .../motors/barMotor/BarMotorMovements.java | 21 -------- .../motors/barMotor/ConfigureMotorBar.java | 15 ------ .../outputs/motors/barMotor/readme.md | 2 - .../pixelMotor/ConfigureMotorPixel.java | 16 ------ .../pixelMotor/PixelMotorMovements.java | 21 -------- .../motors/pixelMotor/Target_pixelMotor.java | 7 --- .../motors/servos/armLift/Target_armLift.java | 4 ++ .../servos/armLift/arm/ConfigureArm.java | 13 +++++ .../armLift/arm/Target_arm.java} | 6 +-- .../servos/armLift/arm/armMovements.java | 24 +++++++++ .../armLift/arm}/readme.md | 4 +- .../servos/armLift/arm/rotateButtons.java | 27 ++++++++++ .../outputs/motors/servos/armLift/readme.md | 2 + .../motors/servos/claw/ConfigureClaw.java | 13 +++++ .../motors/servos/claw/Target_claw.java | 7 +++ .../motors/servos/claw/clawMovements.java | 27 ++++++++++ .../motors/servos/claw/openCloseButtons.java | 20 ++++++++ .../outputs/motors/servos/claw/readme.md | 2 + 28 files changed, 182 insertions(+), 175 deletions(-) delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Gamepad2.java delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Target_inOut.java delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/readme.md delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/BarMotorMovements.java delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/ConfigureMotorBar.java delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/readme.md delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/ConfigureMotorPixel.java delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/PixelMotorMovements.java delete mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/Target_pixelMotor.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/Target_armLift.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/ConfigureArm.java rename TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/{barMotor/Target_barMotor.java => servos/armLift/arm/Target_arm.java} (59%) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/armMovements.java rename TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/{pixelMotor => servos/armLift/arm}/readme.md (55%) create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/rotateButtons.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/readme.md create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/ConfigureClaw.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/Target_claw.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/clawMovements.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/openCloseButtons.java create mode 100644 TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/readme.md diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueBoardSide.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueBoardSide.java index 0570b37..53f1800 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueBoardSide.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueBoardSide.java @@ -7,21 +7,16 @@ import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.forwardMotors; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fr; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EachMotorSet.drive; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.backwardAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.forwardAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.strafeLeftAuto; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.turnLeftAuto; -import com.google.firebase.crashlytics.buildtools.reloc.org.apache.commons.codec.Encoder; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import com.qualcomm.robotcore.hardware.DcMotor; -import com.qualcomm.robotcore.hardware.DistanceSensor; -import com.qualcomm.robotcore.hardware.Servo; import org.firstinspires.ftc.teamcode.operations.Target_operations; -import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Wheels; import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Encoders; +import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Wheels; @Autonomous(name="Blue, Board Side", group="auto") public class BlueBoardSide extends Target_operations { @@ -57,6 +52,7 @@ public void runInitLoop(){} @Override public void runStart() { // guess that team prop is in middle + strafeLeftAuto(3,2,500); // away from rigging forwardAuto(30,3,500); backwardAuto(30,3,500); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueFarSide.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueFarSide.java index 71f907d..1e6ba71 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueFarSide.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/BlueFarSide.java @@ -7,12 +7,10 @@ import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.forwardMotors; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fr; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EachMotorSet.drive; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.backwardAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.forwardAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.strafeLeftAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.strafeRightAuto; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.Target_definingDriveMovements.ticksPerInch; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; @@ -53,6 +51,7 @@ public void runInitLoop() { @Override public void runStart() { // guess that team prop is in middle + strafeLeftAuto(3,2,500); // away from rigging forwardAuto(30,3,500); backwardAuto(30,3,500); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedBoardSide.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedBoardSide.java index d26f599..152fdf4 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedBoardSide.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedBoardSide.java @@ -7,16 +7,16 @@ import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.forwardMotors; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fr; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EachMotorSet.drive; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.backwardAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.forwardAuto; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.strafeLeftAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.strafeRightAuto; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; import org.firstinspires.ftc.teamcode.operations.Target_operations; -import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Wheels; import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Encoders; +import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Wheels; @Autonomous(name="Red, Board Side", group="auto") public class RedBoardSide extends Target_operations { @@ -50,6 +50,7 @@ public void runInitLoop() { @Override public void runStart() { // guess that team prop is in middle + strafeRightAuto(3,2,500); // away from rigging forwardAuto(30,3,500); backwardAuto(30,3,500); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedFarSide.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedFarSide.java index e83d3a8..da13165 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedFarSide.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/RedFarSide.java @@ -46,6 +46,7 @@ public void runInitLoop() { @Override public void runStart() { // guess that team prop is in middle + strafeRightAuto(3,2,500); // away from rigging forwardAuto(30,3,500); backwardAuto(30,3,500); diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Find.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Find.java index 0d31429..e4db303 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Find.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Find.java @@ -8,14 +8,13 @@ import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.forwardMotors; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fr; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.backwardAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.forwardAuto; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.strafeLeftAuto; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.strafeRightAuto; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.turnLeftAuto; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.turnRightAuto; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.clawMovements.closeClawSet; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.clawMovements.openClawSet; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; +import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DistanceSensor; import com.qualcomm.robotcore.hardware.IMU; @@ -26,6 +25,7 @@ import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Wheels; @Autonomous(name="Blue, Board Side 2 -> Team Props", group="auto") +@Disabled // test public class TeamProp_Find extends Target_operations { DcMotor arm; @@ -61,20 +61,20 @@ public void runInitLoop(){} @Override public void runStart() { - // close claw + closeClawSet(); forwardAuto(21,3,500); if (sensorRange.getDistance(DistanceUnit.INCH) < 7) { // zone 2 - // open claw + openClawSet(); } else { turnLeftAuto(180*20, 3,500); // zone 1 if (sensorRange.getDistance(DistanceUnit.INCH) < 7) { - // open claw + openClawSet(); } else { turnLeftAuto(180*20*2, 3,500); forwardAuto(3,3,500); - // open claw + openClawSet(); } } } diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Guessed.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Guessed.java index 9030a03..ed37080 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Guessed.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/autonomous/TeamProp_Guessed.java @@ -11,6 +11,7 @@ import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EncoderTickDefinitions.forwardAuto; import com.qualcomm.robotcore.eventloop.opmode.Autonomous; +import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.hardware.DcMotor; import com.qualcomm.robotcore.hardware.DistanceSensor; import com.qualcomm.robotcore.hardware.IMU; @@ -22,6 +23,7 @@ import org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Encoders; @Autonomous(name="Chance Program (Team Prop)", group="auto") +@Disabled public class TeamProp_Guessed extends Target_operations { DcMotor arm; diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/teleop/DriverControlled.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/teleop/DriverControlled.java index c005310..b7924d6 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/teleop/DriverControlled.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/gamecode/teleop/DriverControlled.java @@ -1,8 +1,6 @@ package org.firstinspires.ftc.teamcode.gamecode.teleop; import static com.qualcomm.hardware.rev.RevHubOrientationOnRobot.LogoFacingDirection.UP; -import static com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection.BACKWARD; -import static com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection.LEFT; import static com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection.RIGHT; import static org.firstinspires.ftc.teamcode.operations.inputs.AprilTag.initAprilTag; import static org.firstinspires.ftc.teamcode.operations.inputs.AprilTag.visionPortal; @@ -19,17 +17,25 @@ import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Mecanum.botHeading; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Mecanum.dpadMovements; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Mecanum.fieldCentricMath; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Target_drive.*; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Target_drive.backLeftPower; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Target_drive.backRightPower; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Target_drive.frontLeftPower; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Target_drive.frontRightPower; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EachMotorSet.drive; import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EachMotorSet.driveStop; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm.armMovements.armSet; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm.rotateButtons.armUseWithGamepad; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.openCloseButtons.clawUseWithGamepad; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.hardware.DistanceSensor; import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; -import org.firstinspires.ftc.teamcode.operations.inputs.DeviceNames; import org.firstinspires.ftc.teamcode.operations.Target_operations; +import org.firstinspires.ftc.teamcode.operations.inputs.DeviceNames; +import org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm.ConfigureArm; +import org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.ConfigureClaw; @TeleOp public class DriverControlled extends Target_operations { @@ -53,23 +59,20 @@ public void runOpMode() { @Override public void runInit() { mapMotors(hardwareMap, "fl","fr","bl","br"); + ConfigureArm.mapMotor(hardwareMap); + ConfigureClaw.mapServo(hardwareMap); forwardMotors(false,true,false,true); - // ConfigureMotorBar.mapMotor("bar"); - // this is commented because it might show an error sense this motor is not configured and can't be because the motor is not yet connected. - // ConfigureMotorPixel.mapMotor("pixel"); - // (hardwareMap, imu device name, logo, USB) imuGet(hardwareMap, DeviceNames.DEFAULT_IMU.hardwareMapName(), RIGHT.name(), UP.name()); initAprilTag(hardwareMap, DeviceNames.DEFAULT_CAMERA.hardwareMapName(), telemetry); try { sensorRange = hardwareMap.get(DistanceSensor.class, "eye"); rangePluggedIn = true; } - catch (Exception E){ + catch (Exception e){ rangePluggedIn = false; } - // ConfigureMotorPixel.mapMotor(hardwareMap, "pixel"); - // PixelMotorMovements.motorEncoder(); // pixel motor not connected + armSet(); } @Override @@ -84,15 +87,18 @@ public void runStart() { public void runLoop() { dpadMovements(gamepad1, speed); // sets waypoints to the d_pads's positions - // calling the joystickMovements method is not needed here because the program calls that method if there is no input found within the dpadMovements method + imuReset(gamepad1.options); // resets imu case of accidents or incidences fieldCentricMath(); // does the required math for Mecanum drive as well as getting imu for field centric telemetry.addData("bot heading: ", botHeading); + + // only display the distance sensor if it is plugged in if (rangePluggedIn) { telemetry.addData("distance ", sensorRange.getDistance(DistanceUnit.INCH)); } + telemetry.addData("position FL ", fl.getCurrentPosition()); telemetry.addData("position FR ", fr.getCurrentPosition()); telemetry.addData("position BL ", bl.getCurrentPosition()); @@ -100,25 +106,11 @@ public void runLoop() { telemetry.addData("degrees ", imu.getRobotYawPitchRollAngles().getYaw(AngleUnit.DEGREES)); telemetry.update(); - //convertPowerToEncoderUse(); - //runPixelMotor(gamepad2.a); - //runBarMotor(gamepad2.y); - // just guesses to how the code might look, this part of the robot has not been built yet. + clawUseWithGamepad(gamepad2); // using the claw (open/close) + armUseWithGamepad(gamepad2); // using the arm (rotation) drive(frontLeftPower,frontRightPower,backLeftPower,backRightPower); - // sets each motor to the speed given by the waypoints method - // odometer will fix issues with the robot not moving directly forward. - // ^ this is not a problem for TeleOp, but is a problem in autonomous. - - /* if (gamepad2.a) { - - PixelMotorMovements.rotate(100, 1); - } - else { - PixelMotorMovements.rotate(100, 0); - } - - */ + // sets each motor to the encoder counts given by the waypoints method } diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Gamepad2.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Gamepad2.java deleted file mode 100644 index 9e7bebd..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Gamepad2.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.firstinspires.ftc.teamcode.operations.inOut; - -import static org.firstinspires.ftc.teamcode.operations.Target_operations.barMotorConfig; -import static org.firstinspires.ftc.teamcode.operations.Target_operations.pixelMotorConfig; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.pixelMotor.Target_pixelMotor.pixelMotor; - -import org.firstinspires.ftc.teamcode.operations.outputs.motors.barMotor.BarMotorMovements; - -public class Gamepad2 { - - public static void runPixelMotor(boolean button) { - if (pixelMotorConfig) { - // this method runs the pixel motor if the given button is pressed - if (button) { - pixelMotor.setPower(1); - } - else { - pixelMotor.setPower(0); - } - } - } - - - public static void runBarMotor(boolean button) { - if (barMotorConfig) { - if (button) { - // rotates the bar motor when the button is pressed - BarMotorMovements.rotate(50,1); - } - } - } -} \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Target_inOut.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Target_inOut.java deleted file mode 100644 index a8fbdbb..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/Target_inOut.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.firstinspires.ftc.teamcode.operations.inOut; - -public class Target_inOut { - // momentarily empty. -} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/readme.md b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/readme.md deleted file mode 100644 index 02dc1b7..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/inOut/readme.md +++ /dev/null @@ -1,4 +0,0 @@ -# inOut -> Both inputs and outputs. - -Not very many .java files are held here. This folder is where code is put if it contains both strong inputs and outputs. Most code will be spit into either the input folder or the output folder, but programs put into this folder are both. \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/BarMotorMovements.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/BarMotorMovements.java deleted file mode 100644 index 7a06ab6..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/BarMotorMovements.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.firstinspires.ftc.teamcode.operations.outputs.motors.barMotor; - -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.barMotor.Target_barMotor.*; - -import com.qualcomm.robotcore.hardware.DcMotor; - -public class BarMotorMovements { - - public void motorEncoder () { - barMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER); - barMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); - barMotor.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE); - // uses the bar motor with encoder, and stops the motor and sets it on brake - } - - public static void rotate(int rotations, int speed) { - barMotor.setTargetPosition(rotations); - barMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION); - barMotor.setPower(speed); - } -} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/ConfigureMotorBar.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/ConfigureMotorBar.java deleted file mode 100644 index a5e3237..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/ConfigureMotorBar.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.firstinspires.ftc.teamcode.operations.outputs.motors.barMotor; - -import static org.firstinspires.ftc.teamcode.operations.Target_operations.barMotorConfig; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.barMotor.Target_barMotor.barMotor; - -import com.qualcomm.robotcore.hardware.HardwareMap; - -public class ConfigureMotorBar { - public static void mapMotor (HardwareMap hardwareMap, String motorName) { - barMotor = hardwareMap.dcMotor.get(motorName); - barMotorConfig = true; - // gets the bar motor from the driver station's hardware map - } - -} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/readme.md b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/readme.md deleted file mode 100644 index 82b9001..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/readme.md +++ /dev/null @@ -1,2 +0,0 @@ -# Bar Motor -This folder is where the motor that clings to the bars for hanging is configured and controlled. \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/ConfigureMotorPixel.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/ConfigureMotorPixel.java deleted file mode 100644 index 57268b1..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/ConfigureMotorPixel.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.firstinspires.ftc.teamcode.operations.outputs.motors.pixelMotor; - -import static org.firstinspires.ftc.teamcode.operations.Target_operations.pixelMotorConfig; -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.pixelMotor.Target_pixelMotor.*; - -import com.qualcomm.robotcore.hardware.HardwareMap; - -public class ConfigureMotorPixel { - - public static void mapMotor (HardwareMap hardwareMap, String motorName) { - pixelMotor = hardwareMap.dcMotor.get(motorName); - pixelMotorConfig = true; - // call the pixel motor from the hardware map - } - -} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/PixelMotorMovements.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/PixelMotorMovements.java deleted file mode 100644 index 93f8ad8..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/PixelMotorMovements.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.firstinspires.ftc.teamcode.operations.outputs.motors.pixelMotor; - -import static org.firstinspires.ftc.teamcode.operations.outputs.motors.pixelMotor.Target_pixelMotor.pixelMotor; - -import com.qualcomm.robotcore.hardware.DcMotor; - -public class PixelMotorMovements { - - public static void motorEncoder () { - pixelMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER); - pixelMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); - // use encoders with the pixel motor - } - - public static void rotate (int rotations, int power) { - pixelMotor.setTargetPosition(rotations); - pixelMotor.setMode(DcMotor.RunMode.RUN_TO_POSITION); - pixelMotor.setPower(power); - } - -} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/Target_pixelMotor.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/Target_pixelMotor.java deleted file mode 100644 index e0d1a6f..0000000 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/Target_pixelMotor.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.firstinspires.ftc.teamcode.operations.outputs.motors.pixelMotor; - -import com.qualcomm.robotcore.hardware.DcMotor; - -public class Target_pixelMotor { - public static DcMotor pixelMotor; -} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/Target_armLift.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/Target_armLift.java new file mode 100644 index 0000000..7ba2307 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/Target_armLift.java @@ -0,0 +1,4 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift; + +public class Target_armLift { +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/ConfigureArm.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/ConfigureArm.java new file mode 100644 index 0000000..b91ec4a --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/ConfigureArm.java @@ -0,0 +1,13 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm; + +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm.Target_arm.arm; + +import com.qualcomm.robotcore.hardware.HardwareMap; + +public class ConfigureArm { + + public static void mapMotor (HardwareMap hardwareMap) { + arm = hardwareMap.dcMotor.get("arm"); + } + +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/Target_barMotor.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/Target_arm.java similarity index 59% rename from TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/Target_barMotor.java rename to TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/Target_arm.java index 36a0874..5084c83 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/barMotor/Target_barMotor.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/Target_arm.java @@ -1,7 +1,7 @@ -package org.firstinspires.ftc.teamcode.operations.outputs.motors.barMotor; +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm; import com.qualcomm.robotcore.hardware.DcMotor; -public class Target_barMotor { - public static DcMotor barMotor; +public class Target_arm { + public static DcMotor arm; } diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/armMovements.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/armMovements.java new file mode 100644 index 0000000..d2afa78 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/armMovements.java @@ -0,0 +1,24 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm; + +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm.Target_arm.arm; + +import com.qualcomm.robotcore.hardware.DcMotor; + +public class armMovements { + + public static void armSet() { + arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER); + arm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); + } + + public static void armStop() { + arm.setPower(0); + arm.setZeroPowerBehavior(DcMotor.ZeroPowerBehavior.BRAKE); + } + + public static void rotateArm(int rotateAmount, double power) { + arm.setTargetPosition(rotateAmount); + arm.setPower(20*power); + arm.setMode(DcMotor.RunMode.RUN_TO_POSITION); + } +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/readme.md b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/readme.md similarity index 55% rename from TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/readme.md rename to TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/readme.md index 298656f..590761e 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/pixelMotor/readme.md +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/readme.md @@ -1,2 +1,2 @@ -# Pixel Motor -This is the project folder that contains all the programs for the motor that manages pixels. \ No newline at end of file +# Arm +This is the project folder that contains all the programs for the servo that controls the rotation of the arm. \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/rotateButtons.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/rotateButtons.java new file mode 100644 index 0000000..9182ad2 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/arm/rotateButtons.java @@ -0,0 +1,27 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm; + +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm.armMovements.armStop; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.armLift.arm.armMovements.rotateArm; + +import com.qualcomm.robotcore.hardware.Gamepad; + +public class rotateButtons { + private static int armRotation = 0; + public static void armUseWithGamepad(Gamepad gamepad){ + if (gamepad.left_bumper) { + armRotation -= 1; + rotateArm(armRotation,0.5); + } + else { + armStop(); + } + if (gamepad.right_bumper) { + armRotation += 1; + rotateArm(armRotation,0.5); + } + else { + armStop(); + } + + } +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/readme.md b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/readme.md new file mode 100644 index 0000000..4402c3f --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/armLift/readme.md @@ -0,0 +1,2 @@ +# Arm Lift +This is the project folder that contains all the programs for the servo that controls the movements of the arm lift. \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/ConfigureClaw.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/ConfigureClaw.java new file mode 100644 index 0000000..5afff82 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/ConfigureClaw.java @@ -0,0 +1,13 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw; + +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.Target_claw.claw; + +import com.qualcomm.robotcore.hardware.HardwareMap; + +public class ConfigureClaw { + + public static void mapServo (HardwareMap hardwareMap) { + claw = hardwareMap.servo.get("claw"); + } + +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/Target_claw.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/Target_claw.java new file mode 100644 index 0000000..7eadb6b --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/Target_claw.java @@ -0,0 +1,7 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw; + +import com.qualcomm.robotcore.hardware.Servo; + +public class Target_claw { + public static Servo claw; +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/clawMovements.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/clawMovements.java new file mode 100644 index 0000000..5228eba --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/clawMovements.java @@ -0,0 +1,27 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw; + +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.Target_claw.claw; + +public class clawMovements { + + private static int clawPosition = 0; + + public static void openClawSet () { + claw.setPosition(15); // open position + } + + public static void openClawAdd () { + clawPosition += 1; + claw.setPosition(clawPosition); // open position added + } + + public static void closeClawAdd () { + clawPosition -= 1; + claw.setPosition(clawPosition); // close position added + } + + public static void closeClawSet () { + claw.setPosition(5); // close position + } + +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/openCloseButtons.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/openCloseButtons.java new file mode 100644 index 0000000..4e71157 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/openCloseButtons.java @@ -0,0 +1,20 @@ +package org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw; +import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.clawMovements.*; +import com.qualcomm.robotcore.hardware.Gamepad; + +public class openCloseButtons { + public static void clawUseWithGamepad(Gamepad gamepad){ + if (gamepad.x) { // fully close claw + closeClawSet(); + } + if (gamepad.b) { // fully open claw + openClawSet(); + } + if (gamepad.y) { // gradually open claw + openClawAdd(); + } + if (gamepad.a) { // gradually close claw + closeClawAdd(); + } + } +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/readme.md b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/readme.md new file mode 100644 index 0000000..3e573f7 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/operations/outputs/motors/servos/claw/readme.md @@ -0,0 +1,2 @@ +# Claw +This is the project folder that contains all the programs for the servo that controls the opening and closing of the claw. \ No newline at end of file