Skip to content
This repository was archived by the owner on Jul 20, 2025. It is now read-only.

Commit 8dcc8f3

Browse files
Add stageGP command (#22)
* Add stageGP command Co-Authored-By: Wu-Fan-529 <176576491+wu-fan-529@users.noreply.github.com> * remove globShooter :( Co-Authored-By: Wu-Fan-529 <176576491+wu-fan-529@users.noreply.github.com> * change sensor number Co-Authored-By: Wu-Fan-529 <176576491+wu-fan-529@users.noreply.github.com> --------- Co-authored-by: FRCTeam3255-Shared <170778697+FRCTeam3255-Shared@users.noreply.github.com> Co-authored-by: Wu-Fan-529 <176576491+wu-fan-529@users.noreply.github.com>
1 parent c6d9fb1 commit 8dcc8f3

File tree

3 files changed

+52
-2
lines changed

3 files changed

+52
-2
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@
1010
import edu.wpi.first.wpilibj2.command.Commands;
1111
import frc.robot.commands.IntakeGround;
1212
import frc.robot.commands.PrepShooter;
13+
import frc.robot.commands.StageGP;
1314
import frc.robot.commands.intakeHopper;
1415
import frc.robot.subsystems.Hopper;
1516
import frc.robot.subsystems.Intake;
1617
import frc.robot.subsystems.Shooter;
18+
import frc.robot.subsystems.Stager;
1719

1820
public class RobotContainer {
1921
private final SN_XboxController m_driverController = new SN_XboxController(1);
2022
private final Intake subIntake = new Intake();
2123
private final Hopper subHopper = new Hopper();
2224
private final Shooter subShooter = new Shooter();
25+
private final Stager subStager = new Stager();
2326
private final IntakeGround com_IntakeGround = new IntakeGround(subIntake, subHopper);
2427
private final PrepShooter com_PrepShooter = new PrepShooter(subShooter);
28+
private final StageGP com_StageGP = new StageGP(subStager);
2529

2630
public RobotContainer() {
2731
configureBindings();
@@ -32,7 +36,7 @@ private void configureBindings() {
3236
m_driverController.btn_B.whileTrue(com_IntakeGround);
3337
m_driverController.btn_LeftBumper.whileTrue(new intakeHopper(subHopper));
3438
m_driverController.btn_X.onTrue(com_PrepShooter);
35-
39+
m_driverController.btn_A.whileTrue(com_StageGP);
3640
}
3741

3842
public Command getAutonomousCommand() {

src/main/java/frc/robot/RobotMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public static class mapShooter {
3838

3939
public static class mapStager {
4040
public static final int CONVEYOR_MOTOR_CAN = 40;
41-
public static final int IS_GP_STAGED_DIO = 41;
41+
public static final int IS_GP_STAGED_DIO = 0;
4242
}
4343

4444
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright (c) FIRST and other WPILib contributors.
2+
// Open Source Software; you can modify and/or share it under the terms of
3+
// the WPILib BSD license file in the root directory of this project.
4+
5+
package frc.robot.commands;
6+
7+
import edu.wpi.first.wpilibj2.command.Command;
8+
import frc.robot.subsystems.Stager;
9+
10+
public class StageGP extends Command {
11+
/** Creates a new StageGP. */
12+
Stager globalStager;
13+
14+
public StageGP(Stager passedStager) {
15+
// Use addRequirements() here to declare subsystem dependencies.
16+
globalStager = passedStager;
17+
}
18+
19+
// Called when the command is initially scheduled.
20+
@Override
21+
public void initialize() {
22+
globalStager.setConveyorMotorVelocity(0.3);
23+
}
24+
25+
// Called every time the scheduler runs while the command is scheduled.
26+
@Override
27+
public void execute() {
28+
if (globalStager.getIsGPStaged()) {
29+
globalStager.setConveyorMotorVelocity(0);
30+
} else {
31+
globalStager.setConveyorMotorVelocity(0.3);
32+
}
33+
}
34+
35+
// Called once the command ends or is interrupted.
36+
@Override
37+
public void end(boolean interrupted) {
38+
globalStager.setConveyorMotorVelocity(0);
39+
}
40+
41+
// Returns true when the command should end.
42+
@Override
43+
public boolean isFinished() {
44+
return false;
45+
}
46+
}

0 commit comments

Comments
 (0)