Orthomosaic Mapping with Pixhawk and Drone Deploy

by Snarls | January 9, 2017 | (0) Posted in How To

Intro:

A couple months ago Flitetest posted a video about 3D mapping with DroneDeploy. DroneDeploy is a service that takes a set of aerial pictures and creates various processed products such as orthomosiac maps, 3D models, and elevation plots. If you own a DJI machine, DroneDeploy has an app on iOS and Google Play which sets up a flight plan to fly your machine and take pictures for you. If you do not have a DJI product, the app will not connect to your machine, but don't fret, the DroneDeploy service can still be used to create beautiful maps. 

This article covers the basics of using the Pixhawk/APM autopilot with the Mission Planner GUI to generate maps using the DroneDeploy service. First we will cover how to use Mission Planner for taking aerial photos suitable for mapping. Then we will talk about image processing and finally submitting a job to DroneDeploy. This process can be applied to both multirotors and fixed wing aircraft.

Acquiring Pictures:

DroneDeploy and other stitching softwares require multiple aerial photos to process in to maps. To acquire these photos you could simply fly manually around your subject area with your camera taking photos at regular intervals or by remote trigger. Downsides to doing it this way are that some photos will overlap the same area more than others, and depending on if you use altitude hold or not, some photos may be closer to the ground than others. This may still work for mapping, but it will be inconsistent and burdensome. Instead we can harness the power of the Pixhawk autopilot to do all the flying for us in an efficient and repeatable way. This way we can return and map the same area at different times without fear of producing a slightly different size and quality image.

To take photos in an efficient and repeatable manner, we will create a flight plan in Mission Planner. Before completing this step, make sure you are comfortable creating and flying autonomous missions with Mission Planner. You will need to be able to trust your machine to fly itself for a few minutes.The flight plan will instruct the flight controller where to fly, at what altitude, and at what speed. It can be created from the comfort of your home, before you even get to the mapping site. Even better, it can be saved to a file so you can bring it up and fly the exact same mission at a later date.

Basic Mission Planning:

In the flight plan tab of MP, zoom in to the area of interest for your mapping. The most efficient way to map an area is with a simple grid, so that is what needs to be drawn over your area of interest. You can make one by hand just by laying down waypoints, or use MPs built in Simple Grid maker. If you have flown autonomous missions before this should be fairly simple, but for more help creating missions and grids in MP, click here. The bulk of the commands in the waypoint list will simply be 'waypoint' commands. In addition I have a 'takeoff' command at the start and a 'return to launch' command at the end. You do not need these commands if you intend to takeoff and land the craft yourself, which may be desireable for fixed wing pilots. Following the takeoff command I have a 'do speed change' command to change the speed of the craft from the default to one desired by the mission. Speed and more details on the grid are discussed below.

A flight plan set up to map a lot at low altitude.

Speed, Altitude, and Grid Spacing:

This part of the mission planning requires a little more thought and calculation. We need to find a suitable speed, altitude, and grid spacing to fly at so that we can acquire good quality pictures of the land within a reasonable time frame. If not we risk taking too many pictures, increasing the processing time in DroneDeploy, or too little pictures, resulting in more processing errors and a lower quality finished product. A basic way of going about this is to fly at the lowest altitude possible at the fastest speed possible. There are limits we must account for though. Flying too fast may bring instability to the machine and will require a larger radius for the craft when turning around. Additionally the camera is likely going to be taking pictures at set intervals. The fastest my Xiaomi Yi can take pictures is at 0.5s intervals. At high speeds even the fastest picture taking speeds will not produce enough overlap between photos.

To produce the best results possible, at least 80% overlap horizontally and vertically between adjacently taken pictures is desired. This is accounted for through both speed and the spacing between grid lines in the flight plan. In terms of altitude, flying at the lowest altitude possible without hitting anything is generally safe but will require a slower speed and provide more pictures to work with. More pictures will take longer to process and can sometimes result in errors in the final output. A higher altitude produces less pictures which will process faster but have less ground resolution.

Here are the variables we are dealing with in determining forward speed:

  • Picture Taking Interval
  • Altitude
  • Overlap
  • Camera Field of View

To determine a proper forward speed first the camera field of view along with the chosen altitude are used to calculate the physical space captured in each photo. This is then used with the desired overlap to determine the difference in camera position between subsequent pictures and the spacing between grid lines. The difference in camera position is then used with the camera interval to determine the necessary speed. This process is not very difficult, but it is a little too much to include in this article. Instead here is a link to a spreadsheet I made that will do the calculations for you. If you do not want to use the spreadsheet here is a little cheat sheet below:

