本文整理汇总了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);
}