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


Java GyroSensor.isCalibrating方法代码示例

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


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

示例1: calibrateGyro

import com.qualcomm.robotcore.hardware.GyroSensor; //导入方法依赖的package包/类
/**
 * @param stateName     the name of the state
 * @param nextStateName the name of the next state
 * @param gyro          the gyro sensor to be calibrated
 * @return the created State
 * @see GyroSensor
 */
public static State calibrateGyro(StateName stateName, final StateName nextStateName, final GyroSensor gyro) {
    gyro.calibrate();
    return new BasicAbstractState(stateName) {
        @Override
        public void init() {
        }

        @Override
        public boolean isDone() {
            return !gyro.isCalibrating();
        }

        @Override
        public StateName getNextStateName() {
            return nextStateName;
        }
    };
}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:26,代码来源:EVStates.java

示例2: displayGyroIsCalibrated

import com.qualcomm.robotcore.hardware.GyroSensor; //导入方法依赖的package包/类
/**
 * Display whether or not a gyro sensor is calibrated on the telemetry screen
 *
 * @param gyro the gyro sensor
 */
public static void displayGyroIsCalibrated(GyroSensor gyro) {
    if (gyro.isCalibrating()) {
        telemetry.addData("Gyro state", "CALIBRATING");
    } else {
        telemetry.addData("Gyro state", "ready");
    }
}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:13,代码来源:Telem.java

示例3: runOpMode

import com.qualcomm.robotcore.hardware.GyroSensor; //导入方法依赖的package包/类
@Override
public void runOpMode() throws InterruptedException {

  GyroSensor sensorGyro;
  int xVal, yVal, zVal = 0;
  int heading = 0;

  // write some device information (connection info, name and type)
  // to the log file.
  hardwareMap.logDevices();

  // get a reference to our GyroSensor object.
  sensorGyro = hardwareMap.gyroSensor.get("gyro");

  // calibrate the gyro.
  sensorGyro.calibrate();

  // wait for the start button to be pressed.
  waitForStart();

  // make sure the gyro is calibrated.
  while (sensorGyro.isCalibrating())  {
    Thread.sleep(50);
  }

  while (opModeIsActive())  {
    // if the A and B buttons are pressed, reset Z heading.
    if(gamepad1.a && gamepad1.b)  {
      // reset heading.
      sensorGyro.resetZAxisIntegrator();
    }

    // get the x, y, and z values (rate of change of angle).
    xVal = sensorGyro.rawX();
    yVal = sensorGyro.rawY();
    zVal = sensorGyro.rawZ();

    // get the heading info.
    // the Modern Robotics' gyro sensor keeps
    // track of the current heading for the Z axis only.
    heading = sensorGyro.getHeading();

    telemetry.addData("1. x", String.format("%03d", xVal));
    telemetry.addData("2. y", String.format("%03d", yVal));
    telemetry.addData("3. z", String.format("%03d", zVal));
    telemetry.addData("4. h", String.format("%03d", heading));

    Thread.sleep(100);
  }
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:FTC-Simple,代码行数:51,代码来源:MRGyroTest.java

示例4: runOpMode

import com.qualcomm.robotcore.hardware.GyroSensor; //导入方法依赖的package包/类
@Override
public void runOpMode() throws InterruptedException {

    GyroSensor sensorGyro;
    int xVal, yVal, zVal = 0;
    int heading = 0;

    // write some device information (connection info, name and type)
    // to the log file.
    hardwareMap.logDevices();

    // get a reference to our GyroSensor object.
    sensorGyro = hardwareMap.gyroSensor.get("gyro");

    // calibrate the gyro.
    sensorGyro.calibrate();

    // wait for the start button to be pressed.
    waitForStart();

    // make sure the gyro is calibrated.
    while (sensorGyro.isCalibrating()) {
        Thread.sleep(50);
    }

    while (opModeIsActive()) {
        // if the A and B buttons are pressed, reset Z heading.
        if (gamepad1.a && gamepad1.b) {
            // reset heading.
            sensorGyro.resetZAxisIntegrator();
        }

        // get the x, y, and z values (rate of change of angle).
        xVal = sensorGyro.rawX();
        yVal = sensorGyro.rawY();
        zVal = sensorGyro.rawZ();

        // get the heading info.
        // the Modern Robotics' gyro sensor keeps
        // track of the current heading for the Z axis only.
        heading = sensorGyro.getHeading();

        telemetry.addData("1. x", String.format("%03d", xVal));
        telemetry.addData("2. y", String.format("%03d", yVal));
        telemetry.addData("3. z", String.format("%03d", zVal));
        telemetry.addData("4. h", String.format("%03d", heading));

        Thread.sleep(100);
    }
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:TeamClutch2016,代码行数:51,代码来源:MRGyroTest.java


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