Skip to content

Commit

Permalink
1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ToborUser committed Jan 27, 2024
1 parent 6bc58a4 commit 97185db
Show file tree
Hide file tree
Showing 28 changed files with 182 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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();
}
}
}
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.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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
Expand All @@ -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
Expand All @@ -84,41 +87,30 @@ 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());
telemetry.addData("position BR ", br.getCurrentPosition());
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

}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 97185db

Please sign in to comment.