a lot of changes
This commit is contained in:
@@ -16,8 +16,8 @@ import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
|
|||||||
|
|
||||||
import org.firstinspires.ftc.teamcode.constants.Color;
|
import org.firstinspires.ftc.teamcode.constants.Color;
|
||||||
import org.firstinspires.ftc.teamcode.constants.ServoPositions;
|
import org.firstinspires.ftc.teamcode.constants.ServoPositions;
|
||||||
import org.firstinspires.ftc.teamcode.constants.TeleStart;
|
|
||||||
import org.firstinspires.ftc.teamcode.pedroPathing.Constants;
|
import org.firstinspires.ftc.teamcode.pedroPathing.Constants;
|
||||||
|
import org.firstinspires.ftc.teamcode.teleop.TeleopV4;
|
||||||
import org.firstinspires.ftc.teamcode.utilsv2.*;
|
import org.firstinspires.ftc.teamcode.utilsv2.*;
|
||||||
import org.firstinspires.ftc.teamcode.utils.MeasuringLoopTimes;
|
import org.firstinspires.ftc.teamcode.utils.MeasuringLoopTimes;
|
||||||
|
|
||||||
@@ -37,8 +37,8 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
SpindexerTransferIntake spindexer;
|
SpindexerTransferIntake spindexer;
|
||||||
|
|
||||||
// Wait Times
|
// Wait Times
|
||||||
public static double sortedShootTime = 2;
|
public static double sortedShootTime = 2.6;
|
||||||
public static double rapidWaitTime = 0.25;
|
public static double rapidWaitTime = 0.5;
|
||||||
public static double rapidShootTime = 0.8;
|
public static double rapidShootTime = 0.8;
|
||||||
public static double openGateTime = 2.5;
|
public static double openGateTime = 2.5;
|
||||||
public static double pushTime = 2;
|
public static double pushTime = 2;
|
||||||
@@ -57,23 +57,23 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
PathState pathState = PathState.PUSHBOT;
|
PathState pathState = PathState.PUSHBOT;
|
||||||
|
|
||||||
// Poses
|
// Poses
|
||||||
public static double startPoseX = 91.5, startPoseY = 15, startPoseH = 90;
|
public static double startPoseX = 12, startPoseY = -64, startPoseH = 90;
|
||||||
public static double pushBotX = 97, pushBotY = 18, pushBotH = 100;
|
public static double pushBotX = 19, pushBotY = -63, pushBotH = 100;
|
||||||
public static double shoot0ControlX = 94.29667812142038, shoot0ControlY = 55.03493699885454;
|
public static double shoot0ControlX = 16.29667812142038, shoot0ControlY = -19.67493699885454;
|
||||||
public static double shoot0X = 95, shoot0Y = 83, shoot0H = 0;
|
public static double shoot0X = 19, shoot0Y = 10, shoot0H = 0;
|
||||||
public static double pickup1X = 126, pickup1Y = 82, pickup1H = 0;
|
public static double pickup1X = 54, pickup1Y = 10, pickup1H = 0;
|
||||||
public static double openGateControlX = 109.184421534937, openGateControlY = 74.24455899198165;
|
public static double openGateControlX = 37.184421534937, openGateControlY = 2.24455899198165;
|
||||||
public static double openGateX = 131, openGateY = 74, openGateH = 0;
|
public static double openGateX = 59, openGateY = 2, openGateH = 0;
|
||||||
public static double shoot1ControlX = 112, shoot1ControlY = 75;
|
public static double shoot1ControlX = 40, shoot1ControlY = 3;
|
||||||
public static double shoot1X = 95, shoot1Y = 83, shoot1H = 0;
|
public static double shoot1X = 19, shoot1Y = 10, shoot1H = 0;
|
||||||
public static double drivePickup2X = 98, drivePickup2Y = 58.5, drivePickup2H = 0;
|
public static double drivePickup2X = 26, drivePickup2Y = -14, drivePickup2H = 0;
|
||||||
public static double pickup2X = 133, pickup2Y = 57, pickup2H = 0;
|
public static double pickup2X = 61, pickup2Y = -14.5, pickup2H = 0;
|
||||||
public static double shoot2ControlX = 102, shoot2ControlY = 63;
|
public static double shoot2ControlX = 30, shoot2ControlY = -9;
|
||||||
public static double shoot2X = 95, shoot2Y = 83, shoot2H = 0;
|
public static double shoot2X = 19, shoot2Y = 10, shoot2H = 0;
|
||||||
public static double drivePickup3X = 98, drivePickup3Y = 34.5, drivePickup3H = 0;
|
public static double drivePickup3X = 26, drivePickup3Y = -37.5, drivePickup3H = 0;
|
||||||
public static double pickup3X = 133, pickup3Y = 34.5, pickup3H = 0;
|
public static double pickup3X = 61, pickup3Y = -37.5, pickup3H = 0;
|
||||||
public static double shoot3ControlX = 97.62371134020621, shoot3ControlY = 34.813287514318446;
|
public static double shoot3ControlX = 25.62371134020621, shoot3ControlY = -38.813287514318446;
|
||||||
public static double shoot3X = 84, shoot3Y = 120, shoot3H = -90;
|
public static double shoot3X = 12, shoot3Y = 40, shoot3H = -90;
|
||||||
double[] xPoses = {startPoseX, pushBotX, shoot0ControlX, shoot0X,
|
double[] xPoses = {startPoseX, pushBotX, shoot0ControlX, shoot0X,
|
||||||
pickup1X, openGateControlX, openGateX, shoot1ControlX, shoot1X,
|
pickup1X, openGateControlX, openGateX, shoot1ControlX, shoot1X,
|
||||||
drivePickup2X, pickup2X, shoot2ControlX, shoot2X,
|
drivePickup2X, pickup2X, shoot2ControlX, shoot2X,
|
||||||
@@ -193,7 +193,6 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
if (!follower.isBusy() || currentTime - timeStamp > pushTime){
|
if (!follower.isBusy() || currentTime - timeStamp > pushTime){
|
||||||
follower.followPath(pushBot_shoot0, true);
|
follower.followPath(pushBot_shoot0, true);
|
||||||
pathState = PathState.DRIVE_SHOOT0;
|
pathState = PathState.DRIVE_SHOOT0;
|
||||||
timeStamp = currentTime;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DRIVE_SHOOT0:
|
case DRIVE_SHOOT0:
|
||||||
@@ -201,6 +200,8 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
timeStamp = currentTime;
|
timeStamp = currentTime;
|
||||||
pathState = PathState.WAIT_SHOOT0;
|
pathState = PathState.WAIT_SHOOT0;
|
||||||
spindexer.setRapidMode(SpindexerTransferIntake.RapidMode.OPEN_GATE);
|
spindexer.setRapidMode(SpindexerTransferIntake.RapidMode.OPEN_GATE);
|
||||||
|
} else if (follower.isBusy()){
|
||||||
|
timeStamp = currentTime;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WAIT_SHOOT0:
|
case WAIT_SHOOT0:
|
||||||
@@ -220,6 +221,8 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
shootY = shoot1Y;
|
shootY = shoot1Y;
|
||||||
shootH = shoot1H;
|
shootH = shoot1H;
|
||||||
timeStamp = currentTime;
|
timeStamp = currentTime;
|
||||||
|
shooter.setFlywheelVelocity(2300);
|
||||||
|
robot.setHoodPos(0.68);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OPENGATE:
|
case OPENGATE:
|
||||||
@@ -271,8 +274,8 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
break;
|
break;
|
||||||
case DRIVE_PICKUP3:
|
case DRIVE_PICKUP3:
|
||||||
if (!follower.isBusy()){
|
if (!follower.isBusy()){
|
||||||
shooter.setFlywheelVelocity(2300);
|
shooter.setFlywheelVelocity(2200);
|
||||||
robot.setHoodPos(0.68);
|
robot.setHoodPos(0.75);
|
||||||
follower.followPath(drivePickup3_pickup3, intakePower, false);
|
follower.followPath(drivePickup3_pickup3, intakePower, false);
|
||||||
pathState = PathState.PICKUP3;
|
pathState = PathState.PICKUP3;
|
||||||
}
|
}
|
||||||
@@ -302,7 +305,7 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Used for changing alliance
|
// Used for changing alliance
|
||||||
private double adjustXPoseBasedOnAlliance(double pose) {return (144-pose);}
|
private double adjustXPoseBasedOnAlliance(double pose) {return -pose;}
|
||||||
private double adjustHeadingBasedOnAlliance(double heading){
|
private double adjustHeadingBasedOnAlliance(double heading){
|
||||||
heading = 180 - heading;
|
heading = 180 - heading;
|
||||||
while (heading > 180) {heading-=360;}
|
while (heading > 180) {heading-=360;}
|
||||||
@@ -321,7 +324,7 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
TELE = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
|
TELE = new MultipleTelemetry(telemetry, FtcDashboard.getInstance().getTelemetry());
|
||||||
follower = Constants.createFollower(hardwareMap);
|
follower = Constants.createFollower(hardwareMap);
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
follower.setStartingPose(new Pose(72,72,0));
|
follower.setStartingPose(new Pose(0,0,0));
|
||||||
loopTimes = new MeasuringLoopTimes();
|
loopTimes = new MeasuringLoopTimes();
|
||||||
loopTimes.init();
|
loopTimes.init();
|
||||||
turret = new Turret(robot);
|
turret = new Turret(robot);
|
||||||
@@ -344,9 +347,14 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
if (gamepad1.crossWasPressed() && !initializeRobot){
|
if (gamepad1.crossWasPressed() && !initializeRobot){
|
||||||
Color.redAlliance = !Color.redAlliance;
|
Color.redAlliance = !Color.redAlliance;
|
||||||
shooter.setRedAlliance(Color.redAlliance);
|
shooter.setRedAlliance(Color.redAlliance);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < xPoses.length; i++) {xPoses[i] = adjustXPoseBasedOnAlliance(xPoses[i]);}
|
if (!initializeRobot){
|
||||||
for (int i = 0; i < headings.length; i++) {headings[i] = adjustHeadingBasedOnAlliance(headings[i]);}
|
if ((Color.redAlliance && xPoses[0] < 0)
|
||||||
|
|| (!Color.redAlliance && xPoses[0] > 0)){
|
||||||
|
for (int i = 0; i < xPoses.length; i++) {xPoses[i] = adjustXPoseBasedOnAlliance(xPoses[i]);}
|
||||||
|
for (int i = 0; i < headings.length; i++) {headings[i] = adjustHeadingBasedOnAlliance(headings[i]);}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gamepad1.triangleWasPressed()){
|
if (gamepad1.triangleWasPressed()){
|
||||||
@@ -385,10 +393,11 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
shooter.setState(Shooter.ShooterState.MANUAL_FLYWHEEL_TRACK_TURR);
|
shooter.setState(Shooter.ShooterState.MANUAL_FLYWHEEL_TRACK_TURR);
|
||||||
shooter.update(robot.voltage.getVoltage());
|
shooter.update(robot.voltage.getVoltage());
|
||||||
|
|
||||||
follower.update();
|
if (!isStopRequested()){
|
||||||
|
follower.update();
|
||||||
|
}
|
||||||
pathStateMachine();
|
pathStateMachine();
|
||||||
Pose currentPose = follower.getPose();
|
TeleopV4.teleStart = follower.getPose();
|
||||||
TeleStart.teleStart = currentPose;
|
|
||||||
|
|
||||||
spindexer.update();
|
spindexer.update();
|
||||||
|
|
||||||
@@ -400,9 +409,9 @@ public class Auto12Ball_Back_Sorted extends LinearOpMode {
|
|||||||
TELE.addData("Avg Loop Time", loopTimes.getAvgLoopTime());
|
TELE.addData("Avg Loop Time", loopTimes.getAvgLoopTime());
|
||||||
TELE.addData("Min Loop Time", loopTimes.getMinLoopTimeOneMin());
|
TELE.addData("Min Loop Time", loopTimes.getMinLoopTimeOneMin());
|
||||||
TELE.addData("Max Loop Time", loopTimes.getMaxLoopTimeOneMin());
|
TELE.addData("Max Loop Time", loopTimes.getMaxLoopTimeOneMin());
|
||||||
TELE.addData("X:", currentPose.getX());
|
TELE.addData("X:", TeleopV4.teleStart.getX());
|
||||||
TELE.addData("Y:", currentPose.getY());
|
TELE.addData("Y:", TeleopV4.teleStart.getY());
|
||||||
TELE.addData("H:", currentPose.getHeading());
|
TELE.addData("H:", TeleopV4.teleStart.getHeading());
|
||||||
TELE.update();
|
TELE.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
package org.firstinspires.ftc.teamcode.constants;
|
|
||||||
|
|
||||||
import com.pedropathing.geometry.Pose;
|
|
||||||
|
|
||||||
public class TeleStart {
|
|
||||||
public static Pose teleStart = new Pose(72,72,0);
|
|
||||||
}
|
|
||||||
@@ -42,8 +42,8 @@ public class Constants {
|
|||||||
public static PathConstraints pathConstraints = new PathConstraints(0.99, 100, breakingStrength, 1);
|
public static PathConstraints pathConstraints = new PathConstraints(0.99, 100, breakingStrength, 1);
|
||||||
|
|
||||||
public static PinpointConstants localizerConstants = new PinpointConstants()
|
public static PinpointConstants localizerConstants = new PinpointConstants()
|
||||||
.forwardPodY(3.7795)
|
.forwardPodY(-3.7795)
|
||||||
.strafePodX(-3.676)
|
.strafePodX(-3.769)
|
||||||
.distanceUnit(DistanceUnit.INCH)
|
.distanceUnit(DistanceUnit.INCH)
|
||||||
.hardwareMapName("pinpoint")
|
.hardwareMapName("pinpoint")
|
||||||
.encoderResolution(GoBildaPinpointDriver.GoBildaOdometryPods.goBILDA_4_BAR_POD)
|
.encoderResolution(GoBildaPinpointDriver.GoBildaOdometryPods.goBILDA_4_BAR_POD)
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ class LocalizationTest extends OpMode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
follower.setStartingPose(new Pose(72,72, 0));
|
follower.setStartingPose(new Pose(0,0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This initializes the PoseUpdater, the drive motors, and the Panels telemetry. */
|
/** This initializes the PoseUpdater, the drive motors, and the Panels telemetry. */
|
||||||
@@ -1272,7 +1272,7 @@ class CentripetalTuner extends OpMode {
|
|||||||
public void start() {
|
public void start() {
|
||||||
follower.activateAllPIDFs();
|
follower.activateAllPIDFs();
|
||||||
forwards = new Path(new BezierCurve(new Pose(0,0), new Pose(Math.abs(DISTANCE) ,0), new Pose(Math.abs(DISTANCE) ,DISTANCE )));
|
forwards = new Path(new BezierCurve(new Pose(0,0), new Pose(Math.abs(DISTANCE) ,0), new Pose(Math.abs(DISTANCE) ,DISTANCE )));
|
||||||
backwards = new Path(new BezierCurve(new Pose(Math.abs(DISTANCE) + 72,DISTANCE + 72), new Pose(Math.abs(DISTANCE) ,0), new Pose(0,0)));
|
backwards = new Path(new BezierCurve(new Pose(Math.abs(DISTANCE) + 0,DISTANCE + 0), new Pose(Math.abs(DISTANCE) ,0), new Pose(0,0)));
|
||||||
|
|
||||||
backwards.setTangentHeadingInterpolation();
|
backwards.setTangentHeadingInterpolation();
|
||||||
backwards.reverseHeadingInterpolation();
|
backwards.reverseHeadingInterpolation();
|
||||||
@@ -1382,14 +1382,14 @@ class Circle extends OpMode {
|
|||||||
|
|
||||||
public void start() {
|
public void start() {
|
||||||
circle = follower.pathBuilder()
|
circle = follower.pathBuilder()
|
||||||
.addPath(new BezierCurve(new Pose(72, 72), new Pose(RADIUS + 72, 72), new Pose(RADIUS + 72, RADIUS + 72)))
|
.addPath(new BezierCurve(new Pose(0, 0), new Pose(RADIUS + 0, 0), new Pose(RADIUS + 0, RADIUS + 0)))
|
||||||
.setHeadingInterpolation(HeadingInterpolator.facingPoint(72, RADIUS + 72))
|
.setHeadingInterpolation(HeadingInterpolator.facingPoint(0, RADIUS + 0))
|
||||||
.addPath(new BezierCurve(new Pose(RADIUS + 72, RADIUS + 72), new Pose(RADIUS + 72, (2 * RADIUS) + 72), new Pose(72, (2 * RADIUS) + 72)))
|
.addPath(new BezierCurve(new Pose(RADIUS + 0, RADIUS + 0), new Pose(RADIUS + 0, (2 * RADIUS) + 0), new Pose(0, (2 * RADIUS) + 0)))
|
||||||
.setHeadingInterpolation(HeadingInterpolator.facingPoint(72, RADIUS + 72))
|
.setHeadingInterpolation(HeadingInterpolator.facingPoint(0, RADIUS + 0))
|
||||||
.addPath(new BezierCurve(new Pose(72, (2 * RADIUS) + 72), new Pose(-RADIUS + 72, (2 * RADIUS) + 72), new Pose(-RADIUS + 72, RADIUS + 72)))
|
.addPath(new BezierCurve(new Pose(0, (2 * RADIUS) + 0), new Pose(-RADIUS + 0, (2 * RADIUS) + 0), new Pose(-RADIUS + 0, RADIUS + 0)))
|
||||||
.setHeadingInterpolation(HeadingInterpolator.facingPoint(72, RADIUS + 72))
|
.setHeadingInterpolation(HeadingInterpolator.facingPoint(0, RADIUS + 0))
|
||||||
.addPath(new BezierCurve(new Pose(-RADIUS + 72, RADIUS + 72), new Pose(-RADIUS + 72, 72), new Pose(72, 72)))
|
.addPath(new BezierCurve(new Pose(-RADIUS + 0, RADIUS + 0), new Pose(-RADIUS + 0, 0), new Pose(0, 0)))
|
||||||
.setHeadingInterpolation(HeadingInterpolator.facingPoint(72, RADIUS + 72))
|
.setHeadingInterpolation(HeadingInterpolator.facingPoint(0, RADIUS + 0))
|
||||||
.build();
|
.build();
|
||||||
follower.followPath(circle);
|
follower.followPath(circle);
|
||||||
}
|
}
|
||||||
@@ -1406,7 +1406,7 @@ class Circle extends OpMode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
follower.setStartingPose(new Pose(72, 72));
|
follower.setStartingPose(new Pose(0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1639,8 +1639,8 @@ class OffsetsTuner extends OpMode {
|
|||||||
telemetry.addLine("Total Angle: " + follower.getTotalHeading());
|
telemetry.addLine("Total Angle: " + follower.getTotalHeading());
|
||||||
|
|
||||||
telemetry.addLine("The following values are the offsets in inches that should be applied to your localizer.");
|
telemetry.addLine("The following values are the offsets in inches that should be applied to your localizer.");
|
||||||
telemetry.addLine("strafeX: " + ((72.0-follower.getPose().getX()) / 2.0));
|
telemetry.addLine("strafeX: " + ((0.0-follower.getPose().getX()) / 2.0));
|
||||||
telemetry.addLine("forwardY: " + ((72.0-follower.getPose().getY()) / 2.0));
|
telemetry.addLine("forwardY: " + ((0.0-follower.getPose().getY()) / 2.0));
|
||||||
telemetry.update();
|
telemetry.update();
|
||||||
|
|
||||||
drawCurrentAndHistory();
|
drawCurrentAndHistory();
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
|
|||||||
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
|
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
|
||||||
|
|
||||||
import org.firstinspires.ftc.teamcode.constants.Color;
|
import org.firstinspires.ftc.teamcode.constants.Color;
|
||||||
import org.firstinspires.ftc.teamcode.constants.TeleStart;
|
|
||||||
import org.firstinspires.ftc.teamcode.pedroPathing.Constants;
|
import org.firstinspires.ftc.teamcode.pedroPathing.Constants;
|
||||||
import org.firstinspires.ftc.teamcode.utils.MeasuringLoopTimes;
|
import org.firstinspires.ftc.teamcode.utils.MeasuringLoopTimes;
|
||||||
import org.firstinspires.ftc.teamcode.utilsv2.*;
|
import org.firstinspires.ftc.teamcode.utilsv2.*;
|
||||||
@@ -31,7 +30,8 @@ public class TeleopV4 extends LinearOpMode {
|
|||||||
ParkTilter parkTilter;
|
ParkTilter parkTilter;
|
||||||
MeasuringLoopTimes loopTimes;
|
MeasuringLoopTimes loopTimes;
|
||||||
|
|
||||||
public static Pose relocalizePose = new Pose(128, 83, 0);
|
public static Pose relocalizePose = new Pose(56, 11, 0);
|
||||||
|
public static Pose teleStart = new Pose(0,0,0);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void runOpMode() throws InterruptedException {
|
public void runOpMode() throws InterruptedException {
|
||||||
@@ -47,9 +47,9 @@ public class TeleopV4 extends LinearOpMode {
|
|||||||
commander = new VelocityCommander();
|
commander = new VelocityCommander();
|
||||||
drivetrain = new Drivetrain(robot, TELE);
|
drivetrain = new Drivetrain(robot, TELE);
|
||||||
follower = Constants.createFollower(hardwareMap);
|
follower = Constants.createFollower(hardwareMap);
|
||||||
follower.setStartingPose(TeleStart.teleStart);
|
follower.setStartingPose(teleStart);
|
||||||
sleep(500);
|
sleep(500);
|
||||||
follower.setPose(TeleStart.teleStart);
|
follower.setPose(teleStart);
|
||||||
follower.update();
|
follower.update();
|
||||||
|
|
||||||
flywheel = new Flywheel(robot);
|
flywheel = new Flywheel(robot);
|
||||||
@@ -73,6 +73,8 @@ public class TeleopV4 extends LinearOpMode {
|
|||||||
limelightUsed = true;
|
limelightUsed = true;
|
||||||
|
|
||||||
TELE.addLine("Initialization is done");
|
TELE.addLine("Initialization is done");
|
||||||
|
TELE.addData("Starting Position", follower.getPose());
|
||||||
|
TELE.addData("TELE START", teleStart);
|
||||||
TELE.update();
|
TELE.update();
|
||||||
|
|
||||||
waitForStart();
|
waitForStart();
|
||||||
@@ -89,10 +91,12 @@ public class TeleopV4 extends LinearOpMode {
|
|||||||
|
|
||||||
if (gamepad1.crossWasPressed()){
|
if (gamepad1.crossWasPressed()){
|
||||||
if (Color.redAlliance){
|
if (Color.redAlliance){
|
||||||
relocalizePose = new Pose(128, 83, 0);
|
relocalizePose = new Pose(57.5, 5, 0);
|
||||||
} else {
|
} else {
|
||||||
relocalizePose = new Pose(16, 83, 180);
|
relocalizePose = new Pose(-57.5, 5, Math.toRadians(180));
|
||||||
}
|
}
|
||||||
|
follower.setPose(relocalizePose);
|
||||||
|
sleep(500);
|
||||||
gamepad1.rumble(100);
|
gamepad1.rumble(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ public class Hardware_Tester extends LinearOpMode {
|
|||||||
|
|
||||||
NormalizedRGBA revColor = robot.revSensor.getNormalizedColors();
|
NormalizedRGBA revColor = robot.revSensor.getNormalizedColors();
|
||||||
TELE.addData("REV Distance", robot.revSensor.getDistance(DistanceUnit.CM));
|
TELE.addData("REV Distance", robot.revSensor.getDistance(DistanceUnit.CM));
|
||||||
TELE.addData("REV Green", revColor.green / (revColor.red + revColor.blue + revColor.green));
|
TELE.addData("REV Green", revColor.blue / (revColor.green + revColor.blue + revColor.red));
|
||||||
|
|
||||||
TELE.addData("Voltage Sensor", robot.voltage.getVoltage());
|
TELE.addData("Voltage Sensor", robot.voltage.getVoltage());
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,9 @@ public class NewShooterTest extends LinearOpMode {
|
|||||||
commander = new VelocityCommander();
|
commander = new VelocityCommander();
|
||||||
drivetrain = new Drivetrain(robot, TELE);
|
drivetrain = new Drivetrain(robot, TELE);
|
||||||
follower = Constants.createFollower(hardwareMap);
|
follower = Constants.createFollower(hardwareMap);
|
||||||
follower.setStartingPose(new Pose(72,72,0));
|
follower.setStartingPose(new Pose(0,0,0));
|
||||||
sleep(500);
|
sleep(500);
|
||||||
follower.setPose(new Pose(72,72,0));
|
follower.setPose(new Pose(0,0,0));
|
||||||
|
|
||||||
flywheel = new Flywheel(robot);
|
flywheel = new Flywheel(robot);
|
||||||
turret = new Turret(robot);
|
turret = new Turret(robot);
|
||||||
@@ -86,11 +86,11 @@ public class NewShooterTest extends LinearOpMode {
|
|||||||
|
|
||||||
if (gamepad1.crossWasPressed()){
|
if (gamepad1.crossWasPressed()){
|
||||||
if (Color.redAlliance){
|
if (Color.redAlliance){
|
||||||
TeleopV4.relocalizePose = new Pose(128, 83, 0);
|
TeleopV4.relocalizePose = new Pose(56, 11, 0);
|
||||||
} else {
|
} else {
|
||||||
TeleopV4.relocalizePose = new Pose(16, 83, 180);
|
TeleopV4.relocalizePose = new Pose(-56, 11, 180);
|
||||||
}
|
}
|
||||||
gamepad1.rumble(100);
|
follower.setPose(TeleopV4.relocalizePose);
|
||||||
gamepad1.rumble(100);
|
gamepad1.rumble(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import com.acmerobotics.dashboard.config.Config;
|
|||||||
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
|
import com.acmerobotics.dashboard.telemetry.MultipleTelemetry;
|
||||||
import com.pedropathing.follower.Follower;
|
import com.pedropathing.follower.Follower;
|
||||||
|
|
||||||
|
import org.firstinspires.ftc.teamcode.constants.Color;
|
||||||
|
|
||||||
@Config
|
@Config
|
||||||
public class Shooter {
|
public class Shooter {
|
||||||
|
|
||||||
@@ -42,14 +44,14 @@ public class Shooter {
|
|||||||
this.red = input;
|
this.red = input;
|
||||||
|
|
||||||
if (this.red) {
|
if (this.red) {
|
||||||
goalX = 144;
|
goalX = 72;
|
||||||
turretGoalX = 140;
|
turretGoalX = 68;
|
||||||
} else {
|
} else {
|
||||||
goalX = 0;
|
goalX = -72;
|
||||||
turretGoalX = 8;
|
turretGoalX = -68;
|
||||||
}
|
}
|
||||||
goalY = 144;
|
goalY = 72;
|
||||||
turretGoalY = 132;
|
turretGoalY = 68;
|
||||||
}
|
}
|
||||||
|
|
||||||
private double flywheelVelocity = 0.0;
|
private double flywheelVelocity = 0.0;
|
||||||
@@ -89,7 +91,7 @@ public class Shooter {
|
|||||||
|
|
||||||
private final double shooterDistFromCenter = 1.545;
|
private final double shooterDistFromCenter = 1.545;
|
||||||
public void update(double voltage) {
|
public void update(double voltage) {
|
||||||
|
setRedAlliance(Color.redAlliance);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case NOTHING:
|
case NOTHING:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ public class SpindexerTransferIntake {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int[] shootOrder = {0, 1, 2};
|
int[] shootOrder = {0, 1, 2};
|
||||||
private final double sensorDistanceThreshold = 6.0;
|
final double sensorDistanceThreshold = 5.3;
|
||||||
private final long pulseTime = 100; // ms
|
final long pulseTime = 100; // ms
|
||||||
|
|
||||||
private DesiredPattern desiredPattern = DesiredPattern.GPP;
|
private DesiredPattern desiredPattern = DesiredPattern.GPP;
|
||||||
|
|
||||||
@@ -203,8 +203,8 @@ public class SpindexerTransferIntake {
|
|||||||
private RapidMode rapidMode = RapidMode.INTAKE;
|
private RapidMode rapidMode = RapidMode.INTAKE;
|
||||||
private SortedIntakeStates sortedIntakeStates = SortedIntakeStates.IDLE;
|
private SortedIntakeStates sortedIntakeStates = SortedIntakeStates.IDLE;
|
||||||
private BallStates[] ballColors = {BallStates.UNKNOWN, BallStates.UNKNOWN, BallStates.UNKNOWN};
|
private BallStates[] ballColors = {BallStates.UNKNOWN, BallStates.UNKNOWN, BallStates.UNKNOWN};
|
||||||
private final double greenThresh = 0.39;
|
final double greenThresh = 0.39;
|
||||||
private final double spinMovementTime = 250;
|
final double spinMovementTime = 250;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time when current state was entered.
|
* Time when current state was entered.
|
||||||
@@ -571,7 +571,7 @@ public class SpindexerTransferIntake {
|
|||||||
break;
|
break;
|
||||||
case WAIT_FOR_1:
|
case WAIT_FOR_1:
|
||||||
|
|
||||||
if (shootStateTime() > 250) {
|
if (shootStateTime() > 400) {
|
||||||
|
|
||||||
setShootState(
|
setShootState(
|
||||||
SortedShootState.SHOOT_1
|
SortedShootState.SHOOT_1
|
||||||
@@ -618,7 +618,7 @@ public class SpindexerTransferIntake {
|
|||||||
break;
|
break;
|
||||||
case WAIT_FOR_2:
|
case WAIT_FOR_2:
|
||||||
|
|
||||||
if (shootStateTime() > 250) {
|
if (shootStateTime() > 400) {
|
||||||
|
|
||||||
setShootState(
|
setShootState(
|
||||||
SortedShootState.SHOOT_2
|
SortedShootState.SHOOT_2
|
||||||
@@ -664,7 +664,7 @@ public class SpindexerTransferIntake {
|
|||||||
break;
|
break;
|
||||||
case WAIT_FOR_3:
|
case WAIT_FOR_3:
|
||||||
|
|
||||||
if (shootStateTime() > 250) {
|
if (shootStateTime() > 400) {
|
||||||
|
|
||||||
setShootState(
|
setShootState(
|
||||||
SortedShootState.SHOOT_3
|
SortedShootState.SHOOT_3
|
||||||
|
|||||||
Reference in New Issue
Block a user