• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AnalogInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: analog

import com.qualcomm.robotcore.hardware.AnalogInput; //导入依赖的package包/类
/**
 * wrap an AnalogInput in an AnalogSensor
 *
 * @param analogInput the input to wrap
 * @return the created AnalogSensor
 */
public static AnalogSensor analog(final AnalogInput analogInput) {
    final double maxVoltage = analogInput.getMaxVoltage();

    return new AnalogSensor() {
        @Override
        public Double getValue() {
            double voltage = analogInput.getVoltage();
            if (voltage == 0) {
                return Double.MAX_VALUE;
            } else {
                return maxVoltage / voltage;
            }
        }
    };
}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:22,代码来源:Sensors.java


示例2: createDeviceMaps

import com.qualcomm.robotcore.hardware.AnalogInput; //导入依赖的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: mapAnalogInputDevice

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


示例4: pololuScaledDistance

import com.qualcomm.robotcore.hardware.AnalogInput; //导入依赖的package包/类
/**
 * DistanceSensor factory class specific to a Pololu distance sensor:
 *
 * Pololu Carrier with Sharp GP2Y0A60SZLF Analog Distance Sensor 10-150cm, 5V
 * https://www.pololu.com/product/2474
 *
 * @param analogInput the AnalogInput to scale
 * @return the created DistanceSensor
 */
public static DistanceSensor pololuScaledDistance(AnalogInput analogInput) {
    return scaledDistanceInches(analogInput, new Function() {
        @Override
        public double f(double x) {
            return .6455 * x * x + 1.726 * x + .5826;
        }
    });
}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:18,代码来源:Sensors.java


示例5: scaledDistanceInches

import com.qualcomm.robotcore.hardware.AnalogInput; //导入依赖的package包/类
/**
 * Wrap an AnalogInput and scale it by a function to get actual distance
 *
 * @param analogInput           the AnalogInput to scale
 * @param scalingFunctionInches the function to scale by
 * @return the created DistanceSensor
 */
public static DistanceSensor scaledDistanceInches(AnalogInput analogInput, Function scalingFunctionInches) {
    return scaledDistanceInches(analog(analogInput), scalingFunctionInches);
}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:11,代码来源:Sensors.java


示例6: averaged

import com.qualcomm.robotcore.hardware.AnalogInput; //导入依赖的package包/类
/**
 * Average the last numReadings of a sensor
 *
 * @param analogInput the sensor to be averaged
 * @param numReadings the number of readings to average
 * @return the created AveragedSensor
 */
public static AveragedSensor averaged(AnalogInput analogInput, int numReadings) {
    return new AveragedSensor(analog(analogInput), numReadings);
}
 
开发者ID:FTC7393,项目名称:EVLib,代码行数:11,代码来源:Sensors.java


示例7: analogInputs

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IAggregatableStream类代码示例发布时间:2022-05-23
下一篇:
Java DfReflectionUtil类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap