dji-sdk/Windows-SDK

Get the thermal camera feed on the mavic mavic 2 enterprise dual

walseb opened this issue · 7 comments

Hi! I'm trying to get the live feed from the thermal camera. I'm currently running the code that's under the section "Implementing the First Person View" in this article and have added this:

public MainPage()
{
    ...
    Task.Run(enableThermal);
}

private async void enableThermal()
{
    // Wait until camera has booted
    await Task.Delay(TimeSpan.FromSeconds(5));

    CameraDisplayModeMsg msg = new CameraDisplayModeMsg
    {
        value = CameraDisplayMode.THERMAL_ONLY
    };
    DJISDKManager.Instance.ComponentManager.GetCameraHandler(0, 0).SetCameraDisplayModeAsync(msg);
}

But nothing happens when I run it. To get the reason why it failed I ran this:

Task<SDKError> tsk = DJISDKManager.Instance.ComponentManager.GetCameraHandler(0, 0).SetCameraDisplayModeAsync(msg);
await Task.Delay(TimeSpan.FromSeconds(1));

System.Diagnostics.Debug.WriteLine("Tsk status: " + tsk.Result.ToString());

Then I got: Tsk status: REQUEST_HANDLER_NOT_FOUND
I also tried running this:

Task<SDKError> tsk = DJISDKManager.Instance.ComponentManager.GetCameraHandler(0, 0).SetVideoResolutionFrameRateAsync(new VideoResolutionFrameRate { resolution = VideoResolution.RESOLUTION_1920x1080 });
await Task.Delay(TimeSpan.FromSeconds(1));

System.Diagnostics.Debug.WriteLine("Tsk status: " + tsk.Result.ToString());

But then I got: Tsk status: SYSTEM_ERROR. So maybe this is a problem with async tasks in general?

Agent comment from William Wong in Zendesk ticket #33389:

Dear Client
Thank you for contacting DJI.

REQUEST_HANDLER_NOT_FOUND normally means disconnect to the aircraft.
For Mavic 2 Enterprise Dual,in function GetCameraHandler(uint productIndex, uint componentIndex) productIndex should be set to 0 and componentIndex should be set to 2. Since there are 2 cameras.

Hopefully our solution can help you.
Kindly Regards,
DJI Developer Support

Thanks it works now but the thermal image seems to be scrambled. This is what it looks like when I point the camera towards my face.
image
I used the same code as above but with the changes you suggested

Agent comment from William Wong in Zendesk ticket #33389:

Dear Client
Thank you for contacting DJI.

It seems like its the camera mode problem. Firstly, we can try to debug if it is the hardware problem. Try again by using DJI Pilot App to see if everything working. The demo is designed for the normal camera, we think the demo does not ultlise for thermal camera.

Hopefully our solution can help you.
Kindly Regards,
DJI Developer Support

Hmm yeah I get the same problem in the DJI pilot app. In the screenshot the camera is pointing straight towards me
IMG_20200409_105526

The demo is designed for the normal camera, we think the demo does not ultlise for thermal camera.

Yeah but I modified it to work with the thermal camera using the changes above.

Turns out I had the camera cover on, it works fine now in both the DJI pilot app and the windows SDK program. Thanks for all the help!

Agent comment from William Wong in Zendesk ticket #33389:

Dear Client
Thank you for contacting DJI.

That's a great news, good luck on your developing.

Hopefully our solution can help you.
Kindly Regards,
DJI Developer Support

I'm using DJI UX SDK for mobile in android but not getting live video feed from any of its cameras with Mavic 2 enterprise. Any solution?