Skip to content

Commit

Permalink
01/25/2022 Copies of autonomous for Shirley were made and adjusted fo…
Browse files Browse the repository at this point in the history
…r use at League Meet FIRST-Tech-Challenge#3 at Mojave High School
  • Loading branch information
Ghostjammer128 committed Jan 26, 2022
1 parent 2b7c7af commit bb3adeb
Show file tree
Hide file tree
Showing 8 changed files with 382 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package org.firstinspires.ftc.teamcode.mojave;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;

@Autonomous(name = "Shirley Blue Storage Unit Mojave")
@SuppressWarnings({"unused"})
public class AUTO_Shirley_Blue_Storage_Mojave extends LinearOpMode
{
private DcMotor frontDrive, backDrive, raiseClaw;
private Servo rotateClaw, claw;
private CRServo carousel;
private ElapsedTime runtime = new ElapsedTime();

@Override
public void runOpMode() throws InterruptedException
{
frontDrive = hardwareMap.get(DcMotor.class, "frontDrive");
backDrive = hardwareMap.get(DcMotor.class, "backDrive");
raiseClaw = hardwareMap.get(DcMotor.class, "raiseClaw");
rotateClaw = hardwareMap.get(Servo.class, "rotateClaw");
claw = hardwareMap.get(Servo.class, "claw");
carousel = hardwareMap.get(CRServo.class, "carousel");

frontDrive.setDirection(DcMotor.Direction.REVERSE);
backDrive.setDirection(DcMotor.Direction.FORWARD);
raiseClaw.setDirection(DcMotor.Direction.FORWARD);

telemetry.addData("Status", "Initialized");
telemetry.update();

//initialize claw
rotateClaw.setPosition(0.75);
claw.setPosition(1.0);

waitForStart();

//move awy from wall
frontDrive.setPower(0.5);
backDrive.setPower(0.5);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.2)
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

while(opModeIsActive() && runtime.seconds() < 0.5) telemetry.update();//pause

//turn towards storage unit
frontDrive.setPower(0.5);
backDrive.setPower(-0.5);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.2)
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//line up with wall
frontDrive.setPower(1.0);
backDrive.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.8)//previously 1.7, 1.4
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

while(opModeIsActive() && runtime.seconds() < 0.25) telemetry.update();

//angle to line up with carousel
frontDrive.setPower(-0.25);//prev -0.5
backDrive.setPower(0.25);//prev 0.5
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.7)//previously 0.95
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//drive back to meet carousel
frontDrive.setPower(-0.5);
backDrive.setPower(-0.5);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 2.6)//previously 2.6, 2.8
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//spin the carousel
frontDrive.setPower(-0.1);
//backDrive.setPower(-0.1);
carousel.setPower(-1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 10.00)
{
telemetry.update();
}
carousel.setPower(0.0);
frontDrive.setPower(0.0);
//backDrive.setPower(0.0);

//drive "completely in" to storage unit
frontDrive.setPower(1.0);
backDrive.setPower(0.4);//prev 0.5
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.75)//previously 0.6
{
telemetry.update();
}
backDrive.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.4)//previously 0.5
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.firstinspires.ftc.teamcode.mojave;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;

@Autonomous(name = "Shirley Blue Warehouse Mojave")
@SuppressWarnings({"unused"})
public class AUTO_Shirley_Blue_Warehouse_Mojave extends LinearOpMode
{
private DcMotor frontDrive, backDrive;
private Servo rotateClaw, claw;
private CRServo carousel;
private ElapsedTime runtime = new ElapsedTime();

@Override
public void runOpMode() throws InterruptedException
{
frontDrive = hardwareMap.get(DcMotor.class, "frontDrive");
backDrive = hardwareMap.get(DcMotor.class, "backDrive");
rotateClaw = hardwareMap.get(Servo.class, "rotateClaw");
carousel = hardwareMap.get(CRServo.class, "carousel");
claw = hardwareMap.get(Servo.class, "claw");

frontDrive.setDirection(DcMotor.Direction.REVERSE);
backDrive.setDirection(DcMotor.Direction.FORWARD);

telemetry.addData("Status", "Initialized");
telemetry.update();

waitForStart();

//turn towards warehouse
frontDrive.setPower(-1.0);
backDrive.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.5)//prev 0.4
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//drive "completely in" to storage unit
frontDrive.setPower(1.0);
backDrive.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 1.6)
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
package org.firstinspires.ftc.teamcode.mojave;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;

