use of com.qualcomm.robotcore.hardware.LegacyModule in project robotcode by OutoftheBoxFTC.
the class HardwareFactory method mapUsbLegacyModule.
private void mapUsbLegacyModule(HardwareMap map, DeviceManager deviceMgr, LegacyModuleControllerConfiguration ctrlConf) throws RobotCoreException, InterruptedException {
if (!ctrlConf.isEnabled()) {
return;
}
LegacyModule legacyModule = deviceMgr.createUsbLegacyModule(ctrlConf.getSerialNumber(), ctrlConf.getName());
map.legacyModule.put(ctrlConf.getName(), legacyModule);
for (DeviceConfiguration devConf : ctrlConf.getDevices()) {
ConfigurationType devType = devConf.getConfigurationType();
if (devType == BuiltInConfigurationType.GYRO) {
mapNxtGyroSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.COMPASS) {
mapNxtCompassSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.IR_SEEKER) {
mapNxtIrSeekerSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.LIGHT_SENSOR) {
mapNxtLightSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.ACCELEROMETER) {
mapNxtAccelerationSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.MOTOR_CONTROLLER) {
mapNxtDcMotorController(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.SERVO_CONTROLLER) {
mapNxtServoController(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.TOUCH_SENSOR) {
mapNxtTouchSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.TOUCH_SENSOR_MULTIPLEXER) {
mapNxtTouchSensorMultiplexer(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.ULTRASONIC_SENSOR) {
mapSonarSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.COLOR_SENSOR) {
mapNxtColorSensor(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.MATRIX_CONTROLLER) {
mapMatrixController(map, deviceMgr, legacyModule, devConf);
} else if (devType == BuiltInConfigurationType.NOTHING) {
// nothing to do
} else {
RobotLog.w("Unexpected device type connected to Legacy Module while parsing XML: " + devType.toString());
}
}
}
Aggregations