<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Christopher O&#39;Hagan on Medium]]></title>
        <description><![CDATA[Stories by Christopher O&#39;Hagan on Medium]]></description>
        <link>https://medium.com/@christopherohagan?source=rss-4efa7d50bc4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*A4u9bCvU-5QxqnPZ.</url>
            <title>Stories by Christopher O&amp;#39;Hagan on Medium</title>
            <link>https://medium.com/@christopherohagan?source=rss-4efa7d50bc4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 01:04:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@christopherohagan/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Real Guns as Controllers: How to Bring Anything into VR]]></title>
            <link>https://medium.com/kainos-applied-innovation/real-guns-as-controllers-how-to-bring-anything-into-vr-bc2e21d3f164?source=rss-4efa7d50bc4------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc2e21d3f164</guid>
            <category><![CDATA[controller]]></category>
            <category><![CDATA[virtual-reality]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[hid]]></category>
            <category><![CDATA[htc-vive]]></category>
            <dc:creator><![CDATA[Christopher O'Hagan]]></dc:creator>
            <pubDate>Fri, 23 Feb 2018 13:45:38 GMT</pubDate>
            <atom:updated>2018-07-19T17:59:47.162Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I’m Christopher O’Hagan, a software engineer at <a href="https://twitter.com/KainosSoftware"><em>@KainosSoftware</em></a><em> and I am working in the Applied Innovation department. Focusing on Immersive technologies. This blog is about how we recently turned an almost completely functioning rifle into a Virtual Reality controller and how we overcame the issues that came with it.</em></blockquote><p>We have recently been approached by a Canadian customer looking for help building a realistic shooter as an attraction for their arcade. This is a part of a growing trend we have observed where immersive technology such as VR is being used for in-location entertainment businesses such as <a href="http://www.exitusvr.com/">escape rooms</a> and <a href="http://www.vrcoaster.com/">roller coasters</a>. While the equipment and setup can be expensive it is viable due to the high footfall and novel environments offered by these businesses. A great example of in-location entertainment is virtual paintball which companies, like ‘<a href="http://www.thevoid.com/">The Void</a>’ have succeeded in doing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Th9iHOe5eCWu43iQI_0BA.png" /></figure><p>Our primary challenge for the immersive shooter we were helping with was to build and utilise an actual firearm… or at least something that looked and felt like one.</p><h3>Getting the Controller</h3><p>Originally we believed sourcing a controller would be difficult. We reached out to a local air-soft gun supplier, <a href="http://www.gearofwar.co.uk/">Gear of War</a>. Our requirements were:</p><ul><li>A replica air-soft rifle that looked, felt and was weighted like a real rifle</li><li>A gun that, when fired would produce realistic recoil</li><li>A trigger and safety that were wired so that we could use them for inputs of our simulation</li></ul><p>We thought this would be asking a lot but were surprised by the fact that this seemed normal to them. They have done a lot of props for TV and Films so had received weirder requests. We then used a mounted <a href="https://www.vive.com/uk/vive-tracker/">Vive tracker</a> to track the gun in VR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nM9tDAYFt0GyJbzQC318Cg.png" /></figure><h3>Setting up the Controller</h3><p>This is where we experienced our main issue, vibrations: The issue was caused by the realistic recoil of our gun. Since the Vive Tracker uses IMUs (Inertial movement units) for tracking at a high frequency, and the Vive lighthouse system for tracking at a comparatively lower frequency and for drift correction. IMUs work by measuring acceleration in each axis then calculating displacement from that measurement. When IMUs are aggressively vibrated, such as when being mounted to a realistically firing weapon, they are unable to track accurately. This was a problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*8eSkxjdkWscUqm2VbGZNaQ.gif" /></figure><p>As we are not experts in vibration, we made some attempts to solve the problem but didn’t make much progress. We then decided to make a <a href="https://www.reddit.com/r/Vive/comments/71rh20/dev_dampening_vive_tracker_attached_to_realistic/?st=jbgbnh9a&amp;sh=dcdf2a67">reddit post</a> to <a href="http://www.reddit.com/r/Vive/">r/Vive</a>. The community response was helpful, correcting some simple stuff we missed such as the tracker being too far up the rail. To our surprise HTC contacted us about the project showing interest in what we were attempting to do. They had a beta version of the Vive Tracker firmware which could help, a low pass filter for the IMU, which they gave us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u0tSx32QzaeCAe5jwdF5yA.png" /><figcaption>Graph of normal input versus input after the use of a low pass filter</figcaption></figure><p>The low pass filter could be configured through the USB HID interface. We were able to send ‘0xB3’ reports, which sends basic information about the device being used as well as the low pass configuration, from a MacBook to the Tracker with the right settings to sufficiently dampen the vibrations. The next step was to send the feature report, which allows us to communicate changes in settings as well as control HID devices, to the Tracker from a raspberry pi as we needed something that could fit inside the gun’s cartridge so that the user couldn’t see the wiring.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a65892664d82662874c309c1d808f7b/href">https://medium.com/media/0a65892664d82662874c309c1d808f7b/href</a></iframe><h3>Low Pass Filter</h3><p>These are the steps to set up the Raspberry Pi for this sort of project</p><ul><li>Install <a href="https://www.raspberrypi.org/downloads/raspbian/">raspbian</a> on the raspberry pi</li><li>Update pi’s version of ‘<a href="http://thisdavej.com/upgrading-to-more-recent-versions-of-node-js-on-the-raspberry-pi/">Node.js</a>’</li><li>Install the ‘<a href="https://github.com/node-hid/node-hid">node-hid</a>’ library into your project, for specific instruction to do that on the pi look <a href="https://github.com/node-hid/node-hid#compiling-from-source">here</a></li><li>Add a file in udev called `60-HTC-Vive-perms.rules` with this line in it</li></ul><pre>KERNEL==&quot;hidraw*&quot;, SUBSYSTEM==&quot;hidraw&quot;, ATTRS{idVendor}==&quot;28de&quot;, ATTRS{idProduct}==&quot;2022&quot;, TAG+=&quot;uaccess&quot;</pre><p>An issue which you can have is that the wrong wIndex value is being used by node-hid, in this case wIndex is used to specify the interface or where the report is sent. Here’s something to help get your head around <a href="http://www.beyondlogic.org/usbnutshell/usb6.shtml">USB requests</a>. ‘Node-hid’ doesn’t allow you to specify the interface. Fortunately when I looked back at the ‘show-devices.js’, which comes with the ‘node-hid’ library and outputs all connected HID devices, it had different paths for each interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LCA9SqyIWLP-K592aUgbDg.png" /><figcaption>Using the show-devices.js, which comes with the node-hid library. You can find which path to use in the code in case it appears different</figcaption></figure><p>If you have any other issues with the script, ‘<a href="https://www.kernel.org/doc/Documentation/usb/usbmon.txt">usbmon</a>’ comes with Raspbian and allows you to view all the usb requests being made. Here’s a useful <a href="https://elinux.org/images/1/17/USB_Debugging_and_Profiling_Techniques.pdf">link</a> to help you decode those requests.(Starts at page 15)</p><h3>Conclusion</h3><p>Using a gun as a VR controller was by no means easy. The vibrations of the gun firing are strong enough to disrupt the IMUs ability to accurately track itself. Using the Tracker’s low pass filter feature, and an on-board raspberry pi we were able to overcome this issue without compromising tracking or the force at which the gun vibrates.</p><p>Thanks for reading <br><a href="https://twitter.com/cohagan154">@cohagan154</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc2e21d3f164" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kainos-applied-innovation/real-guns-as-controllers-how-to-bring-anything-into-vr-bc2e21d3f164">Real Guns as Controllers: How to Bring Anything into VR</a> was originally published in <a href="https://medium.com/kainos-applied-innovation">Kainos Applied Innovation</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>