This project is about harvesting fruits from trees. In uneven terrain harvesting fruits from cherry-trees, pear-trees and olive-trees can be complicated and time consuming. Using a drone with the capability to find and harvest ripe fruits from the air is the goal for my project. The first step is to make a drone capable of autonomous flying and to identify and locate the fruit that is ready to be harvested.
An autonomous drone that can inspect fruit trees in hilly terrain during the growth period and identify ripe fruit that is ready to be harvested. I have not seen any solution to this problem other than manual work. With the final solution it will make harvesting in hilly uneven terrain more or less automatic.
I have been interested in new techniques and wanted to learn how to use machine learning (ML) and object detection from video for a long time and when I found the NXP HoverGames Challenge 3: Sustainable Food Ecosystems I used that as the trigger.
I will use the drone kit as a base for an intelligent vision system starting with a single camera but the final solution will probably use 2 cameras and the i. MX 8M Plus application processor with a Neural Processing Unit to identify the state of fruit trees, their flowers and fruit. The drone will wirelessly and securely receive commands from and transmit data to a ground station. Before going on a mission the drone will determine if the weather is good enough using temperature, rain sensor and wind measurements. The main feature is the capability to locate ripe fruit of different kinds in uneven (mountainous) terrain.
Community helpI had really good help from other competitors that helped me solve many problems.
https://discord.com/channels/1014291298812960913/1027691375770218638/1063479273077346375
https://discord.com/channels/1014291298812960913/1027691375770218638/1063759819477106749
https://discord.com/channels/1014291298812960913/1027691375770218638/1068502582282170378
https://discord.com/channels/1014291298812960913/1027691375770218638/1071874574389612604
https://discord.com/channels/1014291298812960913/1027691375770218638/1072102240153772032
https://discord.com/channels/1022170275984457759/1073880947335901264/1075314208587141162
Building the droneReceived the Drone package just before Christmas but was going to spend the holidays vacation abroad so I just looked through the package and checked that everything was there. I stowed away the drone kit and just waited to return and start building. See attached document Packing list explained for the NAVQ+ contents.
Back in France the 8 Januari I started building the drone following the instructions in https://nxp.gitbook.io/hovergames/userguide/getting-started to get to the point where I now have a complete drone with PX4 and QGroundcontrol waiting to get GPS signal lock, got it to arm after moving the drone outside.
My portable PC had problems with battery life so I had to move to a new PC. Initially I planned to use ROS2 on the companion computer but incompatibilities between different SW made me abandon this idea for now. Setting up wsl2 development environment and mission control center.
Got usb communicaton with wsl2 working after following https://learn.microsoft.com/en-us/windows/wsl/connect-usb
and deleting an old firewall program and restarting my computer. Then I updated /etc/udev/rules.d/99-perm.rules
to contain: KERNEL=="ttyUSB0", OWNER=="root", GROUP=="plugdev"
Then run udevadm control --reload
sudo service udev restart
sudo udevadm control --reload
I got the companion computer working so I could stream videos to QGroundControl and after 1 weeks vacation skiing in the French Alps (Le Portes du Soleil) I started to work on getting tensorflow working on my PC with the examples in opencv-python-free-course-code/13_Object_Detection. Not that it was easy, the course used Anaconda, a framework for presenting code and instructions mixed on a webpage and I had some trouble getting it working. After 3 hours of videos and trying step by step I got it working and now I have a prototype python program that can detect objects and label them.
Next hurdle is getting ML to work on the companion computer. Following the short instructions in https://nxp.gitbook.io/8mpnavq/dev-guide/software/ai I got the example in /usr/bin/tensorflow-lite-2.6.0/examples/ working on the companon computer and after installing tflite_runtime with pip install tflite_runtime the label_image.py program also works.
Assembled the complete drone with a companion computer and an 3s 4200mah battery for a total weight of 1740 grams and took some photos for this description. Lacking time I have only used the default SW packages indicated in the instructions, so I have not forked any repositories.
Flight testingWhen I started this project I had no clue about the drone legislation in France, I was hoping to be able to fly in my garden or in a nearby field, and that is possible if the drone weighs less than 800 grams. As this drone is closer to 2 kilos I will need to only fly in areas designated for model flying and only after completing an official course. It is possible to fly a tethered drone in my garden so I will try to do that.
I started with the drone well anchored to a table to see if the calibration and all parts are working as planned. This video shows the testing:
Some plots taken from Flight Review analysis of logs that show almost acceptable vibration levels:
This has been a very nice and educational project that has teached me a lot of new things but also that things take more time than expected. The pieces of information available on the internet are very dispersed so hard to take in, an example is how to make different versions of PX4 work with ROS or ROS 2. I have not come as far as I had planned but in a way the learning is the journey and it is not yet finished.
Things that remains to do are:
- Get object detection to work on the companion computer
- Get the drone airborne
- Upgrade PX4 to the latest version
- Upgrade the NAVQ to Ubuntu 22.04
- Get the Bosch BME688 integrated to the NAVQ
- Get communication between the two computers to work with the help of Fast RTPS Bridge between HoverGames (running PX4) and ROS 2 - Hackster.io
- Get offboarding to work
- Start analyzing if fruits(pear,olives or apricots) ripeness can be detected from the air
Comments