当前位置: 首页>>代码示例>>Java>>正文


Java JoystickButton类代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.buttons.JoystickButton的典型用法代码示例。如果您正苦于以下问题:Java JoystickButton类的具体用法?Java JoystickButton怎么用?Java JoystickButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JoystickButton类属于edu.wpi.first.wpilibj.buttons包,在下文中一共展示了JoystickButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public OI() {

		driveStick = new Joystick(RobotMap.DRIVE_STICK_NUMBER);
		driveButtons = new JoystickButton[13];

		auxiliaryStick = new Joystick(RobotMap.AUXILLIARY_STICK_NUMBER);
		auxiliaryButtons = new JoystickButton[13];
		
		for(int i = 1; i <= driveButtons.length - 1; i++) {
			driveButtons[i] = new JoystickButton(driveStick, i);
		}
		
		for(int i=1; i <= auxiliaryButtons.length - 1; i++){
			auxiliaryButtons[i] = new JoystickButton(auxiliaryStick, i);
		}

		//this.getButton(RobotMap.SHOOTER_CONTROL_BUTTON).whileHeld(new ShooterControl());
		this.getButton(2).whenPressed(new openIntake());
		this.getButton(3).whenPressed(new closeIntake());
		this.getButton(4).toggleWhenPressed(new IntakeIn());
		this.getButton(5).toggleWhenPressed(new IntakeOut());
		this.getButton(5).toggleWhenPressed(new stopIntake());
		this.getButton(4).whenPressed(new driveForward(20, .25));
		
	}
 
开发者ID:2141-Spartonics,项目名称:Spartonics-Code,代码行数:26,代码来源:OI.java

示例2: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public OI(){
	JoystickButton x = new JoystickButton(controller, 3);
	JoystickButton y = new JoystickButton(controller, 4);
	JoystickButton a = new JoystickButton(controller, 1);
	JoystickButton b = new JoystickButton(controller, 2);
	JoystickButton rb = new JoystickButton(controller, 6);
	JoystickButton lb = new JoystickButton(controller, 5);
	JoystickButton start = new JoystickButton(controller, 8);
	JoystickButton back = new JoystickButton(controller,7);

	a.whileHeld(new PickupOn());
	b.whileHeld(new PickupReverse());
	y.whileHeld(new OpenGDS(5));
	x.whileHeld(new Climb());
	rb.whileHeld(new SpinVoltage(0.80, false));
	start.toggleWhenPressed(new ResetWinch());
	lb.whileHeld(new InvertedStickDrive());
}
 
开发者ID:mr-glt,项目名称:FRC-2017-Command,代码行数:19,代码来源:OI.java

示例3: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

    logitech = new Joystick(0);
    
    shooterbutton = new JoystickButton(logitech, 1);
    shooterbutton.whileHeld(new shoot());


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

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    shootBackwardsButton = new JoystickButton(logitech, 2);
    shootBackwardsButton.whileHeld(new ShootReverse());

    LiftUPButton = new JoystickButton(logitech, 3);
    LiftReservseButton = new JoystickButton(logitech, 4);

    LiftUPButton.whileHeld(new LiftUP());
    LiftReservseButton.whileHeld(new LiftReverse());
}
 
开发者ID:Team2667,项目名称:SteamWorks,代码行数:24,代码来源:OI.java

