Skip to content

Commit bbd59b7

Browse files
authored
Merge pull request #226 from strykeforce/rkalnins/hotfix-v19.2.0
Rkalnins/hotfix v19.2.0
2 parents 2d3b7b1 + f6743fa commit bbd59b7

25 files changed

+741
-271
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Talons
44

5-
Subsystem | Talon | ID | PDP
5+
Subsystem | Talon | ID | PDP
66
------------ | ----------- | -- | ---
77
Drive | azimuth | 0 | 11
88
Drive | azimuth | 1 | 9

nt/networktables-airtight-2.ini renamed to nt/airtight-4-11.ini

Lines changed: 305 additions & 142 deletions
Large diffs are not rendered by default.

src/main/java/frc/team2767/deepspace/Robot.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,14 @@ public void robotInit() {
7979

8080
SmartDashboard.putBoolean("Game/SandstormPickUp", false);
8181
SmartDashboard.putBoolean("Game/haveHatch", false);
82-
82+
SmartDashboard.putBoolean("Game/climbOnTarget", false);
83+
SmartDashboard.putBoolean("Game/climbPrecheck", false);
8384
// new SmartDashboardControls();
8485
}
8586

8687
@Override
8788
public void autonomousInit() {
89+
BISCUIT.setPosition(BISCUIT.getPosition());
8890
DRIVE.setAngleAdjustment(true);
8991
getHatch.start();
9092
}

src/main/java/frc/team2767/deepspace/command/climb/ClimbAutoCommand.java

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,9 @@ protected void initialize() {
3333
climbState = ClimbState.FORM_SEAL;
3434
CLIMB.setVelocity(ClimbSubsystem.kSealOutputVelocity);
3535
logger.info("forming seal");
36-
// CLIMB.setSlowTalonConfig(false);
37-
// climbState = ClimbState.FAST_LOWER;
38-
// CLIMB.setLowerLimit(ClimbSubsystem.kHabHover);
39-
// CLIMB.setVelocity(ClimbSubsystem.kDownVelocity);
4036
}
4137

