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


Java RobotDrive.tankDrive方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:TaylorRobotics,项目名称:TitanRobot2014,代码行数:28,代码来源:TankDriveOperator.java

示例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);
    }
}
 
开发者ID:frc-4931,项目名称:2014-Robot,代码行数:33,代码来源:LogitechController.java

示例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);
}
 
开发者ID:frc-4931,项目名称:2014-Robot,代码行数:6,代码来源:LogitechController.java


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