Mobile-SDK-Android-V5 icon indicating copy to clipboard operation
Mobile-SDK-Android-V5 copied to clipboard

Issue with RTK Health Status in DJI MSDK

Open victor-cornis opened this issue 9 months ago • 3 comments

Hello DJI Support,

I am a Kotlin developer working with the DJI MSDK V5 and using RTK functionalities with M350. I am facing an issue where the RTK system reports conflicting states. Here’s my setup:

  • I use callbackFlow to observe rtkHealthy and RTKServiceState.
  • I also implement startRtkCustomNetworkService() and stopRtkCustomNetworkService() to manage RTK connections.
  • Before calling stopRtkCustomNetworkService() and startRtkCustomNetworkService(), I update the RTK network settings using rtkCenter.customRTKManager.customNetworkRTKSettings = settings which sets new values for the server address, port, username, password, and mount point.

When I call stopRtkCustomNetworkService() then startRtkCustomNetworkService(), the logs show that the RTK network transitions as follows:

  1. DISABLED
  2. RTK_START_PROCESSING
  3. READY
  4. TRANSMITTING
  5. TRANSMITTING again However, despite the network being in TRANSMITTING, the rtkHealthy state remains false. Even after stopping and restarting the RTK service, this value does not change.

Questions:

  1. Why is rtkHealthy still false even when the RTK network is in TRANSMITTING state?
  2. Is there an additional condition that must be met for rtkHealthy to become true?
  3. Should I wait for a specific event or state transition before expecting rtkHealthy to update correctly?

Below is my implementation for reference:

Fun stop and start :

private fun stopRtkCustomNetworkService() {
    logger.i("RTK trying to stop connection")
    rtkCenter.customRTKManager.stopNetworkRTKService(
        object :
            CommonCallbacks.CompletionCallback {
            override fun onSuccess() {
                logger.i("RTK Connection stopped")
            }

            override fun onFailure(error: IDJIError) {
                logger.e("RTK failed to stop connection: ${error.description()}")
            }
        })
}

private fun startRtkCustomNetworkService() {
    rtkCenter.customRTKManager.startNetworkRTKService(CoordinateSystem.UNKNOWN, object :
        CommonCallbacks.CompletionCallback {
        override fun onSuccess() {
            logger.i("RTK settings successfully transmitted | Start converging")
        }

        override fun onFailure(error: IDJIError) {
            logger.e("RTK failed connection to network: ${error.description()}")
        }
    })

    logger.i("RTK try start connection with: ${rtkCenter.customRTKManager.customNetworkRTKSettings}")
}

With rtkCenter : rtkCenter = RTKCenter.getInstance()

Keys information :

val isHealthyFlow = callbackFlow {
    val listener = RTKSystemStateListener {
        logger.d("isHealthyFlow emitted: ${it.rtkHealthy}")
        trySend(it.rtkHealthy).onFailure { error ->
            logger.e("Failed to send isHealthyFlow state: $error")
        }
    }
    logger.d("init RTKConnexionObservable")
    rtkCenter.addRTKSystemStateListener(listener)
    awaitClose { rtkCenter.removeRTKSystemStateListener(listener) }
}
val networkStatusFlow: Flow<RTKServiceState> = callbackFlow {
    val listener = object : INetworkServiceInfoListener {
        override fun onServiceStateUpdate(state: RTKServiceState) {
            scope.launch(Dispatchers.Main) { // Ensure execution on the main thread
                logger.d("networkStatusFlow emitted: $state")
                trySend(state).isSuccess
            }
        }

        override fun onErrorCodeUpdate(code: IDJIError?) {
            logger.e("Failed to send networkStatusFlow state: $code")
        }
    }
    listener.onServiceStateUpdate(RTKServiceState.UNKNOWN)
    logger.d("init networkStatusFlow")
    rtkCenter.customRTKManager.addNetworkRTKServiceInfoListener(listener)

    awaitClose {
        rtkCenter.customRTKManager.removeNetworkRTKServiceInfoListener(listener)
    }
}

Thank you for your help!

Best regards, Victor

victor-cornis avatar Feb 25 '25 13:02 victor-cornis

Agent comment from YIGUI LIU in Zendesk ticket #130257:

Dear Developer, Hello and thank you for reaching out to DJI Innovations.

1、Whether getRTKConnected returns true doesn't necessarily mean the RTK has completed the convergence process and reached the fixed solution. It might still be in the process of convergence.

2、When isRTKHealthy is true, it indicates that both the GPS and RTK signals are healthy, and the RTK signal has good accuracy.

3、You may need to wait until the GPS signal is good and the RTK positioning solution reaches the fixed state.

How can you obtain the RTK positioning solution?

  • You can listen through the RTKLocationInfoListener to get the positioningSolution and check if the RTK positioning calculation result is in the fixed state.

We hope that our solution meets your needs satisfactorily. We appreciate your email and wish you a wonderful day! Best Regards, DJI Innovations SDK Technical Support Team

°°°

dji-dev avatar Feb 27 '25 02:02 dji-dev

Hello DJI Support,

I’m encountering an issue when using the stopNetworkRTKService() function. Here’s my implementation:

private fun stopRtkCustomNetworkService() {
    logger.i("RTK trying to stop connection")
    rtkCenter.customRTKManager.stopNetworkRTKService(
        object : CommonCallbacks.CompletionCallback {
            override fun onSuccess() {
                logger.i("RTK connection stopped")
            }

            override fun onFailure(error: IDJIError) {
                logger.e("RTK failed to stop connection: ${error.description()}")
            }
        }
    )
}

Observed Behavior:

After calling stopRtkCustomNetworkService(): → My networkStatusFlow Flow<RTKServiceState> indicates DISABLED → baseSatellites shows 0 satellites → However, isHealthy remains true, even though "Maintain Accuracy Mode" is disabled

Issue:

I would expect isHealthy to become false after stopping RTK, but it still remains true. How can I ensure that the RTK connection is fully stopped so that isHealthy reflects the correct state?

Thank you for your assistance!

Best regards, Victor

victor-cornis avatar Mar 31 '25 09:03 victor-cornis

Hey @dji-dev , Do you have any news ? Best Regards, Victor

victor-cornis avatar Apr 14 '25 13:04 victor-cornis