Sporadic crashes when swapping between thermal and normal video

I’ve just received an ANAFI USA and I’m currently attempting to integrate it and its thermal capabilities with an existing application. The application streams video and allows another user to remote control the drone and observe its video stream using a URL, and now with the inclusion of the ANAFI USA, they should also be able to swap between camera modes.

The request to change camera mode is sent using a normal API request and works for the most part. However, after switching 2-5 times, the application crashes, with no specified error message. The swap between modes work in the groundsdk-demo, however, the demo application appears to “restart” the video stream each time the mode is changed, most likely a result of switching between activities. The video stream in my case however remains active and within the same activity, triggering thanks to a listener, capturing the API requests.

Currently the meager code snippet that handles this change looks as follows:

            if(config.getCameraType() == ActionProto.CameraConfig.CameraType.THERMAL){
                if (mBlendedThermal != null) {
                    ThermalControl.Mode mode = mThermalControl.mode().getValue();
                    if (mode != ThermalControl.Mode.EMBEDDED) {
                        mThermalControl.mode().setValue(ThermalControl.Mode.EMBEDDED);
                    }
                }
            } else if (config.getCameraType() == ActionProto.CameraConfig.CameraType.NORMAL) {
                if (mCamera != null && !mCamera.isActive()) {
                    mThermalControl.mode().setValue(ThermalControl.Mode.DISABLED);
                }
            }

Is there anything I’m missing in order to get this to work in terms of code or the general behavior of camera modes? I’ve looked around for sample code targeting parrot-thermal however have only found dead links.

Thank you

Thanks for reporting.
Usually the GroundSdk demo code is how we implement it it our app.
We will look into this.

1 Like

Hi,

The best way to switch from the main camera to the thermal camera is :

  1. Stop the video stream.
  2. Set thermal control mode to embedded.
  3. Wait for the thermal camera to be active.
  4. Start the video stream.

Here you could find an android studio sample to display thermal video with blending embedded on the drone, here all GroundSdk Android samples and here all GroundSdk iOS samples.

Regards,
Maxime

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.