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


Java OpticalDistanceSensor类代码示例

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


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

示例1: runOpMode

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

  // get a reference to our Light Sensor object.
  odsSensor = hardwareMap.get(OpticalDistanceSensor.class, "sensor_ods");

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

  // while the op mode is active, loop and read the light levels.
  // Note we use opModeIsActive() as our loop condition because it is an interruptible method.
  while (opModeIsActive()) {

    // send the info back to driver station using telemetry function.
    telemetry.addData("Raw",    odsSensor.getRawLightDetected());
    telemetry.addData("Normal", odsSensor.getLightDetected());

    telemetry.update();
  }
}
 
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:21,代码来源:SensorMROpticalDistance.java

示例2: createDeviceMaps

import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; //导入依赖的package包/类
/**
 * Move the propriety {@link HardwareMap.DeviceMapping} to our {@link DeviceMap} for our
 * internal use
 */
private void createDeviceMaps() {
    fullMap.checkedPut(DcMotorController.class, new DeviceMap<>(basicMap.dcMotorController));
    fullMap.checkedPut(DcMotor.class, new DeviceMap<>(basicMap.dcMotor));
    fullMap.checkedPut(ServoController.class, new DeviceMap<>(basicMap.servoController));
    fullMap.checkedPut(Servo.class, new DeviceMap<>(basicMap.servo));
    fullMap.checkedPut(LegacyModule.class, new DeviceMap<>(basicMap.legacyModule));
    fullMap.checkedPut(TouchSensorMultiplexer.class, new DeviceMap<>(basicMap.touchSensorMultiplexer));
    fullMap.checkedPut(DeviceInterfaceModule.class, new DeviceMap<>(basicMap.deviceInterfaceModule));
    fullMap.checkedPut(AnalogInput.class, new DeviceMap<>(basicMap.analogInput));
    fullMap.checkedPut(DigitalChannel.class, new DeviceMap<>(basicMap.digitalChannel));
    fullMap.checkedPut(OpticalDistanceSensor.class, new DeviceMap<>(basicMap.opticalDistanceSensor));
    fullMap.checkedPut(TouchSensor.class, new DeviceMap<>(basicMap.touchSensor));
    fullMap.checkedPut(PWMOutput.class, new DeviceMap<>(basicMap.pwmOutput));
    fullMap.checkedPut(I2cDevice.class, new DeviceMap<>(basicMap.i2cDevice));
    fullMap.checkedPut(AnalogOutput.class, new DeviceMap<>(basicMap.analogOutput));
    fullMap.checkedPut(ColorSensor.class, new DeviceMap<>(basicMap.colorSensor));
    fullMap.checkedPut(LED.class, new DeviceMap<>(basicMap.led));
    fullMap.checkedPut(AccelerationSensor.class, new DeviceMap<>(basicMap.accelerationSensor));
    fullMap.checkedPut(CompassSensor.class, new DeviceMap<>(basicMap.compassSensor));
    fullMap.checkedPut(GyroSensor.class, new DeviceMap<>(basicMap.gyroSensor));
    fullMap.checkedPut(IrSeekerSensor.class, new DeviceMap<>(basicMap.irSeekerSensor));
    fullMap.checkedPut(LightSensor.class, new DeviceMap<>(basicMap.lightSensor));
    fullMap.checkedPut(UltrasonicSensor.class, new DeviceMap<>(basicMap.ultrasonicSensor));
    fullMap.checkedPut(VoltageSensor.class, new DeviceMap<>(basicMap.voltageSensor));

    LinkedHashMultimap<DcMotorController, DcMotor> multimap = LinkedHashMultimap.create();
    for (DcMotor motor : dcMotors()) {
        multimap.put(motor.getController(), motor);
    }
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:35,代码来源:ExtensibleHardwareMap.java

示例3: mapOpticalDistanceSensor

import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; //导入依赖的package包/类
private void mapOpticalDistanceSensor(HardwareMap map, DeviceManager deviceMgr, DeviceInterfaceModule deviceInterfaceModule, DeviceConfiguration devConf) {
    if (!devConf.isEnabled()) return;
    OpticalDistanceSensor opticalDistanceSensor = deviceMgr.createAnalogOpticalDistanceSensor(deviceInterfaceModule, devConf.getPort());
    map.opticalDistanceSensor.put(devConf.getName(), opticalDistanceSensor);
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:6,代码来源:XtensibleEventLoop.java

示例4: OpticalDistance

import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; //导入依赖的package包/类
public OpticalDistance(OpticalDistanceSensor sensor) {
    this.o = sensor;
}
 
开发者ID:lasarobotics,项目名称:FTCLibrary,代码行数:4,代码来源:OpticalDistance.java

示例5: update

import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; //导入依赖的package包/类
public void update(OpticalDistanceSensor sensor) {
    this.o = sensor;
}
 
开发者ID:lasarobotics,项目名称:FTCLibrary,代码行数:4,代码来源:OpticalDistance.java

示例6: opticalDistanceSensors

import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; //导入依赖的package包/类
/**
 * Returns a {@link DeviceMap<OpticalDistanceSensor>} for use to access Optical Distance Sensor
 * hardware
 *
 * @return a DeviceMap to use for access to representations of Optical Distance Sensors
 * @see DeviceMap
 * @see OpticalDistanceSensor
 */
public DeviceMap<OpticalDistanceSensor> opticalDistanceSensors() {
    return fullMap.checkedGet(OpticalDistanceSensor.class);
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:12,代码来源:ExtensibleHardwareMap.java


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