本文整理汇总了Java中com.qualcomm.robotcore.hardware.DeviceInterfaceModule类的典型用法代码示例。如果您正苦于以下问题:Java DeviceInterfaceModule类的具体用法?Java DeviceInterfaceModule怎么用?Java DeviceInterfaceModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DeviceInterfaceModule类属于com.qualcomm.robotcore.hardware包,在下文中一共展示了DeviceInterfaceModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: mapCoreInterfaceDeviceModule
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
private void mapCoreInterfaceDeviceModule(HardwareMap map, DeviceManager deviceMgr, ControllerConfiguration ctrlConf) throws RobotCoreException, InterruptedException {
if (!ctrlConf.isEnabled()) return;
DeviceInterfaceModule deviceInterfaceModule = deviceMgr.createDeviceInterfaceModule(ctrlConf.getSerialNumber());
map.deviceInterfaceModule.put(ctrlConf.getName(), deviceInterfaceModule);
List<DeviceConfiguration> pwmDevices = ((DeviceInterfaceModuleConfiguration) ctrlConf).getPwmOutputs();
buildDevices(pwmDevices, map, deviceMgr, deviceInterfaceModule);
List<DeviceConfiguration> i2cDevices = ((DeviceInterfaceModuleConfiguration) ctrlConf).getI2cDevices();
buildI2cDevices(i2cDevices, map, deviceMgr, deviceInterfaceModule);
List<DeviceConfiguration> analogInputDevices = ((DeviceInterfaceModuleConfiguration) ctrlConf).getAnalogInputDevices();
buildDevices(analogInputDevices, map, deviceMgr, deviceInterfaceModule);
List<DeviceConfiguration> digitalDevices = ((DeviceInterfaceModuleConfiguration) ctrlConf).getDigitalDevices();
buildDevices(digitalDevices, map, deviceMgr, deviceInterfaceModule);
List<DeviceConfiguration> analogOutputDevices = ((DeviceInterfaceModuleConfiguration) ctrlConf).getAnalogOutputDevices();
buildDevices(analogOutputDevices, map, deviceMgr, deviceInterfaceModule);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:21,代码来源:XtensibleEventLoop.java示例2: buildDevices
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
private void buildDevices(List<DeviceConfiguration> list, HardwareMap map, DeviceManager deviceMgr, DeviceInterfaceModule deviceInterfaceModule) {
for (DeviceConfiguration deviceConfiguration : list) {
ConfigurationType devType = deviceConfiguration.getType();
if (devType == BuiltInConfigurationType.OPTICAL_DISTANCE_SENSOR) {
mapOpticalDistanceSensor(map, deviceMgr, deviceInterfaceModule, deviceConfiguration);
} else if (devType == BuiltInConfigurationType.ANALOG_INPUT) {
mapAnalogInputDevice(map, deviceMgr, deviceInterfaceModule, deviceConfiguration);
} else if (devType == BuiltInConfigurationType.TOUCH_SENSOR) {
mapTouchSensor(map, deviceMgr, deviceInterfaceModule, deviceConfiguration);
} else if (devType == BuiltInConfigurationType.DIGITAL_DEVICE) {
mapDigitalDevice(map, deviceMgr, deviceInterfaceModule, deviceConfiguration);
} else if (devType == BuiltInConfigurationType.PULSE_WIDTH_DEVICE) {
mapPwmOutputDevice(map, deviceMgr, deviceInterfaceModule, deviceConfiguration);
} else if (devType == BuiltInConfigurationType.ANALOG_OUTPUT) {
mapAnalogOutputDevice(map, deviceMgr, deviceInterfaceModule, deviceConfiguration);
} else if (devType == BuiltInConfigurationType.LED) {
mapLED(map, deviceMgr, deviceInterfaceModule, deviceConfiguration);
} else if (devType == BuiltInConfigurationType.NOTHING) {
// nothing to do
} else {
RobotLog.w("Unexpected device type connected to Device Interface Module while parsing XML: " + devType.toString());
}
}
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:25,代码来源:XtensibleEventLoop.java示例3: I2cDeviceReplacementHelper
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
public I2cDeviceReplacementHelper(OpMode context, TARGET client, /* may be null */ TARGET target, I2cController controller, int targetPort) {
this.context = context;
this.isArmed = false;
this.client = client;
this.target = target; // may be null
this.controller = controller;
this.targetPort = targetPort;
this.targetName = null;
this.targetDeviceMapping = null;
if (this.target != null)
findTargetNameAndMapping();
if (controller instanceof LegacyModule) {
this.targetCallback = MemberUtil.callbacksOfLegacyModule((LegacyModule) controller)[targetPort];
} else if (controller instanceof DeviceInterfaceModule) {
this.targetCallback = MemberUtil.callbacksOfDeviceInterfaceModule((DeviceInterfaceModule) controller)[targetPort];
} else
throw new IllegalArgumentException(String.format("unknown controller flavor: %s", controller.getClass().getSimpleName()));
}
开发者ID:MHS-FIRSTrobotics,项目名称:TeamClutch2016,代码行数:21,代码来源:I2cDeviceReplacementHelper.java示例4: runOpMode
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
@Override
public void runOpMode() {
// Connect to motor (Assume standard left wheel)
// Change the text in quotes to match any motor name on your robot.
dim = hardwareMap.get(DeviceInterfaceModule.class, "dim");
// Toggle LEDs while Waiting for the start button
telemetry.addData(">", "Press Play to test LEDs." );
telemetry.update();
while (!isStarted()) {
// Determine if we are on an odd or even second
boolean even = (((int)(runtime.time()) & 0x01) == 0);
dim.setLED(RED_LED, even); // Red for even
dim.setLED(BLUE_LED, !even); // Blue for odd
idle();
}
// Running now
telemetry.addData(">", "Press X for Blue, B for Red." );
telemetry.update();
// Now just use red and blue buttons to set red and blue LEDs
while(opModeIsActive()){
dim.setLED(BLUE_LED, gamepad1.x);
dim.setLED(RED_LED, gamepad1.b);
idle();
}
// Turn off LEDs;
dim.setLED(BLUE_LED, false);
dim.setLED(RED_LED, false);
telemetry.addData(">", "Done");
telemetry.update();
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:37,代码来源:ConceptDIMAsIndicator.java示例5: init
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
/**
* Retrieves references to the sensor and device interface module
* Sets up and turns on sensor's LED
* Default baseline values until calibration
* @param sensor Reference to sensor hardware
* @param dim Reference to the device interface module hardware
*/
public void init(ColorSensor sensor, DeviceInterfaceModule dim) {
rgbSensor = sensor;
cdim = dim;
cdim.setDigitalChannelMode(LED_CHANNEL, DigitalChannelController.Mode.OUTPUT);
cdim.setDigitalChannelState(LED_CHANNEL, true);
BASELINE_BLUE = 127;
BASELINE_RED = 127;
}
开发者ID:FTC10794,项目名称:robolib,代码行数:18,代码来源:RGB.java示例6: createDeviceMaps
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的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示例7: AdafruitSensorWrapper
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
public AdafruitSensorWrapper(ColorSensor sensor, DeviceInterfaceModule dim, int ledPort, boolean enabled) {
this.sensor = sensor;
rawBlue = new Color();
rawGreen = new Color();
rawRed = new Color();
if (dim != null) {
this.dim = dim;
this.ledPort = ledPort;
led = enabled;
dim.setDigitalChannelMode(0, DigitalChannelController.Mode.OUTPUT);
dim.setDigitalChannelState(0, enabled);
}
update();
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:16,代码来源:AdafruitSensorWrapper.java示例8: runOpMode
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
@Override
public void runOpMode() {
boolean inputPin; // Input State
boolean outputPin; // Output State
DeviceInterfaceModule dim; // Device Object
DigitalChannel digIn; // Device Object
DigitalChannel digOut; // Device Object
// get a reference to a Modern Robotics DIM, and IO channels.
dim = hardwareMap.get(DeviceInterfaceModule.class, "dim"); // Use generic form of device mapping
digIn = hardwareMap.get(DigitalChannel.class, "digin"); // Use generic form of device mapping
digOut = hardwareMap.get(DigitalChannel.class, "digout"); // Use generic form of device mapping
digIn.setMode(DigitalChannelController.Mode.INPUT); // Set the direction of each channel
digOut.setMode(DigitalChannelController.Mode.OUTPUT);
// wait for the start button to be pressed.
telemetry.addData(">", "Press play, and then user X button to set DigOut");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
outputPin = gamepad1.x ; // Set the output pin based on x button
digOut.setState(outputPin);
inputPin = digIn.getState(); // Read the input pin
// Display input pin state on LEDs
if (inputPin) {
dim.setLED(RED_LED_CHANNEL, true);
dim.setLED(BLUE_LED_CHANNEL, false);
}
else {
dim.setLED(RED_LED_CHANNEL, false);
dim.setLED(BLUE_LED_CHANNEL, true);
}
telemetry.addData("Output", outputPin );
telemetry.addData("Input", inputPin );
telemetry.addData("LED", inputPin ? "Red" : "Blue" );
telemetry.update();
}
}
开发者ID:ykarim,项目名称:FTC2016,代码行数:45,代码来源:SensorDIO.java示例9: runOpMode
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
@Override
public void runOpMode() {
boolean inputPin; // Input State
boolean outputPin; // Output State
DeviceInterfaceModule dim; // Device Object
DigitalChannel digIn; // Device Object
DigitalChannel digOut; // Device Object
// get a reference to a Modern Robotics DIM, and IO channels.
dim = hardwareMap.get(DeviceInterfaceModule.class, "dim"); // Use generic form of device mapping
digIn = hardwareMap.get(DigitalChannel.class, "digin"); // Use generic form of device mapping
digOut = hardwareMap.get(DigitalChannel.class, "digout"); // Use generic form of device mapping
digIn.setMode(DigitalChannel.Mode.INPUT); // Set the direction of each channel
digOut.setMode(DigitalChannel.Mode.OUTPUT);
// wait for the start button to be pressed.
telemetry.addData(">", "Press play, and then user X button to set DigOut");
telemetry.update();
waitForStart();
while (opModeIsActive()) {
outputPin = gamepad1.x ; // Set the output pin based on x button
digOut.setState(outputPin);
inputPin = digIn.getState(); // Read the input pin
// Display input pin state on LEDs
if (inputPin) {
dim.setLED(RED_LED_CHANNEL, true);
dim.setLED(BLUE_LED_CHANNEL, false);
}
else {
dim.setLED(RED_LED_CHANNEL, false);
dim.setLED(BLUE_LED_CHANNEL, true);
}
telemetry.addData("Output", outputPin );
telemetry.addData("Input", inputPin );
telemetry.addData("LED", inputPin ? "Red" : "Blue" );
telemetry.update();
}
}
开发者ID:trc492,项目名称:Ftc2018RelicRecovery,代码行数:45,代码来源:SensorDIO.java示例10: mapDigitalDevice
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
private void mapDigitalDevice(HardwareMap map, DeviceManager deviceMgr, DeviceInterfaceModule deviceInterfaceModule, DeviceConfiguration devConf) {
if (!devConf.isEnabled()) return;
DigitalChannel digitalChannel = deviceMgr.createDigitalChannelDevice(deviceInterfaceModule, devConf.getPort());
map.digitalChannel.put(devConf.getName(), digitalChannel);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:6,代码来源:XtensibleEventLoop.java示例11: mapTouchSensor
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
private void mapTouchSensor(HardwareMap map, DeviceManager deviceMgr, DeviceInterfaceModule deviceInterfaceModule, DeviceConfiguration devConf) {
if (!devConf.isEnabled()) return;
TouchSensor touchSensor = deviceMgr.createDigitalTouchSensor(deviceInterfaceModule, devConf.getPort());
map.touchSensor.put(devConf.getName(), touchSensor);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:6,代码来源:XtensibleEventLoop.java示例12: mapAnalogInputDevice
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的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示例13: mapAnalogOutputDevice
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
private void mapAnalogOutputDevice(HardwareMap map, DeviceManager deviceMgr, DeviceInterfaceModule deviceInterfaceModule, DeviceConfiguration devConf) {
if (!devConf.isEnabled()) return;
AnalogOutput analogOutput = deviceMgr.createAnalogOutputDevice(deviceInterfaceModule, devConf.getPort());
map.analogOutput.put(devConf.getName(), analogOutput);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:6,代码来源:XtensibleEventLoop.java示例14: mapOpticalDistanceSensor
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的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示例15: deviceInterfaceModuleOfAdaFruitColorSensor
import com.qualcomm.robotcore.hardware.DeviceInterfaceModule; //导入依赖的package包/类
static DeviceInterfaceModule deviceInterfaceModuleOfAdaFruitColorSensor(ColorSensor sensor) {
return Util.getPrivateObjectField(sensor, 0);
}
开发者ID:MHS-FIRSTrobotics,项目名称:RadicalRobotics2017,代码行数:4,代码来源:MemberUtil.java本文标签属性:
示例:示例的拼音
代码:代码是什么
java:java模拟器
DeviceInterfaceModule:DeviceInterfaceModule