Wednesday, August 5, 2009

FPS with Real Guns - Episode 02

Here's the second episode from Waterloo Labs. This time we are playing Half-Life (well, the flash version at least), with a real gun. Using accelerometers and LabVIEW, we can triangulate the position of where a bullet hits a piece of drywall and use that location to generate a mouse click in the game, which has been projected onto the wall.



UPDATE (8/12): If you have other crazy project ideas, comment on our newest blog post with your ideas!

UPDATE: Here is the code to complete the demo yourself.

UPDATE (14:49): Here is the system overview, parts list, and explanation of the math behind this.

58 comments:

  1. Awesome! Where is the LV code to get this done? :)

    ReplyDelete
  2. Code has been posted to

    http://decibel.ni.com/content/docs/DOC-6106

    ReplyDelete
  3. ...I was worried that this might not end well... but frankly, that's full of win!

    ReplyDelete
  4. You can't just say try this at home.. but not with Real Guns.. that takes all the fun out of it..

    ReplyDelete
  5. woah, overact much? downright obnoxious...

    ReplyDelete
  6. Very cool guys! Looks like a lot of fun, and without needing hi-tech pointing/shooting devices!

    Shovels, we need more shovels, the zombies are coming!

    Going to peruse the code too, thanks for this!

    ReplyDelete
  7. Very neat demo with good explanation and (most importantly) handled responsibly.

    ReplyDelete
  8. Hmm, would be fun to play FPS like this, but how is the wall going to withstand my AK47 and bazooka? :D

    ReplyDelete
  9. Okay, so where can I get a BFG?

    ReplyDelete
  10. If they were playing halo they should turn the guns on themselves.

    ReplyDelete
  11. can someone say terrorist training?

    ReplyDelete
  12. What is the sampling rate for the sensors?

    ReplyDelete
  13. Mmmm Ruger supressed .22 pistol

    ReplyDelete
  14. The ranges I shoot at definitely won't allow this. This is the excuse I've been waiting for to build a proper backstop on my property!

    Wife: "Why are you loading up the rifle?"
    Me: "Gonna go play some Half-Life, honey!"

    ReplyDelete
  15. can someone say counter-terrorist training?

    ReplyDelete
  16. Hey Anon,
    The sampling rate is 102.4 kHz.

    ReplyDelete
  17. What type of accelerometer did you guys use?

    ReplyDelete
  18. Made of win and dipped in awesome sauce.

    You can do it at home, just use a squirt gun, nerf gun, spitballs, paper throwing stars. The possibilities are endless!!

    ReplyDelete
  19. Your backstop appeared to be shorter and narrower than the piece of dry wall you were shooting into. It looked like at least half of the rounds that were shot probably didn't impact in your backstop. Your backstop setup definitely wouldn't have met NRA range design guidelines.

    I have a private range & training facility 1 hr from Austin that has a much safer backstop that you could use. Have you tested it with larger calibers? This would be useful for doing realistic training similar to a FATS machine, if it worked with standard defensive calibers.

    ReplyDelete
  20. Hi Karl,
    We built the drywall in an 8x8 foot section. The berm behind it was at least 8 feet tall and far more than 8 feet wide and was backed by another berm that was far more than 8 feet tall. Additionally, we did not fire into the top 1/3 of the drywall just to be sure.

    Steve is a licensed firearms instructor, so it was safety first with him! Must have been a camera trick. Thanks for checking it out!

    ReplyDelete
  21. Shit, I'd start showing up to Dorkbot again if you guys would demo.

    ReplyDelete
  22. Best DIY project I've seen in years.

    It says you used a USB-4432 board, one version of which is $2,000 and the other is $5,000. Which one do you need? And is there an even cheaper way of doing this?

    ReplyDelete
  23. I would be curious to test this sensiitivity of the accelerometers with Airsoft guns. Level of safety improves greatly and doesn't damage the backdrop. Though I would doubt the accelerometer can pick up a 50mm ball bearing traveling 300 fps.

    ReplyDelete
  24. Kudos. Now if you could only make this possible with lasers instead of guns and artificial recoil. Laser tag online baby. And how do you move forward, etc and turn the view? You should put this on a ball tredmil and see what you can do.

    ReplyDelete
  25. > I would be curious to test this sensiitivity of the
    > accelerometers with Airsoft guns. Level of safety
    > improves greatly and doesn't damage the backdrop.
    > Though I would doubt the accelerometer can pick up a
    > 50mm ball bearing traveling 300 fps.

    The level of safety only improves greatly if you are standing behind the drywall. There is just no way a bullet is going to ricochet off drywall... or a dirt mound backstop.

    Perhaps the only real gun you have access to is a desert eagle and you mean the risk of breaking your wrist?

    ReplyDelete
  26. Ya'll should be playing the Reflex series of games off www.missionred.com

    ReplyDelete
  27. To answer the last round of questions
    - 4432 is only 2000, the 5000 dollar version includes software you don't need (though it is pretty cool).
    - Airsoft guns definitely work, in building it we used rubber bands.
    - It is definitely possible to do it cheaper - we chose the 4432 because it has built in accelerometer excitation and good accelerometer acquistion.

    ReplyDelete
  28. Have you thought of turning this into a product? The shooting sports is having trouble attracting kids from the video game generation, something along these lines could go along way to getting more people involved in the sport.

    ReplyDelete
  29. mix this with the wii balance board and you might have a real life fps.

    ReplyDelete
  30. *** BOOM HEADSHOT!! ***

    OK, this definitely qualifies as a VERY COOL HACK. You clearly put some time into this. Nice work! +1 for making this into a product, say, with one of those air guns that shoots the plastic BB's, which would be reusable and cause no damage. This would be great for introducing people to the shooting sports in a safe and inexpensive manner.

    As for the FPS_Doug quote, seriously, have you sent this news to the Pure Pwnage guys? I'm sure they'd get a major kick out of this hack. Heck, they might even feature it in their show.

    --TP

    ReplyDelete
  31. OMG! army ... needs.... this....

    ReplyDelete
  32. really wish you had used crowbars instead of shovels.

    ReplyDelete
  33. Just for clarification on the math, this uses trilateration not triangulation: http://en.wikipedia.org/wiki/Trilateration

    ReplyDelete
  34. Is there a CHEAP replacment for the USB-4432 device?

    ReplyDelete
  35. is accelerometer compatible with arduino board ?

    would like to know if it is possible to do the same thing in a cheaper way … !

    ReplyDelete
  36. maybe plugin' a wiimote accelerometer to a arduino based board

    only things to do is data acquisition and software

    ReplyDelete
  37. @ Eran Gal-Or The important features in your daq device are that it simultaneously smaples all channels so the signals from each accel can be directly compared and the higher the sampling rate the better resolution you will get.

    We are looking into doing this a USB-6009 (from our last project) and $2 radio shack microphones (which could also sample the impact signal).

    Of course if you beat us to the punch with a cheaper alternative certainly let us and everyone else know!

    ReplyDelete
  38. There was a similiar system out a dozen years ago that used some badly acted video scenarios instead of games.
    However, the system used self-sealing foam mats for a video screen. The bullets left very small holes that looked amazingly like a #2 pencil had been poked into it. From 7 feet, the punctures were invisable and the screen could take thousands of rounds before needing to be replaced.

    If I remember correctly, the range that used the above system was located somewhere near College Station.

    ReplyDelete
  39. Just pure awesomeness. I laughed so hard when you guys took shovels to them, especially the last shoven-to-head hit, classic.

    ReplyDelete
  40. Very cool stuff.. Though it is worth mentioning that, at least in it's current form, this is far outside the reach of most hobbyists. The DAQ alone costs thousands, not to mention the thousands more for a copy of LabView.

    I've been trying to come up with a USPSA practice setup that uses airsoft for some time. I think I got some ideas from you guys -- I'll post if we ever get it working (and affordable)! Thanks!

    ReplyDelete
  41. Nice post, can you give more information about this again ?, Can we Be friend ? :)
    Software Source

    ReplyDelete
  42. What accelerometers were used (parts list is too general, I want to know actual parts so I can look at its data sheet).

    ReplyDelete
  43. Just found this and am both amused and impressed. In your post on 8/9 you mentioned looking into doing this with a USB-6009... any luck with that? I just happen to have one sitting here and would love to give this a try.

    ReplyDelete
  44. First, gratz for the project!

    Without the NI USB-4432 you just lose precision or it's impracticable?

    ReplyDelete
  45. Seems to me that reading the voltage spike from a piezo film vibration sensor would be a workable (and cheap) alternative to the accelerometer approach, by which I mean I've got them rigged up to my USB-6009 and it reads the impacts just fine. Any hints on tweaking your VIs for this? Unfortunately I know next to nothing about Labview, so haven't had much luck with it.

    ReplyDelete
  46. @Henrique
    We needed to use a USB 4432 because it gives us simultaneous sampling. That is, each channel has its own ADC and the signal is not multiplexed. Because these signals happen over such a short time span, if we were multiplexing the signal, we would miss the impacts. We had to use simultaneous sampling for this reason.

    ReplyDelete
  47. So, the code should be almost identical for using a USB-6009. The only thing that needs to change is the device name if I remember correctly. The DAQmx driver is used by both the 4432 and the 6009 so all of the acquisition code should remain unchanged.

    I am a bit concerned about the resolution you will have. The max sampling rate of the 6009 is 40kHz aggregate, so on 3 channels you will be sampling at 16.666 kHz (if my mental math is right). I would have to look up the speed of sound in drywall again but I believe we had thought the resolution in feet was too low for it to be workable.

    Not trying to discourage you, just let you know some of the hurdles we ran into and why we went with the 4432.

    ReplyDelete
  48. This is all kinds of cool. Someone please come up with a cheaper solution. The zombie invasion is coming and we're all gonna need to do some practicing. ;-)

    ReplyDelete
  49. Very Cool! I was really hoping to see your solution to the three-pickup version. Something other than "by solving this system..." Where's the real 2D solution?

    ReplyDelete
  50. I love this idea, and I have come up with what could be a very cheap solution to the accelerometers. I don't have ample time to work on this, and would appreciate some feedback and help.
    I found that it is possible to sync a wii remote (wiimote) to a pc via bluetooth, and access all of the accelerometer data (as well as other data from the remote) inside of LabView.
    This gives you the capability of setting up this same device with just a few wiimotes (and LabView for now).
    The problem I see with this is that the feedback requires an extremely precise timing for the triangulation. Does anyone have any input on how precise the feedback could be using a wiimote? Would the feedback be fast and accurate enough for triangulation?
    I look forward to building one myself!
    Thanks,
    -Nitai

    ReplyDelete
  51. Woo nowadays kids build shit to go out shootin at the night or what. From my part I rather stay at playing hl2 from home online while blowing a joint and drinking myself down.

    Im not impressed from this project...
    Make free energy or solve the bp oil shit

    ReplyDelete
  52. Well done, guys and dolls. The presentation was a joy to watch. Look forward to your next presentation. Good luck.

    ReplyDelete
  53. wow
    real shovel ... to the face!!! lol

    ReplyDelete
  54. I have made some work on it subject.
    1. It has nothing to do with tiangulation or trinagulation and so on - it is called
    "Delay estimation by FFT".
    I linked ADXL345+ARDUINO and calculated
    "Delay estimation by FFT". it turned out to be very pretty cheap and easy.
    Now i am at the point of By "solving this system of nonlinear equations for x and y, to determine the location of the impact" but
    it is looks like given method is lame too so I will have to kame up smth more sensible ;-)

    ReplyDelete
  55. I think the next level would be to do this in the round. The projector would have to rotate to wherever your head or eyes were pointed but rotate the scene so that you could turn around and scan 360 degrees. It would look almost exactly like you were using a headlamp (albeit with a square beam) in total darkness. that with as another submitter suggested, some sort of floor device that could sense moving and it would be so immersive.

    ReplyDelete
  56. I wonder what kind of accelerometer I should use? ADXL345 would be good choice? if yes, is it true that I should add high pass filter to the ADXL345 IC in order to obtain impact data??
    and I think, just with four ADXL 345s and cheap MCU module (such as ARM 7 OR CORTEX-M3),which is less than 1500 dollars, and using USB 2.0 high speed communication to PC, I could make the real gun game system like that~ right???

    ReplyDelete