Skip to content

Commit e280546

Browse files
committed
Pre-playoffs-2
1 parent 91dfba7 commit e280546

File tree

6 files changed

+29
-18
lines changed

6 files changed

+29
-18
lines changed

src/main/java/wmironpatriots/Robot.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package wmironpatriots;
88

99
import com.ctre.phoenix6.SignalLogger;
10-
import edu.wpi.first.math.MathUtil;
1110
import edu.wpi.first.math.geometry.Pose2d;
1211
import edu.wpi.first.math.geometry.Rotation2d;
1312
import edu.wpi.first.wpilibj.Alert;
@@ -28,6 +27,7 @@
2827
import java.util.Optional;
2928
import monologue.Logged;
3029
import wmironpatriots.commands.Autonomous;
30+
import wmironpatriots.commands.DriveToPose;
3131
import wmironpatriots.subsystems.climb.Climb;
3232
import wmironpatriots.subsystems.climb.ClimbIOComp;
3333
import wmironpatriots.subsystems.superstructure.Superstructure;
@@ -61,6 +61,8 @@ public class Robot extends TimedRobot implements Logged {
6161

6262
Command auton;
6363

64+
private Command goTo;
65+
6466
public Robot() {
6567
// * SYSTEMS INIT
6668
// Shuts up driverstation
@@ -116,6 +118,8 @@ public Robot() {
116118
new Superstructure(
117119
swerve, new ElevatorIOComp(), new TailIOComp(), new RollerIOComp(), new ChuteIOComp());
118120

121+
goTo = new DriveToPose(swerve, swerve::getAlignPose);
122+
119123
climb.setDefaultCommand(climb.runClimb(0));
120124

121125
autons = Autonomous.configureAutons(swerve, superstructure);
@@ -126,7 +130,8 @@ public Robot() {
126130
() -> -JoystickUtil.applyTeleopModifier(driver::getLeftY),
127131
() -> -JoystickUtil.applyTeleopModifier(driver::getLeftX),
128132
() -> -JoystickUtil.applyTeleopModifier(driver::getRightX),
129-
() -> MathUtil.clamp(1.5 - driver.getRightTriggerAxis(), 0.0, 1.0)));
133+
() -> 1.0));
134+
// () -> MathUtil.clamp(1.5 - driver.getRightTriggerAxis(), 0.0, 1.0)));
130135
driver
131136
.a()
132137
.whileTrue(
@@ -135,6 +140,9 @@ public Robot() {
135140
swerve.resetOdo(
136141
new Pose2d(swerve.getPose().getTranslation(), new Rotation2d()))));
137142
driver.rightBumper().whileTrue(superstructure.score());
143+
driver.x().whileTrue(goTo);
144+
driver.rightTrigger(0.3).onTrue(setbah(0.0));
145+
driver.leftTrigger(0.3).onTrue(setbah(1.0));
138146

139147
// driver.y().whileTrue(swerve.driveToPoseCmmd(() -> Swerve.AlignTargets.A));
140148
operator.a().whileTrue(superstructure.scoreCoralCmmd(ReefLevel.L1));

src/main/java/wmironpatriots/commands/DriveToPose.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public class DriveToPose extends Command {
4545
// }
4646

4747
public static final double LINEAR_P = 0.8;
48-
public static final double LINEAR_D = 0.8;
49-
public static final double ANGULAR_P = 0.8;
50-
public static final double ANGULAR_D = 0.8;
48+
public static final double LINEAR_D = 0.0;
49+
public static final double ANGULAR_P = 0.3;
50+
public static final double ANGULAR_D = 0.0;
5151

5252
public static final double MAX_VEL = 3.8;
5353
public static final double MAX_ACCEL = 3.0;

src/main/java/wmironpatriots/subsystems/superstructure/tail/Tail.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public abstract class Tail implements Logged, Subsystem {
2323
public static final double POSE_MAX = 10;
2424
public static final double POSE_MIN = 8.2;
2525
public static final double POSE_SAFTEY =
26-
6.8; // The position where the tail is safe from the top of 1st stage
26+
7.2; // The position where the tail is safe from the top of 1st stage
2727

2828
public static final double POSE_L1 = 10;
2929
public static final double POSE_L2 = (20 * 5 / 36); // 5;

src/main/java/wmironpatriots/subsystems/superstructure/tail/roller/Roller.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
public abstract class Roller implements Logged, Subsystem {
1515
// * CONSTANTS
16-
public static final double SPEED_INTAKING = 2;
17-
public static final double SPEED_OUTAKING = -2;
16+
public static final double SPEED_INTAKING = 1.25;
17+
public static final double SPEED_OUTAKING = -1.25;
1818
public static final double SPEED_SCORING = 3.5;
1919

2020
// * LOGGED VALUES

src/main/java/wmironpatriots/subsystems/swerve/Swerve.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ public void periodic() {
231231
}
232232
}
233233

234+
public Pose2d getAlignPose() {
235+
return alignTarget.pose;
236+
}
237+
234238
@Override
235239
public void simulationPeriodic() {
236240
simulation.get().periodic();
@@ -426,22 +430,21 @@ public static Pose2d calculateReefPose(int a, int b) {
426430
if (b != -1 && b != 1) {
427431
b = 1;
428432
}
429-
double angle = 0.137 - 1 * 0.0175;
433+
double angle;
434+
435+
if (b == 1) {
436+
angle = 0.137 + 2 * 0.0175;
437+
} else {
438+
angle = 0.137 - 1 * 0.0175;
439+
}
440+
430441
// - 4 * 0.0175;
431442
double x = ((50.49 * Math.cos(((a * Math.PI) / 3) + (angle * b))) + 177.25) / 39.37;
432443
double y = ((50.49 * Math.sin(((a * Math.PI) / 3) + (angle * b))) + 158.50) / 39.37;
433444
double theta = (a * Math.PI) / 3;
434445

435446
x = (Units.inchesToMeters(689.751) - x);
436447
y = (Units.inchesToMeters(317.5) - y);
437-
// x =
438-
// true
439-
// ? (Units.inchesToMeters(689.751) - x)
440-
// : x;
441-
// y =
442-
// true
443-
// ? (Units.inchesToMeters(317.5) - y)
444-
// : y;
445448
theta =
446449
DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Red ? theta + Math.PI : theta;
447450

src/main/java/wmironpatriots/subsystems/swerve/SwerveConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class SwerveConstants {
5252
Rotation2d.fromRotations(
5353
DriverStation.getAlliance().orElse(Alliance.Blue) == Alliance.Blue ? 0 : 0.5);
5454

55-
public static final double MAX_LINEAR_SPEED = Units.feetToMeters(16.5);
55+
public static final double MAX_LINEAR_SPEED = Units.feetToMeters(17.25);
5656
public static final double MAX_ANGULAR_SPEED = MAX_LINEAR_SPEED / RADIUS_METERS;
5757

5858
public static final double LINEAR_P = 3.0; // 4.5;

0 commit comments

Comments
 (0)