dg Discussions Rss Feedhttp://dg.codeplex.com/Thread/List.aspxdg Discussions Rss DescriptionNew Post: Calculating Orientation from Raw Values WM+http://dg.codeplex.com/Thread/View.aspx?ThreadId=237248<div style="line-height: normal;">
<li>
<p>Calibrate the Motionplus (i.e. Find the raw value that corresponds to zero; I do this by holding it stationary for a point of time) -
<strong>Exactly what I do. It is zeroed by pressing the button to start a swing.</strong></p>
</li><li>
<p>For every subsequent raw value read, I subtract the zero value from it to get the "relative" raw value. - <strong>Exactly what I do.</strong></p>
</li><li>
<p>Then, I scale this value using <a rel="nofollow" href="http://wiibrew.org/wiki/Wiimote/Extension_Controllers">http://wiibrew.org/wiki/Wiimote/Extension_Controllers</a> (checking for yaw_fast, pitch_fast etc.), and multiply by 0.33 if its in fast
mode and 0.072 if its in slow mode - <strong>I would check on this. I have .25 and .05 as my values for multiplication (actually I divide by 4 and 20). </strong></p>
</li><li>
<p>Finally I sum up all these values over time (discrete integration) to get the angle of the wiimote wrt initial orientation.
<strong>This is what I do, but I only take 98% of the value. This is leftover from experimenting with various methods of combating jitter. </strong></p>
<p>To calculate this relative to world coordinates, I add an initial orientation value I get from an electronic compass.</p>
<p><strong>I do this to create an orientation matrix for my disc: </strong><br>
<strong>return Quaternion.CreateFromYawPitchRoll(MathHelper.ToRadians(Angle.Z * -1), MathHelper.ToRadians(Angle.X), MathHelper.ToRadians(Angle.Y)); This is bad and needs some checking to ensure you are multiplying the right axis by -1. It works
fine if the wiimote was faceup when initialized.</strong></p>
<p>A.Z is currently set to 0, and as far as I can see is never changed. I was experimenting with various methods for reducing jitter, and I kept the formulas there to facilitate experimentation. The A.Z (and the accompanying percentage) can be used
to smooth the jitter by setting it to the previous value of the Angle. Then you can change the percentages to adjust for how much you "trust" the data from the sensor. I know from experience that getting this to work can be extremely frustrating.
When it does finally work (or somewhat work in my case), it is pretty cool.</p>
<p>Jeremy</p>
</li></div>jjsneedeMon, 06 Dec 2010 20:02:07 GMTNew Post: Calculating Orientation from Raw Values WM+ 20101206080207PNew Post: Calculating Orientation from Raw Values WM+http://dg.codeplex.com/Thread/View.aspx?ThreadId=237248<div style="line-height: normal;">
<p>Hi, I got your reply, thanks! Now what's that G.z you use in the formula? </p>
<p>Angle.Z = .98f * (Angle.Z + (G.Z * <strong><span>.015f</span></strong>)) + .02f * A.Z;</p>
<p>I understand Angle.z is the integration sum and A.z is the new turn rate right? Doing G.z*updatetime makes G.z look like some angle...</p>
<p>You see, I've been trying to make sense of the raw values from WM+ using this method</p>
<ol>
<li>
<p>Calibrate the Motionplus (i.e. Find the raw value that corresponds to zero; I do this by holding it stationary for a point of time)</p>
</li><li>
<p>For every subsequent raw value read, I subtract the zero value from it to get the "relative" raw value.</p>
</li><li>
<p>Then, I scale this value using <a rel="nofollow" href="http://wiibrew.org/wiki/Wiimote/Extension_Controllers">
http://wiibrew.org/wiki/Wiimote/Extension_Controllers</a> (checking for yaw_fast, pitch_fast etc.), and multiply by 0.33 if its in fast mode and 0.072 if its in slow mode</p>
</li><li>
<p>Finally I sum up all these values over time (discrete integration) to get the angle of the wiimote wrt initial orientation.</p>
<p>To calculate this relative to world coordinates, I add an initial orientation value I get from an electronic compass.</p>
<p>The problem is my values just won't scale, and even when my wiimote is stationary, my y,p,r values add up to over 360-400 degrees eventually. I have no idea where this extra noise is coming from; I calculate my zero value by checking for 2 consecutive identical
raw values initially. </p>
<p>Do you know where I might be going wrong?</p>
<p>Thanks, and I'm sorry for the bother! </p>
</li></ol>
<p> </p>
<p> </p>
<p> </p>
</div>imelzaMon, 06 Dec 2010 18:17:37 GMTNew Post: Calculating Orientation from Raw Values WM+ 20101206061737PNew Post: Calculating Orientation from Raw Values WM+http://dg.codeplex.com/Thread/View.aspx?ThreadId=237248<div style="line-height: normal;">
<p>I believe that value was used to convert from degrees per second to degrees per update time (15 milliseconds). </p>
<p>Jeremy Sneeden</p>
</div>jjsneedeMon, 06 Dec 2010 16:48:37 GMTNew Post: Calculating Orientation from Raw Values WM+ 20101206044837PNew Post: Calculating Orientation from Raw Values WM+http://dg.codeplex.com/Thread/View.aspx?ThreadId=237248<div style="line-height: normal;">
<p>Imelza,</p>
<p>Hmmmm. I thought I sent you the answer, but I was wrong. Let me think about it some more.</p>
<p>Jeremy</p>
<p> </p>
<p> </p>
</div>jjsneedeMon, 06 Dec 2010 14:02:07 GMTNew Post: Calculating Orientation from Raw Values WM+ 20101206020207PNew Post: Calculating Orientation from Raw Values WM+http://dg.codeplex.com/Thread/View.aspx?ThreadId=237248<div style="line-height: normal;">
<p>Hi,</p>
<p>I'm an undergraduate student working on a signals project involving the M+ gyroscope sensor. I have a question regarding calculating the orientation from raw values.</p>
<p>When you calculated y, p, r values from the Raw values of the M+ accessed by wiimotelib, you multiply the values by 0.0155 to convert to deg/s. May I know where you get that number from? In the wiibrew page, they've mentioned a raw value of 8063 corresponds
to 595 deg/s therefore to convert to deg/s we need to multiply by 595/8063 (=0.074) But when I do that, I'm not able to scale it between 0 and 360 degrees. Yours seems more accurate. So, could you explain how you arrived at degree values from the raw
values?</p>
<p>Sorry I didn't know any other way to contact you ; I saw your comment in BrianPeek's blog.</p>
<p>Thanks!</p>
<p>Imelza</p>
</div>imelzaMon, 06 Dec 2010 07:37:43 GMTNew Post: Calculating Orientation from Raw Values WM+ 20101206073743ANew Post: Acknowledgementshttp://dg.codeplex.com/Thread/View.aspx?ThreadId=62505<div style="line-height: normal;"><p>A special thanks to the following contributors.</p>
<ol>
<li>Scott Graham, Talented artist -> basket model.</li>
<li>Dan Roddick, PDGA Special Projects -> Permission to use their logos.</li>
<li>Brian Sullivan, Discraft Marketing -> Permission to use their disc information.</li>
<li>Riemers XNA tutorials, www.riemers.net -> Excellent 3D starting tutorials and permission to use the assets/textures that were provided in the tutorials.</li>
<li>http://www.codeplex.com/LTrees -> Procedural Trees</li>
</ol>
<p><span id=main style="visibility:visible"> </span></p>
<p>Un-<span>Acknowledgements</span></p>
<ol>
<li><span>Innova -> I contacted Innova multiple times and couldn't even get a reply. With a simple no, they wouldn't be on this list.<br></span></li>
</ol>
<p> </p></div>jjsneedeWed, 15 Jul 2009 15:08:27 GMTNew Post: Acknowledgements 20090715030827PNew Post: Acknowledgementshttp://dg.codeplex.com/Thread/View.aspx?ThreadId=62505<div style="line-height: normal;"><p>A place for me to recognize the people important to this getting done.</p>
<p> </p>
<p> </p></div>jjsneedeWed, 15 Jul 2009 15:00:22 GMTNew Post: Acknowledgements 20090715030022PNew Post: Bugs and Improvementshttp://dg.codeplex.com/Thread/View.aspx?ThreadId=62503<div style="line-height: normal;"><p>Post your bugs and improvements here</p></div>jjsneedeWed, 15 Jul 2009 14:35:32 GMTNew Post: Bugs and Improvements 20090715023532P