diff --git a/MeepMeepTesting/build.gradle b/MeepMeepTesting/build.gradle index 58f8523..cb8c197 100644 --- a/MeepMeepTesting/build.gradle +++ b/MeepMeepTesting/build.gradle @@ -3,8 +3,8 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } repositories { diff --git a/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepTesting.java b/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepBlueSide.java similarity index 57% rename from MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepTesting.java rename to MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepBlueSide.java index df3e744..e74570a 100644 --- a/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepTesting.java +++ b/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepBlueSide.java @@ -6,22 +6,35 @@ import org.rowlandhall.meepmeep.roadrunner.DefaultBotBuilder; import org.rowlandhall.meepmeep.roadrunner.entity.RoadRunnerBotEntity; -public class MeepMeepTesting { +public class MeepMeepBlueSide { public static void main(String[] args) { MeepMeep meepMeep = new MeepMeep(800); RoadRunnerBotEntity myBot = new DefaultBotBuilder(meepMeep) // Set bot constraints: maxVel, maxAccel, maxAngVel, maxAngAccel, track width .setConstraints(60, 60, Math.toRadians(180), Math.toRadians(180), 15) - .followTrajectorySequence(drive -> drive.trajectorySequenceBuilder(new Pose2d(0, 0, 0)) - .forward(30) - .turn(Math.toRadians(90)) - .forward(30) - .turn(Math.toRadians(90)) - .forward(30) - .turn(Math.toRadians(90)) + .followTrajectorySequence(drive -> drive.trajectorySequenceBuilder(new Pose2d(35, 62.5, Math.toRadians(0))) + .forward(20) + .back(8) + .turn(Math.toRadians(-90)) .forward(30) + .back(30) .turn(Math.toRadians(90)) + .forward(8) + .back(8) + .strafeRight(37) + .forward(5) + .back(5) + .strafeLeft(37) + .forward(8) + .back(8) + .strafeRight(37) + .forward(12) + .back(12) + .strafeLeft(37) + .forward(6) + .back(110) + .build()); diff --git a/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepRedSide.java b/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepRedSide.java new file mode 100644 index 0000000..d2120b7 --- /dev/null +++ b/MeepMeepTesting/src/main/java/com/example/meepmeeptesting/MeepMeepRedSide.java @@ -0,0 +1,47 @@ +package com.example.meepmeeptesting; + +import com.acmerobotics.roadrunner.geometry.Pose2d; + +import org.rowlandhall.meepmeep.MeepMeep; +import org.rowlandhall.meepmeep.roadrunner.DefaultBotBuilder; +import org.rowlandhall.meepmeep.roadrunner.entity.RoadRunnerBotEntity; + +public class MeepMeepRedSide { + public static void main(String[] args) { + MeepMeep meepMeep = new MeepMeep(800); + + RoadRunnerBotEntity myBot = new DefaultBotBuilder(meepMeep) + // Set bot constraints: maxVel, maxAccel, maxAngVel, maxAngAccel, track width + .setConstraints(60, 60, Math.toRadians(180), Math.toRadians(180), 15) + .followTrajectorySequence(drive -> drive.trajectorySequenceBuilder(new Pose2d(-35, -62.5, Math.toRadians(180))) + .forward(20) + .back(8) + .turn(Math.toRadians(-90)) + .forward(30) + .back(30) + .turn(Math.toRadians(90)) + .forward(8) + .back(8) + .strafeRight(37) + .forward(5) + .back(5) + .strafeLeft(37) + .forward(8) + .back(8) + .strafeRight(37) + .forward(12) + .back(12) + .strafeLeft(37) + .forward(6) + .back(110) + + .build()); + + + meepMeep.setBackground(MeepMeep.Background.FIELD_INTOTHEDEEP_JUICE_DARK) + .setDarkMode(true) + .setBackgroundAlpha(0.95f) + .addEntity(myBot) + .start(); + } +} \ No newline at end of file diff --git a/TeamCode/.classpath b/TeamCode/.classpath index 0b62ab9..0a3280e 100644 --- a/TeamCode/.classpath +++ b/TeamCode/.classpath @@ -1,6 +1,6 @@ - + diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/HWC.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/HWC.java index ca4f4f3..32fbafe 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/HWC.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/HWC.java @@ -20,7 +20,7 @@ public class HWC { // Declare empty variables for robot hardware public DcMotorEx leftFront, rightFront, leftRear, rightRear, rightSlide, leftSlide; //TODO: CHANGE TO NORMAL SERVO - public Servo claw; + public Servo claw, joint, arm; // Other Variables @@ -32,7 +32,7 @@ public class HWC { Telemetry telemetry; ElapsedTime time = new ElapsedTime(); - + ElapsedTime sleepTimer = new ElapsedTime(); /** * Constructor for HWC, declares all hardware components * @@ -54,17 +54,23 @@ public HWC(@NonNull HardwareMap hardwareMap, Telemetry telemetry) { //Declare Servos claw = hardwareMap.get(Servo.class, "claw"); + arm = hardwareMap.get(Servo.class,"arm"); + joint = hardwareMap.get(Servo.class, "joint"); // Set the direction of motors // TODO: UPDATE VALUES WITH NEW BOT - leftFront.setDirection(DcMotorEx.Direction.REVERSE); + leftFront.setDirection(DcMotorEx.Direction.FORWARD); rightFront.setDirection(DcMotorEx.Direction.FORWARD); leftRear.setDirection(DcMotorEx.Direction.FORWARD); rightRear.setDirection(DcMotorEx.Direction.FORWARD); + //Set direction of other motors + // leftSlide.setDirection(DcMotorEx.Direction.FORWARD); + //rightSlide.setDirection(DcMotorEx.Direction.FORWARD); + // Set motors to break when power = 0 // TODO: REMOVE IF THIS BEHAVIOUR IS NOT DESIRED ON NEW BOT leftFront.setZeroPowerBehavior(DcMotorEx.ZeroPowerBehavior.BRAKE); @@ -87,4 +93,8 @@ public HWC(@NonNull HardwareMap hardwareMap, Telemetry telemetry) { leftSlide.setMode(DcMotor.RunMode.RUN_USING_ENCODER); } // TODO: ADD ANY HARDWARE RELATED FUNCTIONS BELOW + + public static void betterSleep(double secs){ + + } } \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/TestPipeline.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/TestPipeline.java new file mode 100644 index 0000000..71fd742 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/TestPipeline.java @@ -0,0 +1,13 @@ +package org.firstinspires.ftc.teamcode.subsystems; + +import org.opencv.core.Mat; +import org.openftc.easyopencv.OpenCvPipeline; + +class TestPipeline extends OpenCvPipeline +{ + @Override + public Mat processFrame(Mat input) + { + return input; + } +} \ No newline at end of file diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/VisionTesting.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/VisionTesting.java new file mode 100644 index 0000000..07cb399 --- /dev/null +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/subsystems/VisionTesting.java @@ -0,0 +1,48 @@ +package org.firstinspires.ftc.teamcode.subsystems; + +import org.firstinspires.ftc.robotcore.external.hardware.camera.WebcamName; +import androidx.annotation.NonNull; +import com.qualcomm.robotcore.hardware.DcMotor; +import com.qualcomm.robotcore.hardware.DcMotorEx; +import com.qualcomm.robotcore.hardware.DcMotorSimple; +import com.qualcomm.robotcore.hardware.HardwareMap; +import com.qualcomm.robotcore.util.ElapsedTime; + +import org.firstinspires.ftc.robotcore.external.Telemetry; +import org.openftc.easyopencv.OpenCvCamera; +import org.openftc.easyopencv.OpenCvCameraFactory; +import org.openftc.easyopencv.OpenCvCameraRotation; + +public class VisionTesting +{ + + public VisionTesting(HardwareMap hardwareMap) { + //TODO: Find a value for this??? + int cameraId = 0; + //initializes open cv camera + WebcamName cam = hardwareMap.get(WebcamName.class, "NAME_OF_CAMERA_IN_CONFIG_FILE"); + OpenCvCamera camera = OpenCvCameraFactory.getInstance().createWebcam(cam, cameraId); + + camera.openCameraDeviceAsync(new OpenCvCamera.AsyncCameraOpenListener() + { + @Override + public void onOpened() + { + + // camera.setPipeline(yourPipeline); + camera.startStreaming(320, 240, OpenCvCameraRotation.UPRIGHT); + } + @Override + public void onError(int errorCode) + { + /* + * This will be called if the camera could not be opened + */ + } + }); + + + } + + +} diff --git a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/InitialTeleOp.java b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/InitialTeleOp.java index 53e8ee5..d275ac5 100644 --- a/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/InitialTeleOp.java +++ b/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/teleop/InitialTeleOp.java @@ -11,7 +11,9 @@ * TeleOp OpMode for simply driving with strafing wheels * Look at JAVA DOC! */ + @TeleOp(name = "INIT TELEOP", group = "Iterative OpMode") + public class InitialTeleOp extends OpMode { private final ElapsedTime time = new ElapsedTime(); HWC robot; // Declare the object for HWC, will allow us to access all the motors declared there! @@ -111,6 +113,7 @@ public void loop() { robot.previousGamepad1.copy(robot.currentGamepad1); robot.currentGamepad1.copy(gamepad1); + // Calculate drive power double drive = -robot.currentGamepad1.left_stick_y * driveSpeed; double strafe = robot.currentGamepad1.left_stick_x * strafeSpeed;