38+
@SuppressWarnings("Duplicates")
4239
@Override
4340
protected void execute() {
4441
switch (climbState) {
@@ -59,18 +56,36 @@ protected void execute() {
5956
CLIMB.enableRatchet();
6057
CLIMB.releaseKickstand();
6158
VISION.startLightBlink(VisionSubsystem.LightPattern.CLIMB_GOOD);
62-
// CLIMB.setLowerLimit(ClimbSubsystem.kClimb);
6359
CLIMB.setVelocity(ClimbSubsystem.kDownClimbVelocity);
60+
break;
6461
}
6562

6663
if (CLIMB.getStringPotPosition() >= ClimbSubsystem.kTooLowIn - GOOD_ENOUGH) {
6764
logger.info("resetting");
65+
if (VACUUM.isClimbPrecheck()) {
66+
climbState = ClimbState.PRECHECK;
67+
logger.debug("going to precheck");
68+
CLIMB.stop();
69+
break;
70+
}
6871
CLIMB.setSlowTalonConfig(false);
6972
climbState = ClimbState.RESET;
70-
// CLIMB.setUpperLimit(ClimbSubsystem.kHabHover);
7173
CLIMB.setVelocity(ClimbSubsystem.kUpVelocity);
74+
75+
break;
7276
}
7377

78+
break;
79+
case PRECHECK:
80+
if (VACUUM.isClimbOnTarget()) {
81+
logger.info("fast climbing");
82+
CLIMB.setSlowTalonConfig(false);
83+
climbState = ClimbState.FAST_CLIMB;
84+
CLIMB.enableRatchet();
85+
CLIMB.releaseKickstand();
86+
VISION.startLightBlink(VisionSubsystem.LightPattern.CLIMB_GOOD);
87+
CLIMB.setVelocity(ClimbSubsystem.kDownClimbVelocity);
88+
}
7489
break;
7590
case FAST_CLIMB:
7691
if (CLIMB.getStringPotPosition() >= ClimbSubsystem.kClimb) {
@@ -86,11 +101,23 @@ protected void execute() {
86101
}
87102
break;
88103
case RESET:
104+
if (VACUUM.isClimbOnTarget()) {
105+
logger.info("fast climbing during reset");
106+
CLIMB.setSlowTalonConfig(false);
107+
climbState = ClimbState.FAST_CLIMB;
108+
CLIMB.enableRatchet();
109+
CLIMB.releaseKickstand();
110+
VISION.startLightBlink(VisionSubsystem.LightPattern.CLIMB_GOOD);
111+
CLIMB.setVelocity(ClimbSubsystem.kDownClimbVelocity);
112+
break;
113+
}
114+
89115
if (CLIMB.getStringPotPosition() <= ClimbSubsystem.kHabHover + GOOD_ENOUGH) {
90116
climbState = ClimbState.PAUSE;
91117
CLIMB.stop();
92118
pauseInitTime = Timer.getFPGATimestamp();
93119
}
120+
94121
break;
95122
}
96123
}
@@ -110,6 +137,7 @@ private enum ClimbState {
110137
FAST_LOWER,
111138
FORM_SEAL,
112139
RESET,
140+
PRECHECK,
113141
PAUSE,
114142
FAST_CLIMB,
115143
DONE

src/main/java/frc/team2767/deepspace/command/climb/ClimbDeployCommand.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
import edu.wpi.first.wpilibj.command.Command;
44
import frc.team2767.deepspace.Robot;
55
import frc.team2767.deepspace.subsystem.ClimbSubsystem;
6+
import frc.team2767.deepspace.subsystem.VacuumSubsystem;
67
import org.slf4j.Logger;
78
import org.slf4j.LoggerFactory;
89

910
public class ClimbDeployCommand extends Command {
1011

1112
private static final ClimbSubsystem CLIMB = Robot.CLIMB;
13+
private static final VacuumSubsystem VACUUM = Robot.VACUUM;
1214
private static final int GOOD_ENOUGH = 5;
1315
private State currentState;
1416
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@@ -32,7 +34,6 @@ protected void execute() {
3234
switch (currentState) {
3335
case RELEASE:
3436
if (CLIMB.getStringPotPosition() >= ClimbSubsystem.kLowRelease - GOOD_ENOUGH) {
35-
// CLIMB.setUpperLimit(ClimbSubsystem.kHighRelease);
3637
CLIMB.openLoop(-1.0); // kUpVel
3738
currentState = State.POSITION;
3839
logger.debug("released, climber position = {}", CLIMB.getStringPotPosition());

src/main/java/frc/team2767/deepspace/command/climb/ClimbJogCommand.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
package frc.team2767.deepspace.command.climb;
22

3-
import edu.wpi.first.wpilibj.command.InstantCommand;
3+
import edu.wpi.first.wpilibj.command.Command;
44
import frc.team2767.deepspace.Robot;
55
import frc.team2767.deepspace.subsystem.ClimbSubsystem;
6+
import frc.team2767.deepspace.subsystem.VacuumSubsystem;
67
import org.slf4j.Logger;
78
import org.slf4j.LoggerFactory;
89

9-
public class ClimbJogCommand extends InstantCommand {
10+
public class ClimbJogCommand extends Command {
1011

1112
private static final ClimbSubsystem CLIMB = Robot.CLIMB;
13+
private static final VacuumSubsystem VACUUM = Robot.VACUUM;
1214
private final Logger logger = LoggerFactory.getLogger(this.getClass());
1315
private double percent;
1416

@@ -21,4 +23,14 @@ protected void initialize() {
2123
logger.info("open loop climb at {}", percent);
2224
CLIMB.openLoop(percent);
2325
}
26+
27+
@Override
28+
protected boolean isFinished() {
29+
return CLIMB.getStringPotPosition() < (ClimbSubsystem.kHighRelease - 10);
30+
}
31+
32+
@Override
33+
protected void end() {
34+
CLIMB.stop();
35+
}
2436
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package frc.team2767.deepspace.command.climb;
2+
3+
import edu.wpi.first.wpilibj.command.Command;
4+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
5+
import frc.team2767.deepspace.Robot;
6+
import frc.team2767.deepspace.subsystem.ClimbSubsystem;
7+
import frc.team2767.deepspace.subsystem.VacuumSubsystem;
8+
import org.slf4j.Logger;
9+
import org.slf4j.LoggerFactory;
10+
11+
public class ClimbSlowVelocityCommand extends Command {
12+
private static final VacuumSubsystem VACUUM = Robot.VACUUM;
13+
private static final ClimbSubsystem CLIMB = Robot.CLIMB;
14+
private final Logger logger = LoggerFactory.getLogger(this.getClass());
15+
16+
public ClimbSlowVelocityCommand() {
17+
requires(CLIMB);
18+
}
19+
20+
@Override
21+
protected void initialize() {
22+
logger.info("Manual Lower Suction Cup Slow Velocity");
23+
CLIMB.setSlowTalonConfig(true);
24+
CLIMB.setVelocity(ClimbSubsystem.kSealOutputVelocity);
25+
}
26+
27+
public void execute() {
28+
SmartDashboard.putBoolean("Game/climbOnTarget", VACUUM.isClimbOnTarget());
29+
}
30+
31+
@Override
32+
protected boolean isFinished() {
33+
return false;
34+
}
35+
}

src/main/java/frc/team2767/deepspace/command/intake/RollerInCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class RollerInCommand extends InstantCommand {
1010
private final double output;
1111

1212
public RollerInCommand() {
13-
this(0.8);
13+
this(0.9);
1414
}
1515

1616
public RollerInCommand(double output) {

src/main/java/frc/team2767/deepspace/command/intake/RollerOutCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class RollerOutCommand extends InstantCommand {
1010
private final double output;
1111

1212
public RollerOutCommand() {
13-
this(0.8);
13+
this(0.9);
1414
}
1515

1616
public RollerOutCommand(double output) {

src/main/java/frc/team2767/deepspace/command/intake/WaitForBeamBreakCommand.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
import frc.team2767.deepspace.subsystem.IntakeSubsystem;
66

77
public class WaitForBeamBreakCommand extends Command {
8+
private static final double WAIT_TIME_MS = 300;
9+
private double breakTime;
10+
private boolean hasBroken;
811
private final IntakeSubsystem INTAKE = Robot.INTAKE;
9-
private static boolean hasBroken;
10-
private static double breakTime;
11-
private static double currentTime;
12-
private static double WAIT_TIME_MS = 200;
1312

1413
@Override
1514
protected void initialize() {
@@ -26,8 +25,7 @@ protected void execute() {
2625

2726
@Override
2827
protected boolean isFinished() {
29-
currentTime = System.currentTimeMillis();
30-
return hasBroken && (currentTime - breakTime > WAIT_TIME_MS);
28+
return hasBroken && (System.currentTimeMillis() - breakTime > WAIT_TIME_MS);
3129
}
3230

3331
@Override

0 commit comments

Comments
 (0)