diff --git a/FtcRobotController/build.gradle b/FtcRobotController/build.gradle index e9a3e34..9fa2169 100644 --- a/FtcRobotController/build.gradle +++ b/FtcRobotController/build.gradle @@ -18,11 +18,11 @@ android { buildConfig = true } - compileSdk 34 + compileSdkVersion 30 compileOptions { - sourceCompatibility JavaVersion.VERSION_21 - targetCompatibility JavaVersion.VERSION_21 + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 } namespace = 'com.qualcomm.ftcrobotcontroller' } diff --git a/FtcRobotController/src/main/AndroidManifest.xml b/FtcRobotController/src/main/AndroidManifest.xml index 1ce6a3e..24038bf 100644 --- a/FtcRobotController/src/main/AndroidManifest.xml +++ b/FtcRobotController/src/main/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="58" + android:versionName="10.2"> diff --git a/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/MainTele.java b/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/MainTele.java index 5c60165..010ee26 100644 --- a/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/MainTele.java +++ b/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/MainTele.java @@ -1,6 +1,7 @@ package vcsc.teamcode.opmodes.tele; import com.pedropathing.localization.Pose; +import com.qualcomm.robotcore.eventloop.opmode.Disabled; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import vcsc.core.util.GamepadButton; diff --git a/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/Outreach.java b/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/Outreach.java index ecf4348..0e7754c 100644 --- a/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/Outreach.java +++ b/TeamCode/src/main/java/vcsc/teamcode/opmodes/tele/Outreach.java @@ -1,40 +1,76 @@ package vcsc.teamcode.opmodes.tele; -//Drive-only opmode for outreach events, Undertow V1 - -import com.pedropathing.localization.Pose; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; -import vcsc.teamcode.opmodes.base.BaseOpMode; +import com.qualcomm.robotcore.eventloop.opmode.OpMode; +import com.qualcomm.robotcore.hardware.DcMotor; +import com.qualcomm.robotcore.hardware.DcMotorSimple; + +import com.acmerobotics.dashboard.FtcDashboard; +import com.acmerobotics.dashboard.config.Config; + +@Config +@TeleOp(name = "OutreachTele", group = "Outreach") +public class Outreach extends OpMode { + + private DcMotor frontLeft, frontRight, backLeft, backRight; -@TeleOp(name = "OutreachTele", group = "Main") -public class Outreach extends BaseOpMode { - final double DEFAULT_TURN_SPEED = 0.5; - final double DEFAULT_DRIVE_SPEED = 1; - double driveSpeed = DEFAULT_DRIVE_SPEED; - double turnSpeed = DEFAULT_TURN_SPEED; + public static double driveSpeed = 0.50; // we can change this via dash @Override public void init() { - super.init(); - follower.setStartingPose(new Pose(0, 0, 0)); - } + telemetry.addLine("Hello user, thank you for taking the time to try our robot!"); + telemetry.addLine("Use the left stick to move the bot (forward/backward/move sideways)."); + telemetry.addLine("Use the right stick to rotate the bot."); + telemetry.addLine("Robot is initializing..."); + telemetry.addLine(""); + telemetry.update(); + + // Init those REV motors + frontLeft = hardwareMap.get(DcMotor.class, "frontLeft"); + frontRight = hardwareMap.get(DcMotor.class, "frontRight"); + backLeft = hardwareMap.get(DcMotor.class, "backLeft"); + backRight = hardwareMap.get(DcMotor.class, "backRight"); + + // Set motor directions for now + frontLeft.setDirection(DcMotorSimple.Direction.REVERSE); + backLeft.setDirection(DcMotorSimple.Direction.REVERSE); + frontRight.setDirection(DcMotorSimple.Direction.FORWARD); + backRight.setDirection(DcMotorSimple.Direction.FORWARD); + + telemetry.addLine("✅ Initialization complete! Click start to begin driving."); + telemetry.update(); - @Override - public void start() { - super.start(); } @Override public void loop() { - super.loop(); - - follower.setTeleOpMovementVectors(-gamepad1.left_stick_y * driveSpeed, -gamepad1.left_stick_x * driveSpeed, -gamepad1.right_stick_x * turnSpeed, true); -// drive.setDrivePowers(new PoseVelocity2d( -// new Vector2d( -// -gamepad1.left_stick_y * driveSpeed, -// -gamepad1.left_stick_x * driveSpeed -// ), -// -gamepad1.right_stick_x * turnSpeed -// )); + double y = gamepad1.left_stick_y * driveSpeed; // forward/backward + double x = -gamepad1.left_stick_x * driveSpeed; // strafe + double rx = -gamepad1.right_stick_x * driveSpeed; // rotate + + // Calculate Mecanum Drive values for existance + double fl = y + x + rx; + double bl = y - x + rx; + double fr = y - x - rx; + double br = y + x - rx; + + double max = Math.max(Math.abs(fl), Math.max(Math.abs(bl), Math.max(Math.abs(fr), Math.abs(br)))); + if (max > 1.0) { + fl /= max; + bl /= max; + fr /= max; + br /= max; } + + frontLeft.setPower(fl); + backLeft.setPower(bl); + frontRight.setPower(fr); + backRight.setPower(br); + + telemetry.addLine("Hello user, thank you for taking the time to try our robot!"); + telemetry.addLine("Use the left stick to move the bot (forward/backward/move sideways)."); + telemetry.addLine("Use the right stick to rotate the bot."); + telemetry.addData("Your speed for safety is limited to", "%.0f%%", driveSpeed * 100); + telemetry.update(); } +} diff --git a/build.dependencies.gradle b/build.dependencies.gradle index f2083c3..df48fe0 100644 --- a/build.dependencies.gradle +++ b/build.dependencies.gradle @@ -6,14 +6,14 @@ repositories { } dependencies { - implementation 'org.firstinspires.ftc:Inspection:10.1.1' - implementation 'org.firstinspires.ftc:Blocks:10.1.1' - implementation 'org.firstinspires.ftc:RobotCore:10.1.1' - implementation 'org.firstinspires.ftc:RobotServer:10.1.1' - implementation 'org.firstinspires.ftc:OnBotJava:10.1.1' - implementation 'org.firstinspires.ftc:Hardware:10.1.1' - implementation 'org.firstinspires.ftc:FtcCommon:10.1.1' - implementation 'org.firstinspires.ftc:Vision:10.1.1' + implementation 'org.firstinspires.ftc:Inspection:10.2.0' + implementation 'org.firstinspires.ftc:Blocks:10.2.0' + implementation 'org.firstinspires.ftc:RobotCore:10.2.0' + implementation 'org.firstinspires.ftc:RobotServer:10.2.0' + implementation 'org.firstinspires.ftc:OnBotJava:10.2.0' + implementation 'org.firstinspires.ftc:Hardware:10.2.0' + implementation 'org.firstinspires.ftc:FtcCommon:10.2.0' + implementation 'org.firstinspires.ftc:Vision:10.2.0' implementation 'androidx.appcompat:appcompat:1.7.0' implementation 'com.pedropathing:pedro:1.0.8' implementation 'com.acmerobotics.dashboard:dashboard:0.4.16'