URGENT: Command-Based Program Not Working

Hello everyone, a teammate and I (who didnt learn any sort of programming until the beginning of build season, and are extremely inexperienced) had our command-based program working fine. We had pistons opening/closing, a CAN Network working well and running several motors, and basically had our robot working fine. However, after seemingly no code changes… we can no longer get any commands to run no matter what. We’ve tried everything and we are getting no errors… but commands wont run when we enable our bot. We ran a separate project that was command-based and it worked fine (it just ran a relay). However, I believe we are doing everything the same so it isn’t making much sense. We looked through all of the initialization, as I assume that must be the issue but I can’t find anything. Posted below is our robot.java, oi, and one basic subsystem and command.

public class Robot extends IterativeRobot {

    Command autonomousCommand,intakeRun;

    public static OI oi;
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS
    public static final DriveTrain driveTrain = new DriveTrain();
    public static final Intake intake = new Intake();
    public static final IntakePiston intakePiston = new IntakePiston();
    public static final Shooter shooter = new Shooter();
    public static final Aimer aimer = new Aimer();

    
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=DECLARATIONS

    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
          // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
        oi = new OI(); 
    }

    /**
     * This function is called when the disabled button is hit.
     * You can use it to reset subsystems before shutting down.
     */
    public void disabledInit(){

    }

    public void disabledPeriodic() {
        Scheduler.getInstance().run();
    }

    public void autonomousInit() {
        // schedule the autonomous command (example)
        if (autonomousCommand != null) autonomousCommand.start();
    }

    /**
     * This function is called periodically during autonomous
     */
    public void autonomousPeriodic() {
        Scheduler.getInstance().run();
    }

    public void teleopInit() {
    	aimer.setDefault();
        // This makes sure that the autonomous stops running when
        // teleop starts running. If you want the autonomous to
        // continue until interrupted by another command, remove
        // this line or comment it out.
        if (autonomousCommand != null) autonomousCommand.cancel();
    }

    /**
     * This function is called periodically during operator control
     */
    public void teleopPeriodic() {
    	Scheduler.getInstance().run();
    }

    /**
     * This function is called periodically during test mode
     */
    
   
    public void testPeriodic() {
        LiveWindow.run();
    }
}

package org.usfirst.frc4203.Stronghold;

import org.usfirst.frc4203.Stronghold.commands.*;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.buttons.JoystickButton;

/**
 * This class is the glue that binds the controls on the physical operator
 * interface to the commands and command groups that allow control of the robot.
 */
public class OI {
	
	
    //Controllers
	private Joystick driveStick;
	public static Joystick xboxController;
	
	//Buttons
	public static JoystickButton intakeOnButton;
	public static JoystickButton lowGoalButton;
	public JoystickButton gyroResetButton;
	public static JoystickButton intakePositionButton;
	public static JoystickButton aimPositionButton;
	public static JoystickButton shootButton;
	public static JoystickButton loadButton;
	public static JoystickButton setPrecisionDrive;
	public static JoystickButton cancelPrecisionDrive;
	public static JoystickButton raiseIntakeButton;
	public static JoystickButton lowerIntakeButton; 
	public static JoystickButton fireButton;
   
	
	
    	public OI() {
			driveStick = new Joystick(1);
	    	xboxController = new Joystick(2);
	    	lowerIntakeButton = new JoystickButton(xboxController,RobotMap.L3);
	    	raiseIntakeButton = new JoystickButton(xboxController,RobotMap.R3);
	    	lowGoalButton = new JoystickButton(xboxController,RobotMap.A);
	    	//intakeOnButton = new JoystickButton(xboxController,RobotMap.X);
	    	loadButton = new JoystickButton(xboxController,RobotMap.B);
	    	shootButton = new JoystickButton(xboxController,RobotMap.Y);
	    	setPrecisionDrive = new JoystickButton(xboxController, RobotMap.LB);
	    	cancelPrecisionDrive = new JoystickButton(xboxController, RobotMap.RB); 
    		//fireButton.whenPressed(new Fire());
      		//loadButton.whenPressed(new LoadShooter());
      		//intakeOnButton.whenPressed(new IntakeRun());
	    	//Buttons
    	}
    	
	
		
	
	public Joystick getDriveStick(){
		return driveStick;
	}
    public Joystick getXboxController(){
    	return xboxController;
    }
}

package org.usfirst.frc4203.Stronghold.subsystems;

import org.usfirst.frc4203.Stronghold.RobotMap;
import org.usfirst.frc4203.Stronghold.commands.IntakeRun;

import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.buttons.JoystickButton;
import edu.wpi.first.wpilibj.command.Subsystem;


/**
 *
 */
public class Intake extends Subsystem {
	

    private final Relay motor = new Relay(RobotMap.intakeIntakeMotor);

    
    public void intakeToggleRun(JoystickButton button){
    	
    	if(button.get()==true){
    		
    		motor.set(Relay.Value.kForward);
    	
    	}
    	
    	else if(button.get()==false){
    		
    		motor.set(Relay.Value.kOff);
    		
    	}
    	
    }
    
    public void intake(){
    	
    	motor.set(Relay.Value.kForward);
    	
    }
    
    public void release(){
    	motor.set(Relay.Value.kReverse);
    }
    
    public void stop(){
    	
    	motor.set(Relay.Value.kOff);
    	
    }

	protected void initDefaultCommand() {
		setDefaultCommand(new IntakeRun());
	}

    
}

package org.usfirst.frc4203.Stronghold.commands;

import org.usfirst.frc4203.Stronghold.OI;
import org.usfirst.frc4203.Stronghold.Robot;
import org.usfirst.frc4203.Stronghold.RobotMap;

import edu.wpi.first.wpilibj.command.Command;

/**
 *
 */
public class IntakeRun extends Command {

    public IntakeRun() {
    	requires(Robot.intake);
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
    }

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

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
    	Robot.intake.release();
    	/*if(OI.xboxController.getRawButton(RobotMap.X)){
    	Robot.intake.intake();
    	}
    	
    	if(OI.xboxController.getRawButton(RobotMap.A)){
    		Robot.intake.release();
    	}
    	*/
    }

    // 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() {
    }
}

well… yeah… you commented out your actions code.


	
    	public OI() {
	...
    		//fireButton.whenPressed(new Fire());
      		//loadButton.whenPressed(new LoadShooter());
      		//intakeOnButton.whenPressed(new IntakeRun());
	    	//Buttons
    	}

Right well we commented that our as the buttons did nothing… so we attempted to use the setDefaultCommand in the intake subsystem but that didn’t work either

*Just re-load the last known working version of your code into the robot.

If it works, you made a code change which broke the software.

Just do a file-by-file comparison to identify the changes you made, then start adding the changes back in one at a time until the code breaks again.