Android Example Adding Tripod Mode to your DJI Mobile app

Adding Tripod Mode to your DJI Mobile app



Tripod mode for DJI drones, limits the speed of your drone to around 2 mph. So you're less
likely to hit something, when your in confined spaces, or around people. This shows you how
to add this to your app. Right now, only the Mavic Pro has Tripod Mode.

Since your going to be using DJI objects throughout your app in java object calls, I
recommend you Dimmension them in Process Globals.
B4X:
Sub Process_Globals

    Dim AircraftInstance As JavaObject
    Dim AirlinkInstance As JavaObject
    Dim GimbalInstance As JavaObject
    Dim FlightControllerInstance As JavaObject

Then you initialize them in AfterAircraftConnected

B4X:
Sub AfterAircraftConnected

    AircraftInstance=aircraft
    GimbalInstance=AircraftInstance.RunMethod("getGimbal", Null)
    AirlinkInstance=AircraftInstance.RunMethod("getAirLink", Null)
    FlightControllerInstance=AircraftInstance.RunMethod("getFlightController", Null)

Then to enter Tripod mode you use this code:
B4X:
Sub ToggleTripodMode(On As Boolean)   ' pass True to turn Tripod mode on and False to turn it off

    Dim cc As Object

    cc= GimbalInstance.CreateEventFromUI("dji.common.util.CommonCallbacks$CompletionCallback", "callback", Null)
    FlightControllerInstance.RunMethod("setTripodModeEnabled", Array(On, cc))

    Wait For (FlightControllerInstance) Callback_Event (MethodName As String, Args() As Object)
    If Args(0) = Null Then
        Labelssc.Text="Now in tripod mode."
    Else
        Labelssc.Text="tripod mode.: " & Args(0)
    End If

End Sub

Labelssc is just a designer label I use for in flight debugging information.


I've tested this with the Mavic Pro, and it works.

Here you can find other DJI drone fuctions that are very similar to implement.

https://developer.dji.com/iframe/mo...DJICompletionCallbackWith<java.lang.Integer>)
 
Last edited:

shb777

Active Member
Licensed User
Longtime User
I have more DJI Java object implementations. should I put them in this thread or start new threads for each one?
 

DonManfred

Expert
Licensed User
Longtime User
i guess you should create a new thread for each one.
It is probably better for the searchengine too.
 
Top