Skip to content

Commit

Permalink
Merge pull request #80 from frc2052/msad/MusicPlayer
Browse files Browse the repository at this point in the history
max music yay
  • Loading branch information
caleb-fynewever authored Apr 30, 2024
2 parents 2fae16c + ce22f08 commit 32ee103
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 12 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/team2052/swervemodule/SwerveModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ public SwerveModulePosition getPosition() {
);
}

public TalonFX getTalonFX(){
return driveMotor;
}

public static double getMaxVelocityMetersPerSecond() {
/*
* The formula for calculating the theoretical maximum velocity is:
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import edu.wpi.first.math.numbers.N3;
import edu.wpi.first.math.trajectory.TrapezoidProfile;
import edu.wpi.first.math.util.Units;

import frc.robot.subsystems.DrivetrainSubsystem;
import frc.robot.subsystems.ShamperSubsystem;

public final class Constants {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/frc/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void robotInit() {
Logger.start(); //Start AdvantageKit Logger

m_robotContainer = new RobotContainer();
// m_robotContainer.robotStatusCommunicator.onRobotInitiation();
m_robotContainer.robotStatusCommunicator.onRobotInitiation();
}

/**
Expand All @@ -46,13 +46,13 @@ public void robotPeriodic() {
// and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run();
// m_robotContainer.robotStatusCommunicator.onRobotPeriodic();
m_robotContainer.robotStatusCommunicator.onRobotPeriodic();
}

/** This function is called once each time the robot enters Disabled mode. */
@Override
public void disabledInit() {
//m_robotContainer.robotStatusCommunicator.onRobotDisable();
// m_robotContainer.robotStatusCommunicator.onRobotDisable();
}

@Override
Expand Down Expand Up @@ -85,8 +85,8 @@ public void teleopInit() {
if (m_autonomousCommand != null) {
m_autonomousCommand.cancel();
}
// m_robotContainer.robotStatusCommunicator.onRobotTeleop();

m_robotContainer.robotStatusCommunicator.onRobotTeleop();
}

/** This function is called periodically during operator control. */
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import frc.robot.commands.indexer.IndexerIndexCommand;
import frc.robot.commands.intake.IntakeThenBackupCommand;
import frc.robot.commands.intake.OuttakeCommand;
import frc.robot.commands.music.PlayFOTBCommand;
import frc.robot.commands.shamper.ShamperAmpCommand;
import frc.robot.commands.shamper.ShamperDefaultCommand;
import frc.robot.commands.shamper.ShamperLobOrShootCommand;
Expand All @@ -46,10 +47,12 @@
import frc.robot.subsystems.IndexerSubsystem;
import frc.robot.subsystems.IntakeSubsystem;
import frc.robot.subsystems.LedSubsystem;
import frc.robot.subsystems.MusicPlayerSubsystem;
import frc.robot.subsystems.ShamperSubsystem;
import frc.robot.subsystems.TrapArmSubsystem;
import frc.robot.subsystems.ShamperSubsystem.ShamperSpeed;
import frc.robot.util.AimingCalculator;
import frc.robot.util.RobotStatusCommunicator;
import frc.robot.util.io.Dashboard;
import frc.robot.util.io.pixy.Pixy2CCC;

Expand All @@ -73,7 +76,7 @@ public class RobotContainer {
private final AprilTagSubsystem aprilTag;
private final LedSubsystem ledSubsystem;
private ForwardPixySubsystem pixy;
// private final MusicPlayerSubsystem musicPlayer;
private final MusicPlayerSubsystem musicPlayer;
// private final VisionSubsystem vision;
private final AdvantageScopeSubsystem advantageScope;
private final TrapArmSubsystem trapArm;
Expand All @@ -85,7 +88,7 @@ public class RobotContainer {
private final Joystick controlPanel;

public static boolean musicOn;
// public RobotStatusCommunicator robotStatusCommunicator;
public RobotStatusCommunicator robotStatusCommunicator;
/** The container for the robot. Contains subsystems, OI devices, and commands. */
public RobotContainer() {
drivetrain = new DrivetrainSubsystem();
Expand All @@ -95,14 +98,14 @@ public RobotContainer() {
climber = new ClimberSubsystem();
aprilTag = AprilTagSubsystem.getInstance();
ledSubsystem = LedSubsystem.getInstance();
// musicPlayer = new MusicPlayerSubsystem();
musicPlayer = new MusicPlayerSubsystem();
// vision = new VisionSubsystem();
trapArm = new TrapArmSubsystem();
advantageScope = new AdvantageScopeSubsystem(intake, shamper, climber, drivetrain, indexer);
pixy = new ForwardPixySubsystem();


// robotStatusCommunicator = new RobotStatusCommunicator(musicPlayer);
robotStatusCommunicator = new RobotStatusCommunicator(musicPlayer);

musicOn = true;
ledSubsystem.enableLEDs();
Expand Down Expand Up @@ -293,6 +296,9 @@ private void configureButtonBindings() {
*/
// JoystickButton toggleMusicPlayerButton = new JoystickButton(controlPanel, 2);
// toggleMusicPlayerButton.onTrue(toggleMusic());

JoystickButton musictest = new JoystickButton(translationJoystick, 10);
musictest.onTrue(new PlayFOTBCommand(musicPlayer));
}

// public Command toggleMusic() {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/frc/robot/commands/music/PlayFOTBCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ public PlayFOTBCommand(MusicPlayerSubsystem player) {

@Override
public void initialize() {
System.out.println("RUNING MUSIC STUFF");
player.stopMusic();
player.loadMusic("FlightOfTheBumblebees.chrp");
player.loadMusic("music/FlightOfTheBumblebees.chrp");
player.playLoadedTrack();
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/frc/robot/subsystems/DrivetrainSubsystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.littletonrobotics.junction.Logger;

import com.ctre.phoenix6.hardware.TalonFX;
import com.kauailabs.navx.frc.AHRS;
import com.pathplanner.lib.auto.AutoBuilder;
import com.team2052.swervemodule.SwerveModule;
Expand Down Expand Up @@ -275,6 +276,11 @@ public static double getMaxAngularVelocityRadiansPerSecond() {
//return 6 * Math.PI;
}

public TalonFX[] getDriveMotors() {
TalonFX[] driveMotorArray = {frontLeftModule.getTalonFX(), frontRightModule.getTalonFX(), backRightModule.getTalonFX(), backLeftModule.getTalonFX()};
return driveMotorArray;
}

public void debug() {
frontLeftModule.debug();
backLeftModule.debug();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/util/RobotStatusCommunicator.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void onRobotInitiation() {
}

public void onRobotPeriodic() {
if (DriverStation.getMatchTime() >= 180 && !hasRunTwentySeconds) {
if (DriverStation.getMatchTime() >= 130 && !hasRunTwentySeconds) {
onTwentySecondsLeft();
hasRunTwentySeconds = true;
}
Expand Down

0 comments on commit 32ee103

Please sign in to comment.