I'm a brewer. I love to brew in my garage in the Summer. The problem is the bugs. They've invaded. Time for them to all die. Especially those little flying kamikaze bettles.
This is our primary target:
These little b---ards think the 5g of beer I'm making is a great swimming pool, and I'm tired of them doinking off my head. Time to go Arnold on them!
I'm working on a project I've dubbed "Talos" to identify, track, and down these pests. I've got a few ideas, but before starting the project, I wanted to brainstorm with you guys a few different ways to get this thing done - and to see if it was even possible.
I have a pretty powerful computer that I think can handle whatever is thrown at it for analytical purposes. It's got 64gb of memory, a gtx 680 card w/ 4gb of memory, i7-3820 processor, samsung 500gb ssds for the OS. If the system isn't adequate, please let me know where it falls short.
I had a few questions about the setup for the tracking system:
1) I've heard that a 640x480 camera should be adequate to identify these little buggers as they are about 1/2"-1" in size. Also, deinterlaced video should be used and a high frame rate. I was planning on at least 30fps, but will try to get 60fps if possible.
2) I want the camera to cover an area of about 16' long by 7' height or about 112/sqft.
3) What I planned on doing was to put the camera on one side of the garage in a stationary position. From there, it would focus on a white background rather than a random background to help the camera see smaller objects so the coloration of the pixels can be more easily tracked (well, unless the bugs are white)
4) I'm not sure how I should do the video feed? Should I directly connect the web cam to the computer over a long cable? Should I try a wireless webcam? Should I integrate a camera with arduino and have arduino wirelessly transmit the video feed to my computer? I thought something like this camera might work (25fps/640x480 res/not sure on interlacing):
5) Once the video feed reaches the computer, roborealm takes over. I'm new to RR, so I assume it can do pixel comparisons from frame to frame, but can it do it fast enough to track a bug that can fly up to 2m/sec (though they average less than 1m/sec)?
6) Last but not least, RR will plot a solution to the target. I'm not sure if it's possible to make all of this fast enough and accurate enough? So would you have to have RR track the object and guess it's flight path/speed and then send an anticipated solution to bring down the target? I assume that is the case based on the calculations I've done below.
7) I was planning on using a 2w blue diode laser to make the kill shot. Do you guys think that laser can inflict enough damage to bring down the bugs?
Calculations that I need/have done.
*If the bug can fly 2m/second, that means in the time it takes a 30fps camera to go from one frame to the next, the bug could have moved .06 meters or about 2.4 inches - effectively moving it out of the way of the laser if it bases the targeted position on the present position of the bug. Even at their typical flying speed of 1m/sec - they would still be out of the way of the laser. Hence, I'm assuming a predictive tracking system will be required. Can RR do that?
*Please check my math on this. The camera has 640 x 480 resolution - meaning it captures 307,200 pixels. Assuming the camera will cover 112 square feet, that's about 2,743 pixels per square foot. Which means, that each square inch has about 19 pixels (2,743pixels / 144 in). So if you have about 19 pixels per square inch, that means that each inch is about 4 pixels by 4 pixels. Hence, a camera with a resolution of 640 x 480 should be able to track anything up to 1/4" to 1/5" inch in size? Obviously, the closer you move the camera to the target, the easier it can track it?
*I'm not sure what type of delay the computer will have when it comes to the tracking to view differences from one video frame to the next. I'm assuming milliseconds, but those are additional considerations that will need to be taken into account for tracking. Any ideas on how I could figure that out?
*Lastly, there will probably be a delay with the servos and whether or not they're fast enough or if they can be precise enough. Any ideas? I'm not sure how accurate I should try to have the servos be based on the square footage they're trying to cover and the objects they're trying to track?
So there you have it. That's Talos in a nutshell. What do you guys think?
While possible this is going to be a very challenging project. Others have attempted similar things
along with various YouTube clips of similar systems.
1) Camera - you'll need highest resolution you can afford at the fastest frame rate you can afford. The problem is that bugs are small so unless you have a really high res camera you will not see those bugs more than a foot or so away. Luckily they are not as small as mosquitos (above video) so you have a better change of hitting them.
Try taking some photos in the area you plan to use and see if you can even see the bugs in the image. Note, the faster the frame rate, the sharper the moving bugs will be which will help to determine flight path.
2) Camera coverage - 112/sqft is probably not going to happen. Unless you get something like a fisheye lens you will not be able to get that kind of coverage from a camera unless its placed very high up ... and then it will be too high to actually see the bugs. Again, take some example photos and see how they look.
3) Background - Yes, a planar background will make things easier. Detecting non-white blobs on a white background can be done quite quickly and easily.
4) Connection - You'll have to wire things directly. Wireless will induce too much lag in the processing which means you give the bug more of a chance to get away. USB is probably what you want. Ethernet can work too but you'll need Machine Vision caliber cameras for that (expensive) since anything else will also induce a real time lag (i.e. the image you see is 1 second behind reality). You'll have to test webcams you have access to to see which ones work. Don't skimp on this ... spend at least $100 on a webcam to even get a chance of getting close to what you need.
Forget an Arduino, way WAY too slow and not even relevant in this setup.
The camera you noted (IP Camera) will probably not work ... again cheap IP cameras induce quite a lag from reality as the image makes it way through its hardware. A webcam will give you much better resolution at a fast fps and closer to realtime.
5) RR Computer - RR can do what you need if its running on the right hardware. Fast modern PC (desktop is fine) needed for this. The faster it can run the better since you will decrease the error accumulation that happens over time. I.e. the shorter the distance the bug flys from detection to zapping the less error you will get in the system.
Again, get the webcam, machine and setup and record a short 1 min clip when the bugs fly around with the white background. That will answer a lot of questions.
6) Trajectory - RR doesn't do trajectory planning ... but with a little easy math you can figure that out using a simple linear extrapolation. Its not the best way to do this but if you are looking at short distances it will be fine.
We have this in
second example robofile download where it uses a simple form of prediction. You'd need something like that.
7) Laser Diode - No idea on if that will do enough damage. That's probably the strongest one you can buy without getting into very pricy or restricted situations. Perhaps you can buy a couple and bunch them together?
Anyhow, as I mentioned this is quite a project. Lots of mechanical setup and not cheap too do. At least you can start out by taking some basic pics to see if this is even possible.