dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
247 stars 126 forks source link

Fetch Geoid Height without Drone connection #338

Closed tkocik92 closed 1 month ago

tkocik92 commented 1 month ago

SDK: 5.8.0 and 5.9.0 Drone (if it matters): Mavic 3E

I am attempting to implement the ASL and AGM altitude modes. I found 2 classes inside the SDK that allow me to get the necessary Geoid Height: GeoidManager and GpsUtils. I utilize them like so:

val geoidHeight = GeoidManager.getInstance().geoidhEgm96(latitude, longitude)
val otherGeoidHeight = GpsUtils.getGeoidOffset(latitude, longitude)

However, both of these methods return 0 if the drone is disconnected. Is there a way to work around this?

dji-dev commented 1 month ago

Agent comment from yating.liao in Zendesk ticket #107782:

GeoidManager needs to be initialized before use. You can refer to the end of this article for more information. https://sdk-forum.dji.net/hc/en-us/articles/12976584102041-What-is-the-difference-between-ellipsoidal-height-and-elevation

°°°

tkocik92 commented 1 month ago

Following that article worked. A word of caution for anyone implementing: calling any function immediately after GeoidManager.getInstance().init() is likely to result in inaccurate values. It appears the init() call takes time finish but there is no visibility to when it is fully initialized.

dji-dev commented 1 month ago

Agent comment from yating.liao in Zendesk ticket #107782:

To determine when the initialization is complete, you can check if a geographic file has been generated in the package path with the file extension DAC.

°°°