Skip to content

Commit

Permalink
2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ToborUser committed Feb 4, 2024
1 parent 9f53f91 commit 8f82b6d
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ else if (hasBeenPressed) {

@Override
public void runStart() {
openClaw(0.5);
telemetry.addData("found: ", sensorRange.getDistance(DistanceUnit.INCH));
telemetry.update();
int scanTimes = 0;
Expand All @@ -135,9 +136,9 @@ public void runStart() {
telemetry.update();

closeClaw(); // close
sleep(500);
sleep(700);
// lift arm above ground, holding 1 pixel
rotateArm(400, 1);
rotateArm(100, 1);
sleep(1000);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ else if (hasBeenPressed) {

@Override
public void runStart() {
openClaw(0.5);
// guess that team prop is in middle
closeClaw();
sleep(2000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ else if (hasBeenPressed) {

@Override
public void runStart() {
openClaw(0.5);

// guess that team prop is in middle
strafeRightAuto(3,3,500); // away from rigging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ else if (hasBeenPressed) {

@Override
public void runStart() {
openClaw(0.5);
// guess that team prop is in middle
closeClaw();
sleep(2000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ else if (hasBeenPressed) {

@Override
public void runStart() {
openClaw(0.5);

telemetry.addData("found: ", sensorRange.getDistance(DistanceUnit.INCH));
telemetry.update();
Expand All @@ -129,9 +130,9 @@ public void runStart() {
telemetry.update();

closeClaw(); // close
sleep(500);
sleep(700);
// lift arm above ground, holding 1 pixel
rotateArm(400, 1);
rotateArm(100, 1);
sleep(1000);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ else if (hasBeenPressed) {

@Override
public void runStart() {
openClaw(0.5);

// guess that team prop is in middle
strafeLeftAuto(3,2,500); // away from rigging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.firstinspires.ftc.teamcode.operations.inputs.AprilTag.visionPortal;
import static org.firstinspires.ftc.teamcode.operations.inputs.Target_inputs.cameraConnected;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EachMotorSet.driveStop;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.clawMovements.openClaw;

import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DistanceSensor;
Expand Down Expand Up @@ -41,6 +42,7 @@ public void runInitLoop() {

@Override
public void runStart() {
openClaw(0.5);
//claw.setPosition(claw.getPosition()+2000);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fl;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.fr;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.definingDriveMovements.EachMotorSet.driveStop;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.clawMovements.openClaw;

import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
Expand Down Expand Up @@ -53,6 +54,7 @@ public void runStart() {
br.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
shaft.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
openClaw(0.5);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors;
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.extraSpeed;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Mecanum.fieldCentricMath;
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.servos.claw.Target_claw.claw;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.servos.claw.clawMovements.openClaw;

import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorEx;
Expand Down Expand Up @@ -64,7 +66,7 @@ public static void runLoopFieldCentric(Telemetry telemetry, Gamepad gamepad1, Ga
telemetry.addData("Distance in Inches: ",sensorRange.getDistance(DistanceUnit.INCH));

dpadMovements(gamepad1, speed); // sets waypoints to the d_pads's positions

extraSpeed(gamepad1);

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
Expand All @@ -87,7 +89,7 @@ public static void runLoopFieldCentric(Telemetry telemetry, Gamepad gamepad1, Ga
//clawUseWithGamepad(gamepad2); // using the claw (open/close)
//armUseWithGamepad(gamepad2); // using the arm (rotation)
//shaftUseWithGamepad(gamepad2); // using the shaft/lift (up/down)
drive(frontLeftPower,frontRightPower,backLeftPower,backRightPower);
drive(extraSpeed+frontLeftPower,extraSpeed+frontRightPower,extraSpeed+backLeftPower,extraSpeed+backRightPower);
// sets each motor to the encoder counts given by the waypoints method
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.ConfigureMotors.mapMotors;
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.extraSpeed;
import static org.firstinspires.ftc.teamcode.operations.outputs.motors.drive.Mecanum.robotCentricMath;
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;
Expand Down Expand Up @@ -70,7 +71,9 @@ public static void runLoopRobotCentric(Telemetry telemetry, Gamepad gamepad1, Ga
telemetry.addData("claw: ",claw.getPosition());
telemetry.addData("Distance in Inches: ",sensorRange.getDistance(DistanceUnit.INCH));
telemetry.addData("touch sensor", button.isPressed());

dpadMovements(gamepad1, speed); // sets waypoints to the d_pads's positions
extraSpeed(gamepad1);


imuReset(gamepad1.options); // resets imu case of accidents or incidences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.firstinspires.ftc.robotcore.external.navigation.AngleUnit;

public class Mecanum {
public static double extraSpeed;

public static double botHeading;
static double rotX;
Expand Down Expand Up @@ -51,6 +52,9 @@ public static void waypoints(double Y, double X, double RX) {
rx = RX;
}

public static void extraSpeed(Gamepad gamepad1) {
extraSpeed = gamepad1.right_trigger;
}
public static void dpadMovements(Gamepad gamepad1, double speed) {
// Mecanum using the dpad, if drivers want it, its there.
// how this works is it sets the x and y values depending on what button is pressed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
public class clawMovements {

public static void openClaw() {
claw.setPosition(1); // 0.5
claw.setPosition(0.9); // 0.5
}

public static void openClaw(double value) {
Expand Down

0 comments on commit 8f82b6d

Please sign in to comment.