This Library is based on the Source (thanx for sharing it!!) of the DJI Library posted here.
@Erel will combine the two libraries at some time. My permission is granted for this.
The difference in the two libs are that the DJI Drones UI Lib is using the Mobile UI Library from DJI. With the Mobile UI Library you are able to use some nice UI Widgets in your App.
Find out more about the UI Widget and their prefered Sizes here.
See this reference for a complete list of all widgets.
Please note that the "Panels" are not really working for me. I´m still investigating. But away from that there are some really nice to have Widgets and i do not want to hide them from you.
Here some examples:
DJITakeOffWidget
DJIReturnHomeWidget
DJIFlightModeWidget
To use this Library instead of the Original DJI Library you need to replace the DJI.xml and DJI.jar with the ones attached to this post.
The Setup in the manifesteditor are the same. You can just use the Example
Additional you need to
download this Archive
(which contains the AAR and the additional jar). Copy all files in the zip to your additional Library folder.
DJI
Author: Erel (Base) DonManfred (UIwidgets and additions)
Version: 4.5
@Erel will combine the two libraries at some time. My permission is granted for this.
The difference in the two libs are that the DJI Drones UI Lib is using the Mobile UI Library from DJI. With the Mobile UI Library you are able to use some nice UI Widgets in your App.
Find out more about the UI Widget and their prefered Sizes here.
See this reference for a complete list of all widgets.
Please note that the "Panels" are not really working for me. I´m still investigating. But away from that there are some really nice to have Widgets and i do not want to hide them from you.
Here some examples:
DJITakeOffWidget
DJIReturnHomeWidget
DJIFlightModeWidget
To use this Library instead of the Original DJI Library you need to replace the DJI.xml and DJI.jar with the ones attached to this post.
The Setup in the manifesteditor are the same. You can just use the Example
Additional you need to
download this Archive
(which contains the AAR and the additional jar). Copy all files in the zip to your additional Library folder.
DJI
Author: Erel (Base) DonManfred (UIwidgets and additions)
Version: 4.5
- CameraSettingAdvancedPanel
- CameraSettingExposurePanel
- DJICameraControlsWidget
- DJIBatteryWidget
- DJICameraControlsWidget
- DJICompassWidget
- DJIConnectionWidget
- DJIDashboardWidget
- DJIDistanceHomeWidget
- DJIDistanceRCWidget
- DJIExposureSettingsMenu
- DJIFPVOverlayWidget
- DJIFPVWidget
- DJIFlightModeWidget
- DJIFocusModeWidget
- DJIGPSSignalWidget
- DJIHorizontalVelocityWidget
- DJIPictureVideoSwitch
- DJIPreFlightCheckListPanel
- DJIPreFlightStatusWidget
- DJIRemainingFlightTimeWidget
- DJIRemoteControlSignalWidget
- DJIReturnHomeWidget
- DJIVerticalVelocityWidget
- DJIVideoSignalWidget
- DJIWiFiSignalWidget
- DJIAircraft
Events:- BatteryState (Battery As Object, RemainingPercentage As Int)
- ProductConnectivityChanged (Connected As Boolean)
- Result (Success As Boolean, ErrorMessage As String)
- ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)
- GetName As Object
Gets the aircraft name. The ResultWithValue event will be raised.
Returns an object that can be used as the sender filter parameter.
Example:<code>
Wait for (aircraft.GetName) Aircraft_ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)
If Success Then
aircraftName = Value
End If</code> - Initialize (EventName As String, AircraftData As Object)
Initializes the object.
EventName - Sets the subs that will handle the events.
AircraftData - The parameter passed to DJISDKManager ProductChanged event. - IsInitialized As Boolean
- RegisterBatteryStateEvent
Registers the battery state listener.
- BatteryReady As Boolean [read only]
Returns true if the battery is ready. - CameraReady As Boolean [read only]
Returns true if the camera is ready. - Connected As Boolean [read only]
- Model As String [read only]
Returns the model. - Tag As Object
- DJIAltitudeWidget
Fields:- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Padding()() As Int
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- DJIAttitude
Methods:- IsInitialized As Boolean
- Pitch As Double [read only]
- Roll As Double [read only]
- Yaw As Double [read only]
- DJICamera
Events:- FrameReceived (Data() As Byte)
- CreateVideoView As ConcreteViewWrapper
Creates the view that will show the camera feed. - Initialize (EventName As String, Aircraft As DJIAircraftWrapper)
- IsInitialized As Boolean
- DJICameraCaptureWidget
Fields:- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Padding()() As Int
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Padding()() As Int
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- DJIFlightController
Events:- IMUStateChanged (State As DJIIMUState)
- Result (Success As Boolean, ErrorMessage As String)
- ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)
- AutoLanding As Object
Starts an auto-landing action. The Result event will be raised.
Returns an object that can be used as the sender filter parameter. - GetLEDsEnabled As Object
Gets the LEDs status. The ResultWithValue event will be raised.
Returns an object that can be used as the sender filter parameter.
Example:<code>
Wait For(controller.GetLEDsEnabled) Controller_ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)
If Success Then
Log($"LED status: " ${Value}"$)
End If</code> - GoHomeCancel As Object
Cancels a go home action.
The Result event will be raised. - GoHomeStart As Object
Starts a go home action.
The Result event will be raised. - Initialize (EventName As String, Aircraft As DJIAircraftWrapper)
Initializes the flight controller. - IsInitialized As Boolean
- SetGoHomeHeightInMeters (Height As Float) As Object
Sets the go home flight height. Should be between 20 to 500.
The Result event will be raised. - SetHomeLocationUsingAircraftCurrentLocation As Object
Sets the home location based on the current aircraft location.
The Result event will be raised.
Example:<code>
Dim sf As Object = controller.SetHomeLocationUsingAircraftCurrentLocation
Wait For (sf) Controller_Result (Success As Boolean, ErrorMessage As String)
If Success Then
Log("Home location set.")
Else
Log("Error: " & ErrorMessage)
End If</code> - SetLEDsEnabled (Enabled As Boolean) As Object
Sets the LEDS status. The Result event will be raised.
Returns an object that can be used as the sender filter parameter.
Example: <code>
Wait For (controller.SetLEDsEnabled(True)) Controller_Result (Success As Boolean, ErrorMessage As String)
Log($"LED state changed. Success = ${Success}"$)</code> - TakeOff As Object
Starts a takeoff action. The engine will start automatically.
The Result event will be raised.
Returns an object that can be used as the sender filter parameter.
- Connected As Boolean [read only]
- CurrentState As DJIFlightControllerCurrentStateWrapper [read only]
Returns the current state. - Heading As Double [read only]
Returns the aircraft heading. - SimulatorStarted As Boolean [read only]
Returns true if the simulator has started. - Tag As Object
- DJIFlightControllerCurrentState
Methods:- IsInitialized As Boolean
- AircraftLocation As DJILocation3DWrapper [read only]
Returns the aircraft location. - AreMotorsOn As Boolean [read only]
Returns true if the motors are on. - Attitude As DJIAttitudeWrapper [read only]
Returns the aircraft attitude (pitch, roll and yaw). - FlightMode As String [read only]
Returns the current flight mode.
Possible values: Manual, Atti, AttiCourseLock, AttiHover, Hover, GPSBlake, GPSAtti, GPSCourseLock, GPSHomeLock, GPSHotPoint,
AssistedTakeOff, AutoTakeOff, AutoLanding, AttiLanding, GPSWaypoint, GoHome, ClickGo, Joystick, AttiLimited,
GPSAttiLimited, GPSFollowMe, Tracking, Pointing, PANO, Farming, FPV, GPSSport, GPSNovice,
ConfirmLanding, TerrainTracking, NaviAdvGoHome, NaviAdvLanding, TripodGPS, TrackHeadLock, MotorsJustStarted, GPSGentle, Unknown - Flying As Boolean [read only]
Returns True if the aircraft is flying. - GPSStatus As Int [read only]
Returns 255 if there is no signal. Otherwise returns a value between 0 (weak signal) to 5 (strong signal). - GoHomeHeight As Float [read only]
Returns the go home height in meters. - GoingHome As Boolean [read only]
Returns True if the aircraft is going home. - HomeLocation As DJILocation2DWrapper [read only]
Returns the home location. - HomeLocationSet As Boolean [read only]
Returns true if the home location was set. - IMUPreheating As Boolean [read only]
Returns True if the IMU is preheating. - SatelliteCount As Double [read only]
Returns the number of GPS satellites found. - VelocityX As Double [read only]
Returns the x-axis velocity measured in meters per second. - VelocityY As Double [read only]
Returns the y-axis velocity measured in meters per second. - VelocityZ As Double [read only]
Returns the z-axis velocity measured in meters per second.
- DJIHotpointMissionOperator
Events:- MissionFinish (Error As String)
- MissionStart
- MissionUpdate (Error As String, CurrentState As String, PreviousState As String, Radius As Float)
- Result (Success As Boolean, ErrorMessage As String)
- ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)
- Initialize (EventName As String)
Initializes the mission operator. - IsInitialized As Boolean
- Pause As Object
Pauses a mission. The Result event will be raised. - Resume As Object
Resumes a mission. The Result event will be raised. - StartMission (hotpointLat As Double, hotpointLon As Double, altitude As Double, radius As Double, angularVelocity As Float, isClockwise As Boolean, startPoint As String, heading As String) As Object
Starts a mission. The Result event will be raised. - Stop As Object
Stops a mission. The Result event will be raised.
- Connected As Boolean [read only]
- Tag As Object
- DJIIMUState
Methods:- IsInitialized As Boolean
- AccelerometerStatus As String [read only]
Returns one of the following values:
UNKNOWN, DISCONNECTED, CALIBRATING, CALIBRATION_FAILED, DATA_EXCEPTION, WARMING_UP, IN_MOTION, NORMAL_BIAS, MEDIUM_BIAS, LARGE_BIAS. - CalibrationStatus As String [read only]
Returns one of the following values:
NONE, CALIBRATING, SUCCESSFUL, FAILED, UNKNOWN. - GyroscopeState As String [read only]
Returns one of the following values:
UNKNOWN, DISCONNECTED, CALIBRATING, CALIBRATION_FAILED, DATA_EXCEPTION, WARMING_UP, IN_MOTION, NORMAL_BIAS, MEDIUM_BIAS, LARGE_BIAS.
- DJILocation2D
Methods:- IsInitialized As Boolean
- Latitude As Double [read only]
- Longitude As Double [read only]
- DJILocation3D
Methods:- IsInitialized As Boolean
- Altitude As Float [read only]
Returns the altitude measured by barometer in meters (relative to the take off location). - Latitude As Double [read only]
- Longitude As Double [read only]
- DJISDKManager
Events:- ComponentConnectivityChanged (Connected As Boolean)
- ProductChanged (AircraftData As Object)
- ProductConnectivityChanged (Connected As Boolean)
- ProductName (Success As Boolean, Name As String)
- RegisteredResult (Success As Boolean, ErrorMessage As String)
- Initialize (EventName As String)
Initializes the DJI SDK. The RegisteredResult event will be raised.
Note that an internet connection is required on the first run. - StartConnectionToProduct
Tries to connect to the product. The ProductChanged event will be raised.
- Registered As Boolean [read only]
- DJITakeOffWidget
Fields:- ba As BA
- BringToFront
- DesignerCreateView (base As PanelWrapper, lw As LabelWrapper, props As Map)
- Initialize (EventName As String)
- Invalidate
- Invalidate2 (arg0 As Rect)
- Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- IsInitialized As Boolean
- RemoveView
- RequestFocus As Boolean
- SendToBack
- SetBackgroundImage (arg0 As Bitmap)
- SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
- SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
- SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
- SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
- Background As Drawable
- Color As Int [write only]
- Enabled As Boolean
- Height As Int
- Left As Int
- Padding()() As Int
- Parent As Object [read only]
- Tag As Object
- Top As Int
- Visible As Boolean
- Width As Int
- DJIWaypoint
Methods:- AddAction (Action As WaypointActionType, Parameter As Int)
Adds an action that will be executed when the aircraft reaches the point.
Action - One of the following values:
STAY - Stays at the current point. Parameter = Period in milliseconds.
START_TAKE_PHOTO - Starts to shoot a photo. Parameter is ignored.
START_RECORD - Starts recordsing. Parameter is ignored.
STOP_RECORD - Stops recording. Parameter is ignored.
ROTATE_AIRCRAFT - Rotates the aircraft's yaw. Parameter should be between -180 to 180.
GIMBAL_PITCH - Rotates the gimbal's pitch. Parameter should be between -90 to 0. - Initialize (Latitude As Double, Longitude As Double, Altitude As Float)
Initializes the waypoint with the given coordinate and altitude (in meters). - IsInitialized As Boolean
- TurnMode As String
- actionRepeatTimes As Int
- actionTimeoutInSeconds As Int
- cornerRadiusInMeters As Float
- gimbalPitch As Float
- heading As Float
- shootPhotoDistanceInterval As Float
- shootPhotoTimeInterval As Float
- speed As Float
- waypointActions As List [read only]
- AddAction (Action As WaypointActionType, Parameter As Int)
- DJIWaypointMissionBuilder
Methods:- AddWaypoint (Waypoint As WaypointWrapper)
Adds a waypoint. - Initialize
- IsInitialized As Boolean
- SetFinishAction (Action As WaypointMissionFinishedAction)
Action that will be executed when the mission finishes.
NO_ACTION - No further action will be taken on completion of mission.
GO_HOME - The aircraft will go home and land.
AUTO_LAND - The aircraft will land at the last waypoint.
GO_FIRST_WAYPOINT - The aircraft will go to the first waypoint.
CONTINUE_UNTIL_END - Mission will not end until StopMission is called. - setPointOfInterest (poiLat As Double, poiLon As Double)
- AutoFlightSpeed As Float
Gets or sets the auto flight speed (m/s). This is the default flight speed.
Valid values are between -15 to 15. - HeadingMode As WaypointMissionHeadingMode
- MaxFlightSpeed As Float
Gets or sets the maximum flight speed (m/s). Maximum speed is achieved by pushing the throttle joystick. - PointOfInterest As LocationCoordinate2D [read only]
- AddWaypoint (Waypoint As WaypointWrapper)
- DJIWaypointMissionOperator
Events:- MissionFinish (Error As String)
- MissionProgress (ExecutionEvent As Object, TargetWaypointIndex As Int)
- MissionStart
- Result (Success As Boolean, ErrorMessage As String)
- ResultWithValue (Success As Boolean, ErrorMessage As String, Value As Object)
- Initialize (EventName As String)
Initializes the mission operator. - IsInitialized As Boolean
- LoadMission (MissionBuilder As WaypointMissionBuilderWrapper)
Loads a mission. The next step is to upload it with UploadMission. - PauseMission As Object
Pauses a mission. The Result event will be raised. - ResumeMission As Object
Resumes a mission. The Result event will be raised. - StartMission As Object
Starts a mission. The Result event will be raised. - StopMission As Object
Stops a mission. The Result event will be raised. - UploadMission As Object
Uploads a mission. The Result event will be raised.
- Connected As Boolean [read only]
- MissionState As String [read only]
Returns the mission state.
One of the following values: UNKNOWN, DISCONNECTED, NOT_SUPPORTED, RECOVERING, READY_TO_UPLOAD, UPLOADING, READY_TO_EXECUTE, EXECUTING, EXECUTION_PAUSED. - Tag As Object
Attachments
Last edited: