wpilibsuite / shuffleboard

A modern dashboard for FRC
Other
79 stars 84 forks source link

CameraServer telemetry exceptions #781

Open Starlight220 opened 1 year ago

Starlight220 commented 1 year ago

The log here has the following exceptions:

Mar 24, 2023 6:51:40 PM edu.wpi.first.shuffleboard.plugin.cameraserver.source.CameraServerSource lambda$new$5
WARNING: Could not get bandwidth
VideoException [edu.wpi.first.cscore.VideoException: empty value]
    at edu.wpi.first.cscore.CameraServerJNI.getTelemetryAverageValue(Native Method)
    at edu.wpi.first.cscore.CameraServerJNI.getTelemetryAverageValue(CameraServerJNI.java:364)
    at edu.wpi.first.cscore.VideoSource.getActualDataRate(VideoSource.java:334)
    at edu.wpi.first.shuffleboard.plugin.cameraserver.source.CameraServerSource.lambda$new$5(CameraServerSource.java:139)

Mar 24, 2023 6:51:40 PM edu.wpi.first.shuffleboard.plugin.cameraserver.source.CameraServerSource lambda$new$5
WARNING: Could not get framerate
VideoException [edu.wpi.first.cscore.VideoException: empty value]
    at edu.wpi.first.cscore.CameraServerJNI.getTelemetryAverageValue(Native Method)
    at edu.wpi.first.cscore.CameraServerJNI.getTelemetryAverageValue(CameraServerJNI.java:364)
    at edu.wpi.first.cscore.VideoSource.getActualFPS(VideoSource.java:321)
    at edu.wpi.first.shuffleboard.plugin.cameraserver.source.CameraServerSource.lambda$new$5(CameraServerSource.java:145)

@PeterJohnson Now that I look at the API docs of those cscore methods, I see this warning:

   * <p>CameraServerJNI#setTelemetryPeriod() must be called for this to be valid (throws
   * VisionException if telemetry is not enabled).

It appears that this might be what's happening here, despite that method being called here, after loading the native libs, when the plugin is loaded: https://github.com/wpilibsuite/shuffleboard/blob/69b2dc2e98c3aa34d5ac3aec6a692467d36db6e2/plugins/cameraserver/src/main/java/edu/wpi/first/shuffleboard/plugin/cameraserver/CameraServerPlugin.java#L57 Is it possible that one second isn't fast enough? What can cause this?

Originally posted by @Starlight220 in https://github.com/wpilibsuite/shuffleboard/issues/773#issuecomment-1486507619