Skip to content

Commit b058727

Browse files
committed
Prepare for Intake spin on shoot.
Added "Safe shot".
1 parent 5783633 commit b058727

File tree

5 files changed

+58
-6
lines changed

5 files changed

+58
-6
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ public void robotInit() {
7676
Preferences.initDouble("BLP.Velocity", 500.0);
7777
Preferences.initDouble("BLP.Angle", 60.0);
7878

79+
Preferences.initDouble("SAF.Velocity", 2100.0);
80+
Preferences.initDouble("SAF.Angle", 75.0);
81+
7982
String pathname = "None";
8083
try {
8184
File deployDir = Filesystem.getDeployDirectory();

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,9 @@ public void configureButtonBindings() {
236236
.alongWith(new TurnOnLEDs(mLimelight)));
237237

238238
new JoystickButton(driver, RMZ_D_IN).whenPressed(new PullTrigger(mShooter));
239+
239240
new JoystickButton(driver, RMZ_D_IN).whenReleased(new StopTrigger(mShooter));
241+
240242

241243
// new JoystickButton(driver, RMZ_H_IN).whenPressed(new ResetHood(mShooter));
242244
new JoystickButton(driver, RMZ_G_IN).and(new JoystickButton(driver, RMZ_H_IN).whenPressed(new ZeroHeading(mDrive)));
@@ -352,10 +354,10 @@ public void configureButtonBindings() {
352354
// .alongWith(new TurnOffLEDs(mLimelight))
353355
// .alongWith(new IdleCommand()));
354356

355-
// xBoxX.whenHeld(new VisionShooter(mShooter, mLimelight)
356-
// .alongWith(new TurnOnLEDs(mLimelight))
357-
// .alongWith(new XBoxButtonCommand(X_BOX_X)));
358-
xBoxX.whenHeld(new MotionProfileTurn(mDrive, Math.PI/2));
357+
xBoxX.whenHeld(new VisionShooter(mShooter, mLimelight)
358+
.alongWith(new TurnOnLEDs(mLimelight))
359+
.alongWith(new XBoxButtonCommand(X_BOX_X)));
360+
// xBoxX.whenHeld(new MotionProfileTurn(mDrive, Math.PI/2));
359361

360362
xBoxX.whenReleased(new StopShooter(mShooter)
361363
.alongWith(new TurnOffLEDs(mLimelight))
@@ -388,8 +390,20 @@ public boolean get() {
388390

389391
// .and(new JoystickButton(operator, X_BOX_LOGO_LEFT))
390392
// .whenActive(new ToggleClimber(mClimber));
391-
}
392393

394+
new Button() {
395+
@Override
396+
public boolean get() {
397+
return (operator.getPOV() == 180);
398+
}
399+
}.whenPressed(new PresetFlywheelController(mShooter, "SAF").alongWith(new XBoxButtonCommand(-1)))
400+
.whenReleased(new StopShooter(mShooter).alongWith(new IdleCommand()));
401+
402+
// .and(new JoystickButton(operator, X_BOX_LOGO_LEFT))
403+
// .whenActive(new ToggleClimber(mClimber));
404+
405+
}
406+
393407
}
394408
}
395409

src/main/java/frc/robot/intake/Intake.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ public void rollerStop() {
5252
motor.set(ControlMode.PercentOutput, 0);
5353
}
5454

55+
// Push a ball into the trigger
56+
// public void rollerPush() {
57+
// motor.set(ControlMode.PercentOutput, 0.30);
58+
// }
59+
5560
// Status of the intake arm's extended state.
5661
public boolean isExtended() {
5762
// return solenoid.get() == Value.kForward;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package frc.robot.intake.commands;
2+
3+
import edu.wpi.first.wpilibj.Timer;
4+
import edu.wpi.first.wpilibj2.command.CommandBase;
5+
import frc.robot.intake.Intake;
6+
7+
public class SpinIntake extends CommandBase {
8+
private Intake intake;
9+
10+
public SpinIntake(Intake intake) {
11+
this.intake = intake;
12+
addRequirements(intake);
13+
}
14+
15+
@Override
16+
public void initialize() {
17+
// intake.deploy();
18+
// Timer.delay(0.2);
19+
// intake.rollerPush();
20+
}
21+
22+
@Override
23+
public boolean isFinished() {
24+
return false;
25+
}
26+
}

src/main/java/frc/robot/shooter/commands/PresetFlywheelController.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ public void initialize() {
3535
break;
3636
case "BLP":
3737
this.rpm = Preferences.getInt("BLP.Velocity", 500);
38-
this.hoodAngle = Preferences.getDouble("BLP.Angle", 60.0); // tarmac, upper goal, rear shot
38+
this.hoodAngle = Preferences.getDouble("BLP.Angle", 60.0); // Bloop shot
39+
break;
40+
case "SAF":
41+
this.rpm = Preferences.getInt("SAF.Velocity", 500);
42+
this.hoodAngle = Preferences.getDouble("SAF.Angle", 60.0); // safe loading zone shot
3943
break;
4044
default:
4145
this.rpm = 500;

0 commit comments

Comments
 (0)