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


Java HardwareMap.DeviceMapping方法代码示例

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


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

示例1: buildFromDeviceMapping

import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public ImmutableMap<String, T> buildFromDeviceMapping(HardwareMap.DeviceMapping<T> deviceMapping) {
    ImmutableMap.Builder<String, T> mapBuilder = ImmutableMap.builder();
    Set<Map.Entry<String, T>> entries = deviceMapping.entrySet();
    for (Map.Entry<String, T> device : entries) {
        mapBuilder.put(device.getKey(), device.getValue());
    }

    return mapBuilder.build();
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:10,代码来源:DeviceMap.java

示例2: deviceMappings

import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static List<HardwareMap.DeviceMapping<?>> deviceMappings(HardwareMap map)
// Returns all the device mappings within the map
{
    List<HardwareMap.DeviceMapping<?>> result = new LinkedList<>();
    result.add(map.dcMotorController);
    result.add(map.servoController);
    result.add(map.legacyModule);
    result.add(map.deviceInterfaceModule);
    result.add(map.colorSensor);
    result.add(map.dcMotor);
    result.add(map.gyroSensor);
    result.add(map.servo);
    result.add(map.analogInput);
    result.add(map.digitalChannel);
    result.add(map.opticalDistanceSensor);
    result.add(map.touchSensor);
    result.add(map.pwmOutput);
    result.add(map.i2cDevice);
    result.add(map.analogOutput);
    result.add(map.led);
    result.add(map.accelerationSensor);
    result.add(map.compassSensor);
    result.add(map.irSeekerSensor);
    result.add(map.lightSensor);
    result.add(map.ultrasonicSensor);
    result.add(map.voltageSensor);
    result.add(map.touchSensorMultiplexer);
    return result;
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:30,代码来源:Util.java

示例3: remove

import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static <T extends HardwareDevice> void remove(HardwareMap.DeviceMapping<T> from, IFuncArg<Boolean, T> predicate, IAction<T> action) {
    List<String> names = new LinkedList<>();
    for (Map.Entry<String, T> pair : from.entrySet()) {
        T t = pair.getValue();
        if (predicate == null || predicate.value(t)) {
            names.add(pair.getKey());
            if (action != null) action.doAction(t);
        }
    }
    for (String name : names) {
        removeName(from, name);
    }
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:14,代码来源:Util.java

示例4: contains

import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static <T extends HardwareDevice> boolean contains(HardwareMap.DeviceMapping<T> map, String name) {
    for (Map.Entry<String, T> pair : map.entrySet()) {
        if (pair.getKey().equals(name))
            return true;
    }
    return false;
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:8,代码来源:Util.java

示例5: DeviceMap

import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public DeviceMap(HardwareMap.DeviceMapping<T> deviceMapping) {
    super();
    delegate = buildFromDeviceMapping(deviceMapping);
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:5,代码来源:DeviceMap.java

示例6: removeName

import com.qualcomm.robotcore.hardware.HardwareMap; //导入方法依赖的package包/类
public static <T extends HardwareDevice> void removeName(HardwareMap.DeviceMapping<T> entrySet, String name) {
    Util.<Map>getPrivateObjectField(entrySet, 0).remove(name);
}
 
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:4,代码来源:Util.java


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