dji-sdk / Mobile-SDK-Android

DJI Mobile SDK for Android: http://developer.dji.com/mobile-sdk/
Other
998 stars 580 forks source link

Distance between drone and home point #1280

Open danilofariadutra opened 7 months ago

danilofariadutra commented 7 months ago

What method should I use to acquire the value of the distance already traveled between the homepoint and the current location of the drone, just like in the DJI app?

dji-dev commented 7 months ago

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

Could you clarify if the distance you are referring to is the flying distance after the aircraft takes off, or the straight-line distance between the current position of the aircraft and the return point?

Thank you.

°°°

danilofariadutra commented 7 months ago

the straight-line distance between the current position of the aircraft and the return point

dji-dev commented 7 months ago

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

You can calculate the distance between the current location of the aircraft and the return point after obtaining their positions. The current location of the aircraft can be obtained using FlightController.getState.getAircraftLocation. The return point location can be obtained using FlightController.getState.getHomeLocation. The latitude and longitude coordinates obtained are all based on the WGS84 coordinate system.

°°°