Skip to content

Commit 2eac5f3

Browse files
committed
pre week 0
1 parent 9907378 commit 2eac5f3

21 files changed

+638
-81
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public final class Solenoid {
4949
public static final int SPARE_1 = 1;
5050
public static final int SPARE_2 = 2;
5151
public static final int CLIMBER_PISTONS = 3;
52+
53+
public static final int CAMERA_LIGHTS = 7;
5254
}
5355

5456
public final class PDP {

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

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import edu.wpi.first.wpilibj.Compressor;
1313
import edu.wpi.first.wpilibj.GenericHID;
14+
import edu.wpi.first.wpilibj.Solenoid;
1415
import edu.wpi.first.wpilibj2.command.Command;
1516
import edu.wpi.first.wpilibj2.command.button.Button;
1617

@@ -41,6 +42,8 @@ public class RobotContainer {
4142
public static PidTuner pidtuner;
4243
public static final Chimney chimney = new Chimney();
4344

45+
public static final Solenoid cameraLights = new Solenoid(Constants.Solenoid.CAMERA_LIGHTS);
46+
4447
// Operator Inputs
4548
public static final MayhemDriverStick DRIVER_STICK = new MayhemDriverStick();
4649
public static final MayhemDriverPad DRIVER_PAD = new MayhemDriverPad();
@@ -59,7 +62,9 @@ public RobotContainer() {
5962
pidtuner = new PidTuner(RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_SIX,
6063
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_SEVEN,
6164
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_ELEVEN,
62-
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_TEN, shooter);
65+
RobotContainer.DRIVER_STICK.DRIVER_STICK_ENA_BUTTON_TEN, intake);
66+
67+
cameraLights.set(true);
6368
}
6469

6570
public static void init() {
@@ -70,6 +75,7 @@ private void configureDefaultCommands() {
7075
drive.setDefaultCommand(new DriveDefault());
7176
// intake.setDefaultCommand(new IntakeExtenderVBus());
7277
magazine.setDefaultCommand(new MagazineDefault());
78+
compressor.setDefaultCommand(new AirCompressorDefault());
7379
}
7480

7581
private void configureAutonomousPrograms() {
@@ -126,11 +132,25 @@ private void configureDriverPadButtons() {
126132
// ShooterAdjustWheelVBus(-0.1));
127133
// DRIVER_PAD.DRIVER_PAD_RED_BUTTON.whenPressed(new ShooterSetWheelVBus(0.0));
128134

135+
// Debug Turret
136+
// DRIVER_PAD.DRIVER_PAD_D_PAD_LEFT.whenPressed(new
137+
// ShooterSetTurretAbs(-5500));// about -30 degrees
138+
// DRIVER_PAD.DRIVER_PAD_D_PAD_RIGHT.whenPressed(new
139+
// ShooterSetTurretAbs(+5500));// about +30 degrees
140+
DRIVER_PAD.DRIVER_PAD_D_PAD_LEFT.whileHeld(new ShooterSetTurretVBus(-0.2));// about -30 degrees
141+
DRIVER_PAD.DRIVER_PAD_D_PAD_RIGHT.whileHeld(new ShooterSetTurretVBus(+0.2));// about +30 degrees
142+
143+
// Debug Hood
144+
// DRIVER_PAD.DRIVER_PAD_D_PAD_UP.whenPressed(new ShooterSetHoodRel(+1000));
145+
// DRIVER_PAD.DRIVER_PAD_D_PAD_DOWN.whenPressed(new ShooterSetHoodRel(-1000));
146+
// DRIVER_PAD.DRIVER_PAD_D_PAD_UP.whileHeld(new ShooterSetHoodVBus(+1.0));
147+
// DRIVER_PAD.DRIVER_PAD_D_PAD_DOWN.whileHeld(new ShooterSetHoodVBus(-1.0));
148+
129149
// Debug shooter pid velocity
130150
DRIVER_PAD.DRIVER_PAD_BLUE_BUTTON.whenPressed(new ShooterAdjustWheel(100.0));
131151
DRIVER_PAD.DRIVER_PAD_GREEN_BUTTON.whenPressed(new ShooterAdjustWheel(-100.0));
132152
DRIVER_PAD.DRIVER_PAD_RED_BUTTON.whenPressed(new ShooterSetWheel(0.0));
133-
DRIVER_PAD.DRIVER_PAD_YELLOW_BUTTON.whenPressed(new ShooterSetWheel(4600));
153+
DRIVER_PAD.DRIVER_PAD_YELLOW_BUTTON.whenPressed(new ShooterSetWheel(2700));
134154

135155
DRIVER_PAD.DRIVER_PAD_LEFT_UPPER_TRIGGER_BUTTON.whileHeld(new ShooterSetFeeder(0.5));
136156

@@ -144,28 +164,37 @@ private void configureOperatorStickButtons() {
144164
}
145165

146166
private void configureOperatorPadButtons() {
147-
// OPERATOR_PAD.OPERATOR_PAD_BUTTON_ONE.whenPressed(new IntakeZero());
148-
// new ShooterAdjustWheel(-100));
167+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_ONE.whenPressed(new MagazineSetTurntable(0.2));
149168
OPERATOR_PAD.OPERATOR_PAD_BUTTON_TWO.whenPressed(new IntakeSetPosition(RobotContainer.intake.PIVOT_DOWN));
150-
// new ShooterSetWheel(0));
151-
// OPERATOR_PAD.OPERATOR_PAD_BUTTON_THREE.whenPressed(new
152-
// IntakeSetPosition(RobotContainer.intake.PIVOT_DOWN));
153-
// new ShooterAdjustWheel(+100));
169+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_THREE.whenPressed(new MagazineSetTurntable(1.0));
154170
OPERATOR_PAD.OPERATOR_PAD_BUTTON_FOUR.whenPressed(new IntakeSetPosition(RobotContainer.intake.PIVOT_UP));
171+
155172
// new ShooterSetWheel(1000));
156173
OPERATOR_PAD.OPERATOR_PAD_BUTTON_FIVE.whileHeld(new ChimneySetChimney(1.0));
157174
OPERATOR_PAD.OPERATOR_PAD_BUTTON_SIX.whileHeld(new IntakeSetRollers(-1.0));
158175

176+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_SEVEN.whileHeld(new TurretAimToTarget());
177+
178+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_NINE.whenPressed(new ClimberSetPistons(true));
179+
OPERATOR_PAD.OPERATOR_PAD_BUTTON_TEN.whenPressed(new ClimberSetPistons(false));
180+
159181
OPERATOR_PAD.OPERATOR_PAD_BUTTON_EIGHT.whileHeld(new IntakeSetRollers(1.0));
160-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_UP.whenPressed(new IntakeSetPosition(RobotContainer.intake.PIVOT_UP));
161-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_DOWN.whenPressed(new IntakeSetPosition(RobotContainer.intake.PIVOT_DOWN));
162-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_LEFT.whenPressed(new ShooterSetHood(-0.2));
163-
OPERATOR_PAD.OPERATOR_PAD_D_PAD_RIGHT.whenPressed(new ShooterSetHood(-0.2));
182+
// OPERATOR_PAD.OPERATOR_PAD_D_PAD_UP.whenPressed(new
183+
// IntakeSetPosition(RobotContainer.intake.PIVOT_UP));
184+
// OPERATOR_PAD.OPERATOR_PAD_D_PAD_DOWN.whenPressed(new
185+
// IntakeSetPosition(RobotContainer.intake.PIVOT_DOWN));
186+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_LEFT.whileHeld(new ShooterSetTurretVBus(-0.2));
187+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_RIGHT.whileHeld(new ShooterSetTurretVBus(+0.2));
188+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_UP.whileHeld(new ShooterSetHoodVBus(+1.0));
189+
OPERATOR_PAD.OPERATOR_PAD_D_PAD_DOWN.whileHeld(new ShooterSetHoodVBus(-1.0));
164190

165191
OPERATOR_PAD.OPERATOR_PAD_RIGHT_Y_AXIS_UP.whileHeld(new ClimberSetWinchesPower(0.7));
166192
OPERATOR_PAD.OPERATOR_PAD_RIGHT_Y_AXIS_DOWN.whileHeld(new ClimberSetWinchesPower(-0.7));
167-
OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_UP.whenPressed(new ClimberSetPistons(true));
168-
OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_DOWN.whenPressed(new ClimberSetPistons(false));
193+
194+
// OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_UP.whenPressed(new
195+
// MagazineSetTurntable());
196+
// OPERATOR_PAD.OPERATOR_PAD_LEFT_Y_AXIS_DOWN.whenPressed(new
197+
// ClimberSetPistons(false));
169198
}
170199

171200
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ public DriveStraight() {
2020

2121
addCommands(new DriveZeroGyro());
2222
addCommands(new DriveStraightOnHeading(0.2, DistanceUnits.INCHES, 100, 0));
23-
addCommands(new DriveStraightOnHeading(0.3, DistanceUnits.INCHES, 100, 10));
24-
addCommands(new DriveStraightOnHeading(0.4, DistanceUnits.INCHES, 100, 20));
23+
addCommands(new DriveStraightOnHeading(0.3, DistanceUnits.INCHES, 100, 0));
24+
addCommands(new DriveStraightOnHeading(0.4, DistanceUnits.INCHES, 100, 0));
2525

2626
// addCommands(new ParallelCommandGroup(new IntakeSetPosition(true), new
2727
// MagazineSetTurntable(0.0)));
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*----------------------------------------------------------------------------*/
2+
/* Copyright (c) 2019 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.ShooterSetWheel;
11+
12+
import edu.wpi.first.wpilibj2.command.SequentialCommandGroup;
13+
14+
// NOTE: Consider using this command inline, rather than writing a subclass. For more
15+
// information, see:
16+
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
17+
public class ShootAndDriveForward extends SequentialCommandGroup {
18+
/**
19+
* Creates a new ShootAndDriveForward.
20+
*/
21+
public ShootAndDriveForward() {
22+
// Add your commands in the super() call, e.g.
23+
// super(new FooCommand(), new BarCommand());
24+
super();
25+
26+
addCommands(new ShooterSetWheel(5500));
27+
// addCommands(new Wait(2.0));
28+
}
29+
}

src/main/java/org/mayheminc/robot2020/commands/AirCompressorDefault.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class AirCompressorDefault extends CommandBase {
1717
*/
1818
public AirCompressorDefault() {
1919
// Use addRequirements() here to declare subsystem dependencies.
20+
addRequirements(RobotContainer.compressor);
2021
}
2122

2223
// Called when the command is initially scheduled.

src/main/java/org/mayheminc/robot2020/commands/MagazineDefault.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void initialize() {
2828
// Called every time the scheduler runs while the command is scheduled.
2929
@Override
3030
public void execute() {
31-
RobotContainer.magazine.setTurntableSpeed(RobotContainer.OPERATOR_PAD.getLeftYAxis());
31+
RobotContainer.magazine.setTurntableSpeed(-RobotContainer.OPERATOR_PAD.getLeftYAxis());
3232

3333
}
3434

src/main/java/org/mayheminc/robot2020/commands/ShooterFireWhenReady.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ public void initialize() {
2929
// Called every time the scheduler runs while the command is scheduled.
3030
@Override
3131
public void execute() {
32-
boolean wheelsGood = Math.abs(Targeting.convertRangeToWheelSpeed(RobotContainer.targeting.getRangeToTarget())
33-
- RobotContainer.shooter.getShooterWheelSpeed()) < 100;
32+
// boolean wheelsGood =
33+
// Math.abs(Targeting.convertRangeToWheelSpeed(RobotContainer.targeting.getRangeToTarget())
34+
// - RobotContainer.shooter.getShooterWheelSpeed()) < 100;
3435

35-
RobotContainer.shooter.setFeederSpeed((wheelsGood) ? 0.5 : 0.0);
36+
// RobotContainer.shooter.setFeederSpeed((wheelsGood) ? 0.5 : 0.0);
3637
}
3738

3839
// Called once the command ends or is interrupted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*----------------------------------------------------------------------------*/
2+
/* Copyright (c) 2019 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.commands;
9+
10+
import org.mayheminc.robot2020.RobotContainer;
11+
12+
import edu.wpi.first.wpilibj2.command.InstantCommand;
13+
14+
public class ShooterSetHoodAbs extends InstantCommand {
15+
double m_set;
16+
17+
/**
18+
* Creates a new ShooterSetHoodAbs.
19+
*/
20+
public ShooterSetHoodAbs(double set) {
21+
// Use addRequirements() here to declare subsystem dependencies.
22+
addRequirements(RobotContainer.shooter);
23+
24+
m_set = set;
25+
}
26+
27+
// Called when the command is initially scheduled.
28+
@Override
29+
public void initialize() {
30+
RobotContainer.shooter.setHoodPosition(m_set);
31+
}
32+
33+
}

src/main/java/org/mayheminc/robot2020/commands/ShooterSetHood.java renamed to src/main/java/org/mayheminc/robot2020/commands/ShooterSetHoodRel.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111

1212
import edu.wpi.first.wpilibj2.command.InstantCommand;
1313

14-
public class ShooterSetHood extends InstantCommand {
14+
public class ShooterSetHoodRel extends InstantCommand {
1515
double m_adjust;
1616

1717
/**
1818
* Creates a new ShooterSetHood.
1919
*/
20-
public ShooterSetHood(double adjust) {
20+
public ShooterSetHoodRel(double adjust) {
2121
// Use addRequirements() here to declare subsystem dependencies.
2222
addRequirements(RobotContainer.shooter);
2323

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*----------------------------------------------------------------------------*/
2+
/* Copyright (c) 2019 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.commands;
9+
10+
import org.mayheminc.robot2020.RobotContainer;
11+
12+
import edu.wpi.first.wpilibj2.command.CommandBase;
13+
14+
public class ShooterSetHoodVBus extends CommandBase {
15+
double m_power;
16+
17+
/**
18+
* Creates a new ShooterSetHoodVBus.
19+
*/
20+
public ShooterSetHoodVBus(double power) {
21+
// Use addRequirements() here to declare subsystem dependencies.
22+
addRequirements(RobotContainer.shooter);
23+
m_power = power;
24+
}
25+
26+
// Called when the command is initially scheduled.
27+
@Override
28+
public void initialize() {
29+
RobotContainer.shooter.setHoodVBus(m_power);
30+
}
31+
32+
// Called every time the scheduler runs while the command is scheduled.
33+
@Override
34+
public void execute() {
35+
}
36+
37+
// Called once the command ends or is interrupted.
38+
@Override
39+
public void end(boolean interrupted) {
40+
RobotContainer.shooter.setHoodVBus(0.0);
41+
}
42+
43+
// Returns true when the command should end.
44+
@Override
45+
public boolean isFinished() {
46+
return false;
47+
}
48+
}

0 commit comments

Comments
 (0)