use of com.qualcomm.hardware.matrix.MatrixDcMotorController 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);
}
}
Aggregations