Skip to content

CameraKey.KeyStartShootPhoto.create(cameraIndex) on Matrice 4 leads to SYSTEM_ERROR #537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
SteliosPapamichail opened this issue Apr 7, 2025 · 7 comments

Comments

@SteliosPapamichail
Copy link

We are trying to take pictures on a Matrice 4 drone via:

        CameraKey.KeyStartShootPhoto.create(cameraIndex).action({
            Timber.i("Started shoot photo")
        }, { e: IDJIError ->
            emitMediaError(MediaError.ERROR_PHOTO)
            Timber.i("Shoot photo failed: ${e.errorCode()} ${e.description()}")
        })

but this initially threw a CANNOT_START_TASK_ON_WEAK_GPS null error (why do pictures depend on the GPS signal) and after moving to an outdoor area, we started getting SYSTEM_ERROR null. Tried restarting the drone but nothing seems to work right now.

@dji-dev
Copy link
Contributor

dji-dev commented Apr 8, 2025

Agent comment from YIGUI LIU in Zendesk ticket #138759:

Dear Developer,

When taking a photo, you get the error message "CANNOT_START_TASK_ON_WEAK_GPS", but it doesn't seem to be the real cause. There's an issue with the error return.

Based on the experiences of previous developers facing the same situation, it's usually caused by incorrectly calling the photo-taking interface during a waypoint mission, having too short an interval between two photo-taking operations, or the memory card being full.

Best Regards,
DJI Innovations SDK Technical Support Team

°°°

@SteliosPapamichail
Copy link
Author

Yeah in general the MSDK5 seems to return a lot of such system errors with null descriptions so it's really hard for us to debug what's going on. In this case, we have confirmed that the SYSTEM_ERROR null occurs without having executed any waypoint-related code, no other photo-taking operations before or after the error and while the SD card has multiple GBs of space. We've also made sure to try after restarting the drone and the controller completely.

@dji-dev
Copy link
Contributor

dji-dev commented Apr 8, 2025

Agent comment from YIGUI LIU in Zendesk ticket #138759:

Dear Developer,

You can try to see if you can take photos successfully in the sample code app. In the Key/Value function of the Testing Tools, you can perform operations on relevant keys. If it succeeds, the problem might lie in your code implementation.

Refer to the detailed picture below: https://pan-sec.djicorp.com/s/mq8SR2rgXAReLbM
Run the sample code: https://developer.dji.com/doc/mobile-sdk-tutorial/en/quick-start/run-sample.html

After ensuring that the MSDK has been successfully registered and connected to the aircraft, before starting to take photos, you need to set KeyCameraMode to the photo - taking mode, such as PHOTO_NORMAL.
Then, execute the photo - taking operation through KeyManager.getInstance().performAction(KeyTools.createKey(cameraKey.KeyStartShootPhoto, cameraIndex)).

We appreciate your email and wish you a wonderful day!
Best Regards,
DJI Innovations SDK Technical Support Team

°°°

@SteliosPapamichail
Copy link
Author

SteliosPapamichail commented Apr 9, 2025

I tried using your code but when using the physical buttons on the controller of the M4T drone we get the system error still. Only when using the physical buttons though.

@dji-dev
Copy link
Contributor

dji-dev commented Apr 10, 2025

Agent comment from YIGUI LIU in Zendesk ticket #138759:


Dear Developer,

Regarding the issue that the KeyStartShootPhoto interface cannot be executed, you can refer to the following link, which provides relevant introductions about the invocation of MSDK Keys.
https://sdk-forum.dji.net/hc/en-us/articles/6392364742809-Chapter-4-The-KeyManager-and-the-DJIKey
https://sdk-forum.dji.net/hc/en-us/articles/15152468943641

Regarding the problem that the physical buttons of the M4T cannot perform the photo-taking operation, you can use the MSDK API to Listen the physical buttons (KeyShutterButtonDown), and call KeyStartShootPhoto when it is detected that the button is pressed. For detailed reference, please refer to the [Listen the physical buttons] section in the following article.
https://sdk-forum.dji.net/hc/en-us/articles/9849289626265-Chapter-13-Remote-Controller

Best Regards,
DJI Innovations SDK Technical Support Team

°°°

@SteliosPapamichail
Copy link
Author

Hello!

We are already listening to the physical buttons like this:

RemoteControllerKey.KeyShutterButtonDown.create().listen(this) {
    if (it != true) return@listen
    when (_mediaState.value.cameraModeState) {
        CameraModeState.Photo -> shootPhoto()
        CameraModeState.Video, CameraModeState.Recording -> switchCameraMode()
    }
}

where shootPhoto() is defined as:

fun shootPhoto() {
    val cameraIndex = getCurrentCameraIndex()
    if (cameraMode != CameraMode.PHOTO_NORMAL) {
        setDjiCameraMode(CameraMode.PHOTO_NORMAL)
    }
    if (animatePhotoScope == null) animatePhotoScope = CoroutineScope(Dispatchers.Main)
    animatePhotoScope?.launch {
        _animatePhotoFlow.emit(true)
    }

    KeyManager.getInstance().performAction(
        KeyTools.createKey(CameraKey.KeyStartShootPhoto, cameraIndex),
        object : CompletionCallbackWithParam<EmptyMsg> {
            override fun onSuccess(p0: EmptyMsg?) {
                Timber.i("Started shoot photo with cameraIndex $cameraIndex")
            }

            override fun onFailure(p0: IDJIError) {
                emitMediaError(MediaError.ERROR_PHOTO)
                Timber.i("Shoot photo failed for cameraIndex $cameraIndex: ${p0.errorCode()} ${p0.description()}")
            }
        })
}

The issue still persists with the SYSTEM_ERROR only when using the physical buttons and only for the new M4T drone. This same code works fine for the other drones such as M3 enterprise.

@dji-dev
Copy link
Contributor

dji-dev commented Apr 14, 2025

Agent comment from YIGUI LIU in Zendesk ticket #138759:

Dear Developer,

It's a bit strange that the same MSDK code can be used on the M3E but not on the M4T.

You can also try passing in ComponentIndexType.LEFT_OR_MAIN and CameraLensType.CAMERA_LENS_ZOOM when calling the KeyStartShootPhoto interface for taking photos, that is, adding the lensType input parameter.

Best Regards,
DJI Innovations SDK Technical Support Team

°°°

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants