Skip to content
This repository has been archived by the owner on Feb 21, 2018. It is now read-only.
Ruslan Balanukhin edited this page Nov 6, 2013 · 19 revisions

Documentation

Good place to start - official SDK documentation ARDrone Developer Guide, recommended for better understating how drone is working.

Quick reference

The DroneClient class reference:

Event handlers

NavigationPacketAcquired - fires when raw navigation being acquired from drone, that's gives ability to extract any information which available in original SDK.
NavigationDataAcquired - fires when raw navigation data being successfully parsed to NavigationData class which contains only essential details extracted from a navigation packet.
VideoPacketAcquired - fires when raw video frame (encoded) being acquired.

Methods

GetConfigurationTask - returns a tack thick can be executed asynchronously to acquire settings from the drone.
Send - allows to send command or settings to drone.
AckControlAndWaitForConfirmation - used for acknowledge multi-configuration mode commands.

Emergency / ResetEmergency / Land / Takeoff - for requesting drone state change, this state request will be processed after next navigation data package will be successfully parsed.

FlatTrim - for recalibrate drone "meaning" of flat surface - it is a helper method*.
Progress / ProgressWithMagneto - control drone movement while flying - it is a helper method*.
Hover - stops drone movement , by sending all zeros progress command - it is a helper method*.

Stop / Start - starting and stoping internal background worker - watchdog loop.

* for all helpers as you can do the same action by sending appropriate command using Send method, however, these methods are doing protective state and parameters checks.

Properties

IsActive / IsAlive - indicates that client internal background worker is working. IsConnected - when true means that client acquiring navigation data (will be set to false in case we missing data for 2 seconds).

Internal implementation

The cilent encapsulating three different background workers and each of these workers runs on a dedicated thread:
DroneClient - has main internal worker (Loop method) which responsible for start NavigationAcquisition worker or restart it in case of network failure or acquisition timeout expiration.
NavdataAcquisition - responsible for listening and acquiring data for drone navdata port - UDP port 5554, executes callbacks on new packet acquired, on acquisition started and stopped these callbacks subsequently responsible for firing NavigationPacketAcquired event and triggering start and stop of video acquisition.
VideoAcquisition - responsible for listening and acquiring data from drone video stream port - TCP port 5555, executes callback on video packet acquired which is fires VideoPacketAcquired event.

Support classes

ConfigurationAcquisition - implements drone configuration acquisition, provides a helper method which can generate Task for an async execution, subsequently used in GetConfigurationTask.
VideoPacketDecoderWorker - worker used for video packet decoding, accepts video packages via EnqueuePacket method and executes callback when frame decoded.
PacketRecorder - worker for async storing navigation or video packets to stream (FileStream for example).

As for running library - you should use only one client instance per drone ip address. Due async nature of work you need to subscribe your event handlers to appropriate client events - usually you should subscribe to NavigationDataAcquired for gathering basic navdata information and in case of video support to VideoPacketAcquired and redirect video packet to the instance of VideoPacketDecoderWorker in order to get decoded picture. You either can write both packages to stream using PacketRecorder.
Thus when you do droneClient.Start() it is activates main background worker which is constantly keep a live navigation acquisition.
Then when you are connected to drone and navigation acquisition get a first data package, it will execute drone initialization sequence and you should start receiving NavigationPacketAcquired / NavigationDataAcquired events every 5 or 40 milliseconds - that's depends from the configuration. The first navigation package either triggers start of the video acquisition after that you should getting VideoPacketAcquired events for every video frame.

For doing video channel swaps and executing flight animations, you should send adjusted Settings object to drone.

Clone this wiki locally