Search in sources :

Example 1 with ServoController

use of com.qualcomm.robotcore.hardware.ServoController in project robotcode by OutoftheBoxFTC.

the class HardwareFactory method mapUsbServoController.

private void mapUsbServoController(HardwareMap map, DeviceManager deviceMgr, ServoControllerConfiguration ctrlConf) throws RobotCoreException, InterruptedException {
    if (!ctrlConf.isEnabled()) {
        return;
    }
    ServoController servoController = deviceMgr.createUsbServoController(ctrlConf.getSerialNumber(), ctrlConf.getName());
    map.servoController.put(ctrlConf.getName(), servoController);
    for (DeviceConfiguration servoConf : ctrlConf.getDevices()) {
        mapServo(map, deviceMgr, servoConf, servoController);
    }
}
Also used : LynxServoController(com.qualcomm.hardware.lynx.LynxServoController) MatrixServoController(com.qualcomm.hardware.matrix.MatrixServoController) ServoController(com.qualcomm.robotcore.hardware.ServoController) LynxUsbDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxUsbDeviceConfiguration) LynxI2cDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxI2cDeviceConfiguration) DeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration)

Example 2 with ServoController

use of com.qualcomm.robotcore.hardware.ServoController in project robotcode by OutoftheBoxFTC.

the class HardwareFactory method mapNxtServoController.

private void mapNxtServoController(HardwareMap map, DeviceManager deviceMgr, LegacyModule legacyModule, DeviceConfiguration devConf) {
    if (!devConf.isEnabled()) {
        return;
    }
    ServoController sc = deviceMgr.createHTServoController(legacyModule, devConf.getPort(), devConf.getName());
    map.servoController.put(devConf.getName(), sc);
    for (DeviceConfiguration servoConf : ((ServoControllerConfiguration) devConf).getServos()) {
        mapServo(map, deviceMgr, servoConf, sc);
    }
}
Also used : ServoControllerConfiguration(com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration) LynxServoController(com.qualcomm.hardware.lynx.LynxServoController) MatrixServoController(com.qualcomm.hardware.matrix.MatrixServoController) ServoController(com.qualcomm.robotcore.hardware.ServoController) LynxUsbDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxUsbDeviceConfiguration) LynxI2cDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxI2cDeviceConfiguration) DeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration)

Example 3 with ServoController

use of com.qualcomm.robotcore.hardware.ServoController in project robotcode by OutoftheBoxFTC.

the class HardwareFactory method mapMatrixController.

private void mapMatrixController(HardwareMap map, DeviceManager deviceMgr, LegacyModule legacyModule, DeviceConfiguration devConf) {
    if (!devConf.isEnabled()) {
        return;
    }
    MatrixMasterController master = new MatrixMasterController((ModernRoboticsUsbLegacyModule) legacyModule, devConf.getPort());
    DcMotorController mc = new MatrixDcMotorController(master);
    map.dcMotorController.put(devConf.getName() + "Motor", mc);
    map.dcMotorController.put(devConf.getName(), mc);
    for (DeviceConfiguration motorConf : ((MatrixControllerConfiguration) devConf).getMotors()) {
        mapMotor(map, deviceMgr, (MotorConfiguration) motorConf, mc);
    }
    ServoController sc = new MatrixServoController(master);
    map.servoController.put(devConf.getName() + "Servo", sc);
    map.servoController.put(devConf.getName(), sc);
    for (DeviceConfiguration servoConf : ((MatrixControllerConfiguration) devConf).getServos()) {
        mapServo(map, deviceMgr, servoConf, sc);
    }
}
Also used : MatrixControllerConfiguration(com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration) MatrixMasterController(com.qualcomm.hardware.matrix.MatrixMasterController) MatrixServoController(com.qualcomm.hardware.matrix.MatrixServoController) MatrixDcMotorController(com.qualcomm.hardware.matrix.MatrixDcMotorController) MatrixDcMotorController(com.qualcomm.hardware.matrix.MatrixDcMotorController) ModernRoboticsUsbDcMotorController(com.qualcomm.hardware.modernrobotics.ModernRoboticsUsbDcMotorController) HiTechnicNxtDcMotorController(com.qualcomm.hardware.hitechnic.HiTechnicNxtDcMotorController) DcMotorController(com.qualcomm.robotcore.hardware.DcMotorController) LynxDcMotorController(com.qualcomm.hardware.lynx.LynxDcMotorController) LynxUsbDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxUsbDeviceConfiguration) LynxI2cDeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.LynxI2cDeviceConfiguration) DeviceConfiguration(com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration) LynxServoController(com.qualcomm.hardware.lynx.LynxServoController) MatrixServoController(com.qualcomm.hardware.matrix.MatrixServoController) ServoController(com.qualcomm.robotcore.hardware.ServoController)

Aggregations

LynxServoController (com.qualcomm.hardware.lynx.LynxServoController)3 MatrixServoController (com.qualcomm.hardware.matrix.MatrixServoController)3 ServoController (com.qualcomm.robotcore.hardware.ServoController)3 DeviceConfiguration (com.qualcomm.robotcore.hardware.configuration.DeviceConfiguration)3 LynxI2cDeviceConfiguration (com.qualcomm.robotcore.hardware.configuration.LynxI2cDeviceConfiguration)3 LynxUsbDeviceConfiguration (com.qualcomm.robotcore.hardware.configuration.LynxUsbDeviceConfiguration)3 HiTechnicNxtDcMotorController (com.qualcomm.hardware.hitechnic.HiTechnicNxtDcMotorController)1 LynxDcMotorController (com.qualcomm.hardware.lynx.LynxDcMotorController)1 MatrixDcMotorController (com.qualcomm.hardware.matrix.MatrixDcMotorController)1 MatrixMasterController (com.qualcomm.hardware.matrix.MatrixMasterController)1 ModernRoboticsUsbDcMotorController (com.qualcomm.hardware.modernrobotics.ModernRoboticsUsbDcMotorController)1 DcMotorController (com.qualcomm.robotcore.hardware.DcMotorController)1 MatrixControllerConfiguration (com.qualcomm.robotcore.hardware.configuration.MatrixControllerConfiguration)1 ServoControllerConfiguration (com.qualcomm.robotcore.hardware.configuration.ServoControllerConfiguration)1