Skip to content

Commit

Permalink
12/21/2020
Browse files Browse the repository at this point in the history
  • Loading branch information
aashrithbandaru committed Dec 21, 2020
1 parent 823482c commit ef03d61
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 141 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ public void runOpModeImpl() {
while(true) {
// Gamepad 1 controls:

if (gamepad2.a)
while (gamepad2.a) {
intake.setPower(1);
}
else{
intake.setPower(0);
}

if (gamepad2.x) {
intake.setPower(1);
}

if (gamepad2.y) {
intake.setPower(0);
}



// Left trigger - to move left sideways
strafeRight(-gamepad1.right_trigger, 0);

Expand All @@ -46,38 +64,6 @@ public void runOpModeImpl() {

// left bumper - to close claw (front servo)

if(gamepad2.a){
intake.setPower(1);
}

if (gamepad2.dpad_up) {

arm.setPosition(1);
sleep(100);
telemetry.addData("front servo open", "clawposition: 0.4" );
}

// right bumper - to open claw (front servo)
if (gamepad2.dpad_down) {

arm.setPosition(0.0);
sleep(100);
telemetry.addData("front servo closed", "clawposition: 0.1" );
}

if (gamepad2.dpad_left) {

clamp.setPosition(1);
sleep(100);
telemetry.addData("front servo closed", "clawposition: 0.1" );
}

if (gamepad2.dpad_right) {

clamp.setPosition(0.0);
sleep(100);
telemetry.addData("front servo closed", "clawposition: 0.1" );
}
/*
// Gamepad 2 Controls
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public class Forward extends Movement {
waitForStart();
runtime.reset();

strafeRight(1, 20);
sleep(50);

goForward(1, 20);
/*sense*/
goForward(1, 20);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ abstract class IntakeClass extends LinearOpMode
{

protected DcMotor intake;
protected DcMotor shooter;
protected DcMotor hopper;



protected Servo arm;
protected Servo clamp;

boolean hoppertrue = true;
boolean shootertrue = true;
boolean intaketrue = true;

public void runOpMode() {
setupDriveMotors();
Expand All @@ -37,20 +26,13 @@ protected void setupDriveMotors() {

updateTelemetryMessage("Initializing Motors");
intake = hardwareMap.get(DcMotor.class, "intake");
shooter = hardwareMap.get(DcMotor.class, "shooter");
hopper = hardwareMap.get(DcMotor.class, "hopper");

//Servos
arm = hardwareMap.get(Servo.class, "arm");
clamp = hardwareMap.get(Servo.class, "clamp");


// Most robots need the motor on one side to be reve`rsed to drive goBackward
// Reverse the motor that runs backwards when connected directly to the battery

intake.setDirection(DcMotor.Direction.FORWARD);
shooter.setDirection(DcMotor.Direction.FORWARD);
hopper.setDirection(DcMotor.Direction.REVERSE);


/* */

Expand Down Expand Up @@ -100,35 +82,7 @@ public void intake(final double intakepower, final int duration){
sleep(duration);
}

public void shooter(final double intakepower, final int duration){
shooter.setPower(intakepower);
sleep(duration);
}

public void hopper(final double intakepower, final int duration){
hopper.setPower(intakepower);
sleep(duration);
}

public void armdown() {
arm.setPosition(1);
sleep(200);
}

public void armup() {
arm.setPosition(0);
sleep(200);
}

public void clampdown() {
clamp.setPosition(1);
sleep(200);
}

public void clampup() {
clamp.setPosition(0);
sleep(200);
}

/*
public void armUp(final double armpower, final int duration) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,8 @@ abstract class Movement extends LinearOpMode
protected DcMotor rightFront;
protected DcMotor leftBack;
protected DcMotor rightBack;
protected DcMotor shooter;
protected DcMotor hopper;
protected DcMotor intake;

protected Servo arm;
protected Servo clamp;

public void runOpMode() {
setupDriveMotors();
runOpModeImpl();
Expand All @@ -37,8 +32,6 @@ protected void setupDriveMotors() {
rightFront = hardwareMap.get(DcMotor.class, "rightFront");
rightBack = hardwareMap.get(DcMotor.class, "rightBack");
leftBack = hardwareMap.get(DcMotor.class, "leftBack");
shooter = hardwareMap.get(DcMotor.class, "shooter");
hopper = hardwareMap.get(DcMotor.class, "hopper");
intake = hardwareMap.get(DcMotor.class, "intake");

// Most robots need the motor on one side to be reve`rsed to drive goBackward
Expand All @@ -47,12 +40,9 @@ protected void setupDriveMotors() {
rightFront.setDirection(DcMotor.Direction.REVERSE);
leftBack.setDirection(DcMotor.Direction.FORWARD);
rightBack.setDirection(DcMotor.Direction.REVERSE);
shooter.setDirection(DcMotor.Direction.FORWARD);
hopper.setDirection(DcMotor.Direction.FORWARD);
intake.setDirection(DcMotor.Direction.FORWARD);

arm = hardwareMap.servo.get("arm");
clamp = hardwareMap.servo.get("clamp");

/* */

updateTelemetryMessage("Initialized Motors");
Expand Down Expand Up @@ -103,7 +93,6 @@ public void goForward(final double power, final int duration) {
public void strafeRight(final double power, final int duration) {
//TODO - clarify how these motor powers are distributed for strafeRight movement
leftFront.setPower(-power);
rightFront.setPower(power);
rightBack.setPower(-power);
leftBack.setPower(power);
sleep(duration);
Expand Down Expand Up @@ -149,35 +138,12 @@ protected void turnLeft(final double leftwheelsbackwardpower, final double right

updateTelemetryMessage("Turning Left");
}
public void shooter(final double shooterpower, final int duration) {
shooter.setPower(shooterpower);
sleep(duration);
}

public void intake(final double intakepower, final int duration){
intake.setPower(intakepower);
sleep(duration);
}

public void armdown() {
arm.setPosition(1);
sleep(200);
}

public void armup() {
arm.setPosition(0);
sleep(200);
}

public void clampdown() {
clamp.setPosition(1);
sleep(200);
}

public void clampup() {
clamp.setPosition(0);
sleep(200);
}
/*
public void armUp(final double armpower, final int duration) {
arm.setPower(armpower);
Expand Down
32 changes: 6 additions & 26 deletions TeamCode/src/main/java/org/firstinspires/ftc/teamcode/testing.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,18 @@ public void runOpModeImpl() {
while(opModeIsActive()) {
while(true) {

// left bumper - to close claw (front servo)


if(gamepad1.a){
intaketrue = !intaketrue;
}
if(intaketrue){
if (gamepad1.a) {
intake.setPower(1);
}
else if(!intaketrue){

if (gamepad1.b) {
intake.setPower(0);
}

if(gamepad1.b){
shootertrue = !shootertrue;
}
if(shootertrue){
shooter.setPower(1);
}
if(!shootertrue){
shooter.setPower(0);
}
// left bumper - to close claw (front servo)



if(gamepad1.x){
hoppertrue = !hoppertrue;
}
if(hoppertrue){
hopper.setPower(1);
}
else if(!hoppertrue){
hopper.setPower(0);
}

telemetry.addData("Status", "Run Time: " + runtime.toString());
telemetry.update();
Expand Down

0 comments on commit ef03d61

Please sign in to comment.