示例4: Controller

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public Controller(int port) {

        // Controller
        joystick = new Joystick(port);

        // Buttons
        buttonA = new JoystickButton(joystick, Mappings.BUTTON_A);
        buttonB = new JoystickButton(joystick, Mappings.BUTTON_B);
        buttonX = new JoystickButton(joystick, Mappings.BUTTON_X);
        buttonY = new JoystickButton(joystick, Mappings.BUTTON_Y);
        buttonLeftBumper = new JoystickButton(joystick, Mappings.BUTTON_LEFTBUMPER);
        buttonRightBumper = new JoystickButton(joystick, Mappings.BUTTON_RIGHTBUMPER);

        // Axes
        axisLeftX = new JoystickAxis(joystick, Mappings.AXIS_LEFT_X, AXIS_THRESHOLD);
        axisLeftY = new JoystickAxis(joystick, Mappings.AXIS_LEFT_Y, AXIS_THRESHOLD);
        axisRightX = new JoystickAxis(joystick, Mappings.AXIS_RIGHT_X, AXIS_THRESHOLD);
        axisRightY = new JoystickAxis(joystick, Mappings.AXIS_RIGHT_Y, AXIS_THRESHOLD);
        axisLeftTrigger = new JoystickAxis(joystick, Mappings.AXIS_LEFT_TRIGGER, AXIS_THRESHOLD);
        axisRightTrigger = new JoystickAxis(joystick, Mappings.AXIS_RIGHT_TRIGGER, AXIS_THRESHOLD);
    }
 
开发者ID:vyrotek,项目名称:frc-robot,代码行数:22,代码来源:Controller.java

示例5: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public OI(){
	joystick = new Joystick(0);
	jyButton1 = new JoystickButton(joystick, 1);
    
	xbox = new Joystick(1);
	xbButton1 = new JoystickButton(xbox, 1);
	xbButton2 = new JoystickButton(xbox, 2);
	xbButton3 = new JoystickButton(xbox, 3);
	xbButton4 = new JoystickButton(xbox, 4);
	xbButton5 = new JoystickButton(xbox, 5);
	xbButton6 = new JoystickButton(xbox, 6);

	
    jyButton1.whileHeld(new FineControl());
    
    xbButton1.whileHeld(new Shoot());
    xbButton2.toggleWhenPressed(new IntakeToggle());
    xbButton3.toggleWhenPressed(new ToggleShooter());
    xbButton4.whenPressed(new ClawSet());
    xbButton5.whenPressed(new GripControl(0));
    xbButton6.whenPressed(new GripControl(1));
    
}
 
开发者ID:Team395,项目名称:El-Jefe-2017,代码行数:24,代码来源:OI.java

示例6: XboxController

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
/**
 * @param port of the controller.
 */
public XboxController(int port) {
	super(port);
	a = new JoystickButton(this, 1);
	b = new JoystickButton(this, 2);
	x = new JoystickButton(this, 3);
	y = new JoystickButton(this, 4);
	leftBumper = new JoystickButton(this, 5);
	rightBumper = new JoystickButton(this, 6);
	select = new JoystickButton(this, 7);
	start = new JoystickButton(this, 8);
	leftJoystickButton = new JoystickButton(this, 9);
	rightJoystickButton = new JoystickButton(this, 10);
	leftTrigger = new AnalogButton(this, 2, 0.1);
	rightTrigger = new AnalogButton(this, 3, 0.1);
}
 
开发者ID:FRC-Team-3140,项目名称:FRC-2016,代码行数:19,代码来源:XboxController.java

示例7: XboxController

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public XboxController(final int port) {
	super(port); // Extends Joystick...

	/* Initialize */
	this.port = port;
	this.controller = new Joystick(this.port); // Joystick referenced by
												// everything
	this.dPad = new DirectionalPad(this.controller);
	this.lt = new Trigger(this.controller, HAND.LEFT);
	this.rt = new Trigger(this.controller, HAND.RIGHT);
	this.a = new JoystickButton(this.controller, A_BUTTON_ID);
	this.b = new JoystickButton(this.controller, B_BUTTON_ID);
	this.x = new JoystickButton(this.controller, X_BUTTON_ID);
	this.y = new JoystickButton(this.controller, Y_BUTTON_ID);
	this.lb = new JoystickButton(this.controller, LB_BUTTON_ID);
	this.rb = new JoystickButton(this.controller, RB_BUTTON_ID);
	this.back = new JoystickButton(this.controller, BACK_BUTTON_ID);
	this.start = new JoystickButton(this.controller, START_BUTTON_ID);
	this.rightClick = new JoystickButton(this.controller, RIGHT_CLICK_ID);
	this.leftClick = new JoystickButton(this.controller, LEFT_CLICK_ID);
}
 
