From 5681ae33b37189e7663205766841a4d400cf0c72 Mon Sep 17 00:00:00 2001 From: "Logan G. Minto" Date: Thu, 15 Mar 2018 20:26:44 -0400 Subject: [PATCH] yeet dab fam maker fair stuff --- .../chawks/teleop/HolonomicTankKBottt.java | 2 +- .../main/java/chawks/teleop/KBotTheTank.java | 26 +++---- .../teleop/NextGenHolonomicWIthLift.java | 2 +- .../java/chawks/teleop/NextGenMakerFar.java | 68 +++++++++++++++++++ 4 files changed, 83 insertions(+), 15 deletions(-) create mode 100644 FtcRobotController/src/main/java/chawks/teleop/NextGenMakerFar.java diff --git a/FtcRobotController/src/main/java/chawks/teleop/HolonomicTankKBottt.java b/FtcRobotController/src/main/java/chawks/teleop/HolonomicTankKBottt.java index a4f96d0..fb904f3 100644 --- a/FtcRobotController/src/main/java/chawks/teleop/HolonomicTankKBottt.java +++ b/FtcRobotController/src/main/java/chawks/teleop/HolonomicTankKBottt.java @@ -8,7 +8,7 @@ import chawks.hardware.DrivingDirection; @TeleOp(name = "Holonomic Tank KBottt", group = "TeleOp") -@Disabled + public class HolonomicTankKBottt extends KBotTheTank { /** * The value "K" should never equal or be less than 0 as there will be no clockwise movement diff --git a/FtcRobotController/src/main/java/chawks/teleop/KBotTheTank.java b/FtcRobotController/src/main/java/chawks/teleop/KBotTheTank.java index 5ffa9ab..85c39c2 100644 --- a/FtcRobotController/src/main/java/chawks/teleop/KBotTheTank.java +++ b/FtcRobotController/src/main/java/chawks/teleop/KBotTheTank.java @@ -9,7 +9,7 @@ //import chawks.hardware.ShootingController; @TeleOp(name = "KBOT DA TANK", group = "TeleOp") -@Disabled + public class KBotTheTank extends AbstractTeleOpKBot { @@ -56,10 +56,10 @@ public void handleGamePad1(Gamepad gamepad) { rightPower = -STRAFE_SPEED; break; } - robot.LFMotor.setPower(leftPower); - robot.RFMotor.setPower(rightPower); - robot.LBMotor.setPower(-leftPower); - robot.RBMotor.setPower(-rightPower); + robot.LFMotor.setPower(leftPower/4); + robot.RFMotor.setPower(rightPower/4); + robot.LBMotor.setPower(-leftPower/4); + robot.RBMotor.setPower(-rightPower/4); return; } else if (isDPADRight) { float leftPower; @@ -76,10 +76,10 @@ public void handleGamePad1(Gamepad gamepad) { break; } - robot.LFMotor.setPower(leftPower); - robot.RFMotor.setPower(rightPower); - robot.LBMotor.setPower(-leftPower); - robot.RBMotor.setPower(-rightPower); + robot.LFMotor.setPower(leftPower/4); + robot.RFMotor.setPower(rightPower/4); + robot.LBMotor.setPower(-leftPower/4); + robot.RBMotor.setPower(-rightPower/4); return; } @@ -102,10 +102,10 @@ public void handleGamePad1(Gamepad gamepad) { break; } - robot.LBMotor.setPower(leftPower); - robot.LFMotor.setPower(leftPower); - robot.RFMotor.setPower(rightPower); - robot.RBMotor.setPower(rightPower); + robot.LBMotor.setPower(leftPower/4); + robot.LFMotor.setPower(leftPower/4); + robot.RFMotor.setPower(rightPower/4); + robot.RBMotor.setPower(rightPower/4); } diff --git a/FtcRobotController/src/main/java/chawks/teleop/NextGenHolonomicWIthLift.java b/FtcRobotController/src/main/java/chawks/teleop/NextGenHolonomicWIthLift.java index ea66b69..a217a9d 100644 --- a/FtcRobotController/src/main/java/chawks/teleop/NextGenHolonomicWIthLift.java +++ b/FtcRobotController/src/main/java/chawks/teleop/NextGenHolonomicWIthLift.java @@ -168,7 +168,7 @@ else if(isButtonA) { robot.Elevate.setPower(0); } } - +//qwertyuiop /*if (isDpadUp && !MRLimitSwitch.getState()){ robot.Elevate.setPower(.5); diff --git a/FtcRobotController/src/main/java/chawks/teleop/NextGenMakerFar.java b/FtcRobotController/src/main/java/chawks/teleop/NextGenMakerFar.java new file mode 100644 index 0000000..bd39efd --- /dev/null +++ b/FtcRobotController/src/main/java/chawks/teleop/NextGenMakerFar.java @@ -0,0 +1,68 @@ +package chawks.teleop; + +import com.qualcomm.robotcore.eventloop.opmode.TeleOp; +import com.qualcomm.robotcore.hardware.DcMotor; +import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; +import com.qualcomm.robotcore.hardware.Gamepad; +//import chawks.hardware.ShootingController; + +@TeleOp(name = "NextGenMakerFar", group = "StatesTeleOp") +//@Disabled +public class NextGenMakerFar extends AbstractTeleOpNextGen { + //A Digital Input. + //DigitalChannel MRLimitSwitch; + //CDI. Using this, we can read any digital sensor on this CDI without creating an instance for each sensor. + + DeviceInterfaceModule cdi; + + public void init() { + //telemetry.addData("Entering Init","YAy"); + //telemetry.update(); + super.init(); + while (robot.LimitSwitch.getState() == true) { + //telemetry.addData("Resetting:","Encoder"); + //telemetry.update(); + robot.Elevate.setPower(-0.175); + /*if (opModeIsActive() == false) { + robot.Elevate.setPower(0); + return; + }*/ + } + while (robot.LimitSwitchTilt.getState() == true) { + robot.Lift_Tilt.setPower(-0.4); + } + telemetry.addData("Switch touched Tilt", "o"); + robot.Elevate.setPower(0); + robot.Lift_Tilt.setPower(0); + robot.Lift_Tilt.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); + robot.Lift_Tilt.setMode(DcMotor.RunMode.RUN_TO_POSITION); + robot.Elevate.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER); + robot.Elevate.setMode(DcMotor.RunMode.RUN_TO_POSITION); + } + + public float STRAFE_SPEED = 1.0F; //setting to a higher speed + + + @Override + public void handleGamePad1(Gamepad gamepad) { + double r = Math.hypot(gamepad.left_stick_x, gamepad.left_stick_y); + double robotAngle = Math.atan2(gamepad.left_stick_y, gamepad.left_stick_x) - Math.PI / 4; + double rightX = gamepad.right_stick_x; + final double v1 = r * Math.cos(robotAngle) - rightX; + final double v2 = r * Math.sin(robotAngle) + rightX; + final double v3 = r * Math.sin(robotAngle) - rightX; + final double v4 = r * Math.cos(robotAngle) + rightX; + + + robot.LFMotor.setPower(v3); + robot.RFMotor.setPower(v4); + robot.LBMotor.setPower(v1); + robot.RBMotor.setPower(v2); + } + public void handleGamePad2(Gamepad gamepad){ + + } + + +} +