OpenFTC / EOCV-AprilTag-Plugin

Track AprilTags on your FTC robot!
60 stars 49 forks source link

Timeout after 5 minutes of runtime #2

Closed SBansal947 closed 1 year ago

SBansal947 commented 1 year ago

We were testing with the example programs and noticed the robot controller would crash after an extended amount of runtime. After further testing, these crashes would happen at exactly 5 minutes, with memory not being a constraint or cause. Is this an intentional timeout and is it possible to bypass it to prevent crashes?

Windwoes commented 1 year ago

No that's definitely not intentional.... was it a segfault or a Java crash? Does it happen with two different camera models? What RC device? Do you have logs from the encounter?

SBansal947 commented 1 year ago

Looks like a Java crash, these are the logs from the robot controller, which is a control hub on 8.0. The camera model is a Logitech C920 HD.

09-23 19:52:18.653  7699  7804 D UvcStream: [stream.cpp:729] this is the UVC processTransfer() stream processing thread
09-23 19:52:18.653  7699  7956 D UsbResiliantWebcam|DelCaptureSequence: ...startStreaming(Stopped)
09-23 19:52:18.653  7699  7956 D UsbResiliantWebcam|DelCaptureSession: ...startCapture()
09-23 19:52:18.653  7699  7956 I System.out: OpenCvWebcam: onConfigured
09-23 19:52:18.653  7699  7952 I System.out: OpenCvWebcam: streaming started
09-23 19:52:19.001  7699  7955 E cv::error(): OpenCV(4.5.3) Error: Assertion failed (src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols) in Java_org_opencv_android_Utils_nMatToBitmap2, file /build/master_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp, line 101
09-23 19:52:19.002  7699  7955 E org.opencv.android.Utils: nMatToBitmap caught cv::Exception: OpenCV(4.5.3) /build/master_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'Java_org_opencv_android_Utils_nMatToBitmap2'
--------- beginning of crash
09-23 19:52:19.003  7699  7955 E AndroidRuntime: FATAL EXCEPTION: Thread-19
09-23 19:52:19.003  7699  7955 E AndroidRuntime: Process: com.qualcomm.ftcrobotcontroller, PID: 7699
09-23 19:52:19.003  7699  7955 E AndroidRuntime: CvException [org.opencv.core.CvException: OpenCV(4.5.3) /build/master_pack-android/opencv/modules/java/generator/src/cpp/utils.cpp:101: error: (-215:Assertion failed) src.dims == 2 && info.height == (uint32_t)src.rows && info.width == (uint32_t)src.cols in function 'Java_org_opencv_android_Utils_nMatToBitmap2'
09-23 19:52:19.003  7699  7955 E AndroidRuntime: ]
09-23 19:52:19.003  7699  7955 E AndroidRuntime:    at org.opencv.android.Utils.nMatToBitmap2(Native Method)
09-23 19:52:19.003  7699  7955 E AndroidRuntime:    at org.opencv.android.Utils.matToBitmap(Utils.java:123)
09-23 19:52:19.003  7699  7955 E AndroidRuntime:    at org.opencv.android.Utils.matToBitmap(Utils.java:132)
09-23 19:52:19.003  7699  7955 E AndroidRuntime:    at org.openftc.easyopencv.OpenCvViewport$RenderThread.run(OpenCvViewport.java:580)
09-23 19:52:19.019  7699  7699 V RCActivity: onPause()
--------- beginning of main

Just to note, we have tried modifying the streaming size. We tested both: camera.startStreaming(800, 448, OpenCvCameraRotation.UPRIGHT); and camera.startStreaming(1920, 1080, OpenCvCameraRotation.UPRIGHT); Pretty much all of the code is straight off the example.

Windwoes commented 1 year ago

I will try to replicate this, but, looking at the timestamps in your log, the gap between start of streaming and the crash is less than 1 second, not 5 minutes?

SBansal947 commented 1 year ago

The log is just a snippet of what happened when it crashed and not the log for the whole 5 minutes, so if you need the full log we can send it. For replication, we just ran the sample opmodes continuously for 5 minutes with the only change being an ElapsedTimer in telemetry, but the crash was happening with or without the clock.

Windwoes commented 1 year ago

I just tested running the AprilTagDemo OpMode on a Control Hub with EOCV v1.5.2, AprilTag v1.1.0, SDK v8.0, and a Logitech C920 and it ran for 40 minutes without any issues. So I'm not really sure what's going on for you. I definitely will need to see the whole log.

SBansal947 commented 1 year ago

Thanks for the help! I tested it again with a fresh install of the SDK and it isn't crashing anymore. I'm not sure exactly what caused the issue the first time around, but it doesn't seem to be a problem anymore.