开发者ID:Team1923,项目名称:Stronghold_2016,代码行数:22,代码来源:XboxController.java

示例8: initButtons

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public void initButtons() {
	//intakeButtonIn = new JoystickButton(secondary, RobotMap.INTAKE_BUTTON_IN);
	//intakeButtonOut = new JoystickButton(secondary, RobotMap.INTAKE_BUTTON_OUT);
	//shooterButtonIn = new JoystickButton(secondary, RobotMap.SHOOTER_BUTTON_IN);
	//shooterButtonOut = new JoystickButton(secondary, RobotMap.SHOOTER_BUTTON_OUT);
	//autoIntakeButton = new JoystickButton(secondary, RobotMap.AUTO_INTAKE_BUTTON);
	//pusherButton = new JoystickButton(secondary, RobotMap.PUSHER_BUTTON);
	//driveIntakeOut = new JoystickButton(secondary, RobotMap.INTAKE_BUTTON_OUT);
	//lockButton = new JoystickButton(secondary, RobotMap.LOCK_BUTTON);
	//autoAimButton = new JoystickButton(secondary, RobotMap.AUTO_AIM_BUTTON);
	//autoShootButton = new JoystickButton(secondary, RobotMap.AUTO_SHOOT_BUTTON);
	//autoIntakeButton = new JoystickButton(secondary, RobotMap.AUTO_INTAKE_BUTTON);
	//autoResetShooterButton = new JoystickButton(secondary, RobotMap.RESET_SHOOTER_BUTTON);
	
	manipulatorUp = new JoystickButton(right, RobotMap.MANIPULATOR_UP_BUTTON);
	manipulatorDown = new JoystickButton(right, RobotMap.MANIPULATOR_DOWN_BUTTON);
	
	spinFrontButton = new JoystickButton(right, RobotMap.SPIN_BUTTON_FRONT);
	spinBackButton = new JoystickButton(right, RobotMap.SPIN_BUTTON_BACK);
	
	tieButtons();
}
 
开发者ID:SouthEugeneRoboticsTeam,项目名称:Stronghold-2016,代码行数:23,代码来源:OI.java

示例9: XboxController

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
/**
 * (Constructor #1)
 * There are two ways to make an XboxController. With this constructor,
 * you can specify which port you expect the controller to be on.
 * @param port
 */
public XboxController(final int port) {
    super(port);  // Extends Joystick...
    
    /* Initialize */
    this.port       = port;
    this.controller = new Joystick(this.port);    // Joystick referenced by everything
    
    this.leftStick  = new Thumbstick    (this.controller, HAND.LEFT);
    this.rightStick = new Thumbstick    (this.controller, HAND.RIGHT);
    this.dPad       = new DirectionalPad(this.controller);
    this.lt         = new Trigger       (this.controller, HAND.LEFT);
    this.rt         = new Trigger       (this.controller, HAND.RIGHT);
    this.a          = new JoystickButton(this.controller, A_BUTTON_ID);
    this.b          = new JoystickButton(this.controller, B_BUTTON_ID);
    this.x          = new JoystickButton(this.controller, X_BUTTON_ID);
    this.y          = new JoystickButton(this.controller, Y_BUTTON_ID);
    this.lb         = new JoystickButton(this.controller, LB_BUTTON_ID);
    this.rb         = new JoystickButton(this.controller, RB_BUTTON_ID);
    this.back       = new JoystickButton(this.controller, BACK_BUTTON_ID);
    this.start      = new JoystickButton(this.controller, START_BUTTON_ID);
}
 
开发者ID:owatonnarobotics,项目名称:XboxController,代码行数:28,代码来源:XboxController.java

