當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。