Search in sources :

Example 1 with FtcEventLoopIdle

use of com.qualcomm.ftccommon.FtcEventLoopIdle in project robotcode by OutoftheBoxFTC.

the class FtcRobotControllerActivity method requestRobotSetup.

private void requestRobotSetup() {
    if (controllerService == null) {
        return;
    }
    HardwareFactory factory;
    RobotConfigFile file = cfgFileMgr.getActiveConfigAndUpdateUI();
    HardwareFactory hardwareFactory = new HardwareFactory(context);
    try {
        hardwareFactory.setXmlPullParser(file.getXml());
    } catch (Resources.NotFoundException e) {
        file = RobotConfigFile.noConfig(cfgFileMgr);
        hardwareFactory.setXmlPullParser(file.getXml());
        cfgFileMgr.setActiveConfigAndUpdateUI(false, file);
    }
    factory = hardwareFactory;
    OpModeRegister userOpModeRegister = createOpModeRegister();
    eventLoop = new FtcEventLoop(factory, userOpModeRegister, callback, this, programmingModeController);
    FtcEventLoopIdle idleLoop = new FtcEventLoopIdle(factory, userOpModeRegister, callback, this, programmingModeController);
    controllerService.setCallback(callback);
    controllerService.setupRobot(eventLoop, idleLoop);
    passReceivedUsbAttachmentsToEventLoop();
}
Also used : HardwareFactory(com.qualcomm.hardware.HardwareFactory) FtcEventLoop(com.qualcomm.ftccommon.FtcEventLoop) RobotConfigFile(com.qualcomm.ftccommon.configuration.RobotConfigFile) OpModeRegister(com.qualcomm.robotcore.eventloop.opmode.OpModeRegister) Resources(android.content.res.Resources) FtcEventLoopIdle(com.qualcomm.ftccommon.FtcEventLoopIdle)

Example 2 with FtcEventLoopIdle

use of com.qualcomm.ftccommon.FtcEventLoopIdle in project FTC-2017 by FIRST-4030.

the class FtcRobotControllerActivity method requestRobotSetup.

private void requestRobotSetup() {
    if (controllerService == null)
        return;
    HardwareFactory factory;
    RobotConfigFile file = cfgFileMgr.getActiveConfigAndUpdateUI();
    HardwareFactory hardwareFactory = new HardwareFactory(context);
    try {
        hardwareFactory.setXmlPullParser(file.getXml());
    } catch (Resources.NotFoundException e) {
        file = RobotConfigFile.noConfig(cfgFileMgr);
        hardwareFactory.setXmlPullParser(file.getXml());
        cfgFileMgr.setActiveConfigAndUpdateUI(false, file);
    }
    factory = hardwareFactory;
    OpModeRegister userOpModeRegister = createOpModeRegister();
    eventLoop = new FtcEventLoop(factory, userOpModeRegister, callback, this, programmingModeController);
    FtcEventLoopIdle idleLoop = new FtcEventLoopIdle(factory, userOpModeRegister, callback, this, programmingModeController);
    controllerService.setCallback(callback);
    controllerService.setupRobot(eventLoop, idleLoop);
    passReceivedUsbAttachmentsToEventLoop();
}
Also used : HardwareFactory(com.qualcomm.hardware.HardwareFactory) FtcEventLoop(com.qualcomm.ftccommon.FtcEventLoop) RobotConfigFile(com.qualcomm.ftccommon.configuration.RobotConfigFile) OpModeRegister(com.qualcomm.robotcore.eventloop.opmode.OpModeRegister) Resources(android.content.res.Resources) FtcEventLoopIdle(com.qualcomm.ftccommon.FtcEventLoopIdle)

Example 3 with FtcEventLoopIdle

use of com.qualcomm.ftccommon.FtcEventLoopIdle in project Relic_Main by TeamOverdrive.

the class FtcRobotControllerActivity method requestRobotSetup.

private void requestRobotSetup() {
    if (controllerService == null)
        return;
    HardwareFactory factory;
    RobotConfigFile file = cfgFileMgr.getActiveConfigAndUpdateUI();
    HardwareFactory hardwareFactory = new HardwareFactory(context);
    try {
        hardwareFactory.setXmlPullParser(file.getXml());
    } catch (Resources.NotFoundException e) {
        file = RobotConfigFile.noConfig(cfgFileMgr);
        hardwareFactory.setXmlPullParser(file.getXml());
        cfgFileMgr.setActiveConfigAndUpdateUI(false, file);
    }
    factory = hardwareFactory;
    OpModeRegister userOpModeRegister = createOpModeRegister();
    eventLoop = new FtcEventLoop(factory, userOpModeRegister, callback, this, programmingModeController);
    FtcEventLoopIdle idleLoop = new FtcEventLoopIdle(factory, userOpModeRegister, callback, this, programmingModeController);
    controllerService.setCallback(callback);
    controllerService.setupRobot(eventLoop, idleLoop);
    passReceivedUsbAttachmentsToEventLoop();
}
Also used : HardwareFactory(com.qualcomm.hardware.HardwareFactory) FtcEventLoop(com.qualcomm.ftccommon.FtcEventLoop) RobotConfigFile(com.qualcomm.ftccommon.configuration.RobotConfigFile) OpModeRegister(com.qualcomm.robotcore.eventloop.opmode.OpModeRegister) Resources(android.content.res.Resources) FtcEventLoopIdle(com.qualcomm.ftccommon.FtcEventLoopIdle)

Aggregations

Resources (android.content.res.Resources)3 FtcEventLoop (com.qualcomm.ftccommon.FtcEventLoop)3 FtcEventLoopIdle (com.qualcomm.ftccommon.FtcEventLoopIdle)3 RobotConfigFile (com.qualcomm.ftccommon.configuration.RobotConfigFile)3 HardwareFactory (com.qualcomm.hardware.HardwareFactory)3 OpModeRegister (com.qualcomm.robotcore.eventloop.opmode.OpModeRegister)3