DJI-Mobile-SDK-Tutorials / Android-UXSDKDemo

This demo is designed for you to gain a better understanding of the DJI Android UX SDK.
MIT License
42 stars 47 forks source link

Getting drones altitude, longitude and latitude #25

Open tbakale opened 3 years ago

tbakale commented 3 years ago

I am trying to modify the UXSDKDemo aplication so that I can send the drones current coordinates in real time to another aplication so I can show it using VR, now in order to do that I first needed to get the coordinates and to make sure they are correct I decided to modify the UXSDKDemo to show them using a toast message but when I did it it just showed the cooridantes as "NaN". I am not sure if I made some kind of mistake and called the method I made that was getting the coordiantes and the wrong place or maybe it isn't possible to get this information using the UXSDKDemo.

These were the methods (from the DJI SDK) i used in order to get the data.

    `  FlightControllerState currentState = new FlightControllerState(); `
    ` LocationCoordinate3D location = currentState.getAircraftLocation();  `
    ` double lat = location.getLatitude();  `
    ` double lng = location.getLongitude(); `
    `  float alt = location.getAltitude(); `

I called my method in the MApplication class, in its onCreate method, like this:

public void onCreate() { super.onCreate(); demoApplication.onCreate(); demoApplication.showLocation(); };

My biggest concern is that for some reason it is not possible to get the data on longitude, latitude and altitude in the UXSDKDemo, hope you can help me out! Thanks in advance!

dji-dev commented 3 years ago

Agent comment from Luce Luo in Zendesk ticket #51011:

Dear Customer,

Thank you for contacting DJI. No, that's a wrong way, please refer to this sample: https://developer.dji.com/mobile-sdk/documentation/android-tutorials/GSDemo-Gaode-Map.html

Thanks,

Luce Luo DJI Developer Support
inline574008338.png

°°°

tbakale commented 3 years ago

Thank you for the tip! I also have one more question, is there a way to connect the UXSDKDemo to Firebase? I have tried it but it is not letting be because build.grade has JCenter as one of it's repositories and it is getting depricated soon.

dji-dev commented 3 years ago

Agent comment from Luce Luo in Zendesk ticket #51011:

Dear Customer,

Thank you for contacting DJI. It seems that the Firebase is a third-party lib but not DJI and need to integrate by yourself.

Thanks,

Luce Luo DJI Developer Support

°°°