summaryrefslogtreecommitdiff
path: root/src/org/usfirst/frc/team4272/robot2015/Robot.java
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-01-16 11:24:32 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-01-16 11:24:32 -0500
commitb655dbdba8532f31b13b410f2dfedbbb3775dba3 (patch)
treec8e1b72d1bf2ad54b93b04a8cf47ca3079acbad8 /src/org/usfirst/frc/team4272/robot2015/Robot.java
parent7080d2167ae2447ef18f3ba15d2bc39a880b4dc8 (diff)
The last commit was corrupted; this is it re-createdHEADmaster
Diffstat (limited to 'src/org/usfirst/frc/team4272/robot2015/Robot.java')
-rw-r--r--src/org/usfirst/frc/team4272/robot2015/Robot.java30
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() {