Category Archives: Uncategorized

What’s Next With a Drone?

After you’ve peeked at all of the neighbors backyard landscaping (or their clutter), satisfied your curiosity about what’s behind that 8-foot wall, checked out what the top of a water tower actually looks like, what’s next?

Well, I’ve been practicing flying more gracefully for one thing. And I got to use it last week when I shot some video for my brother, who’s selling his house. I’ll post a bit about that another time. This week I got distracted by a different idea — data collection.

Now I’m not the first to think of a drone as a data collection device. There’s plenty of farmers that are monitoring their crops with drones that fly preprogrammed patterns over their land, and construction companies that have automated drones that track their progress and validate that plans are being followed. Frankly, I think this is a giant industry that is just now getting figured out — I should probably buy some stock.

But in my own little world I like to push my technology (i.e. toys) to its limit, or at least think wistfully about the possibilities. How many people in my neighborhood park their cars on the street? How many in the driveway? How many don’t move for days? These are trivial questions not even worth thinking about, right? But wait, could I actually answer them?

DJI sells a wide range of drones. The Mavic Mini that I have is one of the lowest models they offer, but they have some sophisticated drones that can certainly be programmed to autonomously gather such data. There’s a few pieces of the puzzle that require extra effort but it can be done. One of the things that makes this possible is that DJI drones actually have a developer’s API. That means 3rd party apps can be used to control the drones. The Mavic Mini isn’t yet supported by the API, but it’s supposed to be coming out soon. It’s still a cheap, pretty limited drone, but how much could I accomplish?

So I spent a few days reading on the topic. There are some sophisticated companies already providing solutions for some of this stuff. But I’m cheap… what can I do on the cheap? Turns out there’s a pretty popular package called Open Drone Map and it’s shockingly easy to use.

The idea is to stitch together images (still images) from a drone and correlate them to actual GPS coordinates, and present the results as a data-set. Once you’ve done that you can map terrain, count cows (or cars), look for sick crops, or figure out how far along a giant construction project is. Some companies use thermal cameras or custom made drones to gather their data.

What I wanted to know first was if this software would be useful with my lowly Mavic Mini (basically a toy drone) and whether I would even be able to get it running. Totally as an experiment, I decided to play with the video that I had already shot from the drone doing a circle maneuver over my house (see a previous post).

It turns out my Mac Book Pro may be the limiting factor. I have 52 seconds of 2.7K video at 30 fps. I used FFMPEG to convert my video into ~1500 horribly low quality still images. I knew 1500 images would take forever even if it did work so I threw out 9/10ths of the images and tried processing 150 of them. The docker command I found went right to work on the images but quickly died — out of memory. I cut that down to about 75 images and scaled them down by half (i.e. 1/4th of the pixels) since the quality was so bad to begin with. I tried again and it worked! Oh my, it ran in less than 2 hours and I wasn’t even sure what to do with the result. I found that it produces an OBJ file and I found Mesh Lab to display my house as a 3D Object — I was very excited and took the above screen shot. It took me the rest of the day to figure out how to put it on the web. I used three.js to throw together this quick demo.

It’s not great, but give me some credit here… I used video (not stills) from a very cheap drone, threw out 95% of the frames and 3/4ths of the pixels, ran free software with no installation under docker on my under-powered Mac Book Pro, and wrote some hasty Javascript (not my language of choice) using a free library that I’ve never used before. I think that’s quite a lot of progress for a day’s work.

Nearly Lost My Drone Today

So far, I’ve flown 42 times for over 7 hours. In all this time, I had never had a challenging situation. I usually ended up landing with about 35% battery left and had learned not to panic when I see a “strong wind warning”. In every other case, dropping 50 feet or so would make the warnings go away and I had never seen the drone drift significantly off of it’s course.

Today the “UAV Forecast” app told me “Not Good to Fly”. It said the winds were really strong even down at low altitude. But when I stopped working and stepped outside it was very calm. Now I don’t know the technology behind the app, but I figured it was probably a “prediction” not really a report of current conditions. So with all this confidence I launched from my back porch. I popped up to 150 feet and hovered for a while to see if it had any issues and it did not. So I got over a nearby greenbelt and flew to both ends of it with no issue, maybe a half-mile to the North and a half-mile to the South. To maintain my radio signal I even went up to about 300 feet. At around 40% battery life I decided to start heading home, and everything was going fine until I got just a couple of blocks away.

I started getting strong wind warnings and drifting to the South. I dropped down to 100 feet and was pushing full throttle against the wind and still losing ground. I dropped down to 50 feet, still losing ground, and now the battery was going down fast. My hands were shaking, I couldn’t think clearly, the fence was locked, I ran through the house and out the front door, I was flying as low as I thought I safely could not really knowing where I was. I pointed the camera down, and before I could make a decision about the street I saw it was gone. I saw a line of trees go by and then saw what looked like grass. At this point, I was losing my radio connection and the battery was critical so I didn’t have much choice but to let it do it’s emergency landing.

I was full of adrenaline and running down the street. I was afraid it would land and be impossible to find, or land in someone’s yard that I wouldn’t be able to recover, or worse, it could have landed in a tree or on a building or even hurt someone or damage something. According to the app, it was in the greenbelt, that was a relief but I was still concerned about it sitting unattended in a field. So, here I am, in shorts, running through bushes and 4-foot high grasses, negotiating around a not-quite dry stream. I get through the tree-line and into the field and can calm down a little bit as I try to use the app to help me find the thing. The compass on my phone absolutely sucks and I’m walking in circles in the field and the app offers to “make the drone flash and beep”. I was like 5 feet from the thing and still couldn’t see it because the grass was about a foot tall.

Thank you Lord, that could’ve been so much worse. I’ve been known to fly from my back yard with no shoes on, that would have been bad. There was a line of trees and houses on either side of this greenbelt, either would have been very bad. And while looking for it, I could have easily stepped on it or found a snake instead. All in all, I feel very lucky. It was a pretty gentle lesson to pay more attention to the wind warnings and battery level.