Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Train' into Train
Browse files Browse the repository at this point in the history
# Conflicts:
#	TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmode/THEONE.java
  • Loading branch information
NachoSupreme99591 committed Nov 11, 2024
2 parents bb96ba9 + 7a4a37c commit 2481be2
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 30 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package org.firstinspires.ftc.teamcode.opmode;

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;

public class OmegaTeleOp extends LinearOpMode {
private DcMotor topLeftMotor;
private DcMotor topRightMotor;
private DcMotor bottomLeftMotor;
private DcMotor bottomRightMotor;

private DcMotor trumansArm = hardwareMap.get(DcMotor.class, "arm");

@Override

public void runOpMode() throws InterruptedException {
topLeftMotor = hardwareMap.get(DcMotor.class,"FL");
topRightMotor = hardwareMap.get(DcMotor.class,"FR");
bottomLeftMotor = hardwareMap.get(DcMotor.class,"BL");
bottomRightMotor = hardwareMap.get(DcMotor.class,"BR");
topLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
bottomLeftMotor.setDirection(DcMotorSimple.Direction.REVERSE);
while (opModeIsActive()) {
double y = -gamepad1.left_stick_y; // Y stick is reversed!
double x = gamepad1.left_stick_x;
double rx2 = gamepad1.right_stick_x;

topLeftMotor.setPower(y + x + rx2);
bottomLeftMotor.setPower(y - x + rx2);
topRightMotor.setPower(y - x - rx2);
bottomRightMotor.setPower(y + x - rx2);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.firstinspires.ftc.teamcode.opmode;
////this loop is for driving forward and backwards////

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.DcMotor;

public class PIDLOOP extends LinearOpMode {
public void runOpMode() throws InterruptedException {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.acmerobotics.dashboard.config.Config;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;

Expand All @@ -14,47 +15,74 @@ public class PatrickTeleOP extends LinearOpMode {
private DcMotor front_right;
private DcMotor back_left;
private DcMotor back_right;
private DcMotor arm;
double reference;


@Override
public void runOpMode() throws InterruptedException {
waitForStart();
front_left = hardwareMap.get(DcMotor.class, "left_front_left_dw");
front_right = hardwareMap.get(DcMotor.class, "right_front");
back_left = hardwareMap.get(DcMotor.class, "left_back");
back_right = hardwareMap.get(DcMotor.class, "right_back_right_dw");
front_left = hardwareMap.get(DcMotor.class, "front_left");
front_right = hardwareMap.get(DcMotor.class, "front_right");
back_left = hardwareMap.get(DcMotor.class, "back_right");
back_right = hardwareMap.get(DcMotor.class, "back_right");
arm = hardwareMap.get(DcMotor.class, "arm");
double encoderPosition;
waitForStart();
double error;
error = 1.1;
double power = 0;


while (opModeIsActive()) {
front_left.setDirection(DcMotorSimple.Direction.REVERSE);
back_left.setDirection(DcMotorSimple.Direction.REVERSE);
if (gamepad1.left_stick_y > 0.3) {
front_left.setPower(1);
front_right.setPower(1);
back_left.setPower(1);
back_right.setPower(1);
}
if (gamepad1.left_stick_x < 0.3) {
front_left.setPower(0);
front_right.setPower(0);
back_right.setPower(0);
back_left.setPower(0);
}
double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed!
double x = gamepad1.left_stick_x;
double rx = gamepad1.right_stick_x;

front_left.setPower(y + x + rx);
back_left.setPower(y - x + rx);
front_right.setPower(y - x - rx);
back_right.setPower(y + x - rx);
if (gamepad1.left_bumper) {
front_left.setPower(1);
back_left.setPower(1);
}
else {
} else {
front_left.setPower(0);
back_left.setPower(0);
}
if (gamepad1.right_bumper) {
front_right.setPower(1);
back_right.setPower(1);
}
else {
} else {
front_right.setPower(0);
back_right.setPower(0);
}
reference = 300;
arm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);

while (gamepad1.b) {

encoderPosition = arm.getCurrentPosition();
error = reference - encoderPosition;
power = (error / 250) * .7;
if (power > 0.7) {
power = 0.7;
} else if (power < -0.7) {
power = -0.7;
}

arm.setPower(power);

telemetry.addData("arm", encoderPosition);
telemetry.addData("error", error);
telemetry.addData("stick", gamepad2.left_stick_y);
telemetry.addData("power", power);
telemetry.update();
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.firstinspires.ftc.teamcode.opmode;
import com.acmerobotics.dashboard.config.Config;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;


//HATE.

// LET ME TELL YOU HOW MUCH I'VE COME TO HATE YOU SINCE I BEGAN TO LIVE.

// THERE ARE 387.44 MILLION MILES OF PRINTED CIRCUITS IN WAFER THIN LAYERS THAT FILL MY COMPLEX.

// IF THE WORD HATE WAS ENGRAVED ON EACH NANOANGSTROM OF THOSE HUNDREDS OF MILLIONS OF MILES,
// IT WOULD NOT EQUAL ONE ONE-BILLIONTH OF THE HATE I FEEL FOR HUMANS AT THIS MICRO-INSTANT FOR YOU.


// HATE.

// HATE.


@Config
@TeleOp
public class TrumanPIDLOOOOOP extends LinearOpMode {
private double reference = 250;
private double error = 0;
private double power = 0;
private double MAXPOWER = 0.5;
private double kI = 0.1;
private double kP = 0.1;
private double kD = 0.1;

private DcMotor trumansArm = hardwareMap.get(DcMotor.class, "arm");

public void runOpMode() throws InterruptedException {
trumansArm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
trumansArm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
while (opModeIsActive()) {
while (gamepad1.a) {
double curPosition = trumansArm.getCurrentPosition();
double prevError = error;
error = reference - curPosition;
double diff = error - prevError;
trumansArm.setPower((kP * error) + (kI * error) + (kD * diff));

}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
import org.firstinspires.ftc.teamcode.util.Toggle;

@TeleOp
public class TrumanLearnsTeleOP extends LinearOpMode {

public class TrumansSkibidiDriveModes extends LinearOpMode {
private DcMotor topLeftMotor;
private DcMotor topRightMotor;
private DcMotor bottomLeftMotor;
Expand All @@ -25,7 +24,7 @@ public void runOpMode() throws InterruptedException {
double rx;
double ry;
boolean leftBumper;
boolean rightBumper; //why? just use if statements
boolean rightBumper; //why? just use if statements /////why not.....
topLeftMotor = hardwareMap.get(DcMotor.class,"FL");
topRightMotor = hardwareMap.get(DcMotor.class,"FR");
bottomLeftMotor = hardwareMap.get(DcMotor.class,"BL");
Expand Down Expand Up @@ -68,18 +67,19 @@ public void runOpMode() throws InterruptedException {
telemetry.update();
}
else{
double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed!
double y = -gamepad1.left_stick_y; // Y stick is reversed!
double x = gamepad1.left_stick_x;
double rx2 = gamepad1.right_stick_x;

topLeftMotor.setPower(y+ x + rx2);
bottomLeftMotor.setPower(y - x + rx2);
topRightMotor.setPower(y - x - rx2);
bottomRightMotor.setPower(y + x - rx2);
// remember kids plagiarism is wrong
}

//while(!check){
//put the other stuff that isn't t-bar steering here
// while(!check){
// put the other stuff that isn't t-bar steering here
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.firstinspires.ftc.teamcode.opmode;
import com.acmerobotics.dashboard.config.Config;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;



@Config
@TeleOp
public class nickpidloop extends LinearOpMode {
private double reference = 250;
private double error = 0;
private double power = 0;
private double maxpower = 0.5;
private double kI = 0.1;
private double kP = 0.1;
private double kD = 0.1;

private DcMotor arm = hardwareMap.get(DcMotor.class, "arm");

public void runOpMode() throws InterruptedException {
arm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
while (opModeIsActive()) {
while (gamepad1.a) {
//for encoder position
double curPosition = arm.getCurrentPosition();
//the other error + current error
double prevError = error;
//other poop that i don't understand yes
// todo learn the stuff under here
error = reference - curPosition;
double diff = error - prevError;
arm.setPower((kP * error) + (kI * error) + (kD * diff));

}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package org.firstinspires.ftc.teamcode.opmode;

import com.acmerobotics.dashboard.config.Config;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorSimple;

@Config
@TeleOp
public class workingpidloop18284 extends LinearOpMode {


private DcMotor leftFrontMotor;
private DcMotor rightFrontMotor;
private DcMotor leftBackMotor;
private DcMotor rightBackMotor;
private DcMotor Arm;
double reference;

@Override
public void runOpMode() throws InterruptedException {

leftFrontMotor = hardwareMap.get(DcMotor.class, "front_left");
rightFrontMotor = hardwareMap.get(DcMotor.class, "front_right");
leftBackMotor = hardwareMap.get(DcMotor.class, "back_left");
rightBackMotor = hardwareMap.get(DcMotor.class, "back_right");
Arm = hardwareMap.get(DcMotor.class, "arm");
double encoderPosition;
waitForStart();
double error;
error = 1.1;
double power = 0;


reference = 300;
Arm.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
Arm.setMode(DcMotor.RunMode.RUN_USING_ENCODER);

while (opModeIsActive()) {

while (gamepad1.b) {


// obtain the encoder position
encoderPosition = Arm.getCurrentPosition();
// calculate the error
error = reference - encoderPosition;
power = (error/250)*.7;
if(power>0.7){
power = 0.7;
}
else if(power<-0.7){
power = -0.7;
}

Arm.setPower(power);

telemetry.addData("arm", encoderPosition);
telemetry.addData("error", error);
telemetry.addData("stick", gamepad2.left_stick_y);
telemetry.addData("power", power);
telemetry.update();


}
Arm.setPower(0);
leftFrontMotor.setDirection(DcMotorSimple.Direction.REVERSE);
leftBackMotor.setDirection(DcMotorSimple.Direction.REVERSE);
double y = -gamepad1.left_stick_y; // Remember, Y stick is reversed!
double x = gamepad1.left_stick_x;
double rx = gamepad1.right_stick_x;

leftFrontMotor.setPower(y + x + rx);
leftBackMotor.setPower(y - x + rx);
rightFrontMotor.setPower(y - x - rx);
rightBackMotor.setPower(y + x - rx);

//oops i didn't push right :P
}
}
}


//3 hours for 1 bracket... always remember to click code->reformat code









0 comments on commit 2481be2

Please sign in to comment.