diff --git a/src/main/deploy/pathplanner/autos/Center Shoot 3 vision.auto b/src/main/deploy/pathplanner/autos/Center Shoot 3 vision.auto new file mode 100644 index 0000000..4a4ca57 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/Center Shoot 3 vision.auto @@ -0,0 +1,233 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.42, + "y": 5.527514849608872 + }, + "rotation": 0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "deadline", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "DeployIntake" + } + }, + { + "type": "named", + "data": { + "name": "LiftArmToDeployDemonHorns" + } + }, + { + "type": "named", + "data": { + "name": "RampShooterForManualShot" + } + }, + { + "type": "named", + "data": { + "name": "SwerveStraighten" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "SetShootFromSubwoofer" + } + }, + { + "type": "wait", + "data": { + "waitTime": 0.5 + } + }, + { + "type": "named", + "data": { + "name": "Feed" + } + }, + { + "type": "named", + "data": { + "name": "SetArmAndShooterForIntake" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "race", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "center get center" + } + }, + { + "type": "named", + "data": { + "name": "NoteVisible" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "AutoIntake" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "return center get center" + } + }, + { + "type": "named", + "data": { + "name": "StopSwerves" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "SetShootFromSubwoofer" + } + }, + { + "type": "named", + "data": { + "name": "Feed" + } + }, + { + "type": "named", + "data": { + "name": "SetArmAndShooterForIntake" + } + } + ] + } + }, + { + "type": "parallel", + "data": { + "commands": [ + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "center get podium" + } + }, + { + "type": "named", + "data": { + "name": "StopSwerves" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "HasNote" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "return center get podium" + } + }, + { + "type": "named", + "data": { + "name": "StopSwerves" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "SetShootFromSubwoofer" + } + }, + { + "type": "named", + "data": { + "name": "Feed" + } + }, + { + "type": "named", + "data": { + "name": "StopShooter" + } + } + ] + } + } + ] + } + }, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/deploy/pathplanner/autos/Center Shoot 4 vision.auto b/src/main/deploy/pathplanner/autos/Center Shoot 4 vision.auto new file mode 100644 index 0000000..fcac5e9 --- /dev/null +++ b/src/main/deploy/pathplanner/autos/Center Shoot 4 vision.auto @@ -0,0 +1,202 @@ +{ + "version": 1.0, + "startingPose": { + "position": { + "x": 1.4, + "y": 5.57 + }, + "rotation": 0 + }, + "command": { + "type": "sequential", + "data": { + "commands": [ + { + "type": "named", + "data": { + "name": "InitSequence" + } + }, + { + "type": "named", + "data": { + "name": "ShootSubwooferSequence" + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "race", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "center get center" + } + }, + { + "type": "named", + "data": { + "name": "NoteVisible" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "AutoIntake" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "return center get center" + } + }, + { + "type": "named", + "data": { + "name": "StopSwerves" + } + }, + { + "type": "named", + "data": { + "name": "ShootSubwooferSequence" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "race", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "center get podium" + } + }, + { + "type": "named", + "data": { + "name": "NoteVisible" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "AutoIntake" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "return center get podium" + } + }, + { + "type": "named", + "data": { + "name": "StopSwerves" + } + }, + { + "type": "named", + "data": { + "name": "ShootSubwooferSequence" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "race", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "center get amp" + } + }, + { + "type": "named", + "data": { + "name": "NoteVisible" + } + } + ] + } + }, + { + "type": "named", + "data": { + "name": "AutoIntake" + } + } + ] + } + }, + { + "type": "sequential", + "data": { + "commands": [ + { + "type": "path", + "data": { + "pathName": "return center get amp" + } + }, + { + "type": "named", + "data": { + "name": "StopSwerves" + } + }, + { + "type": "named", + "data": { + "name": "ShootSubwooferSequence" + } + } + ] + } + } + ] + } + }, + "folder": null, + "choreoAuto": false +} \ No newline at end of file diff --git a/src/main/java/frc/robot/RobotContainer.java b/src/main/java/frc/robot/RobotContainer.java index 401c403..1c2c08f 100644 --- a/src/main/java/frc/robot/RobotContainer.java +++ b/src/main/java/frc/robot/RobotContainer.java @@ -40,6 +40,7 @@ import frc.robot.commands.drive.AutoPickupNote; import frc.robot.commands.drive.DriveSwerveWithXbox; import frc.robot.commands.intake.SetIntakeState; +import frc.robot.commands.shooter.NoteVisible; import frc.robot.commands.shooter.RampShooter; import frc.robot.commands.shooter.SetShooterState; import frc.robot.commands.shooter.ShootSpeaker; @@ -399,7 +400,9 @@ private void registerNamedCommands() { NamedCommands.registerCommand("SetArmForScore", new SetArmState(ArmState.kShoot).andThen(new WaitCommand(0.2))); // Intake + Indexing + NamedCommands.registerCommand("AutoIntake", new AutoIntake()); NamedCommands.registerCommand("AutoPickupNote", new AutoPickupNote()); + NamedCommands.registerCommand("NoteVisible", new NoteVisible()); NamedCommands.registerCommand("HasNote", new WaitForNote().withTimeout(4.5)); NamedCommands.registerCommand("RetractIntake", new SetIntakeState(IntakeState.kUp)); NamedCommands.registerCommand("DeployIntake", new SetIntakeState(IntakeState.kDown)); diff --git a/src/main/java/frc/robot/commands/shooter/NoteVisible.java b/src/main/java/frc/robot/commands/shooter/NoteVisible.java new file mode 100644 index 0000000..1ead6d9 --- /dev/null +++ b/src/main/java/frc/robot/commands/shooter/NoteVisible.java @@ -0,0 +1,33 @@ +// 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.shooter; + +import edu.wpi.first.wpilibj2.command.Command; +import frc.robot.RobotContainer; + +public class NoteVisible extends Command { + /** Creates a new NoteVisible. */ + public NoteVisible() { + // Use addRequirements() here to declare subsystem dependencies. + } + + // 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() {} + + // 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 RobotContainer.intakeCamera.getNearestNote().isPresent(); + } +}