Pathfinder generates a path that the UAV will traverse. The follow input arguments are necessary for the algorithm to function:
- The boundaries of the search area
- The initial location of the plane
- The direction of the wind
overshoot_distance
: The distance it takes the plane to level itself after turningpath_width
: The horizontal distance of the field that the camera can capture in one shot
As output, the algorithm returns a list of coordinates that the plane can traverse to capture the entire search area. Note that the algorithm assumes a 2D euclidian coordinate system. In practice, using GPS coordinates is fine.
Algorithm
- Parallel lines are drawn over the search area in the direction of the wind. Each line is
path_width
units apart. - The lines are broken up into line segments, and the line segments are cropped at the borders of the search area.
overshoot_distance
units are added to the top and bottom of each line segment- Starting from the plane location, a path is generated using the following algorithm: a. From the current point, find the nearest point in any line segment that hasn't been seen b. Add that point to the path, followed by the other point in that line segment c. Mark that line segment as seen, and set the current point to the end of the line segments d. Repeat until all line segments have been seen
Algorithm Rationale
This algorithm was chosen to address a couple concerns:
- The resulting path primarily has the plane flying into or against the wind, therefore reducing the distance that the plane will veer off track
- By padding each line segment by the distance it takes to level the plane, it ensures that the plane will always be flying level when it is over the search area
Requirements
Pathfinder requires that the following libraries be installed:
- numpy (pip install numpy)
- scipy (pip install scipy)
- shapely
* GEOS must be installed first. on mac os x you can use brew install geos
- Can be installed with pip install shapely
- Python Imaging Libary (recommended)
- Can be installed with pip install pil
- PIL is only used to render the images for the map, so it is not technically
necessary, but useful
How to Run
- Modify
main
in pathfinder.py with the coordinates that you wish to use - Open a console and run:
python pathfinder.py
- The path will be output to
STDOUT
in QGC format, and the image of the path and search area will be saved tooutput.jpg