-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement closed-loop driving, intaking, and shooting
- Loading branch information
Showing
9 changed files
with
237 additions
and
49 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// 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; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.Constants; | ||
import frc.robot.subsystems.flywheel.Flywheel; | ||
|
||
// import frc.robot.subsystems.CANLauncher; | ||
|
||
/*This is an example of creating a command as a class. The base Command class provides a set of methods that your command | ||
* will override. | ||
*/ | ||
public class IntakeNote extends Command { | ||
Flywheel shooter; | ||
Flywheel hopper; | ||
|
||
// CANLauncher m_launcher; | ||
|
||
/** Creates a new LaunchNote. */ | ||
public IntakeNote(Flywheel shooter, Flywheel hopper) { | ||
// save the launcher system internally | ||
this.shooter = shooter; | ||
this.hopper = hopper; | ||
} | ||
|
||
// The initialize method is called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
// Set the wheels to launching speed | ||
shooter.runVolts(Constants.INTAKE_SHOOTER_VOLTS); | ||
hopper.runVolts(Constants.INTAKE_HOPPER_VOLTS); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
// There is nothing we need this command to do on each iteration. You could remove this method | ||
// and the default blank method | ||
// of the base class will run. | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
// Always return false so the command never ends on it's own. In this project we use the | ||
// scheduler to end the command when the button is released. | ||
return false; | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
// Stop the wheels when the command ends. | ||
shooter.stop(); | ||
hopper.stop(); | ||
} | ||
} |
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,62 @@ | ||
// 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; | ||
|
||
import static frc.robot.Constants.*; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.Constants; | ||
import frc.robot.subsystems.flywheel.Flywheel; | ||
|
||
// import frc.robot.subsystems.CANLauncher; | ||
|
||
/*This is an example of creating a command as a class. The base Command class provides a set of methods that your command | ||
* will override. | ||
*/ | ||
public class LaunchNote extends Command { | ||
Flywheel shooter; | ||
Flywheel hopper; | ||
|
||
// CANLauncher m_launcher; | ||
|
||
/** Creates a new LaunchNote. */ | ||
public LaunchNote(Flywheel shooter, Flywheel hopper) { | ||
// save the launcher system internally | ||
this.shooter = shooter; | ||
this.hopper = hopper; | ||
} | ||
|
||
// The initialize method is called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
// Set the wheels to launching speed | ||
shooter.runVolts(Constants.LAUNCH_SHOOTER_VOLTS); | ||
hopper.runVolts(Constants.LAUNCH_HOPPER_VOLTS); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
// There is nothing we need this command to do on each iteration. You could remove this method | ||
// and the default blank method | ||
// of the base class will run. | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
// Always return false so the command never ends on it's own. In this project we use the | ||
// scheduler to end the command when the button is released. | ||
return false; | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
// Stop the wheels when the command ends. | ||
shooter.stop(); | ||
hopper.stop(); | ||
} | ||
} |
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,54 @@ | ||
// 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; | ||
|
||
import static frc.robot.Constants.*; | ||
|
||
import edu.wpi.first.wpilibj2.command.Command; | ||
import frc.robot.subsystems.flywheel.*; | ||
|
||
// import frc.robot.subsystems.CANLauncher; | ||
|
||
public class PrepareLaunch extends Command { | ||
Flywheel shooter; | ||
Flywheel hopper; | ||
|
||
// CANLauncher m_launcher; | ||
|
||
/** Creates a new PrepareLaunch. */ | ||
public PrepareLaunch(Flywheel shooter, Flywheel hopper) { | ||
this.shooter = shooter; | ||
this.hopper = hopper; | ||
} | ||
|
||
// Called when the command is initially scheduled. | ||
@Override | ||
public void initialize() { | ||
// Set launch wheel to speed, keep feed wheel at 0 to let launch wheel spin up. | ||
shooter.runVolts(12.0); | ||
} | ||
|
||
// Called every time the scheduler runs while the command is scheduled. | ||
@Override | ||
public void execute() { | ||
// There is nothing we need this command to do on each iteration. You could remove this method | ||
// and the default blank method | ||
// of the base class will run. | ||
} | ||
|
||
// Called once the command ends or is interrupted. | ||
@Override | ||
public void end(boolean interrupted) { | ||
// Do nothing when the command ends. The launch wheel needs to keep spinning in order to launch | ||
} | ||
|
||
// Returns true when the command should end. | ||
@Override | ||
public boolean isFinished() { | ||
// Always return false so the command never ends on it's own. In this project we use a timeout | ||
// decorator on the command to end it. | ||
return false; | ||
} | ||
} |
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
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
Oops, something went wrong.