MobileSDK app to stream telemetry data from the drone over TCP
2403 1 2020-5-20
Uploading and Loding Picture ...(0/1)
o(^-^)o
djiuser_2iEDW7qTJSou
lvl.1
Flight distance : 2159 ft

Denmark
Offline

Good afternoon,
Frist of all I wanted to disclose that I am new to the developement world of the DJI SDKs and have no experience in Java or Android App developement. Nevertheless I am currently trying to develop an app using the MobileSDK that will allow me to retrieve telemetry data and video feed from a Matrice 210 v2 RTK and stream it over TCP so it can be displayed in a 3rd party User Interface. I have gone through all the different tutorials I could find as well as read all of the Documentation related to the MSDK, but I have not been able to figure out how this can be done.

I have been browsing through the sample codes available and have decided that the easiest way will probably to create an extra class for the MSDK Sample Code Demo (https://github.com/dji-sdk/Mobile-SDK-Android/tree/master/Sample%20Code). So I went ahead and created a new package inside main/java/com.dji.sdk.sample/demo called aircraftstate with a class FlightControllerCurrentState inside of it. As for the code to include inside this class I know where I am supposed to be looking in the API Reference but not how this code should be implemented.

Both of these classes are the ones containing the methods to extract telemetry: DJIFlightController (https://developer.dji.com/iframe/mobile-sdk-doc/android/reference/dji/sdk/FlightController/DJIFlightController.html) and DJIFlightControllerCurrentState (https://developer.dji.com/iframe/mobile-sdk-doc/android/reference/dji/common/flightcontroller/DJIFlightControllerCurrentState.html).

I will attach the little code I have written so far but that has not worked:
package com.dji.sdk.sample.demo.aircraftstate;

import com.dji.sdk.sample.internal.utils.ToastUtils;

import androidx.annotation.NonNull;
import dji.common.flightcontroller.Attitude;
import dji.common.flightcontroller.FlightControllerState;

public class FlightControllerCurrentState {
    @NonNull
    FlightControllerState getState();

    public Attitude getAttitude ();
        ToastUtils.setResultToToast("This is the attitude");
}

As for the aircraft itself, we installed the OSDK on it and managed through the use of ROS and python to subscribe to the topic that extract the latitude and longitude, so the next step is to use the MSDK to stream this telemetry over TCP. I know this question is very generic and there is not much to go on from, but I am really a noob in these terrain and don't have a lot to go on from. I am hoping it'll be enough to find someone that can point me in the right direction


EDIT: I tried to follow this guide https://masterofcode.com/blog/dji-drone-sdk-implementation-for-android as well, as achieving what this guide proposes would pretty much solve my problems but was not able to implement the code present there.
2020-5-20
Use props
Spacemarine
lvl.4
  • >>>
Hong Kong
Offline

Hi, i feel like your basic Java grammar is wrong. For getting state, try DJISampleApplication.getAircraftInstance()).getFlightController().getState(); and DJISampleApplication.getAircraftInstance()).getFlightController().getState().getAttitude();
2020-5-20
Use props
Advanced
You need to log in before you can reply Login | Register now

Credit Rules