As a hobby drone enthusiast and current owner of Mavic Air, I'm really interested in drones – especially in the DJI brand. Recently, I got the opportunity to work on a proof-of-concept drone project for a client. The client was curious if his idea was executable using DJI drones.
I can’t talk about the idea or all the features regarding the project, but I would like to summarize what it's like to develop with a DJI SDK, as well as with drones in general. It’s quite different from the typical mobile projects, so there's a lot of interesting areas to explore.
Let's jump into it.
What is DJI?
A lot of you have probably heard of DJI, one of the biggest drone producers on the market today. The company offers a variety of drones in three categories. Its consumer drones include the Spark, Mavic and Phantom series. These drones are ready for everyday use right out of the box.
They feature cameras on two- or three-axis gimbals, which guarantee stable and sharp images and videos. The drones have built-in obstacle avoidance, so it’s pretty easy to fly them without previous experience. Usually, there is also a controller in the box. That lets you control the drone on your mobile device or with the controller, which you can connect to your phone. It allows you to see a live preview from the camera, your drone’s position on the map and some telemetry data.
The other two categories, Professional and Enterprise, are for more advanced purposes and are meant for commercial use. You can easily change the equipment, including cameras, gimbals and some third-party onboard computers, allowing the drone to be partially customized for specific use cases.
Which SDKs does DJI provide?
As a developer, you can choose from several types of SDKs. For mobile development, you can use mobile and UX ones (I’ll cover those later.) There's the Payload SDK for third-party drone add-ons.
Using this SDK, allows you to communicate with the drone through your add-on. The Onboard SDK is for third-party onboard computers, which can take control of the drone, while the Windows SDK, currently under development, will provide nearly the same functionality as the Mobile SDK but for Windows computers.
There is an official DJI Developer page, where you can find information about all of the SDKs as well as tutorials, API reference and links to GitHub repositories. There is also a Developer’s Forum, but it was not working when I was working on the client project, so I was not able to turn to the community for help.
Android and iOS SDKs are also available. DJl maintains and constantly improves them. Be aware that newer releases often come with a few breaking changes. Most of the time, they simply involve changes to the package name, which are easy to fix but still a little annoying.
I was using the Android SDK for this particular client project and want to go over its capabilities, which I think are also applicable for the iOS SDK. There are four ways to control the drone. The first two ways can be done manually using a remote controller or virtual sticks on your mobile device.
The third way is by gesture control, which means that you can control the drone with your palm, but the movements are very limited. The fourth way is autonomous control, which is the most interesting one. The Android SDK contains several types of autonomous missions. You are able to configure them, upload them to the drone and start them. I’ve tried the following three missions (but there are a few others):
- Waypoint mission: Multiple points containing GPS coordinates, altitude, speed and heading. The drone will hit all the points and then come back.
- Follow Me mission: Following GPS coordinates, which must be updated periodically.
- Hotpoint mission: Flying in circles around a single GPS coordinate. Speed, radius and direction (clockwise) can be changed.
The Android SDK also provides a lot of aircraft and controller information related to, for example, the drone’s state, telemetry, battery, etc. You are able to change most of the settings and control the camera and gimbal. You can also get a live video stream and will have access to all media stored in the drone.
As far as I know, you are not able to directly control the drone engines. It’s not possible to set the thrust level of each engine. The SDK provides more high level access to the drone. For direct commands, you have to use the Onboard SDK and your custom onboard computer.
This SDK is really handy. It contains a lot of widgets that are ready to use. Just place them directly in your layout. No need to write Java/Kotlin code. The widgets just work on their own. By using this SDK, you will be able to create a kind of lightweight original DJI app for drone controlling and monitoring. You can find a sample layout with most of the widgets at https://developer.dji.com.
Simulator & debugging
DJI also provides a simulator for Windows and Mac, where you can test your app without flying. You will still need the actual drone for testing. It’s necessary to connect your drone to the computer in order to run the simulator. The simulator provides a 3D visualization of your drone in the world and a lot of telemetry data about the drone and its flight.
By default, your Android device must be connected to the drone controller during app testing, making it pretty hard to debug something. Fortunately, there is a Bridge app on DJI’s GitHub page, which you can compile and apply to this use case. You will need two Android devices for this. One needs to have the Bridge app installed and connected to the drone controller, while the second needs to be connected to your computer with your own app. The Bridge app is pretty easy to use, but sometimes it simply doesn’t work for no particular reason.
All these SDKs offer a lot of capabilities, but most of these capabilities are already built into the original DJI app. There are also some third-party apps available. You would use these SDKs for a specific purpose, like, for example, drone delivery or to check out some property or area. It’s up to your imagination.
It was really interesting to work with a DJI SDK and drones in general on this project. I liked that I spent some time coding the app and testing it in the office on a simulator before heading home to do some real testing outside. It was great and also a little bit stressful. After all, I was testing the app with a really expensive device. There is always that possibility of it malfunctioning and the drone falling from the sky, which thankfully didn’t happen. It’s not very common for mobile developers to spent time testing outside with real devices, so needless to say, the change of scenery was very nice!
You might also like...
STRV & Audiobyte: Revolutionizing the GIF
Let’s face it; there’s a lot to love about GIFs. They’re entertaining as hell, incredibly efficient at quickly conveying complex emotions, and in recent years, have emerged as a sort of go-to form of communication independent of words altog...
Wrap-up: Design Tools of 2019
At STRV we eat design for breakfast, and when it comes to the latest design products, we couldn’t be hungrier for more. By the full house of inquisitive creatives at our recent Design Tools of 2019, it was clear that many of you share our p...
Our TSM Concept Is Only the Beginning
Esports will be a billion-dollar industry by 2020. Boasting almost 400 million viewers, competitive gaming is filling arenas. 2018 saw a 38% increase in revenue.With sponsorship and franchising deals already pouring in, mainstream expansion...