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


Java ElapsedTime.time方法代码示例

本文整理汇总了Java中com.qualcomm.robotcore.util.ElapsedTime.time方法的典型用法代码示例。如果您正苦于以下问题:Java ElapsedTime.time方法的具体用法?Java ElapsedTime.time怎么用?Java ElapsedTime.time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.qualcomm.robotcore.util.ElapsedTime的用法示例。


在下文中一共展示了ElapsedTime.time方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: gyroHold

import com.qualcomm.robotcore.util.ElapsedTime; //导入方法依赖的package包/类
/**
 *  Method to obtain & hold a heading for a finite amount of time
 *  Move will stop once the requested time has elapsed
 *
 * @param speed      Desired speed of turn.
 * @param angle      Absolute Angle (in Degrees) relative to last gyro reset.
 *                   0 = fwd. +ve is CCW from fwd. -ve is CW from forward.
 *                   If a relative angle is required, add/subtract from current heading.
 * @param holdTime   Length of time (in seconds) to hold the specified heading.
 */
public void gyroHold( double speed, double angle, double holdTime) {

    ElapsedTime holdTimer = new ElapsedTime();

    // keep looping while we have time remaining.
    holdTimer.reset();
    while (opModeIsActive() && (holdTimer.time() < holdTime)) {
        // Update telemetry & Allow time for other processes to run.
        onHeading(speed, angle, P_TURN_COEFF);
        telemetry.update();
    }

    // Stop all motion;
    robot.leftMotor.setPower(0);
    robot.rightMotor.setPower(0);
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:27,代码来源:PushbotAutoDriveByGyro_Linear.java

示例2: gyroHold

import com.qualcomm.robotcore.util.ElapsedTime; //导入方法依赖的package包/类
/**
 *  Method to obtain & hold a heading for a finite amount of time
 *  Move will stop once the requested time has elapsed
 *
 * @param speed      Desired speed of turn.
 * @param angle      Absolute Angle (in Degrees) relative to last gyro reset.
 *                   0 = fwd. +ve is CCW from fwd. -ve is CW from forward.
 *                   If a relative angle is required, add/subtract from current heading.
 * @param holdTime   Length of time (in seconds) to hold the specified heading.
 */
public void gyroHold( double speed, double angle, double holdTime) {

    ElapsedTime holdTimer = new ElapsedTime();

    // keep looping while we have time remaining.
    holdTimer.reset();
    while (opModeIsActive() && (holdTimer.time() < holdTime)) {
        // Update telemetry & Allow time for other processes to run.
        onHeading(speed, angle, P_TURN_COEFF);
        telemetry.update();
    }

    // Stop all motion;
    robot.leftDrive.setPower(0);
    robot.rightDrive.setPower(0);
}
 
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:27,代码来源:PushbotAutoDriveByGyro_Linear.java

示例3: gyroHold

import com.qualcomm.robotcore.util.ElapsedTime; //导入方法依赖的package包/类
/**
 *  Method to obtain & hold a heading for a finite amount of time
 *  Move will stop once the requested time has elapsed
 *
 * @param speed      Desired speed of turn.
 * @param angle      Absolute Angle (in Degrees) relative to last gyro reset.
 *                   0 = fwd. +ve is CCW from fwd. -ve is CW from forward.
 *                   If a relative angle is required, add/subtract from current heading.
 * @param holdTime   Length of time (in seconds) to hold the specified heading.
 * @throws InterruptedException
 */
public void gyroHold( double speed, double angle, double holdTime)
                        throws InterruptedException {

    ElapsedTime holdTimer = new ElapsedTime();

    // keep looping while we have time remaining.
    holdTimer.reset();
    while (opModeIsActive() && (holdTimer.time() < holdTime)) {
        // Update telemetry & Allow time for other processes to run.
        onHeading(speed, angle, P_TURN_COEFF);
        telemetry.update();
        idle();
    }

    // Stop all motion;
    robot.leftMotor.setPower(0);
    robot.rightMotor.setPower(0);
}
 
开发者ID:forgod01,项目名称:5094-2016-2017,代码行数:30,代码来源:PushbotAutoDriveByGyro_Linear.java

示例4: gyroHold

import com.qualcomm.robotcore.util.ElapsedTime; //导入方法依赖的package包/类
/**
 *  Method to obtain & hold a heading for a finite amount of time
 *  Move will stop once the requested time has elapsed
 *
 * @param speed      Desired speed of turn.
 * @param angle      Absolute Angle (in Degrees) relative to last gyro reset.
 *                   0 = fwd. +ve is CCW from fwd. -ve is CW from forward.
 *                   If a relative angle is required, add/subtract from current heading.
 * @param holdTime   Length of time (in seconds) to hold the specified heading.
 */
public void gyroHold(double speed, double angle, double holdTime) {

    ElapsedTime holdTimer = new ElapsedTime();

    // keep looping while we have time remaining.
    holdTimer.reset();
    while (opModeIsActive() && (holdTimer.time() < holdTime)) {
        // Update telemetry & Allow time for other processes to run.
        onHeading(speed, angle, P_TURN_COEFF);
        telemetry.update();
    }

    // Stop all motion;
    robot.leftMotor.setPower(0);
    robot.rightMotor.setPower(0);
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:27,代码来源:PushbotAutoDriveByGyro_Linear.java

示例5: milliseconds

import com.qualcomm.robotcore.util.ElapsedTime; //导入方法依赖的package包/类
static public double milliseconds(ElapsedTime elapsed) {
    return elapsed.time() * 1000.0;
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:4,代码来源:Util.java


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