diff options
Diffstat (limited to 'src/org/usfirst/frc/team4272/robot2015/Robot.java')
-rw-r--r-- | src/org/usfirst/frc/team4272/robot2015/Robot.java | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2015/Robot.java b/src/org/usfirst/frc/team4272/robot2015/Robot.java index 454f226..dd7e940 100644 --- a/src/org/usfirst/frc/team4272/robot2015/Robot.java +++ b/src/org/usfirst/frc/team4272/robot2015/Robot.java @@ -7,6 +7,7 @@ import edu.wpi.first.wpilibj.IterativeRobot; import edu.wpi.first.wpilibj.Relay; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import java.util.Date; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; @@ -37,21 +38,28 @@ public class Robot extends IterativeRobot { } private void inLog() throws IOException { - log = new PrintWriter(new FileWriter("/usr/local/frc/share/lukeshu.log", true)); + log = new PrintWriter(new FileWriter("/home/lvuser/tweeterbot/var/data.log", true)); log.println("\ntime" - +",ds:alliance,ds:voltage,ds:FMStime" + +",ds:FMS,ds:alliance,ds:voltage,ds:FMStime" +",c:lDrive,c:rDrive,c:winch,c:lIntake,c:rIntake,c:grab,c:push" +",i:lDrive.dist,i:lDrive.rate" +",i:rDrive.dist,i:rDrive.rate" +",i:winch.dist"); } + private void doLogOnce(String tag) throws Exception { + log.println(new Date() + +","+ds.isFMSAttached() + +","+tag); + } + private void doLog() throws Exception { SmartDashboard.putNumber("dist", robot.rDriveE.getDistance()); SmartDashboard.putNumber("raw", robot.rDriveE.getRaw()); if (!ds.isFMSAttached()) return; - log.println(0 + log.println(new Date() + +","+ds.isFMSAttached() +","+ds.getAlliance() +","+ds.getBatteryVoltage() +","+ds.getMatchTime() @@ -85,7 +93,10 @@ public class Robot extends IterativeRobot { } public void autonomousInit() { - auto = new Autonomous(robot); + try { + auto = new Autonomous(robot); + doLogOnce("autonomous"); + } catch (Exception e) {} } public void autonomousPeriodic() { try { @@ -95,8 +106,11 @@ public class Robot extends IterativeRobot { } public void teleopInit() { - robot.rDriveE.reset(); - teleop = new Teleop(); + try { + robot.rDriveE.reset(); + teleop = new Teleop(); + doLogOnce("teleop"); + } catch (Exception e) {} } public void teleopPeriodic() { @@ -107,6 +121,10 @@ public class Robot extends IterativeRobot { } public void disabledInit() { + try { + doLogOnce("disabled"); + log.flush(); + } catch (Exception e) {} } public void disabledPeriodic() { |