@@ -0,0 +1,1491 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage org.tamankeet3933.java2014.commands.raw;%0A%0Aimport org.tamankeet3933.java2014.commands.CommandBase;%0A%0A/**%0A * %0A * This class drives the robot to the optimal fire position%0A * based on the distance obtained from the ultrasonic sensor.%0A * @author David Dominguez Moises%0A * @version 1.0%0A */%0Apublic class MoveToFirePos extends CommandBase %7B%0A    %0A    // Constant that defines the optimal fire position.%0A    public static final double DISTANCE_TO_FIRE  = 20;%0A    %0A    // Used to stop this program.%0A    boolean stopDriving = false;%0A    %0A    public MoveToFirePos() %7B%0A        requires(driveSystem);%0A    %7D%0A%0A    // Sets the speed of the chasis wheels to 0.5 .%0A    protected void initialize() %7B%0A        driveSystem.drive(.5, 0);%0A    %7D%0A%0A    /* Ends the program when the robot is in the desired position,%0A       with an error range of 1.  */%0A    protected void execute() %7B%0A        if (driveSystem.getUltrasonic() %3C= DISTANCE_TO_FIRE + 1 %7C%7C driveSystem.getUltrasonic() %3E= DISTANCE_TO_FIRE - 1)%0A%09%7B%0A            stopDriving = true;%0A%09%7D%0A    %7D%0A%0A    protected boolean isFinished() %7B%0A        return stopDriving;%0A    %7D%0A%0A    // Stops the robot.%0A    protected void end() %7B%0A        driveSystem.drive(0, 0);%0A        stopDriving = false;%0A    %7D%0A%0A    // Calls the end method.%0A    protected void interrupted() %7B%0A        end();%0A    %7D%0A%7D%0A

Move to fire position.