<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dyadica.net &#187; Balance Board Filters</title>
	<atom:link href="http://blog.dyadica.net/archives/tags/balance-board-filters/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.dyadica.net</link>
	<description>Fun and Games in the Dyadic Sea</description>
	<lastBuildDate>Wed, 21 Jul 2010 14:04:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Balance Board Quadrant Filter for WiimoteLib</title>
		<link>http://blog.dyadica.net/archives/the-balance-board-quadrant-filter-for-wiimotelib</link>
		<comments>http://blog.dyadica.net/archives/the-balance-board-quadrant-filter-for-wiimotelib#comments</comments>
		<pubDate>Tue, 14 Jul 2009 22:23:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Wii]]></category>
		<category><![CDATA[balance board]]></category>
		<category><![CDATA[Balance Board Filters]]></category>
		<category><![CDATA[Quadrant]]></category>
		<category><![CDATA[Quadzone]]></category>
		<category><![CDATA[WiiFit]]></category>
		<category><![CDATA[wiimote]]></category>
		<category><![CDATA[wiimoteLib]]></category>

		<guid isPermaLink="false">http://blog.dyadica.net/?p=2163</guid>
		<description><![CDATA[There are times when using the WiiFit Balance Board with WiimoteLib that I find it useful to have direct access to which particular &#8220;Quadrant&#8221; currently has focus (most weight or COG applied), as with the ...]]></description>
			<content:encoded><![CDATA[<p>There are times when using the WiiFit Balance Board with WiimoteLib that I find it useful to have direct access to which particular &#8220;Quadrant&#8221; currently has focus (most weight or COG applied), as with the Quadzone Filter just think WiiFit areobics etc.</p>
<p>When used in conjunction with the Quadzone Filter you have the basic tools needed for very simple forms of navigation. As with the Quadzone filter, output is fed back as a string which can then be used as desired eg in a switch or if statement etc.</p>
<p>So without further ado heres how its done:</p>
<p>First of all open up Data Types.cs and add the following code block within the BalanceBoardState struct:</p>
<blockquote><p>/// &lt;summary&gt;<br />
/// Current Balance Board Quadrant, SJB<br />
/// &lt;/summary&gt;<br />
[DataMember]<br />
public string Quadrant;</p></blockquote>
<p>Next open up Wiimote.cs and locate the parse extension function. For convenience sake the following block shorthands the values included with WiimoteLib. The code is the same as that used in the Quadzone tutorial so if you have already implemented it there you can skip this step, otherwise add the following code below the existing COG code just above the break:<span id="more-2163"></span></p>
<blockquote><p>// Shorthand the values for lazyness (Raw)<br />
// float TLrkg = mWiimoteState.BalanceBoardState.SensorValuesRaw.TopLeft;<br />
// float TRrkg = mWiimoteState.BalanceBoardState.SensorValuesRaw.TopRight;<br />
// float BLrkg = mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomLeft;<br />
// float BRrkg = mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomRight;</p>
<p>// Shorthand the values for lazyness (Kg)<br />
float TLkg = mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft;<br />
float TRkg = mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight;<br />
float BLkg = mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft;<br />
float BRkg = mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight;</p></blockquote>
<p>As you can see I have included suggested functionality for using the raw values, but personally I have not found a need to yet. Its just there for reference! Next we need to add the code that will enable Quadrant output at run time. Below the shorthand code add the following block:</p>
<blockquote><p>// Calculate the heavest quadrant<br />
if (TLkg &gt; TRkg &amp;&amp; TLkg &gt; BRkg &amp;&amp; TLkg &gt; BLkg) { mWiimoteState.BalanceBoardState.Quadrant = &#8220;TL&#8221;; }<br />
if (TRkg &gt; TLkg &amp;&amp; TRkg &gt; BRkg &amp;&amp; TRkg &gt; BLkg) { mWiimoteState.BalanceBoardState.Quadrant = &#8220;TR&#8221;; }<br />
if (BLkg &gt; TLkg &amp;&amp; BLkg &gt; BRkg &amp;&amp; BLkg &gt; TRkg) { mWiimoteState.BalanceBoardState.Quadrant = &#8220;BL&#8221;; }<br />
if (BRkg &gt; TLkg &amp;&amp; BRkg &gt; BLkg &amp;&amp; BRkg &gt; TRkg) { mWiimoteState.BalanceBoardState.Quadrant = &#8220;BR&#8221;; }</p></blockquote>
<p>Once complete Quadrantis available by the normal means for example:</p>
<blockquote><p>WiimoteState ws = state;<br />
BalanceBoardState bb = ws.BalanceBoardState;</p>
<p>string current_quad = bb.Quadrant;</p>
<p>//Or following the Wiimote Test example<br />
lblQuad.Text = ws.BalanceBoardState.Quadrant;</p></blockquote>
<p>That&#8217;s all there is to it easy eh! If you haven&#8217;t seen the Quadzone tutorial yet, go check it out. The two methods compliment each other greatly!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.dyadica.net/archives/the-balance-board-quadrant-filter-for-wiimotelib/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
