This commit is contained in:
Aarav Shah
2021-04-03 15:39:00 -06:00
parent 2b760f520b
commit de69bd7a22
5 changed files with 25 additions and 17 deletions
@@ -18,6 +18,7 @@ import frc4388.robot.commands.shooter.ShootPrepGroup;
import frc4388.robot.commands.storage.RunStorage;
import frc4388.robot.subsystems.Drive;
import frc4388.robot.subsystems.Intake;
import frc4388.robot.subsystems.LimeLight;
import frc4388.robot.subsystems.Shooter;
import frc4388.robot.subsystems.ShooterAim;
import frc4388.robot.subsystems.ShooterHood;
@@ -30,7 +31,7 @@ public class TenBallAutoMiddle extends SequentialCommandGroup {
/**
* Creates a new TenBallAutoMiddle.
*/
public TenBallAutoMiddle(ShooterHood shooterHood, Storage storage, Intake intake, Shooter shooter, ShooterAim shooterAim, Drive drive, RamseteCommand[] paths) {
public TenBallAutoMiddle(ShooterHood shooterHood, Storage storage, Intake intake, Shooter shooter, ShooterAim shooterAim, Drive drive, LimeLight m_limeLight, RamseteCommand[] paths) {
// Add your commands in the super() call, e.g.
// super(new FooCommand(), new BarCommand());
addCommands(
@@ -46,10 +47,10 @@ public class TenBallAutoMiddle extends SequentialCommandGroup {
new Wait(drive, 4, 0),
new PrepChecker(shooter, shooterAim),
new RunCommand(() -> intake.runExtender(IntakeConstants.EXTENDER_SPEED), intake),
new ShootPrepGroup(shooter, shooterAim, shooterHood, storage)
new ShootPrepGroup(shooter, shooterAim, shooterHood, storage, m_limeLight)
),
new ParallelDeadlineGroup(
new ShootPrepGroup(shooter, shooterAim, shooterHood, storage),
new ShootPrepGroup(shooter, shooterAim, shooterHood, storage, m_limeLight),
new RunStorage(storage)
)
//paths[0],
@@ -9,6 +9,7 @@ package frc4388.robot.commands.shooter;
import edu.wpi.first.wpilibj2.command.ParallelDeadlineGroup;
import frc4388.robot.commands.storage.StoragePrep;
import frc4388.robot.subsystems.LimeLight;
import frc4388.robot.subsystems.Shooter;
import frc4388.robot.subsystems.ShooterAim;
import frc4388.robot.subsystems.ShooterHood;
@@ -24,9 +25,9 @@ public class ShootPrepGroup extends ParallelDeadlineGroup {
* @param m_shooterAim The ShooterAim subsystem
* @param m_storage The Storage subsytem
*/
public ShootPrepGroup(Shooter m_shooter, ShooterAim m_shooterAim, ShooterHood m_shooterHood, Storage m_storage) {
public ShootPrepGroup(Shooter m_shooter, ShooterAim m_shooterAim, ShooterHood m_shooterHood, Storage m_storage, LimeLight m_limeLight) {
super(
new TrackTarget(m_shooterAim),
new TrackTarget(m_shooterAim, m_limeLight),
new ShooterVelocityControlPID(m_shooter),
new HoodPositionPID(m_shooterHood)
);
@@ -39,24 +39,30 @@ public class TrackTarget extends CommandBase {
public double m_hoodTrim;
public double m_turretTrim;
LimeLight m_limeLight;
/**
* Uses the Limelight to track the target
* @param shooterSubsystem The Shooter subsystem
* @param aimSubsystem The ShooterAim subsystem
*/
public TrackTarget(ShooterAim aimSubsystem) {
public TrackTarget(ShooterAim aimSubsystem, LimeLight limeLight) {
m_shooterAim = aimSubsystem;
m_shooter = m_shooterAim.m_shooterSubsystem;
m_shooterHood = m_shooter.m_shooterHoodSubsystem;
m_limeLight = limeLight;
addRequirements(m_shooterAim);
NetworkTableInstance.getDefault().getTable("limelight").getEntry("camMode").setNumber(1);
NetworkTableInstance.getDefault().getTable("limelight").getEntry("ledMode").setNumber(0);
//NetworkTableInstance.getDefault().getTable("limelight").getEntry("camMode").setNumber(1);
//NetworkTableInstance.getDefault().getTable("limelight").getEntry("ledMode").setNumber(0);
m_limeLight.limeOff();
}
// Called when the command is initially scheduled.
@Override
public void initialize() {
// Vision Processing Mode
//NetworkTableInstance.getDefault().getTable("limelight").getEntry("camMode").setNumber(0);
//NetworkTableInstance.getDefault().getTable("limelight").getEntry("ledMode").setNumber(3);
NetworkTableInstance.getDefault().getTable("limelight").getEntry("camMode").setNumber(0);
NetworkTableInstance.getDefault().getTable("limelight").getEntry("ledMode").setNumber(3);
}