Skip to content

Commit 0c68e8d

Browse files
committed
Don't use DriverStation Timer.
Try to fix five ball auto LEDs. Stop trigger @ teleopInit.
1 parent 9694a68 commit 0c68e8d

File tree

5 files changed

+23
-12
lines changed

5 files changed

+23
-12
lines changed

src/main/java/frc/robot/Robot.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public void autonomousPeriodic() {
145145
@Override
146146
public void teleopInit() {
147147

148+
Status.getInstance().setTeleopStartTime();
148149
new SetColor(Status.getInstance(), Color.kBlack).schedule();
149150

150151
// new SetColor(Status.getInstance(), Color.kDarkOrchid).schedule();

src/main/java/frc/robot/RobotContainer.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,11 @@ public void setLEDs() {
160160
new SetColor(mStatus, Color.kCornsilk).schedule();
161161
}
162162

163+
/**
164+
* Called by Robot at teleopInit()
165+
*/
163166
public void stopShooter() {
167+
mShooter.stopTrigger();
164168
new StopShooter(mShooter).schedule();
165169
}
166170

@@ -319,6 +323,9 @@ public void configureButtonBindings() {
319323
new JoystickButton(operator, X_BOX_LOGO_RIGHT).whenPressed(new DeployClimber(mClimber));
320324
new JoystickButton(operator, X_BOX_LOGO_LEFT).whenPressed(new RetractClimber(mClimber));
321325

326+
new JoystickButton(operator,9).and(new JoystickButton(operator,10))
327+
.whenActive(new ResetHood(mShooter));
328+
322329
// .and(new JoystickButton(operator, X_BOX_LOGO_LEFT))
323330
// .whenActive(new ToggleClimber(mClimber));
324331
}

src/main/java/frc/robot/auto/groups/FiveBallAuto.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,21 @@
3737
public class FiveBallAuto extends SequentialCommandGroup {
3838
public FiveBallAuto(Drivetrain drive, Intake intake, Shooter shooter) {
3939
addCommands(
40-
new ActionCommand(new ImageAction("burst.bmp", 0.02).brightness(0.7)),
4140
new ResetOdometry(drive, new Pose2d(new Translation2d(0, 0), Rotation2d.fromDegrees(-90.0))),
4241
new ParallelDeadlineGroup(
4342
new SequentialCommandGroup(
4443
new WaitCommand(1.0), // Give shooter time to spin up & hood to move
4544
new PullTrigger(shooter),
4645
new WaitCommand(0.5)),
46+
new ActionCommand(new ImageAction("THFade.png", 0.02).brightness(0.7)),
4747
new TrajectoryFollower(drive, new FiveBallPartOne()), // Turn to point at center
4848
new FlywheelController(shooter, 1810, 77.90)),
4949
new ParallelDeadlineGroup(
5050
new StopShooter(shooter),
5151
new StopTrigger(shooter),
5252
new FastIntake(intake)),
5353
new ParallelDeadlineGroup(
54-
new WaitCommand(4.60),
54+
new WaitCommand(5.10),
5555
new SequentialCommandGroup(
5656
new WaitCommand(1.1),
5757
new FlywheelController(shooter, 1990, 73.25)),

src/main/java/frc/robot/status/Status.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class Status extends SubsystemBase {
6969
private boolean inAuto = false;
7070
private boolean inTeleOp = false;
7171

72+
private double teleopStartTime;
73+
7274
private Status() {
7375
// super();
7476

@@ -251,6 +253,15 @@ public static Status getInstance() {
251253
return INSTANCE;
252254
}
253255

256+
public void setTeleopStartTime() {
257+
this.teleopStartTime = Timer.getFPGATimestamp();
258+
}
259+
260+
/** In seconds */
261+
public double getTeleopStartTime() {
262+
return this.teleopStartTime;
263+
}
264+
254265
public void resetBoot() {
255266
inAuto = false;
256267
inTeleOp = false;

src/main/java/frc/robot/status/commands/IdleCommand.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,11 @@ public void execute() {
5757
5858
Do some gymnastics to try to generate an elapsed time from getMatchTime().
5959
**/
60-
double rawTime = Timer.getMatchTime();
61-
MatchType mt = DriverStation.getMatchType();
6260
double timeElapsed = 0;
63-
if (DriverStation.isFMSAttached() || (mt == MatchType.Practice)) {
64-
// Time will be counting down.
65-
timeElapsed = TELEOP_LENGTH - rawTime;
66-
} else {
67-
// Time will be counting up.
68-
timeElapsed = rawTime;
69-
}
61+
timeElapsed = Timer.getFPGATimestamp() - status.getTeleopStartTime();
7062

7163
Action action = scannerAction;
72-
// new PrintCommand("Time Left = " + String.valueOf(timeLeft)).schedule();
64+
// new PrintCommand("Time Left = " + String.valueOf(timeElapsed)).schedule();
7365
if ( 115.0 < timeElapsed && (0 == phase)) { // 20 Seconds left
7466
action = new ImageAction("yellow_stripes.png",0.05);
7567
phase = 1;

0 commit comments

Comments
 (0)