How to add mavlink items


You get it from your connected DeviceController


I have create this 2 files.

private void initIHM() {

    mTakeOffLand = (TextView)findViewById(;
    mTakeOffLandBt = (Button) findViewById(;
    mTakeOffLandBt.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            LatLng latLng;
            String fileName;
            Log.i(TAG,String.format("flying state equal to = %d", mBebopDrone.getAutoFlyingState().getValue()));
        switch (mBebopDrone.getAutoFlyingState()) {
                Log.i(TAG, "loaded state");
                Log.i(TAG, "playing state");
                Log.i(TAG, "paused state");
                Log.i(TAG, "playing");
                latLng = new LatLng(droneLat,droneLng);
                fileName = mBebopDrone.generateMavlinkFile(latLng, 1.5f, 1.5f);
                mBebopDrone.transmitMavlinkFile(AutonomousBebopActivity.this, service, fileName);
                Log.i(TAG, "default");

private ARDataTransferManager dataTransferManager;
private ARDataTransferUploader uploader;
private ARUtilsManager uploadManager;
private HandlerThread uploadHandlerThread;
private Runnable uploadRunnable;
private Handler uploadHandler;

public void transmitMavlinkFile(final Context ctx, @NonNull ARDiscoveryDeviceService deviceService, final String filename) {
    try {
        ARDISCOVERY_PRODUCT_ENUM product = ARDiscoveryService.getProductFromProductID(deviceService.getProductID());
        String address = ((ARDiscoveryDeviceNetService)(deviceService.getDevice())).getIp();
        ARFeatureCommon featureCommon = mDeviceController.getFeatureCommon();

        dataTransferManager = new ARDataTransferManager();
        uploader = dataTransferManager.getARDataTransferUploader();
        uploadManager = new ARUtilsManager();

            uploadManager.initWifiFtp(UsbAccessoryMux.get(ctx).getMux().newMuxRef(), address, 61, "", "");
        } else {
            uploadManager.initWifiFtp(address, 61, "", "");

        final UploadListener listener = new UploadListener(featureCommon);
        uploader.createUploader(uploadManager, "flightPlan.mavlink", filename, listener, null, listener, null, ARDATATRANSFER_UPLOADER_RESUME_ENUM.ARDATATRANSFER_UPLOADER_RESUME_FALSE);

        uploadHandlerThread = new HandlerThread("mavlink_uploader");

        uploadRunnable = uploader.getUploaderRunnable();
        uploadHandler = new Handler(uploadHandlerThread.getLooper());;

    } catch (Exception e) {
        Log.e(TAG, "transmitMavlinkFile exception: " + e.getMessage(), e);

private class UploadListener implements ARDataTransferUploaderProgressListener, ARDataTransferUploaderCompletionListener {

    private final ARFeatureCommon featureCommon;

    private UploadListener(final ARFeatureCommon featureCommon) {
        this.featureCommon = featureCommon;

    public void didUploadComplete(Object arg, final ARDATATRANSFER_ERROR_ENUM error) {
        if (ARPro3Application.DEBUG) Log.d(TAG, "mavlink didUploadComplete status=" +;

        final Object lock = new Object();

        synchronized (lock) {
            new Thread() {
                public void run() {
                    synchronized (lock) {
                        uploader = null;

                        uploadManager = null;

                        dataTransferManager = null;

                        uploadHandlerThread = null;

                        if (ARPro3Application.DEBUG) Log.d(TAG, "released uploader resources");

                        if (featureCommon != null && error == ARDATATRANSFER_ERROR_ENUM.ARDATATRANSFER_OK) {
                            if (ARPro3Application.DEBUG) Log.d(TAG, "sendMavlinkStart");
                            featureCommon.sendMavlinkStart("flightPlan.mavlink", ARCOMMANDS_COMMON_MAVLINK_START_TYPE_ENUM.ARCOMMANDS_COMMON_MAVLINK_START_TYPE_FLIGHTPLAN);

    public void didUploadProgress(Object arg, float percent) {
        if (ARPro3Application.DEBUG)
            Log.d(TAG, "mavlink file upload progress=" + percent);

Is it Correct?



Where is mBebopDrone created? I’m going to assume it is an instance of AutonomousController. How does mDeviceController get initialized (and connected to a drone) in AutonomousController?

Assuming all of that is working properly then sure, it’s correct. Your drone should takeoff, fly 0.00002000 degrees southeast facing 1.5 degrees (a smidge east of north) at 1.5 meters altitude. Hopefully you are flying over a very level surface or down a hill. 1.5 meters altitude doesn’t leave for much margin of error.

0.00002000 degrees appears to be about 8 feet. That may or may not be long enough for the run to be successful. It appears to be a good starting point if you are looking for a very crude way to calculate distance.



Yes the mBebopDrone is a instance of AutonomousController and mDeviceController get initalized at the start of the activity by connecting to the drone by passing the service to AutonomousController.

The ARPro3Application is not available in any of the library.


Now I know what is the ARPro3Application is about, it is the activity. But then the DEBUG will be a method to check the boolean value. Correct synman?


ARPro3Application is the actual Android Application class for my application. please ignore (remove) it.


Thank you synman.
It was really helpful.


Hi guys,

What is the purpose of sendMavlinkPause() and sendMavlinkStop()?

Is it used when the drone starts hovering or it is to stop/pause the file being transmitted to the drone?


Look at the documentation. :slight_smile:


Hi guys,
After I takeoff, the drone does not fly to the location and return.
And the drone’s gps signal keeps on changing even before the takeoff.
Is it because of for calibration? If so how do I calibrate the gps.


Hi guys,
Can someone help me out with my query?


There is no gps calibration.
Are you outside? Could you tell us more about your drone (type and firmware version).
Could you try to launch FreeFlight, go in the piloting HUD and see if the gps icon is changing on and on from green to orange? Also, in FreeFlight, if the magnetometer calibration is asked, please do it.


Hi Djavan,
Sorry for the late response.

Drone: BebopDrone.
Hardware Version: HW_10
Software Version: 4.0.6

I was outside and they never ask the magnetometer calibration. But I did a manual calibration by going to the settings and calibrating.
I followed this tutorial to calibrate.

But i’m not sure is it correct or not?


Hi guys,
Can anyone help me?


Ok for the magnetometer calibration.


Hi Djavan,
The attach link is the video that i took.[1].mp4?dl=0

It only show orange.

Is it possible that there might be an hardware failure?


Hi, as I can see in your video, FreeFlight shows a green icon for the gps, so it should be good.
However, the other app shows a red icon, do you know why?


Hi, the app is what i’m currently working on. It shows that the GPS is not stable. The value of the lat/lng keeps on changing before taking off.
However, why is the GPS Lat and Lng keeps on changing even when it is in a flat ground?


It is totally normal that the gps position changes a bit. If you look on a map, the gps coordinates you got are really close.


Hi, because when i fly the mavlink file the flight was not going correctly. It keeps flying some other direction and never land.