mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 08:48:01 -06:00
Shooter firing
This commit is contained in:
@@ -13,7 +13,8 @@ import frc4388.robot.subsystems.Shooter;
|
||||
public class HoodAdjustPID extends CommandBase {
|
||||
Shooter m_shooter;
|
||||
/**
|
||||
* Creates a new HoodAdjustPID.
|
||||
* Adjusts the hood based on the limelight target angle
|
||||
* @param shooterSub The Shooter subsystem
|
||||
*/
|
||||
public HoodAdjustPID(Shooter shooterSub) {
|
||||
m_shooter = shooterSub;
|
||||
|
||||
@@ -18,16 +18,17 @@ import frc4388.robot.subsystems.Storage;
|
||||
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
|
||||
public class ShootFireGroup extends ParallelRaceGroup {
|
||||
/**
|
||||
* Creates a new ShootFireGroup.
|
||||
* Fires the shooter
|
||||
* @param m_shooter The Shooter subsytem
|
||||
* @param m_shooterAim The ShooterAim subsystem
|
||||
* @param m_storage The Storage subsytem
|
||||
*/
|
||||
public ShootFireGroup(Shooter m_shooter, ShooterAim m_shooterAim, Storage m_storage) {
|
||||
|
||||
// Add your commands in the super() call, e.g.
|
||||
// super(new FooCommand(), new BarCommand());
|
||||
super(
|
||||
new ShooterVelocityControlPID(m_shooter, m_shooter.addFireVel()),
|
||||
new RunCommand(() -> m_shooter.runAngleAdjustPID(m_shooter.addFireAngle())),
|
||||
new TrackTarget(m_shooter, m_shooterAim)
|
||||
new HoodAdjustPID(m_shooter),
|
||||
new TrackTarget(m_shooter, m_shooterAim),
|
||||
new StorageRun(m_storage)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,15 @@ import frc4388.robot.subsystems.Storage;
|
||||
// https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html
|
||||
public class ShootFullGroup extends SequentialCommandGroup {
|
||||
/**
|
||||
* Creates a new ShootFullGroup.
|
||||
* Preps and Fires the Shooter
|
||||
* @param m_shooter The Shooter subsytem
|
||||
* @param m_shooterAim The ShooterAim subsystem
|
||||
* @param m_storage The Storage subsytem
|
||||
*/
|
||||
public ShootFullGroup(Shooter m_shooter, ShooterAim m_shooterAim, Storage m_storage) {
|
||||
super(
|
||||
new ShootPrepGroup(m_shooter, m_shooterAim, m_storage),
|
||||
new ShootFireGroup()
|
||||
new ShootFireGroup(m_shooter, m_shooterAim, m_storage)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ import frc4388.robot.subsystems.Storage;
|
||||
public class ShootPrepGroup extends ParallelCommandGroup {
|
||||
/**
|
||||
* Preps the Shooter to be fired
|
||||
* @param m_shooter The Shooter subsytem
|
||||
* @param m_shooterAim The ShooterAim subsystem
|
||||
* @param m_storage The Storage subsytem
|
||||
*/
|
||||
public ShootPrepGroup(Shooter m_shooter, ShooterAim m_shooterAim, Storage m_storage) {
|
||||
super(
|
||||
|
||||
@@ -16,6 +16,8 @@ public class ShooterVelocityControlPID extends CommandBase {
|
||||
double m_actualVel;
|
||||
/**
|
||||
* Creates a new ShooterVelocityControlPID.
|
||||
* @param subsystem The Shooter subsytem
|
||||
* @param targetVel The target velocity
|
||||
*/
|
||||
public ShooterVelocityControlPID(Shooter subsystem, double targetVel) {
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
package frc4388.robot.commands;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc4388.robot.Constants.StorageConstants;
|
||||
import frc4388.robot.subsystems.Storage;
|
||||
|
||||
public class StorageRun extends CommandBase {
|
||||
Storage m_storage;
|
||||
/**
|
||||
* Runs the Storage at a speed
|
||||
* @param storageSub The Storage subsytem
|
||||
*/
|
||||
public StorageRun(Storage storageSub) {
|
||||
m_storage = storageSub;
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@Override
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
// Called every time the scheduler runs while the command is scheduled.
|
||||
@Override
|
||||
public void execute() {
|
||||
m_storage.runStorage(StorageConstants.STORAGE_SPEED);
|
||||
}
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user