Introduction: VASP - a UAV That Take Aerial Pictures and Transform It in a "map"
VASP, is an acronym in brazillian portuguese that stands for "Autonomous Vehicle for Plantation Support". It's an flying wing made of styrofoam and equipped with a RC controller, a flight controller board (ArduPilot), a webcam and a DragonBoard 410C.
The main idea is to take aerial pictures and input a GPS tag in each picture, that makes possible to postproccess the pictures and organize then in the exactly place where they were taken.
Step 1: Building the Plane From a Kit...
I've bought my flying wing in a kit composed of 4 parts: 2x wings and 2x winglets and some plastic parts to fit all together.
I had to glue both parts, left and right wings come separately, like the picture...
I've used epoxy glue (the one that comes in two different tubes) and I felt that it doesn't gave enough strength, so I've inserted 4 wooden sticks (the barbecue ones) in the middle of the wing, and it increased considerably the resistance without adding much weight.
After that, I've placed the servo-motors in the hole designed for it, fixed with tape (!) and connect all the electronic part (radio receiver and battery). At the back of the plane, I've installed the 2200kv brushless motor in a wooden piece and glued in the styrofoam with epoxy again (watch out, cyanoacrilate glue will destroy the styrofoam) and connect it to the ESC (Electronic Speed Controller). There's a video of me testing it...
Another idea is to build your own flying wing, that video shows how to:
Step 2: ... or Build One for Yourself
Step 3: Installing Debian on the DragonBoard 410C
Installing Linux in the DB 410C is quite simple, I will explain how to do it using an SD card:
Further information can be found in https://github.com/96boards/documentation/wiki/Dra...
Note that is said that you can use a 4GB SD card, but I've tried with a cheap and untrust card and didn't work, so I advise to use a 8GB card at least, or a good 4GB card.
1) Download the latest version of Debian, from Linaro website, there's a link right to the latest release
2) If you are using Linux, you have to know which block is allocated to your SD card, a clue is to use the command lsblk before and after inserting the card, in my case, the SD card is at sdb, remember this, because you will gonna use later.
3) Go to the place where you have downloaded the image (step 1) and extract the file, it can be done simply typing unzip anda the name of the file (or start to write unzip dragonboard... and press the TAB key).
4) Use the command sudo dd if=db410c_sd_install_debian.img of=/dev/XXX bs=4M oflag=sync status=noxfer
changing the XXX to the block of your SD card (sdb in my case).
In my case, the full command is:
- sudo dd if=db410c_sd_install_debian.img of=/dev/sdb bs=4M oflag=sync status=noxfer
5) Now place the SD card in the DB410C slot, turn your board upside down and find the S6 switch, where you can find 4 little switches, turn the second to ON (where can be read: SD BOOT)
6) Plug the HDMI cable in a monitor/TV and a mouse or keyboard (or both) in the USB port of DB. Turn on the DragonBoard and follow the instruction on screen.
Step 4: Installing ArduPilot
The video shows how to do so...
Step 5: Webcam Installation
I've tried more than one webcam on DragonBoard, one of them I had some extra tasks (setting a different quirks for the camera, in the uvcvideo driver, etc...)
But with the Logitech C910 I had no problem.
The recommended software is the fswebcam that can be easily downloaded using apt-get:
- sudo apt-get install fswebcam
There's a lot of options that can be set to take a picture, I've used the command:
fswebcam -d /dev/video2 -S 2 -s brightness=60% -s Contrast=15% -s Gamma=50% -r 1280x720 --jpeg 80 -s Sharpness=40% -s Saturation=15% --no-banner /home/irving/output.jpg
- -d /dev/video2 : device, can be ommited, in my case, there's more than one video devices connected
- -S 2 : Skip, get the 3rd frame, skip the first 2 frames of the picture, enhance the quality
- -s : settings
-r 1280x720 : resolution of the picture
--jpeg 80 : quality/compression of JPEG
--no-banner : exclude a default banner that comes with the picture, showing date/time
/home/irving/output.jpg : destination and name of the picture
Step 6: Setting Up the GPS
I had a spare USB/Serial converter in my house, so I decided to use it plugged in the USB of the DragonBoard, but I could use the Serial connection, just paying extra attention because of the voltage (1.8V) accepted in DB and the voltage (5V) of the GPS.
If you don't use a USB/Serial converter you should make a tension divider circuit, with some resistors to don't allow more than 1.8V in the RX/TX pins.
Or you can use the Linker Mezzanine Board, that sets the right voltage.
The connection using USB/Serial is quite simple, connect GND and VCC in the right pins and TX of the GPS in RX of converter and RX of GPS in TX of converter.
I've used the uBlox GPS (with compass) and I shared the GND and RX pin with the ArduPilot board. This GPS communicates using the NMEA 0183 protocol.
So I've dowloaded the pynmea2 Python library to deal with the data.
Installing pynmea is quite easy, if you don't have PIP yet, you should use:
sudo apt-get install python python-pip
pip install pynmea2
This lib parses the code sent by the GPS, for an example, one of the lines sent by the GPS is:
Testing the lib:
msg = pynmea2.parse("$GPGGA,184353.07,1929.045,S,02410.506,E,1,04,2.6,100.00,M,-33.9,M,,0000*6D")
Should print, as result:
You may also need to install the serial library
pip install pyserial
Step 7: Code
The full script in python is available to download, it runs in a loop, taking coordinates and using a tool called exiftool, that tag the pictures with the latitude and longitude variables.
You may need to download it before starting to code
sudo apt-get install exiftool
Another feature of the code is the way that avoid to overwrite the pictures, naming those with the full date/time
timestr = time.strftime("%Y%m%d-%H%M%S")
name = "pic"+timestr+".jpg"
The full code is available to download, and it's a working in progress...
To execute, just go to the folder that you saved it, and write:
Step 8: (optional) Testing With a Drone
After doing all the steps, I decided to test it with a drone, it's much more simply and safe to fly than a flying wing.
I have used a portable monitor and keyboard to execute the code before flying, and tried to fly in a fixed altitude and making a 'zig-zag' pattern of fly.
The cool part is that you can film the flight with the onboard camera while take geotagged pictures with the other.
Step 9: Installing WebODM
OpenDroneMap is a platform that postprocess the aerial pictures, as explained in their website:
"OpenDroneMap is a tool to postprocess drone, balloon, kite, and street view data to geographic data including orthophotos, point clouds, & textured mesh."
And they developed an user-friendly and ready-to-use version, that you can host in your on machine, called WebODM.
You may need to install Docker and docker-compose before starting:
Installing Docker-CE in Ubuntu
- pip install docker-compose
To install WebODM, simply follow GitHub instructions:
- git clone https://github.com/OpenDroneMap/WebODM --config core.autocrlf=input
- cd WebODM
- ./webodm.sh start
Step 10: Running WebODM and Results
If the start of WebODM was done correctly, you should open your browser using the URL: http://localhost:8000/ and see a login page.
After setting your user, you can create a new project and upload the pictures, one hint is to delete the pictures where your plane/drone was not in the specified altitude, avoiding the algorithm to make mistakes because the pictures near the groud are very different.
The picture showed is from a database (you can download and test it) and is a "Point Cloud" structure, in the WebODM you can move it, rotate and take a better look, it seems like a 3D image.