/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.afs.commands;

import edu.afs.subsystems.drivesubsystem.*;
/**
 *
 * @author User
 */
public class DriveWithJoystickCommand extends CommandBase {
    
    
    public DriveWithJoystickCommand() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(drive); // reserve the chassis subsystem
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        drive.driveWithJoystick();
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return false;
    }

    // Called once after isFinished returns true
    protected void end() {
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    }
}

@@ -1,10 +1,11 @@
 /*
+%0D
 %0A * To c
@@ -76,16 +76,17 @@
 perties.
+%0D
 %0A * To c
@@ -135,16 +135,17 @@
 emplates
+%0D
 %0A * and 
@@ -176,20 +176,22 @@
  editor.
+%0D
 %0A */
+%0D
 %0Apackage
@@ -208,17 +208,19 @@
 ommands;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -259,15 +259,113 @@
 m.*;
+%0D%0Aimport edu.afs.subsystems.autoranger.*;%0D%0Aimport edu.afs.commands.AutoDriveToShotRangeCommand;%0D
 %0A/**
+%0D
 %0A *
+%0D
 %0A * 
@@ -376,20 +376,22 @@
 hor User
+%0D
 %0A */
+%0D
 %0Apublic 
@@ -442,26 +442,155 @@
 ndBase %7B
+%0D
 %0A    
+%0D
 %0A    
+private static double RANGE_TOLERANCE = 12.0;  // In inches.%0D%0A    RangeBeacon m_rangeBeacon;%0D%0A    double m_desiredRange;%0D%0A    %0D
 %0A    pub
@@ -617,24 +617,25 @@
 kCommand() %7B
+%0D
 %0A        // 
@@ -687,16 +687,17 @@
 ndencies
+%0D
 %0A       
@@ -722,16 +722,17 @@
 hassis);
+%0D
 %0A       
@@ -781,23 +781,151 @@
 ubsystem
+%0D%0A        m_rangeBeacon = RangeBeacon.getInstance();%0D%0A        m_desiredRange = AutoDriveToShotRangeCommand.GetDesiredRange();%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    // 
@@ -975,16 +975,17 @@
 rst time
+%0D
 %0A    pro
@@ -1006,24 +1006,25 @@
 itialize() %7B
+%0D
 %0A        %0A  
@@ -1020,23 +1020,26 @@
         
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    // 
@@ -1085,32 +1085,33 @@
 scheduled to run
+%0D
 %0A    protected v
@@ -1121,24 +1121,417 @@
  execute() %7B
+%0D%0A        // Check the range to target.%0D%0A        double range = autoRanger.GetRange();%0D%0A        double absError = Math.abs(m_desiredRange - range);%0D%0A        if(absError %3C= RANGE_TOLERANCE)%7B%0D%0A            // At shooting range - set beaon indicator.%0D%0A            m_rangeBeacon.SetAtShotRangeIndicator(true);%0D%0A        %7D else %7B%0D%0A            m_rangeBeacon.SetAtShotRangeIndicator(false);%0D%0A        %7D%0D
 %0A        dri
@@ -1553,23 +1553,26 @@
 stick();
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    // 
@@ -1643,16 +1643,17 @@
 xecute()
+%0D
 %0A    pro
@@ -1677,24 +1677,25 @@
 Finished() %7B
+%0D
 %0A        ret
@@ -1704,23 +1704,26 @@
 n false;
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    // 
@@ -1763,16 +1763,17 @@
 rns true
+%0D
 %0A    pro
@@ -1791,23 +1791,26 @@
  end() %7B
+%0D
 %0A    %7D
-%0A
+%0D%0A%0D
 %0A    // 
@@ -1875,16 +1875,17 @@
 the same
+%0D
 %0A    // 
@@ -1914,16 +1914,17 @@
 d to run
+%0D
 %0A    pro
@@ -1954,13 +1954,16 @@
 () %7B
+%0D
 %0A    %7D
+%0D
 %0A%7D
+%0D
 %0A

Add shot range indication while driving manually.