As many probably know, this year's Sparkfun Autonomous Vehicle Competition (AVC) is similar to last year's except that a new challenge has been added in which we can gain extra points by finding and popping 1m red balloons. It's pretty difficult to do (see failed attempts #1, #2, #3) but as you can see from the video above it's finally getting the balloons.
The setup is detailed on this page on the developer wiki (scroll down to the Red Balloon in the Example Projects section) but in any case, it uses a Pixhawk running a modified version of AC3.2 (code here, AC3.2 testing thread here). The Pixhawk has all the regular ArduCopter functionality but in addition it accepts commands from an external navigation computer, an Odroid U3 when it is in the Guided flight mode, or in AUTO and running a newly created MAVLink NAV_GUIDED mission command. This NAV_GUIDED command takes some special arguments like a timeout (in seconds), a min and max altitude, and a maximum distance and if the Odroid takes too long to find the balloon, or gives crazy commands that cause the copter to fly away, the Pixhawk retakes control.
So while the Odroid is in control, it first requests the pixhawk to rotate the copter slowly around while it pulls images from the Logitech C920 web cam and uses OpenCV to search for blobs of red in the images. During the search it keeps track of the largest red blob it saw so after the copter has rotate 360 degrees it sends commands to point the vehicle in the direction of that blob and then sends 3D velocity requests 5 times per second to guide the copter towards the top of the balloon. Leonard Hall helped me greatly in improving the control algorithm both for the new velocity controller that was added to ArduCopter and also with the strategy the Odroid should use to best get to the balloon..
All of the communication between Pixhawk and Odroid uses Kevin Hester's Drone API and Tridge's MavProxy. It's relatively easy to use and allowed me to write all the code in Python. That code is all here.
A couple of extra things that came out of this was I managed to use Python's MultiProcessing to allow the image capture and image processing to run in separate processes (so they run in parallel). It seems that unless images are pulled from the camera at 15 ~ 30hz, they become extremely laggy. In one test I measured a 1.3 second lag in the images from the camera! With MultiProcessing that's down to less than 0.2 seconds and there are 2 more cores still free on the Odroid so there's room for more sophisticated work to be done!
For testing, at Tridge's suggestion, I set-up a balloon simulator that works within SITL. It used the simulated copter's position and attitude and then created a simulated image of the horizon and the balloon (if it was within the field of view of the simulated camera). This fake image was then fed into the image recognition python code making it an end-to-end test. This was all possible because both the Odroid and our Simulator run on Ubuntu. Having the simulator allowed a lot of bench testing before any real flights happened.
If you want to see a really impressive use of image processing in ArduPlane, check out Michael Darling's video here of one arduplane following another. Michael's set-up is similar in that he uses the same camera and an external nav computer (a beagle bone black) and OpenCV. I'm not sure what communication method he used between the BBB and the Pixhawk.
Also I hope that over the next year we will enable more image processing computers to work with ArduCopter (and ArduPlane, ArduRover) and maybe lead to the safe precision landings Jesper Andersen suggested in this blog post.
All feedback welcome!
Comments
@anderson cool!!!..
@randy.. shop.adapteva.com just opened this morning and I managed to score 2x 16 core boards eagerly awaiting the next gen 64K boards in same form factor.
hzl
ps off to frys for a C920 cam with hw mjpeg streaming
This project made Wired!
oh and yes the parallella board supports a dual core arm9 and ubuntu in addition to the epiphany 16 core chip(which are accessed via OpenCL :) so porting the code I am hacking at should not be much of a chore. Looks like michael has used a c920 cam supporting mjpeg with xmitted huffman tables dont know if this c-910 up to task but will try shortly.
more later
hi randy
OpenCl is a code interface for parallel programming and can greatly accelerate programs/algor/libs that benefit from same such as certain algorithms in OpenCV,(multiple object tracking is one app), CMT and OpenTLD remain to be seen(got .95 fps on BBB with an OpenTLD implementation without neon) we will see after I wade through these neon instructions , get my net setup for distcc cross compiles etc.. Michael seems to have had quite some time setting up all these facilities...:) hopefully will finish in a few hours given all the interrupts I have had since morning.
as far as parallella goes the AMD path of GPUs are where one sees OpenCL and derivatives and the parallella chips (they are supposed to have 64 cores in the next pass) will supposedly support same? I am awaiting either the store to reopen OR publication of the reference design to use the chips failing that will design breakout for same and breadboard it for now..) boards are currently going for about 250.00 ebay(list is 99.00) but feel the store will reopen soon . and yes I am expecting dramatic improvements in OpenCV et al...
hzl
Wow, is the balloon recognition code also available in the above links?
@FD,
Yes, I think the precision landing is very possible with a similar approach. We'd probably want to make some changes to guided mode so that the odroid (or equivalent) knows that we're attempting a landing so that it knows to shut off the motors the moment the landing detector says the vehicle has landed. The odroid's python code would probably be changed a bit but mostly it's the same I think.
One neat thing about the Odroid is it has lots of power so it's possible that it could be used to do multiple things like FPV, OSD, precision landing, etc. It could even handle multiple cameras. It's a little bulky so I expect that at some point someone will develop a board with very similar components but specifically made to be put on ArduCopters/ArduPlanes although I haven't heard of anyone (including 3dr) with plans to do that.
@Bill, you can purchase a U3 here. On the dev wiki page, there's a list of some other bits you might consider getting if you do decide to buy one.
Thanks for the feedback!
@Bill, you can purchase a U3 here. On the dev wiki page here, there's a list of some other bits you might consider getting if you do decide to buy one.
Thanks for the feedback!
Wow this is amazing. I can't seem to find anywhere to purchase an Odroid U3. Does anyone know where I can get one?
-
1
-
2
-
3
-
4
of 4 Next