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


Java LinearOpMode类代码示例

本文整理汇总了Java中com.qualcomm.robotcore.eventloop.opmode.LinearOpMode的典型用法代码示例。如果您正苦于以下问题:Java LinearOpMode类的具体用法?Java LinearOpMode怎么用?Java LinearOpMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LinearOpMode类属于com.qualcomm.robotcore.eventloop.opmode包,在下文中一共展示了LinearOpMode类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shootBall

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //导入依赖的package包/类
public void shootBall(LinearOpMode opMode) {
    shootBalls(true);
    waitFor(opMode, RobotConstants.shotWaitPeriod);

    intakeBalls(true);
    waitFor(opMode, 3);

    intakeBalls(false);
    shootBalls(false);
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:11,代码来源:RobotUtilities.java

示例2: shootDoubleBall

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //导入依赖的package包/类
public void shootDoubleBall(LinearOpMode opMode) {
    shootBalls(true);
    waitFor(opMode, RobotConstants.shotWaitPeriod);

    intakeBalls(true);
    waitFor(opMode, 5);

    intakeBalls(false);
    shootBalls(false);
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:11,代码来源:RobotUtilities.java

示例3: waitFor

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //导入依赖的package包/类
private void waitFor(LinearOpMode opMode, int sec) {
    long millis = sec * 1000;
    long stopTime = System.currentTimeMillis() + millis;
    while(opMode.opModeIsActive() && System.currentTimeMillis() < stopTime) {
        try {
            opMode.waitOneFullHardwareCycle();
        } catch(Exception ex) {}
    }
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:10,代码来源:RobotUtilities.java

示例4: initAutoOp

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //导入依赖的package包/类
/**
     * Initializes all drive and ball motors in USING ENCODERS mode
     * @param hwMap
     */
    public void initAutoOp(LinearOpMode opMode, HardwareMap hwMap) {
        this.hwMap = hwMap;

        initDrive();
        initBall();
//        initCap();
//        initServos();
//        initSensors();

        for(DcMotor driveMotor : driveMotors) {
            driveMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
            opMode.idle();
            driveMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
            driveMotor.setDirection(DcMotorSimple.Direction.FORWARD);
            driveMotor.setPower(0);
        }
        for(DcMotor ballMotor : ballMotors) {
            ballMotor.setMode(DcMotor.RunMode.STOP_AND_RESET_ENCODER);
            opMode.idle();
            ballMotor.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
            ballMotor.setDirection(DcMotorSimple.Direction.FORWARD);
            ballMotor.setPower(0);
        }
//        cap.setMode(DcMotor.RunMode.RUN_USING_ENCODER);
//        cap.setDirection(DcMotorSimple.Direction.FORWARD);
//        cap.setPower(0);
    }
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:32,代码来源:Robot.java

示例5: waitForBeaconDetection

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //导入依赖的package包/类
public static int waitForBeaconDetection(LinearOpMode opMode, Image img,
                                   VuforiaTrackableDefaultListener beacon,
                                   CameraCalibration camCal, long timeOut) {
    int config = NOT_VISIBLE;
    long beginTime = System.currentTimeMillis();
    while (config == NOT_VISIBLE && System.currentTimeMillis() - beginTime < timeOut && opMode.opModeIsActive()) {
        config = getBeaconConfig(img, beacon, camCal);
        opMode.idle();
    }

    return config;
}
 
开发者ID:ykarim,项目名称:FTC2016,代码行数:13,代码来源:BeaconUtils.java

示例6: check

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //导入依赖的package包/类
@Override
public boolean check(Thread opModeThread, OpMode currentOpMode) {
    return currentOpMode instanceof LinearOpMode &&
            ((LinearOpMode) currentOpMode).isStopRequested();
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:6,代码来源:Watchdog2.java

示例7: walkMenuTree

import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; //导入依赖的package包/类
/**
 * This method traverses the menu tree from the given root menu displaying each menu and waiting for the user
 * to respond to a menu. After the user responded to a menu, it will go to the next menu in the tree. If the
 * user cancels the menu, it will go back to the parent menu where it came from. If there is no next menu, the
 * traversal is ended. Note: this is a static method, meaning you can call it without a menu instance. Also note
 * that this is a blocking call so this should not be called in a multitasking robot loop such as in the execution
 * of a state machine. To use the menus in a multitasking environment, you must use the runMenus() method instead.
 *
 * @param rootMenu specifies the root of the menu tree.
 * @param opmode specifies the linear opmode that calls this.
 */
public static void walkMenuTree(FtcMenu rootMenu, LinearOpMode opmode)
{
    setRootMenu(rootMenu);
    rootMenu.displayMenu();
    while (!runMenus() && !opmode.isStopRequested())
    {
        TrcUtil.sleep(LOOP_INTERVAL);
    }
}
 
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:21,代码来源:FtcMenu.java


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