summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/usfirst/frc/team4272/robot2015/Autonomous.java9
-rw-r--r--src/org/usfirst/frc/team4272/robot2015/Robot.java30
-rw-r--r--src/org/usfirst/frc/team4272/robot2015/Teleop.java2
3 files changed, 32 insertions, 9 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2015/Autonomous.java b/src/org/usfirst/frc/team4272/robot2015/Autonomous.java
index 5d48588..162d00b 100644
--- a/src/org/usfirst/frc/team4272/robot2015/Autonomous.java
+++ b/src/org/usfirst/frc/team4272/robot2015/Autonomous.java
@@ -15,8 +15,13 @@ public class Autonomous {
}
public Control run(Control c) {
- if (robot.rDriveE.getDistance() < (15.5*140*1.1)) {
- c.rDrive = c.lDrive = -0.7;
+ if (robot.rDriveE.getDistance() > -(15.5*140*1.15)) {
+ c.rDrive = c.lDrive = 0.7;
+ //initially -0.7 to drive backwards
+ //0 to 9787 for going backwards
+ //0 to negative for forward
+ //INDY: (15.5*140*1.1)
+ //PURDUE: (15.5*140*1.15) for a drop further
} else {
c.rDrive = c.lDrive = 0;
}
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() {
diff --git a/src/org/usfirst/frc/team4272/robot2015/Teleop.java b/src/org/usfirst/frc/team4272/robot2015/Teleop.java
index 058589a..85b071b 100644
--- a/src/org/usfirst/frc/team4272/robot2015/Teleop.java
+++ b/src/org/usfirst/frc/team4272/robot2015/Teleop.java
@@ -27,7 +27,7 @@ public class Teleop {
control.lDrive = jsScale(oi.lStick);
control.rDrive = jsScale(oi.rStick);
/* Winch */
- control.winch = oi.xbox.getAxis(Axis.LY);/* up is neg, down is pos */
+ control.winch = oi.xbox.getAxis(Axis.LY ) * -1;/* up is neg, down is pos */
if (Math.abs(control.winch) < 0.1) { control.winch = 0; }
/* left intake */