From: niyatisriram Date: Sat, 28 Jan 2017 04:50:17 +0000 (-0800) Subject: initialize variables and calculate error X-Git-Url: http://challenge-bot.com/repos/?a=commitdiff_plain;h=a395f6a8f395a1a618fa4fe21a53929d5730cd60;p=3501%2F2017steamworks initialize variables and calculate error --- 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 index 0000000..3712401 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/SlaveWheel.java @@ -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? + +}