import edu.wpi.first.wpilibj2.command.ParallelCommandGroup;
import frc.robot.commands.DoNothing;
import frc.robot.commands.LogCommand;
+import frc.robot.commands.Music;
import frc.robot.commands.auto_comm.DynamicAutoBuilder;
import frc.robot.commands.drive_comm.DefaultDriveCommand;
import frc.robot.commands.gpm.IntakeMovementCommand;
addAuto(leftDoNothing);
addAuto(rightDoNothing);
addAuto(centerDoNothing);
+ addAuto("LeftShallowDoubleSwipe");
+ addAuto("RightShallowDoubleSwipe");
- DynamicAutoBuilder dynamicAutoBuilder = new DynamicAutoBuilder(spindexer, turret, hood, intake);
+
+ DynamicAutoBuilder dynamicAutoBuilder = new DynamicAutoBuilder(spindexer, turret, hood, intake, drive);
// names
String leftDynamicLiberalDoubleSwipe = "LeftDynamicDoubleLiberalSwipe";
package frc.robot.commands.auto_comm;
+import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj2.command.*;
import frc.robot.commands.gpm.IntakeCommand;
import frc.robot.subsystems.Intake.Intake;
import frc.robot.subsystems.PowerControl.BreakerConstants;
import frc.robot.subsystems.PowerControl.EMABreaker;
+import frc.robot.subsystems.drivetrain.Drivetrain;
import frc.robot.subsystems.hood.Hood;
import frc.robot.subsystems.spindexer.Spindexer;
import frc.robot.subsystems.turret.Turret;
private final Turret turret;
private final Hood hood;
private final Intake intake;
+ private final Drivetrain drive;
- public DynamicAutoBuilder(Spindexer spindexer, Turret turret, Hood hood, Intake intake) {
+ public DynamicAutoBuilder(Spindexer spindexer, Turret turret, Hood hood, Intake intake, Drivetrain drive) {
this.spindexer = spindexer;
this.turret = turret;
this.hood = hood;
this.intake = intake;
+ this.drive = drive;
}
/*
* Autos have no named commands within them. They must be added here
- * Still need to make one method to call that four command block in each sequential
+ * Still need to make one method to call that four command block in each
+ * sequential
*/
public Command getDynamicDoubleLiberalSwipe(boolean left) {
runSpindexerWithAbort(),
departCommand(),
+ // new InstantCommand(() -> drive.setPose(Translation2d.kZero)),
new PathPlannerAuto(left ? "LeftSwipeTwo" : "RightSwipeTwo"),
startShootingCommand(),
runSpindexerWithAbort(),
departCommand(),
+ // new InstantCommand(() -> drive.setPose(Translation2d.kZero)),
new PathPlannerAuto(left ? "LeftSwipeTwo" : "RightSwipeTwo"),
startShootingCommand(),
runSpindexerWithAbort(),
-
+
departCommand(),
+ // new InstantCommand(() -> drive.setPose(Translation2d.kZero)),
new PathPlannerAuto(left ? "LeftSwipeTwo" : "RightSwipeTwo"),
startShootingCommand(),
- runSpindexerWithAbort()
- );
+ runSpindexerWithAbort());
}
-
+
public Command getDynamicDoubleConservativeSwipe(boolean left) {
return new SequentialCommandGroup(
departCommand(),
new PathPlannerAuto(left ? "LeftSwipeTwo" : "RightSwipeTwo"),
startShootingCommand(),
runSpindexerWithAbort(),
-
+
departCommand(),
new PathPlannerAuto(left ? "LeftSwipeTwo" : "RightSwipeTwo"),
startShootingCommand(),
- runSpindexerWithAbort()
- );
+ runSpindexerWithAbort());
}
public Command getDynamicDoubleShallowSwipe(boolean left) {
new PathPlannerAuto(left ? "LeftSwipeTwo" : "RightSwipeTwo"),
startShootingCommand(),
runSpindexerWithAbort(),
-
+
departCommand(),
new PathPlannerAuto(left ? "LeftSwipeTwo" : "RightSwipeTwo"),
startShootingCommand(),
- runSpindexerWithAbort()
- );
+ runSpindexerWithAbort());
}
private Command departCommand() {
// timer.start();
// return new RunSpindexer(spindexer, turret, hood, intake).raceWith(
- // new WaitUntilCommand(() -> spindexer.spinningAir() && timer.hasElapsed(3.0)));
- // return new RunSpindexer(spindexer, turret, hood, intake).raceWith(new WaitCommand(3.0));
- // return new RunSpindexer(spindexer, turret, hood, intake).until(() -> spindexer.spinningAir() && timer.hasElapsed(3.0));
+ // new WaitUntilCommand(() -> spindexer.spinningAir() &&
+ // timer.hasElapsed(3.0)));
+ // return new RunSpindexer(spindexer, turret, hood, intake).raceWith(new
+ // WaitCommand(3.0));
+ // return new RunSpindexer(spindexer, turret, hood, intake).until(() ->
+ // spindexer.spinningAir() && timer.hasElapsed(3.0));
// has an isFinnished so it should work
return new RunSpindexerWithStop(spindexer, turret, hood, intake);
import org.littletonrobotics.junction.AutoLogOutput;
import org.littletonrobotics.junction.Logger;
+import com.ctre.phoenix6.hardware.TalonFX;
import com.pathplanner.lib.util.PathPlannerLogging;
import edu.wpi.first.math.VecBuilder;
import edu.wpi.first.math.estimator.SwerveDrivePoseEstimator;
import edu.wpi.first.math.geometry.Pose2d;
import edu.wpi.first.math.geometry.Rotation2d;
+import edu.wpi.first.math.geometry.Translation2d;
import edu.wpi.first.math.kinematics.ChassisSpeeds;
import edu.wpi.first.math.kinematics.SwerveDriveKinematics;
import edu.wpi.first.math.kinematics.SwerveModulePosition;
import edu.wpi.first.wpilibj.smartdashboard.Field2d;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
+import frc.robot.commands.Music;
import frc.robot.constants.Constants;
import frc.robot.constants.FieldConstants;
import frc.robot.constants.GyroBiasConstants;
if (!Constants.DISABLE_SMART_DASHBOARD) {
SmartDashboard.putData("Field", field);
}
+
+ addMusic();
+
+ }
+
+ public void setPose(Translation2d pose) {
+ poseEstimator.resetTranslation(pose);
+ }
+
+ public void addMusic() {
+ ArrayList<TalonFX> motors = new ArrayList<>();
+ for (Module m: modules) {
+ motors.add(m.getMotors()[0]);
+ motors.add(m.getMotors()[1]);
+ }
+
+ TalonFX[] f = new TalonFX[8];
+
+ SmartDashboard.putData("Chirp", new Music(motors.toArray(f)));
}
public void close() {