initialize variables and calculate error n/SlaveWheel
authorniyatisriram <niyatisriram@gmail.com>
Sat, 28 Jan 2017 04:50:17 +0000 (20:50 -0800)
committerniyatisriram <niyatisriram@gmail.com>
Sat, 28 Jan 2017 04:50:17 +0000 (20:50 -0800)
src/org/usfirst/frc/team3501/robot/commands/driving/SlaveWheel.java [new file with mode: 0644]

diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/SlaveWheel.java b/src/org/usfirst/frc/team3501/robot/commands/driving/SlaveWheel.java
new file mode 100644 (file)
index 0000000..3712401
--- /dev/null
@@ -0,0 +1,26 @@
+package org.usfirst.frc.team3501.robot.commands.driving;
+
+import org.usfirst.frc.team3501.robot.Robot;
+
+public class SlaveWheel {
+
+  // Left motor and wheel(s) are Master, right motor and wheel(s) are slave
+
+  double masterVal = Robot.getDriveTrain().getLeftSpeed();
+  double slaveVal = Robot.getDriveTrain().getRightSpeed();
+
+  double distL, distR;
+
+  double error = 0;
+  double k = 0.1;
+
+  public double calculateError() {
+    distL = Robot.getDriveTrain().getLeftEncoderDistance();
+    distR = Robot.getDriveTrain().getRightEncoderDistance();
+    error = distL - distR;
+    return error;
+  }
+
+  // repeat every 20 milliseconds?
+
+}