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(){
|
public void intakeMinPower(){
|
||||||
intakePower = 0.5;
|
intakeState = 2;
|
||||||
intakeState = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void intake(){
|
public void intake(){
|
||||||
@@ -57,7 +56,7 @@ public class Intake implements Subsystem {
|
|||||||
|
|
||||||
|
|
||||||
public void stop(){
|
public void stop(){
|
||||||
intakeState =-1;
|
intakeState =0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -70,6 +69,8 @@ public class Intake implements Subsystem {
|
|||||||
intake.setPower(intakePower);
|
intake.setPower(intakePower);
|
||||||
} else if (intakeState == -1){
|
} else if (intakeState == -1){
|
||||||
intake.setPower(-intakePower);
|
intake.setPower(-intakePower);
|
||||||
|
} else if (intakeState == 2){
|
||||||
|
intake.setPower(intakePower);
|
||||||
}else {
|
}else {
|
||||||
intake.setPower(0);
|
intake.setPower(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package org.firstinspires.ftc.teamcode.subsystems;
|
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.dashboard.telemetry.MultipleTelemetry;
|
||||||
import com.acmerobotics.roadrunner.Pose2d;
|
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) {
|
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.Drivetrain;
|
||||||
import org.firstinspires.ftc.teamcode.subsystems.Intake;
|
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.Spindexer;
|
||||||
import org.firstinspires.ftc.teamcode.subsystems.Transfer;
|
import org.firstinspires.ftc.teamcode.subsystems.Transfer;
|
||||||
import org.firstinspires.ftc.teamcode.utils.Robot;
|
import org.firstinspires.ftc.teamcode.utils.Robot;
|
||||||
@@ -32,6 +33,8 @@ public class TeleopV1 extends LinearOpMode {
|
|||||||
|
|
||||||
Transfer transfer;
|
Transfer transfer;
|
||||||
|
|
||||||
|
Shooter shooter;
|
||||||
|
|
||||||
MultipleTelemetry TELE;
|
MultipleTelemetry TELE;
|
||||||
|
|
||||||
GamepadEx g1;
|
GamepadEx g1;
|
||||||
@@ -42,16 +45,21 @@ public class TeleopV1 extends LinearOpMode {
|
|||||||
|
|
||||||
public static double slowMoSpeed = 0.4;
|
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 g1RightBumper;
|
||||||
|
|
||||||
|
ToggleButtonReader g1LeftBumper;
|
||||||
|
|
||||||
ToggleButtonReader g2Circle;
|
ToggleButtonReader g2Circle;
|
||||||
|
|
||||||
ToggleButtonReader g2Square;
|
ToggleButtonReader g2Square;
|
||||||
|
|
||||||
|
ToggleButtonReader g2LeftBumper;
|
||||||
|
|
||||||
ToggleButtonReader g2Triangle;
|
ToggleButtonReader g2Triangle;
|
||||||
public double g1RightBumperStamp = 0.0;
|
public double g1RightBumperStamp = 0.0;
|
||||||
@@ -78,6 +86,10 @@ public class TeleopV1 extends LinearOpMode {
|
|||||||
g1, GamepadKeys.Button.RIGHT_BUMPER
|
g1, GamepadKeys.Button.RIGHT_BUMPER
|
||||||
);
|
);
|
||||||
|
|
||||||
|
g1LeftBumper = new ToggleButtonReader(
|
||||||
|
g1, GamepadKeys.Button.LEFT_BUMPER
|
||||||
|
);
|
||||||
|
|
||||||
g2 = new GamepadEx(gamepad2);
|
g2 = new GamepadEx(gamepad2);
|
||||||
|
|
||||||
g2Circle = new ToggleButtonReader(
|
g2Circle = new ToggleButtonReader(
|
||||||
@@ -92,6 +104,11 @@ public class TeleopV1 extends LinearOpMode {
|
|||||||
g2, GamepadKeys.Button.X
|
g2, GamepadKeys.Button.X
|
||||||
);
|
);
|
||||||
|
|
||||||
|
g2LeftBumper = new ToggleButtonReader(
|
||||||
|
g2, GamepadKeys.Button.LEFT_BUMPER
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
drivetrain = new Drivetrain(robot, TELE, g1);
|
drivetrain = new Drivetrain(robot, TELE, g1);
|
||||||
@@ -109,6 +126,8 @@ public class TeleopV1 extends LinearOpMode {
|
|||||||
|
|
||||||
spindexer = new Spindexer(robot, TELE);
|
spindexer = new Spindexer(robot, TELE);
|
||||||
|
|
||||||
|
shooter = new Shooter(robot, TELE);
|
||||||
|
|
||||||
spindexer.setTelemetryOn(true);
|
spindexer.setTelemetryOn(true);
|
||||||
|
|
||||||
time = getRuntime();
|
time = getRuntime();
|
||||||
@@ -126,7 +145,16 @@ public class TeleopV1 extends LinearOpMode {
|
|||||||
|
|
||||||
TELE.update();
|
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) {
|
if (intake.getIntakeState()==1) {
|
||||||
spindexer.intakeShake(getRuntime());
|
spindexer.intakeShake(getRuntime());
|
||||||
|
transfer.setTransferPowerOff();
|
||||||
|
transfer.setTransferPositionOff();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
if (g2Circle.wasJustPressed()){
|
if (g2Circle.wasJustPressed()){
|
||||||
|
transfer.setTransferPositionOff();
|
||||||
intake.intakeMinPower();
|
intake.intakeMinPower();
|
||||||
spindexer.outtake3();
|
spindexer.outtake3();
|
||||||
|
transfer.setTransferPowerOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g2Triangle.wasJustPressed()){
|
if (g2Triangle.wasJustPressed()){
|
||||||
|
transfer.setTransferPositionOff();
|
||||||
intake.intakeMinPower();
|
intake.intakeMinPower();
|
||||||
spindexer.outtake2();
|
spindexer.outtake2();
|
||||||
|
transfer.setTransferPowerOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g2Square.wasJustPressed()){
|
if (g2Square.wasJustPressed()){
|
||||||
|
transfer.setTransferPositionOff();
|
||||||
intake.intakeMinPower();
|
intake.intakeMinPower();
|
||||||
spindexer.outtake1();
|
spindexer.outtake1();
|
||||||
|
transfer.setTransferPowerOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -194,7 +230,7 @@ public class TeleopV1 extends LinearOpMode {
|
|||||||
intake.update();
|
intake.update();
|
||||||
|
|
||||||
|
|
||||||
|
transfer.update();
|
||||||
|
|
||||||
spindexer.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