diff --git a/src/main/java/frc4388/robot/Constants.java b/src/main/java/frc4388/robot/Constants.java index f4f8c2b..04e18c3 100644 --- a/src/main/java/frc4388/robot/Constants.java +++ b/src/main/java/frc4388/robot/Constants.java @@ -21,7 +21,7 @@ public final class Constants { public static final class DriveConstants { /* Drive Train IDs */ public static final int DRIVE_LEFT_FRONT_CAN_ID = 2; - public static final int DRIVE_RIGHT_FRONT_CAN_ID = 4; + public static final int DRIVE_RIGHT_FRONT_CAN_ID = 8; public static final int DRIVE_LEFT_BACK_CAN_ID = 3; public static final int DRIVE_RIGHT_BACK_CAN_ID = 5; public static final int PIGEON_ID = 6; diff --git a/src/main/java/frc4388/robot/RobotContainer.java b/src/main/java/frc4388/robot/RobotContainer.java index e46afbd..b259b06 100644 --- a/src/main/java/frc4388/robot/RobotContainer.java +++ b/src/main/java/frc4388/robot/RobotContainer.java @@ -17,6 +17,7 @@ import edu.wpi.first.wpilibj2.command.button.JoystickButton; import frc4388.robot.Constants.*; import frc4388.robot.commands.DriveStraightAtVelocityPID; import frc4388.robot.commands.DriveWithJoystick; +import frc4388.robot.commands.PlaySongDrive; import frc4388.robot.commands.RunClimberWithTriggers; import frc4388.robot.commands.RunIntakeWithTriggers; import frc4388.robot.subsystems.Climber; @@ -98,7 +99,7 @@ public class RobotContainer { .whenPressed(new InstantCommand(() -> m_robotDrive.resetGyroYaw(), m_robotDrive)); new JoystickButton(getDriverJoystick(), XboxController.Y_BUTTON) - .whileHeld(new RunCommand(() -> m_robotDrive.playSong(), m_robotDrive)); + .whileHeld(new PlaySongDrive(m_robotDrive)); //new JoystickButton(getDriverJoystick(), XboxController.Y_BUTTON) // .whenPressed(new RunCommand(() -> m_robotDrive.runMotionMagicPID(5000, 0), m_robotDrive)); diff --git a/src/main/java/frc4388/robot/commands/PlaySongDrive.java b/src/main/java/frc4388/robot/commands/PlaySongDrive.java new file mode 100644 index 0000000..79eb580 --- /dev/null +++ b/src/main/java/frc4388/robot/commands/PlaySongDrive.java @@ -0,0 +1,47 @@ +/*----------------------------------------------------------------------------*/ +/* 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.subsystems.Drive; + +public class PlaySongDrive extends CommandBase { + private Drive m_drive; + + /** + * Creates a new PlaySongDrive. + */ + public PlaySongDrive(Drive subsystem) { + // Use addRequirements() here to declare subsystem dependencies. + m_drive = subsystem; + addRequirements(m_drive); + } + + // Called when the command is initially scheduled. + @Override + public void initialize() { + m_drive.playSong(); + } + + // Called every time the scheduler runs while the command is scheduled. + @Override + public void execute() { + System.err.println("Playing " + m_drive.m_orchestra.isPlaying()); + } + + // 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; + } +} diff --git a/src/main/java/frc4388/robot/subsystems/Drive.java b/src/main/java/frc4388/robot/subsystems/Drive.java index 7e23293..7ad5551 100644 --- a/src/main/java/frc4388/robot/subsystems/Drive.java +++ b/src/main/java/frc4388/robot/subsystems/Drive.java @@ -239,15 +239,16 @@ public class Drive extends SubsystemBase { */ m_rightFrontMotor.configAuxPIDPolarity(false, DriveConstants.DRIVE_TIMEOUT_MS); - m_orchestra.addInstrument(m_leftBackMotor); - m_orchestra.addInstrument(m_leftFrontMotor); - m_orchestra.addInstrument(m_rightBackMotor); + //m_orchestra.addInstrument(m_leftBackMotor); + //m_orchestra.addInstrument(m_leftFrontMotor); + //m_orchestra.addInstrument(m_rightBackMotor); m_orchestra.addInstrument(m_rightFrontMotor); - File songsDir = new File(Filesystem.getDeployDirectory().getAbsolutePath() + "\\songs"); + File songsDir = new File(Filesystem.getDeployDirectory().getAbsolutePath() + "/songs"); + System.err.println(songsDir.getPath()); String[] songsStrings = songsDir.list(); for (String songString : songsStrings){ - m_songChooser.addOption(songString, songsDir.getAbsolutePath() + "\\" + songString); + m_songChooser.addOption(songString, songsDir.getAbsolutePath() + "/" + songString); } Shuffleboard.getTab("Songs").add(m_songChooser); }