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


Java Joystick.getRawAxis方法代码示例

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


在下文中一共展示了Joystick.getRawAxis方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
protected void execute() {
	Joystick control = Robot.oi.xBoxController;
	double speed = control.getRawAxis(1)* (InterfaceFlip.isFlipped ? 1 : -1);
	double turn = control.getRawAxis(4) * 0.8;
	DriveTrain.robotDrive.arcadeDrive(speed, turn);

}
 
开发者ID:FRC2832,项目名称:Robot_2017,代码行数:8,代码来源:Drive.java

示例2: hybridDrive

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
public void hybridDrive(Joystick driveStick, boolean isInverted) {
	double lspeed = 0;
	double rspeed = 0;
	
	double RT = driveStick.getRawAxis(3);
	double LT = driveStick.getRawAxis(2);
	double RJ = driveStick.getRawAxis(5);
	double LJ = driveStick.getRawAxis(1);
	
	if (isInverted) {
		// straight drive control, RT forward LT backward
		lspeed = RT - LT;
		rspeed = lspeed;

		// tank drive control
		lspeed -= LJ;
		rspeed -= RJ;
		
	} else {
		lspeed = driveStick.getRawAxis(2) - driveStick.getRawAxis(3);
		rspeed = driveStick.getRawAxis(2) - driveStick.getRawAxis(3);

		// tank drive control
		lspeed -= RJ;
		rspeed -= LJ;
		
	}
}
 
开发者ID:Team4914,项目名称:2017-emmet,代码行数:29,代码来源:DriveTrain.java

示例3: makeState

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
/**
 * Creates a new GamepadState based off of a gamepad's current state.
 * @param j The gamepad object
 * @return A gamepad state
 */
public static GamepadState makeState(Joystick j) {
	double[] axes = new double[j.getAxisCount()];
	for(int i = 0; i < axes.length; i ++)
		axes[i] = j.getRawAxis(i);
	
	boolean[] buttons = new boolean[j.getButtonCount()];
	for(int i = 0; i < buttons.length; i ++)
		buttons[i] = j.getRawButton(i + 1);
	
	return (new GamepadState(axes, buttons, j.getPOV(), System.currentTimeMillis()));
}
 
开发者ID:FRC2832,项目名称:Robot_2016,代码行数:17,代码来源:GamepadState.java

示例4: arcade

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
public void arcade(Joystick stick, boolean twostick)
{
	double y = stick.getY();
	double x;
	if (twostick)
		{
			x = stick.getRawAxis(4);
		}
	else
		{
			x = stick.getX();
		}

	if (Math.abs(y) <= Constants.JOYSTICK_DEADBAND_V)
		{
			y = 0;
		}

	if (Math.abs(x) <= Constants.JOYSTICK_HEADBAND_H)
		{
			x = 0;
		}

	// "Exponential" drive, where the movements are more sensitive during slow movement,
	// permitting easier fine control
	x = Math.pow(x, 3);
	y = Math.pow(y, 3);
	arcade(y, x);
}
 
开发者ID:first95,项目名称:FRC2017,代码行数:30,代码来源:Drive.java

示例5: halfArcade

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
public void halfArcade(Joystick stick, boolean twostick)
{
	double y = stick.getY();
	double x;
	if (twostick)
		{
			x = stick.getRawAxis(4);
		}
	else
		{
			x = stick.getX();
		}
	if (Math.abs(y) <= Constants.JOYSTICK_DEADBAND_V)
		{
			y = 0;
		}

	if (Math.abs(x) <= Constants.JOYSTICK_HEADBAND_H)
		{
			x = 0;
		}

	// "Exponential" drive, where the movements are more sensitive during slow movement,
	// permitting easier fine control
	x = Math.pow(x, 3);
	y = Math.pow(y, 3);
	halfArcade(y, x);
}
 
开发者ID:first95,项目名称:FRC2017,代码行数:29,代码来源:Drive.java

示例6: execute

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
protected void execute() {
	Joystick control = Robot.oi.xBoxController;
	double speed = -control.getRawAxis(1) * 0.7;
	double turn = control.getRawAxis(4) * 0.7;
	WheelMotors.robotDriveSystem.arcadeDrive(speed, turn);
}
 
开发者ID:FRC2832,项目名称:Practice_Robot_Code,代码行数:7,代码来源:DefaultDrive.java

示例7: triggerDrive

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
/**
 * Operates drivetrain in trigger drive
 * 
 * @param turnChannel input for left/right turning
 * @param forwardChannel input for forward speed
 * @param backwardChannel input for backward speed
 */
/*
public void triggerDrive(double turnChannel, double forwardChannel, double backwardChannel) {
	// left and right input speeds
	double leftSpeed = 0;
	double rightSpeed = 0;
	
	if (forwardChannel <= 0.001) {
		leftSpeed = -backwardChannel;
		rightSpeed = -backwardChannel;
	} else {
		leftSpeed = forwardChannel;
		rightSpeed = forwardChannel;
	}
	
	if (turnChannel > 0) {
		leftSpeed *= (1 - Math.abs(turnChannel));
	} else {
		rightSpeed *= (1 - Math.abs(turnChannel));
	}
	
	tankDrive(leftSpeed, rightSpeed, false, RobotConstants.isInverted);
}
*/

public void hybridDrive(Joystick driveStick, boolean isInverted) {
	double lspeed = 0;
	double rspeed = 0;
	
	double RT = driveStick.getRawAxis(3);
	double LT = driveStick.getRawAxis(2);
	double RJ = driveStick.getRawAxis(5);
	double LJ = driveStick.getRawAxis(1);
	
	if (isInverted) {
		// straight drive control, RT forward LT backward
		lspeed = RT - LT;
		rspeed = lspeed;

		// tank drive control
		lspeed -= LJ;
		rspeed -= RJ;
		
	} else {
		lspeed = LT - RT;
		rspeed = lspeed;

		// tank drive control
		lspeed += RJ;
		rspeed += LJ;
	}
	
	robotDrive41.tankDrive(lspeed, rspeed, false);
}
 
开发者ID:Team4914,项目名称:2017-emmet,代码行数:61,代码来源:Drivetrain.java

示例8: LT

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
public static double LT(Joystick joy) {return joy.getRawAxis(2);} 
开发者ID:wh1ter0se,项目名称:PowerUp-2018,代码行数:2,代码来源:Xbox.java

示例9: RT

import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
public static double RT(Joystick joy) {return joy.getRawAxis(3);} 
开发者ID:wh1ter0se,项目名称:PowerUp-2018,代码行数:2,代码来源:Xbox.java


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