Skip to content

Commit c04a007

Browse files
committed
cleanup and add toggleable subsystems
1 parent 15f2854 commit c04a007

File tree

11 files changed

+473
-260
lines changed

11 files changed

+473
-260
lines changed

src/main/java/frc/robot/Constants/Constants.java

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -263,26 +263,16 @@ public static final class ELEVATOR {
263263
* (3.0 / 2.0)
264264
/ 2.0; // CALCULATE LAST VALUE FOR STAGES IN THE ELEVATOR
265265
public static final Distance CYCLE_HEIGHT = Inches.of(2.15 * Math.PI); // CALCULATE
266+
public static final Distance TOLERANCE = Inches.of(0.1);
266267
public static final Distance Bhobe_HEIGHT = Inches.of(1);
267-
268-
public static final NavigableMap<Double, AngleRange> HEIGHT_TO_ANGLE_MAP = new TreeMap<>();
269-
270-
static {
271-
HEIGHT_TO_ANGLE_MAP.put(0.0, new AngleRange(Degrees.of(0.0), Degrees.of(45.0)));
272-
HEIGHT_TO_ANGLE_MAP.put(1.0, new AngleRange(Degrees.of(10.0), Degrees.of(40.0)));
273-
HEIGHT_TO_ANGLE_MAP.put(2.0, new AngleRange(Degrees.of(20.0), Degrees.of(35.0)));
274-
HEIGHT_TO_ANGLE_MAP.put(3.0, new AngleRange(Degrees.of(30.0), Degrees.of(30.0)));
275-
HEIGHT_TO_ANGLE_MAP.put(4.0, new AngleRange(Degrees.of(40.0), Degrees.of(25.0)));
276-
}
277-
278268
public static final class PROFILE {
279-
public static final double kP = 25.0;
280-
public static final double kS = 1.0;
269+
public static final double kP = 4.0;
270+
public static final double kS = 2.0;
281271
}
282272

283273
// HEIGHT IS MEASURED FROM THE GROUND TO THE TOP OF THE ELEVATOR
284274
public static final Distance BASE_HEIGHT = Inches.of(35.5);
285-
public static final Distance MAX_HEIGHT = Inches.of(83.6);
275+
public static final Distance MAX_HEIGHT = Inches.of(84.5);
286276
public static final Distance MIN_HEIGHT = BASE_HEIGHT;
287277
public static final Distance STOW_HEIGHT = BASE_HEIGHT;
288278
public static final Distance MAX_UNLIMITED_HEIGHT = Inches.of(41.0); // AVERAGE

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public void disabledPeriodic() {
9898
/** This autonomous runs the autonomous command selected by your {@link RobotContainer} class. */
9999
@Override
100100
public void autonomousInit() {
101+
System.out.println("=== AUTON ENABLED ===");
101102
autonomousCommand = robotContainer.getAutonomousCommand();
102103

103104
// schedule the autonomous command (example)
@@ -112,6 +113,7 @@ public void autonomousPeriodic() {}
112113

113114
@Override
114115
public void teleopInit() {
116+
System.out.println("=== TELEOP ENABLED ===");
115117
// This makes sure that the autonomous stops running when
116118
// teleop starts running. If you want the autonomous to
117119
// continue until interrupted by another command, remove

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

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static RobotContainer getInstance() {
7474
public final Elevator elevator;
7575
public final Hang hang;
7676
public final Autonomous autonomous;
77-
public final Algae algaeDetector;
77+
// public final Algae algaeDetector;
7878
public final PieceCombos pieceCombos;
7979
public final SafeSubsystems safeties;
8080
// public final ManipulatorSafeties manipulatorSafeties;
@@ -103,12 +103,11 @@ public RobotContainer() {
103103
// Logger.autoLog("PDH", PDH);
104104

105105
CachedRobotState.init();
106-
107106
AutonChooser.init();
108107

109108
LiveWindow.disableAllTelemetry();
110109

111-
DriverStation.silenceJoystickConnectionWarning(true);
110+
DriverStation.silenceJoystickConnectionWarning(false);
112111

113112
StatusChecks.Category statusChecks = StatusChecks.under("General");
114113

@@ -133,11 +132,11 @@ public RobotContainer() {
133132
// KinematicsUtils.getTranslation(swerveDrive.getEstimatedSpeeds()).getNorm());
134133
// intake = new Intake();
135134
manipulator = new Manipulator();
136-
elevator = new Elevator();
135+
elevator = Elevator.create();
137136
safeties = new SafeSubsystems(elevator, manipulator);
138137
pieceCombos = new PieceCombos(elevator, manipulator, safeties);
139138
autonomous = new Autonomous(stateController, swerveDrive, manipulator, elevator, pieceCombos);
140-
algaeDetector = new Algae();
139+
// algaeDetector = new Algae();
141140
hang = Hang.create();
142141
// // collisionDetector = new CollisionDetector();
143142

@@ -156,27 +155,6 @@ public RobotContainer() {
156155
statusChecks.timestampAdd("timerChecker", () -> Timer.getFPGATimestamp());
157156

158157
refreshButtonEntry.setBoolean(false);
159-
160-
// module.configureModule(Constants.SWERVE.CONFIG, Corner.FRONT_LEFT);
161-
162-
// AprilTags.printConfig(Constants.LIMELIGHT.APRILTAG_CAMERA_POSES);
163-
164-
// Pathfinding.ensureInitialized();
165-
166-
// swerveModuleTest = new SwerveModuleTest();
167-
168-
// new Talon10Test();
169-
170-
// steerModuleTest = new SteerModuleTest();
171-
172-
// test = new DriveModuleTest();
173-
174-
// ChassisSpeeds testSpeeds = new ChassisSpeeds(0, 0, 1);
175-
176-
// Logger.log("conversionTest/speeds", testSpeeds);
177-
// Logger.log("conversionTest/states",
178-
// KinematicsUtils.kinematicsFromChassis(Constants.SWERVE.CHASSIS).toSwerveModuleStates(testSpeeds));
179-
180158
Logger.start(Milliseconds.of(20));
181159
}
182160

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
package frc.robot.commands.drive;
1+
// package frc.robot.commands.drive;
22

3-
import edu.wpi.first.wpilibj.XboxController;
4-
import edu.wpi.first.wpilibj2.command.Command;
5-
import frc.robot.subsystems.elevator.Elevator;
6-
import frc.robot.subsystems.manipulator.Manipulator;
3+
// import edu.wpi.first.wpilibj.XboxController;
4+
// import edu.wpi.first.wpilibj2.command.Command;
5+
// import frc.robot.subsystems.elevator.Elevator;
6+
// import frc.robot.subsystems.manipulator.Manipulator;
77

8-
public class OperatorFineControls extends Command {
9-
private Elevator elevator;
10-
private XboxController controller;
11-
private Manipulator manipulator;
8+
// public class OperatorFineControls extends Command {
9+
// private Elevator elevator;
10+
// private XboxController controller;
11+
// private Manipulator manipulator;
1212

13-
public OperatorFineControls(
14-
Elevator elevator, Manipulator manipulator, XboxController controller) {
15-
this.elevator = elevator;
16-
this.controller = controller;
17-
this.manipulator = manipulator;
18-
}
13+
// public OperatorFineControls(
14+
// Elevator elevator, Manipulator manipulator, XboxController controller) {
15+
// this.elevator = elevator;
16+
// this.controller = controller;
17+
// this.manipulator = manipulator;
18+
// }
1919

20-
@Override
21-
public void execute() {
22-
double elevatorSpeed = controller.getLeftY() * 0.2;
20+
// @Override
21+
// public void execute() {
22+
// double elevatorSpeed = controller.getLeftY() * 0.2;
2323

24-
if (elevator.getCurrentCommand() == elevator.getDefaultCommand()
25-
&& Math.abs(controller.getLeftY()) > 0.1) {
26-
elevator.move(elevatorSpeed).schedule();
27-
}
24+
// if (elevator.getCurrentCommand() == elevator.getDefaultCommand()
25+
// && Math.abs(controller.getLeftY()) > 0.1) {
26+
// elevator.move(elevatorSpeed).schedule();
27+
// }
2828

29-
double manipulatorSpeed = controller.getRightY() * 0.2;
29+
// double manipulatorSpeed = controller.getRightY() * 0.2;
3030

31-
if (manipulator.pivot.getCurrentCommand() == manipulator.pivot.getDefaultCommand()
32-
&& Math.abs(controller.getRightY()) > 0.1) {
33-
manipulator.pivot.move(manipulatorSpeed).schedule();
34-
}
35-
}
36-
}
31+
// if (manipulator.pivot.getCurrentCommand() == manipulator.pivot.getDefaultCommand()
32+
// && Math.abs(controller.getRightY()) > 0.1) {
33+
// manipulator.pivot.move(manipulatorSpeed).schedule();
34+
// }
35+
// }
36+
// }
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package frc.robot.subsystems.elevator;
2+
3+
import static edu.wpi.first.units.Units.Meters;
4+
5+
import com.team6962.lib.utils.CommandUtils;
6+
7+
import edu.wpi.first.units.measure.Distance;
8+
import edu.wpi.first.wpilibj2.command.Command;
9+
import edu.wpi.first.wpilibj2.command.SubsystemBase;
10+
11+
public class DisabledElevator extends SubsystemBase implements Elevator {
12+
public Command setHeight(Distance height) {
13+
return CommandUtils.noneWithRequirements(this);
14+
}
15+
16+
public Command stop() {
17+
return CommandUtils.noneWithRequirements(this);
18+
}
19+
20+
public Command hold() {
21+
return CommandUtils.noneWithRequirements(this);
22+
}
23+
24+
public Command stow() {
25+
return CommandUtils.noneWithRequirements(this);
26+
}
27+
28+
public Command coralL1() {
29+
return CommandUtils.noneWithRequirements(this);
30+
}
31+
32+
public Command coralL2() {
33+
return CommandUtils.noneWithRequirements(this);
34+
}
35+
36+
public Command coralL3() {
37+
return CommandUtils.noneWithRequirements(this);
38+
}
39+
40+
public Command coralL4() {
41+
return CommandUtils.noneWithRequirements(this);
42+
}
43+
44+
public Command coralIntake() {
45+
return CommandUtils.noneWithRequirements(this);
46+
}
47+
48+
public Command algaeGround() {
49+
return CommandUtils.noneWithRequirements(this);
50+
}
51+
52+
public Command algaeL2() {
53+
return CommandUtils.noneWithRequirements(this);
54+
}
55+
56+
public Command algaeL3() {
57+
return CommandUtils.noneWithRequirements(this);
58+
}
59+
60+
public Command algaeBarge() {
61+
return CommandUtils.noneWithRequirements(this);
62+
}
63+
64+
public Command algaeProcessor() {
65+
return CommandUtils.noneWithRequirements(this);
66+
}
67+
68+
public Command rezeroAtBottom() {
69+
return CommandUtils.noneWithRequirements(this);
70+
}
71+
72+
public Distance getAverageHeight() {
73+
return Meters.of(0.0);
74+
}
75+
76+
public Command up () {
77+
return CommandUtils.noneWithRequirements(this);
78+
}
79+
80+
public Command down() {
81+
return CommandUtils.noneWithRequirements(this);
82+
}
83+
84+
public Distance getMaxHeight() {
85+
return Meters.of(Double.POSITIVE_INFINITY);
86+
}
87+
88+
public Distance getMinHeight() {
89+
return Meters.of(Double.NEGATIVE_INFINITY);
90+
}
91+
}

0 commit comments

Comments
 (0)