Knowledge Base Presented By Flytbase “How to Build a Custom Mobile App for Your Drone”

Drones have matured over time. From being an object of amusement to simplifying complex tasks, they have come a long way. They are now empowering industries like agriculture, construction, photography, disaster management and real estate.

More and more companies have started adapting to this drone era. As such, knowing how to develop your own custom application can be a useful skill.

In this guide, I will teach you how one can build a custom mobile application for drones. Building a drone application will require an application platform.

There are a few options in the market but I will be going with FlytBase. Why? FlytBase provides you with drone SDK and APIs to develop research and commercial drone applications.

Step 1: Setup Your Account and Download FlytSDK
To start with your development, you will need access to FlytSDKs and APIs. So, start by creating your FlytBase account. It is free and won’t take much of your time. They have a dedicated support team in case you face any issues.

Once your account is up and running, go and download the android FlytSDK.
FlytSDK provides you with necessary pre-integrated client libraries. It also has an inbuilt mechanism for establishing a connection with the drone.

Step 2: Install Android Studio and Start Developing your App With Ease

I created a sample app which gives drone the command to Take Off and Land after setting up the altitude. Here is a screenshot of sample app which I created using FlytSDK and FlytAPIs.

You can download the app and find the source code on GitHub. The FlytSDK has the required libraries for making a REST call and a websocket connection to FlytOS already integrated into it.

Here, I share with you the code for Take Off command

private class TakeOffRequest extends AsyncTask<Void, Void, String> {

private Double takeoff_alt; public TakeOffRequest(Double val) {

takeoff_alt = val;

}

@Override

protected String doInBackground(Void… params) {

try {

//Rest url

final String url = “http://”+ip+”/ros/”+namespace+”/navigation/take_off”;

//params in json

JSONObject param= new JSONObject();

param.put(“takeoff_alt”,takeoff_alt); //restTemplate object initialise for rest call

RestTemplate restTemplate = new RestTemplate();

restTemplate.getMessageConverters().add(new StringHttpMessageConverter());

// make the rest call and recieve the response in “response”

String response = restTemplate.postForObject(url,param.toString(), String.class); return response;

} catch (Exception e) {

Log.e(“MainActivity”, e.getMessage(), e);

} return null;

}

//function called after a successful rest call

@Override

protected void onPostExecute(String response) {

if (response!=””) { try {

//initialise a JSON object with the response string

JSONObject resp = new JSONObject(response);

//extract the required field from the JSON object

// namespace=resp.getJSONObject(“param_info”).getString(“param_value”);

if (resp.getBoolean(“success”)) {

Toast.makeText(getApplicationContext(), “Taking Off.”, Toast.LENGTH_SHORT).show(); } else {

Toast.makeText(getApplicationContext(), “Take Off rejected.”, Toast.LENGTH_SHORT).show();

} } catch (JSONException | NullPointerException e) {

} }else{

Toast.makeText(getApplicationContext(), “Failed to contact FlytPOD. Retry Take Off!”, Toast.LENGTH_SHORT).show();

}

}

}

Refer to android

FlytSDK and start building your own app.

Step 3: Install FlytSIM and Test Your App

FlytSIM is ROS-Gazebo environment where you get a simulated version of your drone environment. This is an amazing tool to test your drone applications without having to actually fly the drone. This helps you remove bugs, if any and gives you an idea how your drone will behave in the real world.

Once your development is complete, be sure to test your application using FlytSIM. You can download it here.

Every app you develop using FlytSDK will require you to enter the IP address of the device running FlytSIM(usually your laptop).

After installing FlytSIM, run it on your system and connect it to your Wi-Fi network. Connect your phone to the same Wi-Fi network and launch your app.

Also, remember to connect your phone to the same WiFi network to launch your app.

Once connected, start testing your application.

Step 4: Install FlytOS on Your Companion Computer

FlytOS is the operating system to develop commercial and research drone applications. It supports multiple companion computers.

Here is a step-by-step guide to install FlytOS Once the installation is complete, you must activate the license for the navigation APIs to work. It’s free to use.

Now, you are ready for your first flight.

Step 5: Prepare for Field Test

If you have followed the instructions so far, your drone should be ready for field test. Your field test will also depend on the type of application you are building.

Before you fly, be sure to check out the safety guidelines.

Congratulations you have successfully developed and deployed your own mobile app for your drone.

You can refer FlytAPI for further development and assistance.

For more information, visit FlytBase.

Utsav Chopra – Flytbase

No Replies to "Knowledge Base Presented By Flytbase "How to Build a Custom Mobile App for Your Drone""