teleop ground logic
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
package org.firstinspires.ftc.teamcode.constants;
|
||||
|
||||
import com.acmerobotics.dashboard.config.Config;
|
||||
|
||||
@Config
|
||||
public class ShooterVars {
|
||||
public static double turret_GearRatio = 0.9974;
|
||||
|
||||
public static double turret_Range = 355;
|
||||
}
|
||||
@@ -43,8 +43,7 @@ public class Intake implements Subsystem {
|
||||
}
|
||||
|
||||
public void intakeMinPower(){
|
||||
intakePower = 0.5;
|
||||
intakeState = 1;
|
||||
intakeState = 2;
|
||||
}
|
||||
|
||||
public void intake(){
|
||||
@@ -57,7 +56,7 @@ public class Intake implements Subsystem {
|
||||
|
||||
|
||||
public void stop(){
|
||||
intakeState =-1;
|
||||
intakeState =0;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +69,9 @@ public class Intake implements Subsystem {
|
||||
intake.setPower(intakePower);
|
||||
} else if (intakeState == -1){
|
||||
intake.setPower(-intakePower);
|
||||
} else {
|
||||
} else if (intakeState == 2){
|
||||
intake.setPower(intakePower);
|
||||
}else {
|
||||
intake.setPower(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.firstinspires.ftc.teamcode.subsystems;
|
||||
|
||||
import static org.firstinspires.ftc.teamcode.constants.ServoVars.*;
|
||||
import static org.firstinspires.ftc.teamcode.constants.ShooterVars.*;
|
||||
|
||||
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
|
||||
import com.acmerobotics.roadrunner.Pose2d;
|
||||
@@ -50,9 +50,9 @@ public class Shooter implements Subsystem {
|
||||
|
||||
|
||||
|
||||
private String shooterMode = "AUTO";
|
||||
private String shooterMode = "MANUAL";
|
||||
|
||||
private String turretMode = "AUTO";
|
||||
private String turretMode = "MANUAL";
|
||||
|
||||
|
||||
public Shooter(Robot robot, MultipleTelemetry TELE) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
||||
|
||||
import org.firstinspires.ftc.teamcode.subsystems.Drivetrain;
|
||||
import org.firstinspires.ftc.teamcode.subsystems.Intake;
|
||||
import org.firstinspires.ftc.teamcode.subsystems.Shooter;
|
||||
import org.firstinspires.ftc.teamcode.subsystems.Spindexer;
|
||||
import org.firstinspires.ftc.teamcode.subsystems.Transfer;
|
||||
import org.firstinspires.ftc.teamcode.utils.Robot;
|
||||
@@ -32,6 +33,8 @@ public class TeleopV1 extends LinearOpMode {
|
||||
|
||||
Transfer transfer;
|
||||
|
||||
Shooter shooter;
|
||||
|
||||
MultipleTelemetry TELE;
|
||||
|
||||
GamepadEx g1;
|
||||
@@ -42,16 +45,21 @@ public class TeleopV1 extends LinearOpMode {
|
||||
|
||||
public static double slowMoSpeed = 0.4;
|
||||
|
||||
public static double power = 0.0;
|
||||
public static double shooterPower = 0.0;
|
||||
|
||||
public static double pos = 0.501;
|
||||
public static double turretPosition = 0.501;
|
||||
|
||||
public static double hoodPosition = 0.501;
|
||||
|
||||
ToggleButtonReader g1RightBumper;
|
||||
|
||||
ToggleButtonReader g1LeftBumper;
|
||||
|
||||
ToggleButtonReader g2Circle;
|
||||
|
||||
ToggleButtonReader g2Square;
|
||||
|
||||
ToggleButtonReader g2LeftBumper;
|
||||
|
||||
ToggleButtonReader g2Triangle;
|
||||
public double g1RightBumperStamp = 0.0;
|
||||
@@ -78,6 +86,10 @@ public class TeleopV1 extends LinearOpMode {
|
||||
g1, GamepadKeys.Button.RIGHT_BUMPER
|
||||
);
|
||||
|
||||
g1LeftBumper = new ToggleButtonReader(
|
||||
g1, GamepadKeys.Button.LEFT_BUMPER
|
||||
);
|
||||
|
||||
g2 = new GamepadEx(gamepad2);
|
||||
|
||||
g2Circle = new ToggleButtonReader(
|
||||
@@ -92,6 +104,11 @@ public class TeleopV1 extends LinearOpMode {
|
||||
g2, GamepadKeys.Button.X
|
||||
);
|
||||
|
||||
g2LeftBumper = new ToggleButtonReader(
|
||||
g2, GamepadKeys.Button.LEFT_BUMPER
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
drivetrain = new Drivetrain(robot, TELE, g1);
|
||||
@@ -109,6 +126,8 @@ public class TeleopV1 extends LinearOpMode {
|
||||
|
||||
spindexer = new Spindexer(robot, TELE);
|
||||
|
||||
shooter = new Shooter(robot, TELE);
|
||||
|
||||
spindexer.setTelemetryOn(true);
|
||||
|
||||
time = getRuntime();
|
||||
@@ -126,7 +145,16 @@ public class TeleopV1 extends LinearOpMode {
|
||||
|
||||
TELE.update();
|
||||
|
||||
transfer.update();
|
||||
transfer();
|
||||
|
||||
shooter.setManualPower(shooterPower);
|
||||
|
||||
shooter.sethoodPosition(hoodPosition);
|
||||
|
||||
shooter.setTurretPosition(turretPosition);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -171,22 +199,30 @@ public class TeleopV1 extends LinearOpMode {
|
||||
|
||||
if (intake.getIntakeState()==1) {
|
||||
spindexer.intakeShake(getRuntime());
|
||||
transfer.setTransferPowerOff();
|
||||
transfer.setTransferPositionOff();
|
||||
} else {
|
||||
|
||||
|
||||
if (g2Circle.wasJustPressed()){
|
||||
transfer.setTransferPositionOff();
|
||||
intake.intakeMinPower();
|
||||
spindexer.outtake3();
|
||||
transfer.setTransferPowerOn();
|
||||
}
|
||||
|
||||
if (g2Triangle.wasJustPressed()){
|
||||
transfer.setTransferPositionOff();
|
||||
intake.intakeMinPower();
|
||||
spindexer.outtake2();
|
||||
transfer.setTransferPowerOn();
|
||||
}
|
||||
|
||||
if (g2Square.wasJustPressed()){
|
||||
transfer.setTransferPositionOff();
|
||||
intake.intakeMinPower();
|
||||
spindexer.outtake1();
|
||||
transfer.setTransferPowerOn();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -194,7 +230,7 @@ public class TeleopV1 extends LinearOpMode {
|
||||
intake.update();
|
||||
|
||||
|
||||
|
||||
transfer.update();
|
||||
|
||||
spindexer.update();
|
||||
|
||||
@@ -202,5 +238,17 @@ public class TeleopV1 extends LinearOpMode {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void transfer(){
|
||||
|
||||
g1LeftBumper.readValue();
|
||||
|
||||
if (g1LeftBumper.wasJustPressed()){
|
||||
transfer.setTransferPositionOn();
|
||||
}
|
||||
|
||||
transfer.update();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user