-
Notifications
You must be signed in to change notification settings - Fork 556
Work with DroneKit Android
Tower is essentially a front-end GUI app. It generates buttons and figures and takes in the command from user touches. When it launches, it will automatically send an intent in your android system and request the launch of 3DR service app (assuming you have already installed it). 3DR service app is a client lib app that comes with DroneKit-Android build (the client lib sub-app). So when Tower talks to 3DR service app, it essentially calls the library defined by DroneKit-Android. It sends user's commands to DroneKit and it is the DroneKit that convert these commands into numbers and messages that Drone can understand and communicate with the Drone through interfaces wherein.
For example, Tower generates the button "Follow-Me" and the user touches it. Tower gets the command and send it to DroneKit. DroneKit then generates a message and send it to the drone to initiate the "Follow-Me" mode. Then if the user touches "Lead" mode. Tower sends this command to DroneKit. DroneKit then compute the next waypoint ahead of the user and send the calculated waypoint to the Drone, which then flies to the very waypoint to realize the lead action.
So, if the developer wants to develop a new flight mode, say "Panorama", both Tower and DroneKit needs to be updated. Tower needs to be modified to include a button called "Panorama" and the associated activity file. DroneKit needs to be modified to include a script to calculate next waypoint according to the current waypoint to actually carry out the flight action.
In this way, function calls are implicitly buried all over the code. It would be better if we know how to develop Tower and Dronekit using Android Studio at the same time and constantly keep them refer to each other. This document is a tutorial on how to do it.
Assuming the developer has already fork and clone the Tower source code and successfully build it in Android, if not, please refer to this tutorial. Then the developer needs to fork and clone the DroneKit-Android Repo and import it into Android Studio (please make sure you import the root directory, Android Studio will automatically recognize all the sub-apps inside), as shown below
Modify the code if you have already figured out what you want (in other case, don't), and hit build. Now it will automatically generate an arr file in the directory "DroneKit-Android\ClientLib\build\outputs\aar". That's the client lib dependency file Tower uses when it builds itself. In other words, whatever changes you made in Dronekit (especially drone