示例10: Robot

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public Robot() {	// initialize variables in constructor
	stick = new Joystick(RobotMap.JOYSTICK_PORT); // set the stick to refer to joystick #0
	button = new JoystickButton(stick, RobotMap.BTN_TRIGGER);
	
    myRobot = new RobotDrive(RobotMap.FRONT_LEFT_MOTOR, RobotMap.REAR_LEFT_MOTOR,
    		RobotMap.FRONT_RIGHT_MOTOR, RobotMap.REAR_RIGHT_MOTOR);
    myRobot.setExpiration(RobotDrive.kDefaultExpirationTime);  // set expiration time for motor movement if error occurs
    
    pdp = new PowerDistributionPanel();  // instantiate class to get PDP values
    
    compressor = new Compressor(); // Compressor is controlled automatically by PCM
    
    solenoid = new DoubleSolenoid(RobotMap.SOLENOID_PCM_PORT1, RobotMap.SOLENOID_PCM_PORT2); // solenoid on PCM port #0 & #1
    
    /*camera = CameraServer.getInstance();
    camera.setQuality(50);
    camera.setSize(200);*/
    frame = NIVision.imaqCreateImage(NIVision.ImageType.IMAGE_RGB, 0);  // create the image frame for cam
    session = NIVision.IMAQdxOpenCamera("cam0",
            NIVision.IMAQdxCameraControlMode.CameraControlModeController);  // get reference to camera
    NIVision.IMAQdxConfigureGrab(session);  // grab current streaming session
}
 
开发者ID:TechnoWolves5518,项目名称:2015RobotCode,代码行数:23,代码来源:Robot.java

示例11: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public OI() {
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    driverStick = new Joystick(1);
    coStick = new Joystick(2);

    autoSteerButton = new JoystickButton(driverStick, 2);
    
    shootButton = new JoystickButton(coStick, 1);
    eightBallSpit = new JoystickButton(coStick, 2);
    eightBallSuck = new JoystickButton(coStick, 3);
    bunnyLaunchButton = new JoystickButton(coStick, 4);

    shootButton.whileHeld(new ShootCommand());
    eightBallSuck.whileHeld(new EightBallSuck());
    eightBallSpit.whileHeld(new EightBallSpit());
    bunnyLaunchButton.whileHeld(new BunnyLaunch());
    // SmartDashboard Buttons
    //SmartDashboard.putData("Autonomous Command", new AutonomousCommand());
    //SmartDashboard.putData("DriveLoop", new DriveLoop());
    SmartDashboard.putData("Reset Gyro", new ResetGyroCommand(Math.PI));
    
// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
}
 
开发者ID:Tmm2471,项目名称:Swerve,代码行数:24,代码来源:OI.java

示例12: OI

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public OI() {
    joystick1 = new Joystick(RobotMap.J1);
    joystick2 = new Joystick(RobotMap.J2);
    
    Snake = new JoystickButton(joystick1, ButtonType.LeftThumb);
        Snake.whileHeld(new Subsystem.Swerve.C_Snake());
    GoToHeading = new JoystickButton(joystick1, ButtonType.RightThumb);
        GoToHeading.whileHeld(new Subsystem.Swerve.C_GoToHeading());
    Pivot0 = new JoystickButton(joystick1, ButtonType.L1);
        Pivot0.whileHeld(new Subsystem.Swerve.C_Pivot());
    Pivot1 = new JoystickButton(joystick1, ButtonType.R1);
        Pivot1.whileHeld(new Subsystem.Swerve.C_Pivot());
    Pivot2 = new Bumper(joystick1, Axis.Trigger);
        Pivot2.whileHeld(new Subsystem.Swerve.C_Pivot());
    ZeroModules = new JoystickButton(joystick1, ButtonType.A);
        ZeroModules.whenPressed(new Subsystem.Swerve.C_ZeroModules());
    ResetGyro = new JoystickButton(joystick1, ButtonType.B);
    	ResetGyro.whenPressed(new Subsystem.Swerve.C_ResetGyro());
    CancelZeroModules = new JoystickButton(joystick1, ButtonType.X);
}
 
