View Single Post
  #9   Spotlight this post!  
Unread 17-11-2015, 11:07
origamitaco origamitaco is offline
Registered User
FRC #4328
 
Join Date: Nov 2015
Location: Richmond, TX
Posts: 35
origamitaco is an unknown quantity at this point
Re: Commands Stop Everything

Here's the OI
Code:
// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.


package org.usfirst.frc4328.Judy;

import org.usfirst.frc4328.Judy.commands.*;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.buttons.*;


/**
 * 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 {
    //// CREATING BUTTONS
    // One type of button is a joystick button which is any button on a joystick.
    // You create one by telling it which joystick it's on and which button
    // number it is.
    // Joystick stick = new Joystick(port);
    // Button button = new JoystickButton(stick, buttonNumber);
    
    // There are a few additional built in buttons you can use. Additionally,
    // by subclassing Button you can create custom triggers and bind those to
    // commands the same as any other Button.
    
    //// TRIGGERING COMMANDS WITH BUTTONS
    // Once you have a button, it's trivial to bind it to a button in one of
    // three ways:
    
    // Start the command when the button is pressed and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenPressed(new ExampleCommand());
    
    // Run the command while the button is being held down and interrupt it once
    // the button is released.
    // button.whileHeld(new ExampleCommand());
    
    // Start the command when the button is released  and let it run the command
    // until it is finished as determined by it's isFinished method.
    // button.whenReleased(new ExampleCommand());

    
    
	
	//Initialize inputs
	public JoystickButton trigger;
    public JoystickButton joystickButton2;
    public JoystickButton joystickButton11;
    public JoystickButton joystickButton12;
    public Joystick joystick1;
    public Joystick joystick2;
    
    
    
    public OI() {
    	
    	//Make joystick objects
    	joystick1 = new Joystick(0);
        joystick2 = new Joystick(1);
        
        
        //Make button and trigger objects
        joystickButton2 = new JoystickButton(joystick1, 7);
        joystickButton12 = new JoystickButton(joystick1, 12);
        joystickButton11 = new JoystickButton(joystick1, 11);
        trigger = new JoystickButton(joystick1, 1);
        
        //Assign command to the buttons
        trigger.whileHeld(new Strafe());
        joystickButton2.whileHeld(new recalibrategyro());
        joystickButton11.whileHeld(new LiftBox());     
        joystickButton12.whileHeld(new LowerBox());
        

	    
        // SmartDashboard Buttons
        SmartDashboard.putData("Autonomous Command", new AutonomousCommand());

        SmartDashboard.putData("Recalibrate Gyroscope", new recalibrategyro());

        
    }
    
   
    
    public Joystick getJoystick1() {
        return joystick1;
  }

    public Joystick getJoystick2() {
        return joystick2;
    }
}
Reply With Quote