/*
 * 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 org.tamankeet3933.java2014.commands.raw;

import org.tamankeet3933.java2014.commands.CommandBase;

/**
 *
 * @author david
 */
public class MoveCollector extends CommandBase {
    
    int position;
    double finalPosition;
    boolean stop = false;
    public final double ERROR = 0.01;
    
    public MoveCollector(int position) {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        this.position = position;
        requires(collectorSystem);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        collectorSystem.armPickup(0.4);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
         switch (position)
         {
            case 1:
                finalPosition = collectorSystem.RETRACT;
                break;
            case 2:
                finalPosition = collectorSystem.STORAGE;
                break;
            case 3:
                finalPosition = collectorSystem.EXTEND;
                break;
         }
        
         collectorSystem.setBar(finalPosition, ERROR);
         stop = true;
    }

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

    // Called once after isFinished returns true
    protected void end() {
        collectorSystem.armPickup(0.0);
        stop = false;
    }

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

@@ -291,16 +291,144 @@
 %0A%0A/**%0A *
+ %0A * This class moves the arm pick up system and the collector arm to three %0A * different positions according to the user input.
 %0A * @aut
@@ -435,13 +435,46 @@
 hor 
-d
+D
 avid
+ Dominguez Moises%0A * @version 1.0
 %0A */
@@ -536,256 +536,410 @@
     
-int position;%0A    double finalPosition;%0A    boolean stop = false;%0A    public final double ERROR = 0.01;%0A    %0A    public MoveCollector(int position) %7B%0A        // Use requires() here to declare subsystem dependencies%0A        // eg. requires(chassis);
+// Stores the user input.%0A    int position;%0A    %0A    // Stores the desired position for the collector arm.%0A    double finalPosition;%0A    %0A    // Used to stop the program.%0A    boolean stop = false;%0A    %0A    // Range of error for the position of the collector arm.%0A    public final double ERROR = 0.01;%0A    %0A    // Stores the user input in the variable position.%0A    public MoveCollector(int position) %7B%0A
 %0A   
@@ -1022,59 +1022,57 @@
  // 
-Called just before this Command runs the first time
+Sets the speed of the arm pick up system to 0.4 .
 %0A   
@@ -1158,65 +1158,200 @@
    /
-/ Called repeatedly when this Command is scheduled to run
+*%0A       Analises the variable position and stores the correspondant position %0A       constant to the variable finalPosition and calls the method setBar with the variable finalPosition.%0A    */
 %0A   
@@ -1830,24 +1830,15 @@
  // 
-Make this r
+R
 eturn
+s
  tru
@@ -1850,51 +1850,30 @@
 n th
-is Command no longer needs to run execute()
+e execute method ends.
 %0A   
@@ -1945,49 +1945,37 @@
  // 
-Called once after isFinished returns true
+Stops the arm pick up system.
 %0A   
@@ -2082,108 +2082,25 @@
 Call
-ed when another command which requires one or more of the same%0A    // subsystems is scheduled to run
+s the end method.
 %0A   

Move collector command.