mirror of
https://github.com/Team4388/2023WayOfTheRobot.git
synced 2026-06-09 08:38:02 -06:00
time
This commit is contained in:
@@ -62,12 +62,13 @@ public class JoystickPlayback extends CommandBase {
|
||||
|
||||
// Called once the command ends or is interrupted.
|
||||
@Override
|
||||
public void end(boolean interrupted) {}
|
||||
public void end(boolean interrupted) {
|
||||
input.close();
|
||||
}
|
||||
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
input.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,19 +10,21 @@ import java.nio.file.Path;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import edu.wpi.first.wpilibj2.command.CommandBase;
|
||||
import frc4388.utility.RobotTime;
|
||||
import frc4388.utility.controller.DeadbandedXboxController;
|
||||
|
||||
public class JoystickRecorder extends CommandBase {
|
||||
|
||||
DeadbandedXboxController joystick;
|
||||
Supplier<DeadbandedXboxController> joystickSupplier;
|
||||
|
||||
int numEntries = 0;
|
||||
|
||||
RobotTime time;
|
||||
|
||||
/** Creates a new JoystickRecorder. */
|
||||
public JoystickRecorder(Supplier<DeadbandedXboxController> joystickSupplier) {
|
||||
// Use addRequirements() here to declare subsystem dependencies.
|
||||
this.joystickSupplier = joystickSupplier;
|
||||
time = RobotTime.getInstance();
|
||||
}
|
||||
|
||||
// Called when the command is initially scheduled.
|
||||
@@ -40,8 +42,7 @@ public class JoystickRecorder extends CommandBase {
|
||||
double rightY = joystick.getRightY();
|
||||
|
||||
try {
|
||||
Files.writeString(Path.of("JoystickInputs.txt"), "leftX: " + leftX + ", " + "leftY: " + leftY + ", " + "rightX: " + rightX + ", " + "rightY: " + rightY);
|
||||
numEntries = numEntries + 1;
|
||||
Files.writeString(Path.of("JoystickInputs.txt"), "Time: " + time.m_robotTime + ", leftX: " + leftX + ", " + "leftY: " + leftY + ", " + "rightX: " + rightX + ", " + "rightY: " + rightY + "\n");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -54,6 +55,6 @@ public class JoystickRecorder extends CommandBase {
|
||||
// Returns true when the command should end.
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return numEntries > 10;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user