Skip to content

Commit 1d3585e

Browse files
committed
added basic manual controls
basic manual coral scoring controls
1 parent 31f39a6 commit 1d3585e

File tree

3 files changed

+95
-8
lines changed

3 files changed

+95
-8
lines changed

src/main/java/wmironpatriots/Robot.java

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public class Robot extends TimedRobot implements Logged {
4848
private final CommandScheduler scheduler = CommandScheduler.getInstance();
4949

5050
private final CommandXboxController driveController;
51-
private final OperatorController operatorController;
51+
private final CommandXboxController operatorController;
52+
53+
private final OperatorController operatorController2;
5254

5355
private final Swerve swerve;
5456
private final Tail tail;
@@ -103,7 +105,9 @@ public Robot() {
103105

104106
// * SUBSYSTEM INIT
105107
driveController = new CommandXboxController(0);
106-
operatorController = new OperatorController(1);
108+
operatorController = new CommandXboxController(1);
109+
110+
operatorController2 = new OperatorController(3);
107111

108112
Optional<SwerveDriveSimulation> swerveSim =
109113
Robot.isSimulation()
@@ -180,6 +184,7 @@ public Robot() {
180184
// driveController.a().whileTrue(tail.setTargetPoseCmmd(0.0));
181185

182186
// driveController.x().whileTrue(tail.setTargetPoseCmmd(Tail.POSE_MIN_REVS));
187+
/*
183188
driveController
184189
.x()
185190
.whileTrue(tail.setRollerSpeedCmmd(1.4))
@@ -196,7 +201,78 @@ public Robot() {
196201
.whileFalse(chute.runChuteSpeedCmmd(0).alongWith(tail.setRollerSpeedCmmd(0)));
197202
198203
driveController.b().whileTrue(elevator.setTargetPoseCmmd(Elevator.POSE_L3));
204+
*/
199205
// driveController.x().whileTrue(tail.setRollerSpeedCmmd(1)).onFalse(tail.setRollerSpeedCmmd(0.0));
206+
207+
208+
// * ELEVATOR LEVEL 1 COMMAND
209+
operatorController
210+
.a()
211+
.whileTrue(tail.setTargetPoseCmmd(Tail.POSE_MIN_REVS)
212+
.until(() -> tail.inSetpointRange())
213+
.andThen(elevator.setTargetPoseCmmd(Elevator.POSE_L1))
214+
.alongWith(tail.setTargetPoseCmmd(Tail.POSE_L1)))
215+
.whileFalse(elevator.setTargetPoseCmmd(Elevator.POSE_INTAKING)
216+
.until(() -> elevator.inSetpointRange())
217+
.andThen(tail.setTargetPoseCmmd(Tail.POSE_MAX_REVS)));
218+
219+
// * ELEVATOR LEVEL 2 COMMAND
220+
operatorController
221+
.x()
222+
.whileTrue(tail.setTargetPoseCmmd(Tail.POSE_MIN_REVS)
223+
.until(() -> tail.inSetpointRange())
224+
.andThen(elevator.setTargetPoseCmmd(Elevator.POSE_L2))
225+
.alongWith(tail.setTargetPoseCmmd(Tail.POSE_L2)))
226+
.whileFalse(elevator.setTargetPoseCmmd(Elevator.POSE_INTAKING)
227+
.until(() -> elevator.inSetpointRange())
228+
.andThen(tail.setTargetPoseCmmd(Tail.POSE_MAX_REVS)));
229+
230+
// * ELEVATOR LEVEL 3 COMMAND
231+
operatorController
232+
.a()
233+
.whileTrue(tail.setTargetPoseCmmd(Tail.POSE_MIN_REVS)
234+
.until(() -> tail.inSetpointRange())
235+
.andThen(elevator.setTargetPoseCmmd(Elevator.POSE_L3))
236+
.alongWith(tail.setTargetPoseCmmd(Tail.POSE_L3)))
237+
.whileFalse(elevator.setTargetPoseCmmd(Elevator.POSE_INTAKING)
238+
.until(() -> elevator.inSetpointRange())
239+
.andThen(tail.setTargetPoseCmmd(Tail.POSE_MAX_REVS)));
240+
241+
// * ELEVATOR LEVEL 4 COMMAND
242+
operatorController
243+
.x()
244+
.whileTrue(tail.setTargetPoseCmmd(Tail.POSE_MIN_REVS)
245+
.until(() -> tail.inSetpointRange())
246+
.andThen(elevator.setTargetPoseCmmd(Elevator.POSE_L4))
247+
.alongWith(tail.setTargetPoseCmmd(Tail.POSE_L4)))
248+
.whileFalse(elevator.setTargetPoseCmmd(Elevator.POSE_INTAKING)
249+
.until(() -> elevator.inSetpointRange())
250+
.andThen(tail.setTargetPoseCmmd(Tail.POSE_MAX_REVS)));
251+
252+
253+
// * INTAKING CORAL COMMAND
254+
operatorController.leftBumper()
255+
.whileTrue(chute.runChuteSpeedCmmd(Chute.INTAKE_SPEED)
256+
.alongWith(tail.setRollerSpeedCmmd(Tail.INTAKING_SPEEDS)))
257+
.whileFalse(chute.runChuteSpeedCmmd(0)
258+
.alongWith(tail.setRollerSpeedCmmd(0)));
259+
260+
// * OUTTAKING CORAL COMMAND
261+
operatorController.rightBumper()
262+
.whileTrue(chute.runChuteSpeedCmmd(Chute.OUTAKE_SPEED)
263+
.alongWith(tail.setRollerSpeedCmmd(Tail.OUTTAKING_SPEEDS)))
264+
.whileFalse(chute.runChuteSpeedCmmd(0)
265+
.alongWith(tail.setRollerSpeedCmmd(0)));
266+
267+
268+
// * SCORING CORAL COMMAND
269+
driveController
270+
.rightBumper()
271+
.whileTrue(tail.setRollerSpeedCmmd(Tail.OUTPUTTING_SPEEDS))
272+
.whileFalse(tail.setRollerSpeedCmmd(0));
273+
274+
275+
200276
// * SUPERSTRUCTURE INIT
201277
Map<Requests, Trigger> triggerMap = new HashMap<Superstructure.Requests, Trigger>();
202278

@@ -206,15 +282,17 @@ public Robot() {
206282
// * AUTON INIT
207283
autonChooser = Autonomous.configureAutons(swerve);
208284
SmartDashboard.putData("Select Auton", autonChooser);
209-
285+
/*
210286
new Superstructure(
211287
elevator,
212288
tail,
213289
chute,
214-
triggerMap,
215-
operatorController.getBranchTarget(),
216-
operatorController.getLevelTarget());
290+
triggerMap
291+
operatorController2.getBranchTarget(),
292+
operatorController2.getLevelTarget());
293+
*/
217294
}
295+
218296

219297
@Override
220298
public void robotPeriodic() {

src/main/java/wmironpatriots/subsystems/chute/Chute.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
public abstract class Chute extends SubsystemBase {
1313
public static final double INTAKE_SPEED = -0.13;
14+
public static final double OUTAKE_SPEED = 0.13;
1415

1516
public Command runChuteSpeedCmmd(double speed) {
1617
return this.run(() -> {});

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ public abstract class Tail implements IronSubsystem {
2525
public static final double POSE_MIN_REVS = -10.4;
2626
public static final double POSE_MAX_REVS = 0.1;
2727

28+
public static final double POSE_L1 = -4;
29+
public static final double POSE_L2 = -4;
30+
public static final double POSE_L3 = -4;
31+
public static final double POSE_L4 = -4;
32+
2833
// Roller speeds
29-
public static final double INTAKING_SPEEDS = 5;
30-
public static final double OUTTAKING_SPEEDS = 5;
34+
public static final double INTAKING_SPEEDS = 1;
35+
public static final double OUTTAKING_SPEEDS = -1;
36+
public static final double OUTPUTTING_SPEEDS = 2;
3137

3238
public static final double PIVOT_P = 1.5;
3339
public static final double PIVOT_I = 0.0;
@@ -60,6 +66,8 @@ public Command setTargetPoseCmmd(double poseRes) {
6066
});
6167
}
6268

69+
70+
6371
/** Runs rollers at specific speed */
6472
public Command setRollerSpeedCmmd(double speed) {
6573
return this.run(

0 commit comments

Comments
 (0)