dogecv / DogeCV

FTC Vision Library
https://discord.gg/colton
GNU General Public License v3.0
68 stars 64 forks source link

FTC Robot controller app crashing at stop? #10

Closed apal1010 closed 5 years ago

apal1010 commented 5 years ago

TI'm experiencing a bug in which after using the Vuforia phone testing OpMode(which works correctly), either after init or after starting the FTC Robot Controller app on the RC phone crashes, with an android dialog saying "Unfortunately, FTC Robot Controller has stopped." This will probably prove to be an issue for us in the future, is there any way to fix this? We are using ZTE speeds for now, but we might upgrade later down the line. Is there any way to stop the app from crashing?

victoryforphil commented 5 years ago

I'll look in to this. Any chance you can get the crash logs from Android studio (logcat)? Either the error it self or just the entire logs. This will help alot in cases where I can't replicate the error on my devices.

apal1010 commented 5 years ago

robotControllerLog.txt Here is the logcat, I hope it's the right file. If not, please let me know the right location. Thanks.

victoryforphil commented 5 years ago

Hi, so that was the right file, and I think I identified the issue, if you are willing to edit source code, we try an attempted fixed.

Edit Dogeforia.java inside of DogeCV Add this snippit inside the for loop, above line 126:

if(trackable == null || ((VuforiaTrackableDefaultListener)trackable.getListener()) == null){
    continue;
}

The for loop should end up looking like this:

for(VuforiaTrackable trackable : trackables){
      if(trackable == null || ((VuforiaTrackableDefaultListener)trackable.getListener()) == null){
            continue;
      }
      if(((VuforiaTrackableDefaultListener)trackable.getListener()).isVisible()){
          Imgproc.putText(outMat,"Vuforia: " + trackable.getName(), new Point(10,50 * count +50),0,2,new Scalar(0,255,0),3);
          count++;
      }
}
apal1010 commented 5 years ago

robotControllerLog.txt Heres the new logcat, but the crash still occurs. The line for the if statement to be inserted on in my code was actually 129 instead of 126, but I doubt thats the problem.

victoryforphil commented 5 years ago

Here as a quick hack, try inside the OpMode to remove vuforia.showDebug(); around line 173.

apal1010 commented 5 years ago

This worked! Thanks!

victoryforphil commented 5 years ago

This is a temporary fix to get your team up and running. This disables the text on the screen that shows you what vuforia target is visable. Vuforia is still active in the background. This merely hides the debug text as apparently that snippit is bugged. I'll look into it and get it patched by next update.

jliew1975 commented 5 years ago

The issue is in line 123 of Dogeforia.java file. When close() is called the loadedTrackableSets is clear out and in line 123 has a hardcoded of loadedTrackablesSets.get(0) which caused and IndexOutOfBoundException.

jliew1975 commented 5 years ago

I fixed it with surrounding it with below if statement:

if(loadedTrackableSets !=null && loadedTrackableSets.size() > 0) {
  VuforiaTrackablesImpl trackables = loadedTrackableSets.get(0);
  ...
}
victoryforphil commented 5 years ago

@jliew1975 Thanks for debugging it for us! We'll implement this change in the next update!