开发者ID:VulcanRobotics,项目名称:Veer,代码行数:21,代码来源:OI.java

示例13: init

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public static void init()
{
    stick1 = new Joystick(1);
    stick2 = new Joystick(2);
    
    
    new JoystickButton(stick1, 5).whenPressed(new ShiftCommand(true));
    
    new JoystickButton(stick1, 3).whenPressed(new ShiftCommand(false));
    
    new JoystickButton(stick2, 7).whenPressed(new StopBallIntakeCommand());
    new JoystickButton(stick2, 6).whenPressed(new BallIntakeCommand());

    new JoystickButton(stick2, 11).whileHeld(new ShooterRotationCommand(-ShooterRotator.REGULAR_SPEED));
    new JoystickButton(stick2, 10).whileHeld(new ShooterRotationCommand(ShooterRotator.REGULAR_SPEED));
    
    
    new JoystickButton(stick2, 2).whenPressed(new ShooterRotateTargetCommand(ShooterRotator.AUTONOMOUS_ANGLE));
    new JoystickButton(stick2, 1).whenPressed(new PunchGroupCommand());
    new JoystickButton(stick2, 9).whenPressed(new TopArmDownCommand());
    new JoystickButton(stick2, 8).whenPressed(new TopArmUpCommand());
    new JoystickButton(stick2, 11).whenPressed(new ResetDogEarCommand());
    new JoystickButton(stick2, 3).whenPressed(new AutonomousCommand());
}
 
开发者ID:Nashoba-Robotics,项目名称:NR-2014-CMD,代码行数:25,代码来源:OI.java

示例14: init

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
public static void init() {
    // Spin Up
    shootButton = new JoystickButton[1];
    shootButton[0] = new JoystickButton(stick, LEFT_BUMPER_BUTTON); // Left bumper
    shootButton[0].whileHeld(new SpeedUpShooter());

    
    // Shoot
    shootFrisbee = new JoystickButton[1];
    shootFrisbee[0] = new JoystickButton(stick, RIGHT_BUMPER_BUTTON); // Right bumper
    shootFrisbee[0].whenPressed(new PushFrisbeeOut());

    startCompressor = new JoystickButton[2];
    startCompressor[0] = new JoystickButton(stick, A_BUTTON); // A button
    startCompressor[0].whileHeld(new StartCompressor());
    
}
 
开发者ID:Team-2502,项目名称:RobotCode2013,代码行数:18,代码来源:XboxController.java

示例15: initButtons

import edu.wpi.first.wpilibj.buttons.JoystickButton; //导入依赖的package包/类
private void initButtons() {
	// Wills buttons
	driveMode = new JoystickButton(driveStick, 1);
	wAngle = new JoystickButton(driveStick, 4);
	wLength = new JoystickButton(driveStick, 5);
	
	//Right Buttons
	rAngle = new JoystickButton(rightStick, 1);
	rLength = new JoystickButton(rightStick, 2);
	rLock = new JoystickButton(rightStick, 4);
	rULock = new JoystickButton(rightStick, 5);
	rAdjust = new JoystickButton(rightStick, 8);
	
	//Left Buttons
	lAngle = new JoystickButton(leftStick, 1);
	lLength = new JoystickButton(leftStick,2);
	lLock = new JoystickButton(leftStick, 4);
	lULock = new JoystickButton(leftStick, 5);
	lAdjust = new JoystickButton(leftStick, 8);
	
	//Assign the buttons to their commands
	tieButtons();
}
 
开发者ID:FRC-Team-1160,项目名称:Command-Based-Robot,代码行数:24,代码来源:OI.java


注:本文中的edu.wpi.first.wpilibj.buttons.JoystickButton类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。