filename parameter (incomplete)

This commit is contained in:
aarav18
2023-02-25 08:55:54 -07:00
parent d50cd60496
commit 7cca9e0547
2 changed files with 13 additions and 2 deletions
@@ -94,7 +94,7 @@ public class RobotContainer {
* @return the command to run in autonomous
*/
public Command getAutonomousCommand() {
return new InstantCommand();
return new JoystickPlayback(m_robotSwerveDrive);
}
public DeadbandedXboxController getDeadbandedDriverController() {
@@ -15,6 +15,7 @@ import frc4388.utility.UtilityStructs.TimedOutput;
public class JoystickPlayback extends CommandBase {
private final SwerveDrive swerve;
private String filename;
private Scanner input;
private final ArrayList<TimedOutput> outputs = new ArrayList<>();
private int counter = 0;
@@ -26,6 +27,16 @@ public class JoystickPlayback extends CommandBase {
/** Creates a new JoystickPlayback. */
public JoystickPlayback(SwerveDrive swerve) {
this.swerve = swerve;
this.filename = "JoystickInputs.txt";
addRequirements(this.swerve);
}
/** Creates a new JoystickPlayback. */
public JoystickPlayback(SwerveDrive swerve, String filename) {
this.swerve = swerve;
this.filename = filename;
addRequirements(this.swerve);
}
@@ -36,7 +47,7 @@ public class JoystickPlayback extends CommandBase {
playbackTime = 0;
lastIndex = 0;
try {
input = new Scanner(new File("/home/lvuser/JoystickInputs.txt"));
input = new Scanner(new File("/home/lvuser/" + this.filename));
String line = "";
while (input.hasNextLine()) {