FtcXtensible/src/main/java/org/ftccommunity/ftcxtensible/robot/ExtensibleOpMode.java
@Override
    public final void loop() {
        loopCount++;
        //handleEvents();
        if (skipNextLoop > 0) {
            skipNextLoop--;
            Log.i(TAG, "Skipping Loop #" + getLoopCount());
            return;
        }

        //  determine if the following line is needed;  I think not
        // bindHardwareMap(super.hardwareMap);
        if (status().getMainRobotState() == RobotStatus.MainStates.EXCEPTION &&
                (status().getCurrentStateType() == RobotStatus.Type.FAILURE ||
                        status().getCurrentStateType() == RobotStatus.Type.IDK)) {
            throw new IllegalStateException("Robot cannot continue to execute, due to an exception");
        }

        // Good to continue
        long startTime = System.nanoTime();

        // Update the gamepads
        gamepad1().updateGamepad(this, gamepad1);
        gamepad2().updateGamepad(this, gamepad2);

        // Pre loop init
        status().setMainState(RobotStatus.MainStates.EXEC);
        LinkedList<Object> list = new LinkedList<>();

        // Start loop checks
        for (RunAssistant assistant : loopManager.getPreloopAssistants(getLoopCount())) {
            runAssistant(assistant);
        }

        // Main loop
        try {
            loop(this, list);
        } catch (InterruptedException ex) {
            return;
        } catch (Exception e) {
            handleException(list, e);
        }

        // Post loop processing
        for (RunAssistant assistant : loopManager.getPostLoopAssistants(getLoopCount())) {
            runAssistant(assistant);
        }

        postProcess(list, status().getMainRobotState());

        if (logTimes) {
            long endTime = System.nanoTime();
            long timeTaken = (endTime - startTime);
            loopTimes.add((int) timeTaken);
            tracer.log();
        }
    }
/**
     * The looping system of Extensible OpMode
     */
The looping system of Extensible OpMode
The looping system of Extensible OpMode
@Override
    public final void loop() {
        loopCount++;
        if (skipNextLoop > 0) {
            skipNextLoop--;
            Log.i(TAG, "Skipping Loop #" + getLoopCount());
            return;
        }
        if (status().getMainRobotState() == RobotStatus.MainStates.EXCEPTION &&
                (status().getCurrentStateType() == RobotStatus.Type.FAILURE ||
                        status().getCurrentStateType() == RobotStatus.Type.IDK)) {
            throw new IllegalStateException("Robot cannot continue to execute, due to an exception");
        }
        long startTime = System.nanoTime();
        gamepad1().updateGamepad(this, gamepad1);
        gamepad2().updateGamepad(this, gamepad2);
        status().setMainState(RobotStatus.MainStates.EXEC);
        LinkedList<Object> list = new LinkedList<>();
        for (RunAssistant assistant : loopManager.getPreloopAssistants(getLoopCount())) {
            runAssistant(assistant);
        }
        try {
            loop(this, list);
        } catch (InterruptedException ex) {
            return;
        } catch (Exception e) {
            handleException(list, e);
        }
        for (RunAssistant assistant : loopManager.getPostLoopAssistants(getLoopCount())) {
            runAssistant(assistant);
        }
        postProcess(list, status().getMainRobotState());
        if (logTimes) {
            long endTime = System.nanoTime();
            long timeTaken = (endTime - startTime);
            loopTimes.add((int) timeTaken);
            tracer.log();
        }
    }
@ Override public final void loop ( ) { loopCount ++ ; if ( skipNextLoop > 0 ) { skipNextLoop -- ; Log . i ( TAG , "Skipping Loop #" + getLoopCount ( ) ) ; return ; } if ( status ( ) . getMainRobotState ( ) == RobotStatus . MainStates . EXCEPTION && ( status ( ) . getCurrentStateType ( ) == RobotStatus . Type . FAILURE || status ( ) . getCurrentStateType ( ) == RobotStatus . Type . IDK ) ) { throw new IllegalStateException ( "Robot cannot continue to execute, due to an exception" ) ; } long startTime = System . nanoTime ( ) ; gamepad1 ( ) . updateGamepad ( this , gamepad1 ) ; gamepad2 ( ) . updateGamepad ( this , gamepad2 ) ; status ( ) . setMainState ( RobotStatus . MainStates . EXEC ) ; LinkedList < Object > list = new LinkedList < > ( ) ; for ( RunAssistant assistant : loopManager . getPreloopAssistants ( getLoopCount ( ) ) ) { runAssistant ( assistant ) ; } try { loop ( this , list ) ; } catch ( InterruptedException ex ) { return ; } catch ( Exception e ) { handleException ( list , e ) ; } for ( RunAssistant assistant : loopManager . getPostLoopAssistants ( getLoopCount ( ) ) ) { runAssistant ( assistant ) ; } postProcess ( list , status ( ) . getMainRobotState ( ) ) ; if ( logTimes ) { long endTime = System . nanoTime ( ) ; long timeTaken = ( endTime - startTime ) ; loopTimes . add ( ( int ) timeTaken ) ; tracer . log ( ) ; } }
The looping system of Extensible OpMode
The looping system of Extensible OpMode
//handleEvents(); //  determine if the following line is needed;  I think not // bindHardwareMap(super.hardwareMap); // Good to continue // Update the gamepads // Pre loop init // Start loop checks // Main loop // Post loop processing