@Autonomous(name = "Shirley Red Storage Unit Mojave")
@SuppressWarnings({"unused"})
public class AUTO_Shirley_Red_Storage_Mojave extends LinearOpMode
{
private DcMotor frontDrive, backDrive, raiseClaw;
private Servo rotateClaw, claw;
private CRServo carousel;
private ElapsedTime runtime = new ElapsedTime();

@Override
public void runOpMode() throws InterruptedException
{
frontDrive = hardwareMap.get(DcMotor.class, "frontDrive");
backDrive = hardwareMap.get(DcMotor.class, "backDrive");
raiseClaw = hardwareMap.get(DcMotor.class, "raiseClaw");
rotateClaw = hardwareMap.get(Servo.class, "rotateClaw");
claw = hardwareMap.get(Servo.class, "claw");
carousel = hardwareMap.get(CRServo.class, "carousel");

frontDrive.setDirection(DcMotor.Direction.REVERSE);
backDrive.setDirection(DcMotor.Direction.FORWARD);
raiseClaw.setDirection(DcMotor.Direction.FORWARD);

telemetry.addData("Status", "Initialized");
telemetry.update();

//initialize claw
rotateClaw.setPosition(0.75);
claw.setPosition(1.0);

waitForStart();

//move awy from wall
frontDrive.setPower(0.5);
backDrive.setPower(0.5);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.2)
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

while(opModeIsActive() && runtime.seconds() < 0.5) telemetry.update();//pause

//turn towards storage unit
frontDrive.setPower(-0.5);
backDrive.setPower(0.5);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.2)
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//line up with wall
frontDrive.setPower(1.0);
backDrive.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 1.7)//previously 1.6,1.65
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//angle to line up with carousel
frontDrive.setPower(0.5);
backDrive.setPower(-0.5);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.7)//previously 0.55,0.6
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//drive back to meet carousel
frontDrive.setPower(-0.5);
backDrive.setPower(-0.5);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 2.6)//previously 1.3,1.7,2.0,2.3
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//spin the carousel
//frontDrive.setPower(-0.1);
backDrive.setPower(-0.1);
carousel.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 10.00)
{
telemetry.update();
}
carousel.setPower(0.0);
//frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//drive "completely in" to storage unit
frontDrive.setPower(1.0);
backDrive.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.75)//previously 0.6
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package org.firstinspires.ftc.teamcode.mojave;

import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import com.qualcomm.robotcore.hardware.CRServo;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;

@Autonomous(name = "Shirley Red Warehouse Mojave")
@SuppressWarnings({"unused"})
public class AUTO_Shirley_Red_Warehouse_Mojave extends LinearOpMode
{
private DcMotor frontDrive, backDrive;
private Servo rotateClaw, claw;
private CRServo carousel;
private ElapsedTime runtime = new ElapsedTime();

@Override
public void runOpMode() throws InterruptedException
{
frontDrive = hardwareMap.get(DcMotor.class, "frontDrive");
backDrive = hardwareMap.get(DcMotor.class, "backDrive");
rotateClaw = hardwareMap.get(Servo.class, "rotateClaw");
claw = hardwareMap.get(Servo.class, "claw");
carousel = hardwareMap.get(CRServo.class, "carousel");

frontDrive.setDirection(DcMotor.Direction.REVERSE);
backDrive.setDirection(DcMotor.Direction.FORWARD);

telemetry.addData("Status", "Initialized");
telemetry.update();

//initialize claw
rotateClaw.setPosition(0.75);
claw.setPosition(1.0);

waitForStart();

//turn towards warehouse
frontDrive.setPower(1.0);
backDrive.setPower(-1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 0.4)//0.35
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);

//drive "completely in" to storage unit
frontDrive.setPower(1.0);
backDrive.setPower(1.0);
runtime.reset();
while(opModeIsActive() && runtime.seconds() < 1.6)
{
telemetry.update();
}
frontDrive.setPower(0.0);
backDrive.setPower(0.0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.Servo;
import com.qualcomm.robotcore.util.ElapsedTime;

@Disabled
@Autonomous(name = "Shirley Blue Storage Unit BASE")
@SuppressWarnings({"unused"})
public class AUTO_Shirley_Blue1 extends LinearOpMode
Expand Down
Loading

0 comments on commit bb3adeb

Please sign in to comment.