mirror of
https://github.com/Team4388/RiseOfRidgebotics2020.git
synced 2026-06-09 08:48:01 -06:00
Attempts to make it work
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user