Skip to content

Commit 827f6c8

Browse files
committed
Merge branch 'master' of https://github.com/FRC1519/2020-Robot
2 parents c20fa9a + d01872a commit 827f6c8

File tree

74 files changed

+2270
-875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+2270
-875
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public class Robot extends TimedRobot {
3535
@Override
3636
@SuppressWarnings("deprecation")
3737
public void robotInit() {
38-
// Instantiate our RobotContainer. This will perform all our button bindings,
38+
// Instantiate our RobotContainer. This will perform all our button bindings,
3939
// and put our autonomous chooser on the dashboard.
4040
m_robotContainer = new RobotContainer();
4141

@@ -81,6 +81,9 @@ public void disabledPeriodic() {
8181
*/
8282
@Override
8383
public void autonomousInit() {
84+
// ensure robot "safety" before anything else when entering new mode
85+
RobotContainer.safetyInit();
86+
8487
m_autonomousCommand = m_robotContainer.getAutonomousCommand();
8588

8689
// schedule the autonomous command (example)
@@ -98,6 +101,9 @@ public void autonomousPeriodic() {
98101

99102
@Override
100103
public void teleopInit() {
104+
// ensure robot "safety" before anything else when entering new mode
105+
RobotContainer.safetyInit();
106+
101107
// This makes sure that the autonomous stops running when
102108
// teleop starts running. If you want the autonomous to
103109
// continue until interrupted by another command, remove
@@ -106,7 +112,7 @@ public void teleopInit() {
106112
m_autonomousCommand.cancel();
107113
}
108114

109-
// RobotContainer.compressor.start();
115+
// for safety reasons, call
110116
}
111117

112118
/**

src/main/java/org/mayheminc/robot2020/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ public final class Talon {
3434
public static final int INTAKE_ROLLERS = 9;
3535
public static final int INTAKE_PIVOT = 10;
3636

37-
public static final int MAGAZINE_TURNTABLE = 11;
38-
public static final int MAGAZINE_CHIMNEY = 12;
37+
public static final int REVOLVER_TURNTABLE = 11;
38+
public static final int CHIMNEY_ROLLER = 12;
3939

4040
public static final int CLIMBER_WINCH_LEFT = 14; // high current
4141
public static final int CLIMBER_WINCH_RIGHT = 13; // high current

src/main/java/org/mayheminc/robot2020/RobotContainer.java

Lines changed: 72 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.mayheminc.robot2020.autonomousroutines.*;
2121
import org.mayheminc.robot2020.commands.*;
22+
import org.mayheminc.robot2020.commands.DriveStraightOnHeading.DistanceUnits;
2223
import org.mayheminc.robot2020.subsystems.*;
2324

2425
/**
@@ -32,8 +33,11 @@ public class RobotContainer {
3233
// The robot's subsystems and commands are defined here...
3334

3435
public static final Climber climber = new Climber();
35-
public static final Magazine magazine = new Magazine();
36-
public static final Shooter shooter = new Shooter();
36+
public static final Revolver revolver = new Revolver();
37+
public static final ShooterWheel shooterWheel = new ShooterWheel();
38+
public static final Hood hood = new Hood();
39+
public static final Turret turret = new Turret();
40+
public static final Feeder feeder = new Feeder();
3741
public static final Drive drive = new Drive();
3842
public static final Intake intake = new Intake();
3943
public static final Autonomous autonomous = new Autonomous();
@@ -62,40 +66,55 @@ public RobotContainer() {
6266
pidtuner = new PidTuner(RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_SIX,
6367
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_SEVEN,
6468
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_ELEVEN,
65-
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_TEN, shooter);
69+
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_TEN, drive);
6670

6771
cameraLights.set(true);
6872
}
6973

7074
public static void init() {
71-
shooter.init();
75+
shooterWheel.init();
76+
}
77+
78+
public static void safetyInit() {
79+
hood.setVBus(0.0);
80+
turret.setVBus(0.0);
81+
climber.setPistons(false);
7282
}
7383

7484
private void configureDefaultCommands() {
7585
drive.setDefaultCommand(new DriveDefault());
7686
// intake.setDefaultCommand(new IntakeExtenderVBus());
77-
magazine.setDefaultCommand(new MagazineDefault());
78-
79-
// TODO: Figure out if the current approach of "AirCompressorDefault()" is the way to go for compressor control.
80-
// KBS doesn't think the below is the right way to have the compressor be on "by default" because
81-
// it would require there to always be a command running to keep the compressor off. However, that
82-
// is a good way to ensure it doesn't get left off by accident. Not quite sure how to handle this;
83-
// would really rather that other commands which need the compressor off (such as a high-power command
84-
// which wants all the battery power available) would turn the compressor off when the command starts
85-
// and off when the command ends.) Then again, maybe the "defaultCommand" is a good way to do this
87+
revolver.setDefaultCommand(new RevolverDefault());
88+
89+
// KBS doesn't think the below is the right way to have the compressor be on "by
90+
// default" because it would require there to always be a command running to
91+
// keep the compressor off.
92+
// However, that is a good way to ensure it doesn't get left off by accident.
93+
// Not quite sure how to handle this;
94+
// would really rather that other commands which need the compressor off (such
95+
// as a high-power command which wants all the battery power available) would
96+
// turn the compressor off when the command starts and off when the command
97+
// ends.) Then again, maybe the "defaultCommand" is a good way to do this
8698
// and I just don't understand the style yet.
87-
compressor.setDefaultCommand(new AirCompressorDefault());
99+
// compressor.setDefaultCommand(new AirCompressorDefault());
88100
}
89101

90102
private void configureAutonomousPrograms() {
91103
LinkedList<Command> autonomousPrograms = new LinkedList<Command>();
92-
// TODO: fix "wierdness" with auto program selection - sometimes doesn't seem to work
93-
// TODO: fix so that auto program is shown not just when changed (as shows old setting sometimes)
94-
95-
// autonomousPrograms.push(/* 01 */ new StayStill());
96-
autonomousPrograms.push(/* 00 */ new TrenchAuto());
97-
// autonomousPrograms.push( new ShooterReadyAimFire());
98-
// autonomousPrograms.push(new TestTurret());
104+
105+
autonomousPrograms.push(/* 12 */ new StayStill());
106+
autonomousPrograms.push(/* 11 */ new StartBWDriveOnlyToRP());
107+
autonomousPrograms.push(/* 10 */ new StartBWDriveOnlyToWall());
108+
autonomousPrograms.push(/* 09 */ new StartFWDriveOnlyToRP());
109+
autonomousPrograms.push(/* 08 */ new StartFWDriveOnlyToWall());
110+
autonomousPrograms.push(/* 07 */ new StartBWShoot3ThenToRP());
111+
autonomousPrograms.push(/* 06 */ new StartBWShoot3ThenToWall());
112+
autonomousPrograms.push(/* 05 */ new StartFWShoot3ThenToRP());
113+
autonomousPrograms.push(/* 04 */ new StartFWShoot3ThenToWall());
114+
autonomousPrograms.push(/* 03 */ new StartFWRendezvous());
115+
autonomousPrograms.push(/* 02 */ new StartBWOppTrench());
116+
autonomousPrograms.push(/* 01 */ new StartBWTrench3());
117+
autonomousPrograms.push(/* 00 */ new StartBWTrench5());
99118

100119
autonomous.setAutonomousPrograms(autonomousPrograms);
101120

@@ -155,8 +174,8 @@ private void configureDriverPadButtons() {
155174
// about -30 degrees
156175
// DRIVER_PAD.DRIVER_PAD_D_PAD_RIGHT.whileHeld(new
157176
// ShooterSetTurretVBus(+0.2));// about +30 degrees
158-
DRIVER_PAD.DRIVER_PAD_D_PAD_UP.whenPressed(new ShooterSetHoodAbs(Shooter.HOOD_INITIATION_LINE_POSITION));
159-
DRIVER_PAD.DRIVER_PAD_D_PAD_DOWN.whenPressed(new ShooterSetHoodAbs(Shooter.HOOD_TARGET_ZONE_POSITION));
177+
DRIVER_PAD.DRIVER_PAD_D_PAD_UP.whenPressed(new HoodSetAbsWhileHeld(Hood.INITIATION_LINE_POSITION));
178+
DRIVER_PAD.DRIVER_PAD_D_PAD_DOWN.whenPressed(new HoodSetAbsWhileHeld(Hood.STARTING_POSITION));
160179

161180
// DRIVER_PAD.DRIVER_PAD_D_PAD_LEFT.whenPressed(new
162181
// ShooterSetTurretRel(-200.0));
@@ -173,52 +192,59 @@ private void configureDriverPadButtons() {
173192
// DRIVER_PAD.DRIVER_PAD_D_PAD_DOWN.whileHeld(new ShooterSetHoodVBus(-1.0));
174193

175194
// Debug shooter pid velocity
176-
DRIVER_PAD.DRIVER_PAD_BLUE_BUTTON.whenPressed(new ShooterAdjustWheel(100.0));
177-
DRIVER_PAD.DRIVER_PAD_GREEN_BUTTON.whenPressed(new ShooterAdjustWheel(-100.0));
178-
DRIVER_PAD.DRIVER_PAD_RED_BUTTON.whenPressed(new ShooterSetWheelVBus(0.0));
179-
DRIVER_PAD.DRIVER_PAD_YELLOW_BUTTON.whenPressed(new ShooterSetWheel(3000));
180-
// TODO: above hard-coded constant (3000) should be a named constant from Shooter.java
195+
DRIVER_PAD.DRIVER_PAD_BLUE_BUTTON.whenPressed(new ShooterWheelAdjust(50.0));
196+
DRIVER_PAD.DRIVER_PAD_GREEN_BUTTON.whenPressed(new ShooterWheelAdjust(-50.0));
197+
DRIVER_PAD.DRIVER_PAD_RED_BUTTON.whenPressed(new ShooterWheelSetVBus(0.0));
198+
DRIVER_PAD.DRIVER_PAD_YELLOW_BUTTON.whenPressed(new ShooterWheelSet(ShooterWheel.INITIATION_LINE_SPEED));
199+
200+
DRIVER_PAD.DRIVER_PAD_LEFT_UPPER_TRIGGER_BUTTON.whenHeld(new ShooterFiringSequence(60.0));
201+
DRIVER_PAD.DRIVER_PAD_LEFT_UPPER_TRIGGER_BUTTON.whenReleased(new ShooterCeaseFire());
181202

182-
DRIVER_PAD.DRIVER_PAD_LEFT_UPPER_TRIGGER_BUTTON.whileHeld(new ShooterSetFeeder(1.0));
203+
DRIVER_PAD.DRIVER_PAD_LEFT_LOWER_TRIGGER_BUTTON.whileHeld(new ShooterCloseFiringSequence(60.0));
204+
DRIVER_PAD.DRIVER_PAD_LEFT_LOWER_TRIGGER_BUTTON.whenReleased(new ShooterCeaseFire());
205+
206+
DRIVER_PAD.DRIVER_PAD_BACK_BUTTON.whenPressed(new DriveStraightOnHeading(-0.3, DistanceUnits.INCHES, 240, 0));
207+
DRIVER_PAD.DRIVER_PAD_START_BUTTON.whenPressed(new DriveStraightOnHeading(0.3, DistanceUnits.INCHES, 240, 0));
208+
209+
// DRIVER_PAD.DRIVER_PAD_LEFT_LOWER_TRIGGER_BUTTON.whileHeld(new
210+
// FeederSet(1.0));
183211

184212
}
185213

186214
private void configureOperatorStickButtons() {
187215
}
188216

189217
private void configureOperatorPadButtons() {
190-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_ONE.whileHeld(new MagazineSetTurntable(0.2));
191-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_TWO.whenPressed(new IntakeSetPosition(RobotContainer.intake.PIVOT_DOWN));
192-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_THREE.whileHeld(new MagazineSetTurntable(0.5));
193-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_FOUR.whenPressed(new IntakeSetPosition(RobotContainer.intake.PIVOT_UP));
218+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_ONE.whileHeld(new RevolverSetTurntable(0.2));
219+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_TWO.whenPressed(new IntakeSetPosition(Intake.PIVOT_DOWN));
220+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_THREE.whileHeld(new RevolverSetTurntable(1.0));
221+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_FOUR.whenPressed(new IntakeSetPosition(Intake.PIVOT_UP));
194222

195223
// new ShooterSetWheel(1000));
196-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_FIVE.whileHeld(new ChimneySetChimney(1.0));
197-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_SIX.whileHeld(new IntakeSetRollers(-1.0));
224+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_FIVE.whileHeld(new ChimneySet(1.0));
225+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_SIX.whileHeld(new IntakeSetRollersWhileHeld(-1.0));
226+
227+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_SEVEN.whenPressed(new ShooterAimToTarget());
228+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_EIGHT.whileHeld(new IntakeSetRollersWhileHeld(1.0));
198229

199-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_SEVEN.whileHeld(new TurretAimToTarget());
200-
OPERATOR_PAD.OPERATOR_PAD_BUTTON_EIGHT.whileHeld(new IntakeSetRollers(1.0));
201-
202230
OPERATOR_PAD.OPERATOR_PAD_BUTTON_NINE.whenPressed(new ClimberSetPistons(true));
203231
OPERATOR_PAD.OPERATOR_PAD_BUTTON_TEN.whenPressed(new ClimberSetPistons(false));
204232

205-
206233
// OPERATOR_PAD.OPERATOR_PAD_D_PAD_UP.whenPressed(new
207234
// IntakeSetPosition(RobotContainer.intake.PIVOT_UP));
208235
// OPERATOR_PAD.OPERATOR_PAD_D_PAD_DOWN.whenPressed(new
209236
// IntakeSetPosition(RobotContainer.intake.PIVOT_DOWN));
210-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_LEFT.whileHeld(new ShooterSetTurretVBus(-0.2));
211-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_RIGHT.whileHeld(new ShooterSetTurretVBus(+0.2));
212-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_UP.whileHeld(new ShooterAdjustHood(+1000.0));
213-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_DOWN.whileHeld(new ShooterAdjustHood(-1000.0));
237+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_LEFT.whileHeld(new TurretSetVBus(-0.4));
238+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_RIGHT.whileHeld(new TurretSetVBus(+0.4));
239+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_UP.whileHeld(new HoodAdjust(+1000.0));
240+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_DOWN.whileHeld(new HoodAdjust(-1000.0));
214241

215-
// TODO: Consider if below should use "variable power" for climber or just always full speed?
216242
OPERATOR_PAD.OPERATOR_PAD_RIGHT_Y_AXIS_UP.whileHeld(new ClimberSetWinchesPower(1.0));
217243
OPERATOR_PAD.OPERATOR_PAD_RIGHT_Y_AXIS_DOWN.whileHeld(new ClimberSetWinchesPower(-1.0));
218244

219245
// OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_UP.whenPressed(new
220-
// MagazineSetTurntable());
221-
OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_DOWN.whileHeld(new ChimneySetChimney(-1.0));
246+
// RevolverSetTurntable());
247+
OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_DOWN.whileHeld(new ChimneySet(-1.0));
222248
}
223249

224250
/**

src/main/java/org/mayheminc/robot2020/autonomousroutines/DriveStraight.java renamed to src/main/java/org/mayheminc/robot2020/autonomousroutines/DriveStraightOnly.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@
99

1010
import org.mayheminc.robot2020.commands.*;
1111
import org.mayheminc.robot2020.commands.DriveStraightOnHeading.DistanceUnits;
12-
import org.mayheminc.robot2020.subsystems.Shooter;
1312

1413
import edu.wpi.first.wpilibj2.command.*;
1514

16-
public class DriveStraight extends SequentialCommandGroup {
15+
public class DriveStraightOnly extends SequentialCommandGroup {
1716
/**
1817
* Add your docs here.
1918
*/
20-
public DriveStraight() {
19+
public DriveStraightOnly() {
2120

22-
addCommands(new DriveZeroGyro());
23-
// addCommands(new DriveStraightOnHeading(0.2, DistanceUnits.INCHES, 100, 0));
24-
addCommands(new DriveStraightOnHeading(-0.3, DistanceUnits.INCHES, 50, 0));
25-
addCommands(new ShooterSetHoodAbs(Shooter.HOOD_INITIATION_LINE_POSITION));
21+
addCommands(new DriveZeroGyro(0.0));
22+
23+
addCommands(new DriveStraightOnHeading(0.3, DistanceUnits.INCHES, 50, 0));
24+
25+
addCommands(new DriveStraightOnHeading(0.3, DistanceUnits.INCHES, 100, 270));
26+
27+
// addCommands(new ShooterSetHoodAbs(Shooter.HOOD_INITIATION_LINE_POSITION));
2628
// addCommands(new DriveStraightOnHeading(0.4, DistanceUnits.INCHES, 100, 0));
2729

2830
}

src/main/java/org/mayheminc/robot2020/autonomousroutines/ShootAndDriveForward.java

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*----------------------------------------------------------------------------*/
2+
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
3+
/* Open Source Software - may be modified and shared by FRC teams. The code */
4+
/* must be accompanied by the FIRST BSD license file in the root directory of */
5+
/* the project. */
6+
/*----------------------------------------------------------------------------*/
7+
8+
package org.mayheminc.robot2020.autonomousroutines;
9+
10+
import org.mayheminc.robot2020.commands.*;
11+
import org.mayheminc.robot2020.commands.DriveStraightOnHeading.DistanceUnits;
12+
import org.mayheminc.robot2020.subsystems.Intake;
13+
14+
import edu.wpi.first.wpilibj2.command.*;
15+
16+
public class StartBWDriveOnlyToRP extends SequentialCommandGroup {
17+
/**
18+
* Add your docs here.
19+
*/
20+
public StartBWDriveOnlyToRP() {
21+
22+
// start backwards
23+
addCommands(new DriveZeroGyro(180.0));
24+
25+
// lower the intake
26+
addCommands(new IntakeSetPosition(Intake.PIVOT_DOWN));
27+
28+
// then, drive to the rendezvous point
29+
addCommands(new DriveStraightOnHeading(0.3, DistanceUnits.INCHES, 12, 180));
30+
}
31+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*----------------------------------------------------------------------------*/
2+
/* Copyright (c) 2018 FIRST. All Rights Reserved. */
3+
/* Open Source Software - may be modified and shared by FRC teams. The code */
4+
/* must be accompanied by the FIRST BSD license file in the root directory of */
5+
/* the project. */
6+
/*----------------------------------------------------------------------------*/
7+
8+
package org.mayheminc.robot2020.autonomousroutines;
9+
10+
import org.mayheminc.robot2020.commands.*;
11+
import org.mayheminc.robot2020.commands.DriveStraightOnHeading.DistanceUnits;
12+
import org.mayheminc.robot2020.subsystems.Intake;
13+
14+
import edu.wpi.first.wpilibj2.command.*;
15+
16+
public class StartBWDriveOnlyToWall extends SequentialCommandGroup {
17+
/**
18+
* Add your docs here.
19+
*/
20+
public StartBWDriveOnlyToWall() {
21+
22+
// start backwards
23+
addCommands(new DriveZeroGyro(180.0));
24+
25+
// lower the intake
26+
addCommands(new IntakeSetPosition(Intake.PIVOT_DOWN));
27+
28+
// then, drive towards the wall
29+
addCommands(new DriveStraightOnHeading(-0.3, DistanceUnits.INCHES, 40, 180));
30+
}
31+
}

0 commit comments

Comments
 (0)