Compare commits
2 Commits
danielv5
...
209c34b3fd
| Author | SHA1 | Date | |
|---|---|---|---|
| 209c34b3fd | |||
| d8cf594828 |
@@ -25,6 +25,8 @@ public class TeleopV4 extends LinearOpMode {
|
|||||||
MultipleTelemetry TELE;
|
MultipleTelemetry TELE;
|
||||||
Follower follower;
|
Follower follower;
|
||||||
SpindexerTransferIntake spindexerTransferIntake;
|
SpindexerTransferIntake spindexerTransferIntake;
|
||||||
|
Turret turret;
|
||||||
|
Flywheel flywheel;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runOpMode() throws InterruptedException {
|
public void runOpMode() throws InterruptedException {
|
||||||
@@ -40,7 +42,11 @@ public class TeleopV4 extends LinearOpMode {
|
|||||||
Pose start = new Pose(teleStartPoseX, teleStartPoseY, Math.toRadians(teleStartPoseH));
|
Pose start = new Pose(teleStartPoseX, teleStartPoseY, Math.toRadians(teleStartPoseH));
|
||||||
follower.setStartingPose(start);
|
follower.setStartingPose(start);
|
||||||
|
|
||||||
shooter = new Shooter(robot, TELE, follower, Color.redAlliance);
|
flywheel = new Flywheel(robot);
|
||||||
|
turret = new Turret(robot);
|
||||||
|
|
||||||
|
|
||||||
|
shooter = new Shooter(robot, TELE, follower, Color.redAlliance, turret, flywheel);
|
||||||
shooter.setState(Shooter.ShooterState.TRACK_GOAL);
|
shooter.setState(Shooter.ShooterState.TRACK_GOAL);
|
||||||
spindexerTransferIntake = new SpindexerTransferIntake(robot, TELE);
|
spindexerTransferIntake = new SpindexerTransferIntake(robot, TELE);
|
||||||
spindexerTransferIntake.setSpindexerMode(SpindexerTransferIntake.SpindexerMode.RAPID);
|
spindexerTransferIntake.setSpindexerMode(SpindexerTransferIntake.SpindexerMode.RAPID);
|
||||||
|
|||||||
@@ -11,15 +11,17 @@ import org.firstinspires.ftc.teamcode.pedroPathing.Constants;
|
|||||||
import org.firstinspires.ftc.teamcode.utilsv2.Flywheel;
|
import org.firstinspires.ftc.teamcode.utilsv2.Flywheel;
|
||||||
import org.firstinspires.ftc.teamcode.utilsv2.Robot;
|
import org.firstinspires.ftc.teamcode.utilsv2.Robot;
|
||||||
import org.firstinspires.ftc.teamcode.utilsv2.Shooter;
|
import org.firstinspires.ftc.teamcode.utilsv2.Shooter;
|
||||||
|
import org.firstinspires.ftc.teamcode.utilsv2.Turret;
|
||||||
|
|
||||||
@Config
|
@Config
|
||||||
@TeleOp
|
@TeleOp
|
||||||
public class NewShooterTest extends LinearOpMode {
|
public class NewShooterTest extends LinearOpMode {
|
||||||
|
|
||||||
Robot robot;
|
Robot robot;
|
||||||
|
Flywheel flywheel;
|
||||||
|
Turret turret;
|
||||||
MultipleTelemetry TELE;
|
MultipleTelemetry TELE;
|
||||||
Shooter shooter;
|
|
||||||
Flywheel rpmFlywheel;
|
|
||||||
|
|
||||||
public static boolean intake = true;
|
public static boolean intake = true;
|
||||||
public static boolean shoot = false;
|
public static boolean shoot = false;
|
||||||
@@ -28,7 +30,7 @@ public class NewShooterTest extends LinearOpMode {
|
|||||||
public static double transferIntakePower = -1;
|
public static double transferIntakePower = -1;
|
||||||
public static double turretPos = 0.51;
|
public static double turretPos = 0.51;
|
||||||
public static double hoodPos = 0.51;
|
public static double hoodPos = 0.51;
|
||||||
public static double flywheel = 0;
|
public static double flywheel_velo = 0;
|
||||||
|
|
||||||
public static double shooterP = 255, shooterI = 0, shooterD = 0, shooterF = 75;
|
public static double shooterP = 255, shooterI = 0, shooterD = 0, shooterF = 75;
|
||||||
|
|
||||||
@@ -50,15 +52,19 @@ public class NewShooterTest extends LinearOpMode {
|
|||||||
|
|
||||||
TELE = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
|
TELE = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
|
||||||
|
|
||||||
shooter = new Shooter(
|
|
||||||
|
flywheel = new Flywheel(robot);
|
||||||
|
turret = new Turret(robot);
|
||||||
|
|
||||||
|
Shooter shooter = new Shooter(
|
||||||
robot,
|
robot,
|
||||||
TELE,
|
TELE,
|
||||||
Constants.createFollower(hardwareMap),
|
Constants.createFollower(hardwareMap),
|
||||||
true
|
true,
|
||||||
|
turret,
|
||||||
|
flywheel
|
||||||
);
|
);
|
||||||
|
|
||||||
rpmFlywheel = new Flywheel(robot);
|
|
||||||
|
|
||||||
shooter.setState(Shooter.ShooterState.MANUAL);
|
shooter.setState(Shooter.ShooterState.MANUAL);
|
||||||
|
|
||||||
waitForStart();
|
waitForStart();
|
||||||
@@ -69,10 +75,9 @@ public class NewShooterTest extends LinearOpMode {
|
|||||||
|
|
||||||
robot.setHoodPos(hoodPos);
|
robot.setHoodPos(hoodPos);
|
||||||
shooter.setTurretPosition(turretPos);
|
shooter.setTurretPosition(turretPos);
|
||||||
shooter.setFlywheelVelocity(flywheel);
|
shooter.setFlywheelVelocity(flywheel_velo);
|
||||||
rpmFlywheel.manageFlywheel(shooter.getFlywheelVelocity());
|
|
||||||
double voltage = robot.voltage.getVoltage();
|
double voltage = robot.voltage.getVoltage();
|
||||||
rpmFlywheel.setPIDF(shooterP, shooterI, shooterD, shooterF / voltage);
|
flywheel.setPIDF(shooterP, shooterI, shooterD, shooterF / voltage);
|
||||||
|
|
||||||
robot.setSpinPos(ServoPositions.spindexer_A2);
|
robot.setSpinPos(ServoPositions.spindexer_A2);
|
||||||
|
|
||||||
@@ -131,9 +136,9 @@ public class NewShooterTest extends LinearOpMode {
|
|||||||
|
|
||||||
TELE.addData("Flywheel Velocity1", (robot.shooter1.getVelocity() * 60) / 28);
|
TELE.addData("Flywheel Velocity1", (robot.shooter1.getVelocity() * 60) / 28);
|
||||||
TELE.addData("Flywheel Velocity2", (robot.shooter2.getVelocity() * 60) / 28);
|
TELE.addData("Flywheel Velocity2", (robot.shooter2.getVelocity() * 60) / 28);
|
||||||
TELE.addData("Flywheel Averag Velocity", rpmFlywheel.getAverageVelocity());
|
TELE.addData("Flywheel Averag Velocity", flywheel.getAverageVelocity());
|
||||||
TELE.addData("PIDF Coefficients", Flywheel.shooterPIDF);
|
TELE.addData("PIDF Coefficients", Flywheel.shooterPIDF);
|
||||||
TELE.addData("Power", rpmFlywheel.getShooterPower());
|
TELE.addData("Power", flywheel.getShooterPower());
|
||||||
TELE.update();
|
TELE.update();
|
||||||
|
|
||||||
shooter.update();
|
shooter.update();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.pedropathing.follower.Follower;
|
|||||||
public class Shooter {
|
public class Shooter {
|
||||||
|
|
||||||
Robot robot;
|
Robot robot;
|
||||||
|
Flywheel fly;
|
||||||
Turret turr;
|
Turret turr;
|
||||||
VelocityCommander commander;
|
VelocityCommander commander;
|
||||||
|
|
||||||
@@ -20,15 +21,21 @@ public class Shooter {
|
|||||||
|
|
||||||
Follower follow;
|
Follower follow;
|
||||||
|
|
||||||
public Shooter(Robot rob, MultipleTelemetry TELE, Follower follower, boolean redAlliance) {
|
public Shooter(Robot rob, MultipleTelemetry TELE, Follower follower, boolean redAlliance, Turret turret, Flywheel flywheel) {
|
||||||
this.robot = rob;
|
this.robot = rob;
|
||||||
this.turr = new Turret(rob);
|
this.fly = flywheel;
|
||||||
|
this.turr = turret;
|
||||||
this.follow = follower;
|
this.follow = follower;
|
||||||
this.commander = new VelocityCommander();
|
this.commander = new VelocityCommander();
|
||||||
|
|
||||||
setRedAlliance(redAlliance);
|
setRedAlliance(redAlliance);
|
||||||
|
|
||||||
if (redAlliance) {
|
}
|
||||||
|
|
||||||
|
public void setRedAlliance(boolean input) {
|
||||||
|
this.red = input;
|
||||||
|
|
||||||
|
if (this.red) {
|
||||||
goalX = 144;
|
goalX = 144;
|
||||||
} else {
|
} else {
|
||||||
goalX = 0;
|
goalX = 0;
|
||||||
@@ -36,10 +43,6 @@ public class Shooter {
|
|||||||
goalY = 144;
|
goalY = 144;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRedAlliance(boolean input) {
|
|
||||||
this.red = input;
|
|
||||||
}
|
|
||||||
|
|
||||||
private double flywheelVelocity = 0.0;
|
private double flywheelVelocity = 0.0;
|
||||||
private double turretPosition = 0.5;
|
private double turretPosition = 0.5;
|
||||||
|
|
||||||
@@ -66,7 +69,7 @@ public class Shooter {
|
|||||||
public void setFlywheelVelocity(double input) {
|
public void setFlywheelVelocity(double input) {
|
||||||
this.flywheelVelocity = input;
|
this.flywheelVelocity = input;
|
||||||
}
|
}
|
||||||
public double getFlywheelVelocity(){return this.flywheelVelocity;}
|
|
||||||
public int getObeliskID() {
|
public int getObeliskID() {
|
||||||
return turr.getObeliskID();
|
return turr.getObeliskID();
|
||||||
}
|
}
|
||||||
@@ -78,6 +81,7 @@ public class Shooter {
|
|||||||
case NOTHING:
|
case NOTHING:
|
||||||
break;
|
break;
|
||||||
case MANUAL:
|
case MANUAL:
|
||||||
|
fly.manageFlywheel(flywheelVelocity);
|
||||||
turr.manual(turretPosition);
|
turr.manual(turretPosition);
|
||||||
break;
|
break;
|
||||||
case TRACK_GOAL:
|
case TRACK_GOAL:
|
||||||
@@ -101,6 +105,7 @@ public class Shooter {
|
|||||||
follow.getAcceleration().getYComponent()
|
follow.getAcceleration().getYComponent()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fly.manageFlywheel(flywheelVelocity);
|
||||||
break;
|
break;
|
||||||
case READ_OBELISK:
|
case READ_OBELISK:
|
||||||
turr.trackObelisk(
|
turr.trackObelisk(
|
||||||
@@ -118,6 +123,7 @@ public class Shooter {
|
|||||||
follow.getAcceleration().getYComponent()
|
follow.getAcceleration().getYComponent()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fly.manageFlywheel(flywheelVelocity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MANUAL_TURRET_TRACK_FLY:
|
case MANUAL_TURRET_TRACK_FLY:
|
||||||
@@ -131,6 +137,7 @@ public class Shooter {
|
|||||||
follow.getAcceleration().getYComponent()
|
follow.getAcceleration().getYComponent()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
fly.manageFlywheel(flywheelVelocity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MANUAL_FLYWHEEL_TRACK_TURR:
|
case MANUAL_FLYWHEEL_TRACK_TURR:
|
||||||
@@ -144,6 +151,7 @@ public class Shooter {
|
|||||||
follow.getVelocity().getYComponent(),
|
follow.getVelocity().getYComponent(),
|
||||||
follow.getAcceleration().getYComponent()
|
follow.getAcceleration().getYComponent()
|
||||||
);
|
);
|
||||||
|
fly.manageFlywheel(flywheelVelocity);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user