Search in sources :

Example 1 with LegacyModule

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());
        }
    }
}
Also used : ConfigurationType(com.qualcomm.robotcore.hardware.configuration.ConfigurationType) BuiltInConfigurationType(com.qualcomm.robotcore.hardware.configuration.BuiltInConfigurationType) UserConfigurationType(com.qualcomm.robotcore.hardware.configuration.UserConfigurationType) LegacyModule(com.qualcomm.robotcore.hardware.LegacyModule) ModernRoboticsUsbLegacyModule(com.qualcomm.hardware.modernrobotics.ModernRoboticsUsbLegacyModule) LynxUsbDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxUsbDeviceConfiguration) LynxI2cDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxI2cDeviceConfiguration) DeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration)

Aggregations

ModernRoboticsUsbLegacyModule (com.qualcomm.hardware.modernrobotics.ModernRoboticsUsbLegacyModule)1 LegacyModule (com.qualcomm.robotcore.hardware.LegacyModule)1 BuiltInConfigurationType (com.qualcomm.robotcore.hardware.configuration.BuiltInConfigurationType)1 ConfigurationType (com.qualcomm.robotcore.hardware.configuration.ConfigurationType)1 DeviceConfiguration (com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration)1 LynxI2cDeviceConfiguration (com.qualcomm.robotcore.hardware.configuration.LynxI2cDeviceConfiguration)1 LynxUsbDeviceConfiguration (com.qualcomm.robotcore.hardware.configuration.LynxUsbDeviceConfiguration)1 UserConfigurationType (com.qualcomm.robotcore.hardware.configuration.UserConfigurationType)1