本文整理汇总了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);
}
示例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;
}
}
示例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()));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例8: LT
import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
public static double LT(Joystick joy) {return joy.getRawAxis(2);}
示例9: RT
import edu.wpi.first.wpilibj.Joystick; //导入方法依赖的package包/类
public static double RT(Joystick joy) {return joy.getRawAxis(3);}