本文整理匯總了Java中edu.wpi.first.wpilibj.RobotDrive.tankDrive方法的典型用法代碼示例。如果您正苦於以下問題:Java RobotDrive.tankDrive方法的具體用法?Java RobotDrive.tankDrive怎麽用?Java RobotDrive.tankDrive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類edu.wpi.first.wpilibj.RobotDrive
的用法示例。
在下文中一共展示了RobotDrive.tankDrive方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: periodic
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public void periodic() {
if (driveForwardButton.isSwitchOn()) {
direction = FORWARD;
}
else if (driveBackwardButton.isSwitchOn()) {
direction = REVERSE;
}
RobotDrive robotDrive = robot.getMotorStore().getRobotDrive(direction == FORWARD);
if (driveSlowButton.isSwitchOn()) {
speedFactor = SLOW_SPEED_FACTOR;
}
else if (driveFastButton.isSwitchOn()) {
speedFactor = FAST_SPEED_FACTOR;
}
else {
speedFactor = DEFAULT_SPEED_FACTOR;
}
robotDrive.setMaxOutput(speedFactor);
if (direction == FORWARD) {
robotDrive.tankDrive(rightDriveJoystick, leftDriveJoystick);
}
else {
robotDrive.tankDrive(leftDriveJoystick, rightDriveJoystick);
}
}
示例2: drive
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
/**
* Call the appropriate {@link RobotDrive} drive method based upon the #
*
* @param robotDrive
*/
public void drive( RobotDrive robotDrive ) {
if (Mode.X.equals(mode)) {
// X-mode ...
if (DriveStyle.TANK.equals(style)) {
robotDrive.tankDrive(this, XModeAxes.LEFT_JOYSTICK_VERTICAL, this, XModeAxes.RIGHT_JOYSTICK_VERTICAL);
} else if (DriveStyle.ARCADE_LEFT.equals(style)) {
robotDrive.arcadeDrive(this, XModeAxes.LEFT_JOYSTICK_VERTICAL, this, XModeAxes.LEFT_JOYSTICK_HORIZONTAL);
} else if (DriveStyle.ARCADE_RIGHT.equals(style)) {
robotDrive.arcadeDrive(this, XModeAxes.RIGHT_JOYSTICK_VERTICAL, this, XModeAxes.RIGHT_JOYSTICK_HORIZONTAL);
} else {
System.out.println("Unknown Logitech Controller drive style: " + style);
}
} else if (Mode.D.equals(mode)) {
// D-mode ...
if (DriveStyle.TANK.equals(style)) {
robotDrive.tankDrive(this, DModeAxes.LEFT_JOYSTICK_VERTICAL, this, DModeAxes.RIGHT_JOYSTICK_VERTICAL);
} else if (DriveStyle.ARCADE_LEFT.equals(style)) {
robotDrive.arcadeDrive(this, DModeAxes.LEFT_JOYSTICK_VERTICAL, this, DModeAxes.LEFT_JOYSTICK_HORIZONTAL);
} else if (DriveStyle.ARCADE_RIGHT.equals(style)) {
robotDrive.arcadeDrive(this, DModeAxes.RIGHT_JOYSTICK_VERTICAL, this, DModeAxes.RIGHT_JOYSTICK_HORIZONTAL);
} else {
System.out.println("Unknown Logitech Controller drive style: " + style);
}
} else {
System.out.println("Unknown Logitech Controller mode: " + mode);
}
}
示例3: drive
import edu.wpi.first.wpilibj.RobotDrive; //導入方法依賴的package包/類
public void drive( RobotDrive robotDrive ) {
double move = ctrl().getRawAxis(DMode.Axes.LEFT_JOYSTICK_VERTICAL);
double turn = ctrl().getRawAxis(DMode.Axes.RIGHT_JOYSTICK_VERTICAL);
robotDrive.tankDrive(move, turn, true);
}