For GoPro/Xiaomi Yi with a desired overlap of 80% and altitude of 100ft:

Camera Interval                 Speed              Grid Spacing

     0.5s                              14m/s                   10m

     1.0s                               7m/s                    10m

     2.0s                               3m/s                    10m

     5.0s                               1m/s                    10m

In Mission Planner set the speed with a 'do change speed' command. The grid spacing is set when creating the grid. Altitude is set in each 'waypoint' command or through 'default alt' before placing any waypoints.

Some Notes on the Camera:

The picture taking can be done with a fixed wing or multirotor, with a gimbal or without a gimbal. A fixed wing will have its own positives and negatives over a multirotor. Positives being longer flight times and the ability to function in more inclement weather. Negatives being less positional accuracy and a nonzero minimum flight speed. Not using a gimbal will still work but not all pictures will be perfectly straight down.

If you are using a wide angle camera like a GoPro or Xiaomi Yi you need to turn on lens correction to remove some of the curvature in the pictures. Flying with an ND filter or close to sunset can cause problems with stitching due to the low contrast. I recommend taking photos when the sun is at its highest.

Two mapping methods. Left image credit: theaeroscout.com.au

Processing the Pictures:

After flying the mission and acquiring the pictures it is time for some post processing. DroneDeploy requires that each picture is geotagged with the location it was taken at. Some cameras have this ability built in. If not, the geotagging will have to be done manually. Luckily Pixhawk and Mission Planner along with Google Earth make this job easy. First you will need the flight log from the mapping mission. If you had your laptop connected to the craft via telemetry radio during the mission then the log is already on the computer. If not then you can connect the Pixhawk to your computer and download the log via mavlink.With the log acquired, press CTRL + F to bring up a hidden menu. Choose the first option 'Geo ref images' to bring up the geotagging window.

Downloading a flight log via Mavlink

Hidden menu with the geo reference images window opened

Linking GPS Data to Photos:

Browse your computer to locate the log and the folder with your photos inside. Make sure the photos are in thier own separate folder. Select time offset as the method of associating the GPS data from the log to the photos. The time offset value can be estimated, but I find it generally unreliable so we will have to guess the value. I find values between 0 and 15 are what I end up with. Guess a number and press 'Pre-process.' In the folder containing your photos you will find a new Google Earth KML file. Open it up and zoom in to the location of the mapping mission. There will be a bunch of pinned photos along the flight path. The goal is to make sure what is in the photos lines up with the locations along the flight path. If a photo appears to be of a location after the pinned location, lower the time offset. If the photo is of a location before the pinned location, increase the time offset. I like to look at the corners of the grid path because I can expect the photos to show the craft turning at these points. To make another guess delete the KML and its associated files, change the time offset, and press pre-process again. Once you find that the photos and pinned locations in Google Earth match up, go ahead and press 'GeoTag Images.' This will create a new folder in your photos folder which contains the newly geotagged images.

Looking at pinned photos in Google Earth.

DroneDeploy:

To create the final orthomosaic image the photos must be submitted to DroneDeploy. First you must register an account on their website. DroneDeploy gives a free Pro level trial for the first month which gives acess to unlimited processing jobs and other premium features. After one month you are limited to 5 processing jobs per month and limited features.

Once in the online dashboard start a project by uploading your geotagged images. Uploading all the pictures may take a while depending on your internet and how many photos you have. In the meantime highlight the area you want to map.

Highlighting the desired mapped area.

Once all the images are uploaded, sit back, take a break, and let DroneDeploy do the rest of the work. After a couple of hours you will get an email that your map is done processing. Congratulations you have just used your Pixhawk machine and DroneDeploy to create an orthomosaic map!


Final orthomosaic based on 194 images taken in the summer.

Orthomosiac based on 67 images taken in the winter.

COMMENTS

Accrecon on February 22, 2017
This is a great article, been using drone pics and video for years for traffic crash reconstruction... want to expand into mapping...thanks
Log In to reply
Snarls on February 22, 2017
Thanks Accrecon, glad you could get some use from this article!
Log In to reply
Theosurveys on May 3, 2019
Sir am finding it difficult to understand the Excel sheet u attached for computing speed
Log In to reply

You need to log-in to comment on articles.


Orthomosaic Mapping with Pixhawk and Drone Deploy