package storm2014.commands;

import edu.wpi.first.wpilibj.command.Command;
import storm2014.Robot;
/**
 *Drives the robot forward by a certain distance and speed
 */
public class DriveForward extends Command {
    final double _speed;
    final double _distance;

    public DriveForward(double speed, double distance) {
        requires(Robot.driveTrain);
        _speed = speed;
        _distance = distance;
    }

    protected void initialize() {
        Robot.driveTrain.clearEncoders();
    }

    protected void execute() {
        Robot.driveTrain.tankDrive(_speed*0.95, _speed);
    }

    protected boolean isFinished() {
        double left  = Robot.driveTrain.getLeftDistance(),
               right = Robot.driveTrain.getRightDistance();
        double distance = Math.abs(left) > Math.abs(right) ? left :
                                                             right;
        return (_speed >= 0 && distance >= _distance)
            || (_speed < 0  && distance <= -_distance);
    }

    protected void end() {
        Robot.driveTrain.tankDrive(0, 0);
    }

    protected void interrupted() {
        end();
    }
}

@@ -68,16 +68,76 @@
 ommand;%0A
+import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;%0A
 import s
@@ -152,16 +152,16 @@
 .Robot;%0A
-
 /**%0A *Dr
@@ -263,16 +263,146 @@
 mmand %7B%0A
+    private static final double P_GAIN = 0;%0A    static %7B%0A        SmartDashboard.putNumber(%22Encoder feedback gain%22, P_GAIN);%0A    %7D%0A
     fina
@@ -727,54 +727,767 @@
     
-Robot.driveTrain.tankDrive(_speed*0.95, _speed
+double gain = SmartDashboard.getNumber(%22Encoder feedback gain%22,P_GAIN);%0A        double err = Robot.driveTrain.getRightDistance()-Robot.driveTrain.getLeftDistance();%0A        double diff = err*gain;%0A        double left  = _speed + diff/2,%0A               right = _speed - diff/2;%0A        if(right %3C -1) %7B%0A            left -= (right+1);%0A            right = -1;%0A        %7D else if(right %3E 1) %7B%0A            left -= (right-1);%0A            right = 1;%0A        %7D%0A        if(left %3C -1) %7B%0A            right -= (left+1);%0A            left = -1;%0A        %7D else if(left %3E 1) %7B%0A            right -= (left-1);%0A            left = 1;%0A        %7D%0A        Robot.driveTrain.tankDrive(Math.max(-1, Math.min(1, left )),%0A                                   Math.max(-1, Math.min(1, right))
 );%0A 

Add proportional feedback control to DriveForward