Skip to content

Commit

Permalink
Changes to Teleop and Auto-latch
Browse files Browse the repository at this point in the history
arjvik committed Feb 2, 2019
1 parent ede4247 commit 8c3e8c3
Showing 3 changed files with 102 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/firstinspires/ftc/teamcode/Collector.java
Original file line number Diff line number Diff line change
@@ -41,6 +41,10 @@ public class Collector {
public int posPostLatch = 20;
public double intakePwr = .5;

public int pos_prelatch = 1870;
public int pos_latched = 2950;
public int pos_postlatch = 560;

public static int extendMax = 3700;
public static int extendMid= 1750;
public static int extendMin = 10;
95 changes: 92 additions & 3 deletions src/main/java/org/firstinspires/ftc/teamcode/Game_6832.java
Original file line number Diff line number Diff line change
@@ -128,15 +128,16 @@ public class Game_6832 extends LinearOpMode {
private int left_stick_button = 14;
private int right_stick_button = 15; //sound player



private boolean butY = false;
private boolean butA = false;
private boolean butX = false;
private boolean butB = false;
private int targetPos = 0;


private int latchStage = 0;
private boolean goLatch = false;

private VisionProvider vp;
private int visionProviderState;
private boolean visionProviderFinalized;
@@ -909,7 +910,7 @@ private void joystickDrive(){
}*/


if(gamepad1.y){
/*if(gamepad1.y){
butY=true;
butA = false;
butX = false;
@@ -983,8 +984,96 @@ private void joystickDrive(){
}
}
}
}*/

if(toggleAllowed(gamepad1.x,x)){
robot.collector.restart(.40, .5);
robot.superman.restart(.75);
robot.superman.setTargetPosition(robot.superman.pos_prelatch);
robot.collector.setElbowTargetPos(robot.collector.pos_prelatch);
goLatch = false;
}
if(toggleAllowed(gamepad1.y,y)){
robot.superman.restart(.60);
robot.collector.restart(.30,.75);
robot.superman.setTargetPosition(robot.superman.pos_latched);
robot.collector.setElbowTargetPos(robot.collector.pos_latched);
goLatch = false;
}
if(toggleAllowed(gamepad1.a,a)){
robot.collector.restart(.40, .5);
robot.superman.restart(.75);
robot.superman.setTargetPosition(robot.superman.pos_postlatch);
robot.collector.setElbowTargetPos(robot.collector.pos_postlatch);
goLatch = false;
}




if(toggleAllowed(gamepad1.b,b)){
goLatch = true;
}


if(goLatch){
switch(latchStage){
case 0:
robot.collector.restart(.40, .5);
robot.superman.restart(.75);
robot.superman.setTargetPosition(robot.superman.pos_prelatch);
robot.collector.setElbowTargetPos(robot.collector.pos_prelatch);
latchStage++;
break;
case 1:
if((Math.abs(robot.collector.pos_prelatch)-robot.collector.getElbowCurrentPos())<= 20 &&(Math.abs(robot.superman.pos_prelatch)-robot.superman.getCurrentPosition())<= 20){
autoTimer = futureTime(1);
latchStage++;
}
break;
case 2:
if(System.nanoTime()>autoTimer){
latchStage++;
}
break;
case 3:
if(robot.driveForward(true, .1, .75)){
latchStage++;
}
break;
case 4:
robot.superman.restart(.60);
robot.collector.restart(.30,.75);
robot.superman.setTargetPosition(robot.superman.pos_latched);
robot.collector.setElbowTargetPos(robot.collector.pos_latched);
autoTimer = futureTime(3);
latchStage++;
break;
case 5:
robot.driveMixerTank(-.5, 0);
if (((Math.abs(robot.collector.pos_latched)-robot.collector.getElbowCurrentPos())<= 20 && (Math.abs(robot.superman.pos_latched)-robot.superman.getCurrentPosition())<= 20)||System.nanoTime()>autoTimer) {
latchStage++;
}
break;
case 6:
robot.collector.restart(.40, .5);
robot.superman.restart(.75);
robot.superman.setTargetPosition(robot.superman.pos_postlatch);
robot.collector.setElbowTargetPos(robot.collector.pos_postlatch);
latchStage++;
break;
default:
latchStage = 0;
goLatch = false;
}
}







if(gamepad1.dpad_down){
robot.superman.lower();
}
6 changes: 6 additions & 0 deletions src/main/java/org/firstinspires/ftc/teamcode/Superman.java
Original file line number Diff line number Diff line change
@@ -14,6 +14,12 @@ public class Superman {
public int posPreLatch = 10;
public int posLatch = 297;
public int posPostLatch=10;

public int pos_prelatch = 0;
public int pos_latched = 360;
public int pos_postlatch = 0;


//filler value; needs to be updated to reflect actual ratio
public double ticksPerDegree = 5;
public boolean active = true;

0 comments on commit 8c3e8c3

Please sign in to comment.