<commit_before>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.OI;
import edu.wpi.first.wpilibj.templates.subsystems.ForkLift;
/**
 *
 * @author en
 */
public class FireAndWait extends CommandBase {
    public static final float MOTOR_SPEED_DOWN = .5f;
    public static final float MOTOR_SPEED_UP = -1.0f;
    private final int DOWN_MODE = 1;
    private final int WAIT_MODE = 2;
    private final int UP_MODE = 3;
    private final int NULL_MODE = 0;
    private int mode;
    
    public FireAndWait() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        mode = DOWN_MODE;
        OI.forkLift.setMode(ForkLift.AUTOMATIC);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        switch(mode){
            case DOWN_MODE:
            
                if(OI.forkLift.atLowerStop()){
                    OI.forkLift.forkLiftStop();
                    mode = WAIT_MODE;
                } else {
                    OI.forkLift.lowerForkLift(MOTOR_SPEED_DOWN);
                }
                    
            
            break;
            case WAIT_MODE:
                
                 if(OI.forkLift.hitByBall())
                   mode = UP_MODE;
                
        
            break;
            case UP_MODE:
                if(OI.forkLift.atUpperStop())
                {
                    OI.forkLift.forkLiftStop();
                    mode = NULL_MODE;
                    OI.forkLift.setMode(ForkLift.MANUAL);
                    
                    
                }
                else {
                    OI.forkLift.liftBall(MOTOR_SPEED_UP);
                }
                break;
                    
                
        }
    }
    // 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() {
    }
}<commit_msg>Fork Lift commands editted<commit_after>/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.templates.OI;
import edu.wpi.first.wpilibj.templates.subsystems.ForkLift;
/**
 *
 * @author en
 */
public class FireAndWait extends CommandBase {
    public static final float MOTOR_SPEED_DOWN = .5f;
    public static final float MOTOR_SPEED_UP = -1.0f;
    private final int DOWN_MODE = 1;
    private final int WAIT_MODE = 2;
    private final int UP_MODE = 3;
    private final int NULL_MODE = 0;
    private int mode;
    
    public FireAndWait() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        mode = DOWN_MODE;
        OI.forkLift.setMode(ForkLift.AUTOMATIC);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        switch(mode){
            case DOWN_MODE:
            
                if(OI.forkLift.atLowerStop()){
                    OI.forkLift.forkLiftStop();
                    mode = WAIT_MODE;
                } else {
                    OI.forkLift.lowerForkLift(MOTOR_SPEED_DOWN);
                }
                    
            
            break;
            case WAIT_MODE:
                
                 if(OI.forkLift.hitByBall())
                   mode = UP_MODE;
                
        
            break;
            case UP_MODE:
                if(OI.forkLift.atUpperStop())
                {
                    OI.forkLift.forkLiftStop();
                    mode = NULL_MODE;
                    OI.forkLift.setMode(ForkLift.MANUAL);
                    
                    
                }
                else {
                    OI.forkLift.liftBall(MOTOR_SPEED_UP);
                }
                break;
                    
                
        }
    }
    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        if(mode==NULL_MODE)
            return true;
        if(OI.forkLift.getMode()==ForkLift.MANUAL)
            return true;
        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() {
    }
}
{'fraction_non_alphanumeric': 0.07619622034579815, 'fraction_numerical': 0.0028146361077603537, 'mean_word_length': 1.4138767588549248, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4891478', 'n_tokens_mistral': 1467, 'n_tokens_neox': 1352, 'n_words': 357}