Technology Forum Has Moved!

The FIRST Tech Challenge Technology forum has moved to a new location! Please take a look at our forum blog for links and instructions on how to access the new forum.


Note that volunteers (except for FTA/WTA/CSA will still access their role specific forum through this site. The blog also outlines how to access the volunteer forums.
See more
See less

Vuforia loadTrackablesFromAsset getting stuck in init()

  • Filter
  • Time
  • Show
Clear All
new posts

  • Vuforia loadTrackablesFromAsset getting stuck in init()

    Our robot is constantly getting stuck in init and restarting.

    We tracked it down to where Vuforia is loading the trackable data:

    targets = this.vuforia.loadTrackablesFromAsset("FTC_2016-17");

    When this line is commented out, init completes. When it is not, we get the "OpMode Stuck in init(), restarting robot" message.

    1) Is this something we should be doing in init()?

    2) If so, any ideas what we can do to speed this up, or otherwise prevent problems in init()?

    Other details:

    We are using the latest release (2.35) of the SDK. Extended just OpMode
    We have previously had this working with only an occasional lockup. However, now it is happening 100% of the time when this line is kept in the code - even when it is the last line in init().

  • #2
    I assume you are using OpMode not LinearOpMode. The init() method in OpMode probably has a watchdog timer to check if it takes too long to init. You may want to change to use LinearOpMode. It's not too difficult to convert your code to use LinearOpMode. You don't even have to change your code much (i.e. keeping your init() and loop() methods).
    public class MyRobot extends LinearOpMode
        public void runOpMode()
            while (opModeIsActive())


    • #3
      All callbacks into opmodes have a watchdog with a default timeout of 5000 milliseconds (except for stop(), which is less). These durations are specified in member variables of OpMode, which can be adjusted (with caution!) by setting the value of (e.g.) msStuckDetectInit in the constructor of your own opmode.

      Remember that these watchdogs are there for a reason. Far, far more often than not they detect bugs that would otherwise go unnoticed, and potentially cause safety concerns (if, for example, motors continue to run after a match is complete because an opmode fails to stop). The most common exception to that is what we're discussing here, the init() timeout: it seems reasonable that some initialization logic can take longer than the accounted-for five seconds. In such situations, adjusting msStuckDetectInit would be appropriate. However, before adjusting any of the other durations, please especially take the time to understand exactly what is actually happening (the logs can be particularly helpful, since they'll give you stack traces, at least with the latest SDK) before assuming that things are simply taking too long for what's allowed for and adjusting a timeout to compensate.

      [COLOR=#008000][I]// Safety Management
      [/I][/COLOR][COLOR=#008000][I]// These constants manage the duration we allow for callbacks to user code to run for before
      [/I][/COLOR][COLOR=#008000][I]// such code is considered to be stuck (in an infinite loop, or wherever) and consequently
      [/I][/COLOR][COLOR=#008000][I]// the robot controller application is restarted. They SHOULD NOT be modified except as absolutely
      [/I][/COLOR][COLOR=#008000][I]// necessary as poorly chosen values might inadvertently compromise safety.
      [/I][/COLOR][COLOR=#000080][B]protected int [/B][/COLOR][COLOR=#660e7a][B]msStuckDetectInit     [/B][/COLOR]= [COLOR=#0000ff]5000[/COLOR];
      [COLOR=#000080][B]protected int [/B][/COLOR][COLOR=#660e7a][B]msStuckDetectInitLoop [/B][/COLOR]= [COLOR=#0000ff]5000[/COLOR];
      [COLOR=#000080][B]protected int [/B][/COLOR][COLOR=#660e7a][B]msStuckDetectStart    [/B][/COLOR]= [COLOR=#0000ff]5000[/COLOR];
      [COLOR=#000080][B]protected int [/B][/COLOR][COLOR=#660e7a][B]msStuckDetectLoop     [/B][/COLOR]= [COLOR=#0000ff]5000[/COLOR];
      [COLOR=#000080][FONT=&amp][B]protected int [/B][/FONT][/COLOR][COLOR=#660E7A][FONT=&amp][B]msStuckDetectStop     [/B][/FONT][/COLOR][COLOR=#000000][FONT=&amp]= [/FONT][/COLOR][COLOR=#0000FF][FONT=&amp]1000[/FONT][/COLOR][COLOR=#000000][FONT=&amp];[/FONT][/COLOR]