-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from primo4586/CollectCommand
CollectingCommandGroup
- Loading branch information
Showing
7 changed files
with
98 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/frc/robot/commands/IntakeCommands/CollectToFeeder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands.IntakeCommands; | ||
|
||
import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; | ||
import frc.robot.Constants.IntakeConstants; | ||
import frc.robot.commands.IntakeArmCommands.MoveIntakeArmToDegree; | ||
import frc.robot.commands.feederCommands.FeedUntilNote; | ||
|
||
// NOTE: Consider using this command inline, rather than writing a subclass. For more | ||
// information, see: | ||
// https://docs.wpilib.org/en/stable/docs/software/commandbased/convenience-features.html | ||
public class CollectToFeeder extends ParallelCommandGroup { | ||
/** Creates a new MoveIntakeToCollectNote. */ | ||
public CollectToFeeder() { | ||
// Add your commands in the addCommands() call, e.g. | ||
// addCommands(new FooCommand(), new BarCommand()); | ||
addCommands( | ||
new IntakeSetSpeed(IntakeConstants.getNoteSpeed), | ||
new FeedUntilNote(), | ||
new MoveIntakeArmToDegree(IntakeConstants.GroundIntakePose)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/frc/robot/commands/feederCommands/FeedUntilNote.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) FIRST and other WPILib contributors. | ||
// Open Source Software; you can modify and/or share it under the terms of | ||
// the WPILib BSD license file in the root directory of this project. | ||
|
||
package frc.robot.commands.feederCommands; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.Constants.FeederConstants; | ||
import frc.robot.subsystems.FeederSubsystem; | ||
|
||
public class FeedUntilNote extends Command { | ||
private final FeederSubsystem feederSubsystem = FeederSubsystem.getInstance(); | ||
/** Creates a new FeedUntilNote. */ | ||
public FeedUntilNote() { | ||
addRequirements(feederSubsystem); | ||
// Use addRequirements() here to declare subsystem dependencies. | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
feederSubsystem.setSpeed(FeederConstants.getNoteSpeed);} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() {} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
feederSubsystem.setSpeed(0); | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
return feederSubsystem.getSwitch(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters