Skip to content

Commit 75f73fd

Browse files
rkalninsmwitcpalek
authored andcommitted
Rkalnins/pre st. joe (#164)
* --wip-- [skip ci] * Finish adding vacuum healthcheck * Revert status frames * Spotless * Finish Pre st. joe
1 parent ce6ec47 commit 75f73fd

File tree

16 files changed

+611
-272
lines changed

16 files changed

+611
-272
lines changed

networktables.ini

Lines changed: 35 additions & 180 deletions
Large diffs are not rendered by default.

networktables.ini.bak

Lines changed: 352 additions & 36 deletions
Large diffs are not rendered by default.

src/main/java/frc/team2767/deepspace/command/sequences/CoconutPickupCommandGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public CoconutPickupCommandGroup() {
3535
addSequential(new ElevatorSetPositionCommand(22.0));
3636
addSequential(new BiscuitSetPositionCommand(BiscuitSubsystem.kDownRightPositionDeg));
3737

38-
addSequential(new ElevatorSetPositionCommand(18.0));
38+
addSequential(new ElevatorSetPositionCommand(17.8));
3939
addParallel(new IntakePositionCommand(105)); // 105
4040
addSequential(new LogCommand("opening valves"));
4141
addSequential(

src/main/java/frc/team2767/deepspace/subsystem/BiscuitSubsystem.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,19 @@ public BiscuitSubsystem() {
5858

5959
private void biscuitPreferences() {
6060
// ticks
61-
kAbsoluteZeroTicks = (int) getPreference("absolute_zero_ticks", 1452);
61+
kAbsoluteZeroTicks = (int) getPreference("absolute_zero_ticks", 2450);
6262
kCloseEnoughTicks = (int) getPreference("close_enough_ticks", 50);
6363

6464
// degrees
6565
kUpPositionDeg = getPreference("up_deg", 0);
6666
kDownRightPositionDeg = getPreference("down_R_deg", 179);
6767
kDownLeftPositionDeg = getPreference("down_L_deg", -179);
68-
kLeftPositionDeg = getPreference("left_deg", -85);
69-
kRightPositionDeg = getPreference("right_deg", 85);
68+
kLeftPositionDeg = getPreference("left_deg", -86.5);
69+
kRightPositionDeg = getPreference("right_deg", 87);
7070
kBackStopLeftPositionDeg = getPreference("backstop_L_deg", -135);
7171
kBackStopRightPositionDeg = getPreference("backstop_R_deg", 135);
72-
kTiltUpLeftPositionDeg = getPreference("tilt_up_L_deg", -60);
73-
kTiltUpRightPositionDeg = getPreference("tilt_up_R_deg", 60);
72+
kTiltUpLeftPositionDeg = getPreference("tilt_up_L_deg", -65);
73+
kTiltUpRightPositionDeg = getPreference("tilt_up_R_deg", 64);
7474
}
7575

7676
private void configTalon() {

src/main/java/frc/team2767/deepspace/subsystem/ElevatorSubsystem.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,17 +61,17 @@ private void elevatorPreferences() {
6161
kDownOutput = getPreference("down_output", -0.2);
6262

6363
kCloseEnoughTicks = (int) getPreference("close_enough_ticks", 500);
64-
kAbsoluteZeroTicks = (int) getPreference("absolute_zero_ticks", 1854);
64+
kAbsoluteZeroTicks = (int) getPreference("absolute_zero_ticks", 2064);
6565

6666
kCargoPickupPositionInches = getPreference("cargo_pickup_in", 16.22);
67-
kHatchLowPositionInches = getPreference("hatch_low_in", 8.5);
68-
kHatchMediumPositionInches = getPreference("hatch_medium_in", 24.0);
69-
kHatchHighPositionInches = getPreference("hatch_high_in", 32.5);
67+
kHatchLowPositionInches = getPreference("hatch_low_in", 8.43);
68+
kHatchMediumPositionInches = getPreference("hatch_medium_in", 22.0);
69+
kHatchHighPositionInches = getPreference("hatch_high_in", 33.45);
7070
kStowPositionInches = getPreference("stow_in", 4.0);
71-
kCargoLowPositionInches = getPreference("cargo_low_in", 11.0);
72-
kCargoMediumPositionInches = getPreference("cargo_medium_in", 22.0);
71+
kCargoLowPositionInches = getPreference("cargo_low_in", 12.5);
72+
kCargoMediumPositionInches = getPreference("cargo_medium_in", 25.0);
7373
kCargoPlayerPositionInches = getPreference("cargo_player_in", 19.9);
74-
kCargoHighPositionInches = getPreference("cargo_high_in", 32.5);
74+
kCargoHighPositionInches = getPreference("cargo_high_in", 32.57);
7575
}
7676

7777
private void configTalon() {

src/main/java/frc/team2767/deepspace/subsystem/IntakeSubsystem.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ private void intakePreferences() {
5959
// ticks
6060
kZeroPositionTicks = getPreference("zero_position_ticks", 0);
6161
kCloseEnoughTicks = (int) getPreference("close_enough_ticks", 100);
62-
kAbsoluteZero = (int) getPreference("absolute_zero", 2163);
62+
kAbsoluteZero = (int) getPreference("absolute_zero", 1978);
6363

6464
// degrees
65-
kStowPositionDeg = getPreference("up_position_deg", 107);
66-
kMiddlePositionDeg = getPreference("middle_position_deg", 105);
65+
kStowPositionDeg = getPreference("up_position_deg", 109.86);
66+
kMiddlePositionDeg = getPreference("middle_position_deg", 95);
6767
kCargoPlayerPositionDeg = getPreference("cargo_player_position_deg", 97.4);
68-
kLoadPositionDeg = getPreference("load_position_deg", 24.4);
68+
kLoadPositionDeg = getPreference("load_position_deg", 0.0);
6969
}
7070

7171
@SuppressWarnings("Duplicates")

src/main/java/frc/team2767/deepspace/subsystem/VacuumSubsystem.java

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

33
import com.ctre.phoenix.motorcontrol.ControlMode;
44
import com.ctre.phoenix.motorcontrol.FeedbackDevice;
5-
import com.ctre.phoenix.motorcontrol.StatusFrameEnhanced;
65
import com.ctre.phoenix.motorcontrol.can.TalonSRX;
76
import com.ctre.phoenix.motorcontrol.can.TalonSRXConfiguration;
87
import edu.wpi.first.wpilibj.AnalogInput;
@@ -90,7 +89,6 @@ private void configTalon() {
9089
vacuumConfig.peakOutputForward = 1.0;
9190
vacuumConfig.peakOutputReverse = 0.0;
9291

93-
vacuum.setStatusFramePeriod(StatusFrameEnhanced.Status_3_Quadrature, 10);
9492
vacuum.configAllSettings(vacuumConfig);
9593
vacuum.enableCurrentLimit(true);
9694
vacuum.enableVoltageCompensation(true);
@@ -164,8 +162,7 @@ public void setSolenoid(Valve valve, boolean state) {
164162
}
165163

166164
public double getPumpTemperature() {
167-
double temp = (analogInput.getVoltage() - TEMP_OFFSET) / VOLTS_PER_CELSIUS;
168-
return temp;
165+
return (analogInput.getVoltage() - TEMP_OFFSET) / VOLTS_PER_CELSIUS;
169166
}
170167

171168
public boolean onTarget() {

src/main/java/frc/team2767/deepspace/subsystem/safety/IntakePosition.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package frc.team2767.deepspace.subsystem.safety;
22

33
enum IntakePosition {
4-
INTAKE_INTAKE(9664, -250),
5-
INTAKE_STOW(3224, -250);
4+
INTAKE_INTAKE(12_081, -250),
5+
INTAKE_STOW(3_932, -250);
66

77
public final int forwardLimit;
88
public final int reverseLimit;

src/main/kotlin/frc/team2767/deepspace/command/HealthCheckCommand.kt

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,38 @@ class HealthCheckCommand : Command() {
1515
requires(Robot.DRIVE)
1616
requires(Robot.ELEVATOR)
1717
requires(Robot.INTAKE)
18+
requires(Robot.VACUUM)
1819
}
1920

2021
private lateinit var healthCheck: HealthCheck
2122

2223
override fun initialize() {
2324
healthCheck = healthCheck {
25+
//
26+
// vacuumCheck {
27+
// name = "pressure tests"
28+
//
29+
// pressureTest {
30+
// name = "climb pressure test"
31+
//
32+
// pressure = 16.0
33+
// encoderTimeOutCount = 20_000
34+
// maxAcceptablePressureDrop = 2
35+
// }
36+
// }
37+
38+
// pump tests are highly dependent on valve states set in pressure tests
39+
talonCheck {
40+
name = "pump tests"
41+
talons = Robot.VACUUM.talons
42+
43+
timedTest {
44+
percentOutput = 0.25
45+
currentRange = 0.0..0.0
46+
speedRange = 0..0
47+
duration = 5.0
48+
}
49+
}
2450

2551

2652
talonCheck {
@@ -87,24 +113,35 @@ class HealthCheckCommand : Command() {
87113
name = "elevator position tests"
88114
talons = Robot.ELEVATOR.talons
89115

116+
positionTalon {
117+
encoderTarget = 10_000
118+
encoderGoodEnough = 100
119+
}
120+
90121
positionTest {
91122
percentOutput = 0.2
92123

93-
encoderChangeTarget = 10_000
124+
encoderChangeTarget = 15_000
94125
encoderGoodEnough = 500
95126
encoderTimeOutCount = 5000
96127

97128
currentRange = 0.0..0.5
98129
speedRange = 500..600
99130
}
100131

101-
positionTalon {
102-
encoderTarget = 10_000
103-
encoderGoodEnough = 100
132+
positionTest {
133+
percentOutput = -0.2
134+
135+
encoderChangeTarget = 15_000
136+
encoderGoodEnough = 500
137+
encoderTimeOutCount = 5000
104138

139+
currentRange = 0.0..0.5
140+
speedRange = 500..600
105141
}
106142
}
107143

144+
108145
talonCheck {
109146
name = "shoulder position tests"
110147
talons = Robot.INTAKE.shoulderTalon
@@ -119,6 +156,17 @@ class HealthCheckCommand : Command() {
119156
currentRange = 0.0..0.5
120157
speedRange = 500..600
121158
}
159+
160+
positionTest {
161+
percentOutput = -0.2
162+
163+
encoderChangeTarget = 2500
164+
encoderGoodEnough = 200
165+
encoderTimeOutCount = 500
166+
167+
currentRange = 0.0..0.5
168+
speedRange = 500..600
169+
}
122170
}
123171

124172
talonCheck {
@@ -164,7 +212,6 @@ class HealthCheckCommand : Command() {
164212
speedRange = 1000..1100
165213
}
166214
}
167-
168215
}
169216

170217
}

src/main/kotlin/frc/team2767/deepspace/health/HealthCheck.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ class HealthCheck {
2222
private lateinit var iterator: Iterator<TestGroup>
2323
private lateinit var currentTestGroup: TestGroup
2424

25+
fun vacuumCheck(init: VacuumGroup.() -> Unit): VacuumGroup {
26+
val test = VacuumGroup(this)
27+
test.init()
28+
testGroups.add(test)
29+
return test
30+
}
2531

2632
fun talonCheck(init: TalonGroup.() -> Unit): TalonGroup {
2733
val test = TalonGroup(this)

0 commit comments

Comments
 (0)