1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../../../css/manpage.css" type="text/css" />
7    <style type="text/css"><!--
8      span.static_style
9      {
10        font-size			: 8pt;
11        color				: white;
12        font-weight			: bold;
13        background			: #44f;
14        border-left			: solid 1px #aaf;
15        border-top			: solid 1px #aaf;
16        border-right		: solid 1px #00c;
17        border-bottom		: solid 1px #00c;
18        padding-left		: 2px;
19        padding-right		: 2px;
20      }
21      span.virtual_style
22      {
23        font-size			 : 8pt;
24        color				 : white;
25        font-weight			: bold;
26        background			: #0a0;
27        border-left			: solid 1px #0f0;
28        border-top			: solid 1px #0f0;
29        border-right		: solid 1px #060;
30        border-bottom		: solid 1px #060;
31        padding-left		: 2px;
32        padding-right		: 2px;
33      }
34      span.protected_style
35      {
36        font-size			 : 8pt;
37        color				 : white;
38        font-weight			: bold;
39        background			: #444;
40        border-left			: solid 1px #ccc;
41        border-top			: solid 1px #ccc;
42        border-right		: solid 1px #222;
43        border-bottom		: solid 1px #222;
44        padding-left		: 2px;
45        padding-right		: 2px;
46      }
47        --></style>
48<title>nn::hid::CTR::GyroscopeReader</title>
49  </head>
50  <body>
51<h1><CODE><a href="../../../../nn/Overview.html">nn</a>::<a href="../../../../nn/hid/Overview.html">hid</a>::<a href="../../../../nn/hid/CTR/Overview.html">CTR</a>::GyroscopeReader</CODE> Class</h1>
52<h2>Syntax</h2>
53    <div class="section">
54<pre class="definition">class GyroscopeReader : private ADLFireWall::NonCopyable<GyroscopeReader></pre>
55    </div>
56<h2>Description</h2>
57    <div class="section">
58<p>Class for loading sampling data from the gyro sensor.</p><h3>Sampling Rate</h3><p>
59Samples the angular velocity of the gyro sensor an average of every 10 milliseconds. Use the <a href="../../../../nn/hid/CTR/Gyroscope/Overview.html"><CODE>nn::hid::CTR::Gyroscope</CODE></a> class to know when sampling occurs, allowing you to accurately monitor sampling timing.</p><h3>Output Value Details</h3>
60This class stores sampling results as a <a href="../../../../nn/hid/CTR/GyroscopeStatus/Overview.html"><CODE>nn::hid::CTR::GyroscopeStatus</CODE></a> structure. This structure contains not just the angular velocity, but also information about the attitude calculated from the angular velocity. Attitude is calculated when the <a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html"><CODE>nn::hid::CTR::GyroscopeReader::Read</CODE></a> or <a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html"><CODE>nn::hid::CTR::GyroscopeReader::ReadLatest</CODE></a> functions are called, and either one must be called regularly (ideally every frame). Data stored in the internal buffer can become discontinuous, resulting in less accurate attitude information, if too much time elapses between calls to either of these functions.
61<h3>Conditions to Start Sampling</h3><p>
62Gyro sensor sampling halts in two cases: when the system is in Sleep Mode, and when there are no instances of the <CODE>GyroscopeReader</CODE> class. You must destroy all instances to explicitly stop sampling.<BR />It takes up to approximately 160 milliseconds for the system to transition to a state where sampling is possible. No sampling is done during this transition time, and calls to the <a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html"><CODE>nn::hid::CTR::GyroscopeReader::Read</CODE></a> or <a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html"><CODE>nn::hid::CTR::GyroscopeReader::ReadLatest</CODE></a> functions have no effect. To be sure to obtain sampling results, Nintendo recommends calling the <CODE><a href="../../../../nn/hid/CTR/HidBase/WaitSampling.html">nn::hid::CTR::HidBase::WaitSampling</a></CODE> function in the <CODE><a href="../../../../nn/hid/CTR/Gyroscope/Overview.html">nn::hid::CTR::Gyroscope</a></CODE> class, which waits until results have been sampled at least once. Starting from the second instance, this sampling wait time is the same as the wait until the next sample, which is a maximum of approximately 10 milliseconds.
63		</p><h3>Correction Processing</h3><p>
64This class includes the following correction processing for getting information more accurately.<table><tr><th>Acceleration Correction</th><td>Uses the accelerometer to improve the accuracy of CTR attitude calculations.</td></tr><tr><th>Zero-Point Drift Correction</th><td>The gyro sensor's zero point can drift due to environmental factors. This correction automatically detects zero-point drift and adjusts angular velocity values accordingly.</td></tr></table><br />All correction processes are enabled by default, but can be configured or disabled as necessary. For details, see the various function references.
65</p><h3>Output Value Processing Features</h3><p>
66This class includes the following features to process output values.<table><tr><th>Zero-Point Play Tolerance</th><td>When the sampling results are within any radius centered on the zero-point, that is output as the zero-point.<br />This is used when, for example, you don't want to reflect small movements in the output.</td></tr><tr><th>Axial Rotation</th><td>The sampling results are multiplied by any rotational matrix and then output.<br />You can get output that reflects placement of the gyro sensor at an angle.</td></tr></table><BR />All processing features are disabled by default. Configure and enable them as needed. For details, see the various function references.
67</p><h3>Axis Orientation</h3><p>
68The default gyro sensor axes are as follows.<table><tr><th>X+</th><td>A clockwise rotation about the direction indicated by the Left Button on the +Control Pad.</td></tr><tr><th>Y+</th><td>A clockwise rotation about the direction normal to and outward from the Touch Screen.</td></tr><tr><th>Z+</th><td>A clockwise rotation about the direction indicated by the Up Button on the +Control Pad.</td></tr></table></p><h3>Recalibration of Accelerometer from HOME Menu</h3><p>
69A future update to the HOME menu will add a feature enabling users to recalibrate the accelerometer whenever they like.<br /><br />As a result, correction in accordance with the user's environment may start while the user is transitioned from the application to the HOME Menu using the HOME Button.<br />After this operation, the values retrieved from the <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html">nn::hid::CTR::GyroscopeReader::Read</a></CODE> and <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html">nn::hid::CTR::GyroscopeReader::ReadLatest</a></CODE> functions will be the corrected values. In most cases, the corrected values will accurately reflect the user's environment.<br /><br />The applications, however, need not take any special measures to deal with this.
70</p><h3>Miscellaneous Notes</h3><p>
71This class maintains an internal instance of the <CODE><a href="../../../../nn/hid/CTR/AccelerometerReader/Overview.html">nn::hid::CTR::AccelerometerReader</a></CODE> class for acceleration correction. The accelerometer is started when an instance is generated.
72        </p></div>
73    <a name="function" id="function">
74<h2>Member Functions</h2>
75      <div class="section">
76        <table class="members">
77          <tr>
78<th class="category" colspan="3">Constructors/Destructors</th>
79          </tr>
80          <tr>
81            <td width="100">  </td>
82            <th>
83<a href="../../../../nn/hid/CTR/GyroscopeReader/GyroscopeReader.html"><CODE>GyroscopeReader</CODE></a>
84            </th>
85<td>Constructor.</td>
86          </tr>
87          <tr>
88            <td width="100">  </td>
89            <th>
90<a href="../../../../nn/hid/CTR/GyroscopeReader/~GyroscopeReader.html"><CODE>~GyroscopeReader</CODE></a>
91            </th>
92<td>Destructor.</td>
93          </tr>
94          <tr>
95<th class="category" colspan="3">Reading Sampling Data</th>
96          </tr>
97          <tr>
98            <td width="100">  </td>
99            <th>
100<a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html"><CODE>Read</CODE></a>
101            </th>
102<td>Loads sampling data from the gyro sensor, starting with the most recent data. Does not load any data that has been previously loaded.</td>
103          </tr>
104          <tr>
105            <td width="100">  </td>
106            <th>
107<a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html"><CODE>ReadLatest</CODE></a>
108            </th>
109<td>Loads the most recent sampling data from the gyro sensor. This function, unlike the <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html">nn::hid::CTR::GyroscopeReader::Read</a></CODE> function, can load the same sampling data more than once.</td>
110          </tr>
111          <tr>
112<th class="category" colspan="3">Reset</th>
113          </tr>
114          <tr>
115            <td width="100">  </td>
116            <th>
117<a href="../../../../nn/hid/CTR/GyroscopeReader/Reset.html"><CODE>Reset</CODE></a>
118            </th>
119<td>Initializes the internal state.</td>
120          </tr>
121          <tr>
122<th class="category" colspan="3">Output Value Settings</th>
123          </tr>
124          <tr>
125            <td width="100">  </td>
126            <th>
127<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAngle.html"><CODE>SetAngle</CODE></a>
128            </th>
129<td>Resets to an arbitrary value the <code>angle</code> member of the <CODE><a href="../../../../nn/hid/CTR/GyroscopeStatus/Overview.html">GyroscopeStatus</a></CODE> Structure (obtained by the <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html">Read</a></CODE> and <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html">ReadLatest</a></CODE> functions).</td>
130          </tr>
131          <tr>
132            <td width="100">  </td>
133            <th>
134<a href="../../../../nn/hid/CTR/GyroscopeReader/SetDirection.html"><CODE>SetDirection</CODE></a>
135            </th>
136<td>Resets to an arbitrary value the <code>direction</code> member of the <CODE><a href="../../../../nn/hid/CTR/GyroscopeStatus/Overview.html">GyroscopeStatus</a></CODE> structure (obtained by the <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html">Read</a></CODE> and <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html">ReadLatest</a></CODE> functions).</td>
137          </tr>
138          <tr>
139            <td width="100">  </td>
140            <th>
141<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAngleMagnification.html"><CODE>SetAngleMagnification</CODE></a>
142            </th>
143<td>Sets individual scaling factors to apply for each axis when calculating angular velocity.</td>
144          </tr>
145          <tr>
146            <td width="100">  </td>
147            <th>
148<a href="../../../../nn/hid/CTR/GyroscopeReader/SetDirectionMagnification.html"><CODE>SetDirectionMagnification</CODE></a>
149            </th>
150<td>Sets the scaling factor to apply to the angular velocity used when calculating the <CODE>direction</CODE> member of the <CODE><a href="../../../../nn/hid/CTR/GyroscopeStatus/Overview.html">GyroscopeStatus</a></CODE> Structure, which is obtained by the <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html">Read</a></CODE> and <CODE><a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html">ReadLatest</a></CODE> functions.</td>
151          </tr>
152          <tr>
153<th class="category" colspan="3">Zero-Point Play Tolerance</th>
154          </tr>
155          <tr>
156            <td width="100">  </td>
157            <th>
158<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableZeroPlay.html"><CODE>EnableZeroPlay</CODE></a>
159            </th>
160<td>Enables zero-point play tolerance.</td>
161          </tr>
162          <tr>
163            <td width="100">  </td>
164            <th>
165<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableZeroPlay.html"><CODE>DisableZeroPlay</CODE></a>
166            </th>
167<td>Disables the zero-point play tolerance.</td>
168          </tr>
169          <tr>
170            <td width="100">  </td>
171            <th>
172<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableZeroPlay.html"><CODE>IsEnableZeroPlay</CODE></a>
173            </th>
174<td>Checks whether zero-point play tolerance is enabled.</td>
175          </tr>
176          <tr>
177            <td width="100">  </td>
178            <th>
179<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroPlayEffect.html"><CODE>GetZeroPlayEffect</CODE></a>
180            </th>
181<td>Gets the strength of correction applied by the zero-point play tolerance.</td>
182          </tr>
183          <tr>
184            <td width="100">  </td>
185            <th>
186<a href="../../../../nn/hid/CTR/GyroscopeReader/SetZeroPlayParam.html"><CODE>SetZeroPlayParam</CODE></a>
187            </th>
188<td>Sets the zero-point (at-rest) play tolerance.</td>
189          </tr>
190          <tr>
191            <td width="100">  </td>
192            <th>
193<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroPlayParam.html"><CODE>GetZeroPlayParam</CODE></a>
194            </th>
195<td>Gets the zero-point play tolerance.</td>
196          </tr>
197          <tr>
198            <td width="100">  </td>
199            <th>
200<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetZeroPlayParam.html"><CODE>ResetZeroPlayParam</CODE></a>
201            </th>
202<td>Initializes the zero-point play tolerance.</td>
203          </tr>
204          <tr>
205<th class="category" colspan="3">Zero-Point Drift Correction</th>
206          </tr>
207          <tr>
208            <td width="100">  </td>
209            <th>
210<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableZeroDrift.html"><CODE>EnableZeroDrift</CODE></a>
211            </th>
212<td>Enables zero-point drift correction.</td>
213          </tr>
214          <tr>
215            <td width="100">  </td>
216            <th>
217<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableZeroDrift.html"><CODE>DisableZeroDrift</CODE></a>
218            </th>
219<td>Disables zero-point drift correction.</td>
220          </tr>
221          <tr>
222            <td width="100">  </td>
223            <th>
224<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableZeroDrift.html"><CODE>IsEnableZeroDrift</CODE></a>
225            </th>
226<td>Checks whether zero-point drift correction is enabled.</td>
227          </tr>
228          <tr>
229            <td width="100">  </td>
230            <th>
231<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroDriftEffect.html"><CODE>GetZeroDriftEffect</CODE></a>
232            </th>
233<td>Gets the strength of zero-point drift correction.</td>
234          </tr>
235          <tr>
236            <td width="100">  </td>
237            <th>
238<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetZeroDriftMode.html"><CODE>ResetZeroDriftMode</CODE></a>
239            </th>
240<td>Initializes the zero-point drift correction mode.</td>
241          </tr>
242          <tr>
243            <td width="100">  </td>
244            <th>
245<a href="../../../../nn/hid/CTR/GyroscopeReader/SetZeroDriftMode.html"><CODE>SetZeroDriftMode</CODE></a>
246            </th>
247<td>Sets the zero-point drift correction mode.</td>
248          </tr>
249          <tr>
250            <td width="100">  </td>
251            <th>
252<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroDriftMode.html"><CODE>GetZeroDriftMode</CODE></a>
253            </th>
254<td>Gets the zero-point drift correction mode.</td>
255          </tr>
256          <tr>
257<th class="category" colspan="3">Acceleration Correction</th>
258          </tr>
259          <tr>
260            <td width="100">  </td>
261            <th>
262<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableAccRevise.html"><CODE>EnableAccRevise</CODE></a>
263            </th>
264<td>Enables acceleration correction.</td>
265          </tr>
266          <tr>
267            <td width="100">  </td>
268            <th>
269<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableAccRevise.html"><CODE>DisableAccRevise</CODE></a>
270            </th>
271<td>Disables acceleration correction.</td>
272          </tr>
273          <tr>
274            <td width="100">  </td>
275            <th>
276<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableAccRevise.html"><CODE>IsEnableAccRevise</CODE></a>
277            </th>
278<td>Checks whether acceleration correction is enabled.</td>
279          </tr>
280          <tr>
281            <td width="100">  </td>
282            <th>
283<a href="../../../../nn/hid/CTR/GyroscopeReader/GetAccReviseEffect.html"><CODE>GetAccReviseEffect</CODE></a>
284            </th>
285<td>Gets the strength of acceleration correction.</td>
286          </tr>
287          <tr>
288            <td width="100">  </td>
289            <th>
290<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAccReviseParam.html"><CODE>SetAccReviseParam</CODE></a>
291            </th>
292<td>Sets the weight and enabled range for acceleration correction.</td>
293          </tr>
294          <tr>
295            <td width="100">  </td>
296            <th>
297<a href="../../../../nn/hid/CTR/GyroscopeReader/GetAccReviseParam.html"><CODE>GetAccReviseParam</CODE></a>
298            </th>
299<td>Gets the weight and enabled range for acceleration correction.</td>
300          </tr>
301          <tr>
302            <td width="100">  </td>
303            <th>
304<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetAccReviseParam.html"><CODE>ResetAccReviseParam</CODE></a>
305            </th>
306<td>Initializes the weight and enabled range for acceleration correction.</td>
307          </tr>
308          <tr>
309<th class="category" colspan="3">Axial Rotation</th>
310          </tr>
311          <tr>
312            <td width="100">  </td>
313            <th>
314<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableAxisRotation.html"><CODE>EnableAxisRotation</CODE></a>
315            </th>
316<td>Enables axial rotation.</td>
317          </tr>
318          <tr>
319            <td width="100">  </td>
320            <th>
321<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableAxisRotation.html"><CODE>DisableAxisRotation</CODE></a>
322            </th>
323<td>Disables axial rotation.</td>
324          </tr>
325          <tr>
326            <td width="100">  </td>
327            <th>
328<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableAxisRotation.html"><CODE>IsEnableAxisRotation</CODE></a>
329            </th>
330<td>Checks whether axial rotation is enabled or disabled.</td>
331          </tr>
332          <tr>
333            <td width="100">  </td>
334            <th>
335<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAxisRotationMatrix.html"><CODE>SetAxisRotationMatrix</CODE></a>
336            </th>
337<td>Sets the rotation matrix used for axial rotation.</td>
338          </tr>
339          <tr>
340            <td width="100">  </td>
341            <th>
342<a href="../../../../nn/hid/CTR/GyroscopeReader/GetAxisRotationMatrix.html"><CODE>GetAxisRotationMatrix</CODE></a>
343            </th>
344<td>Gets the rotation matrix used for axial rotation.</td>
345          </tr>
346          <tr>
347            <td width="100">  </td>
348            <th>
349<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetAxisRotationMatrix.html"><CODE>ResetAxisRotationMatrix</CODE></a>
350            </th>
351<td>Initializes the rotation matrix used for axial rotation. When this function is called, the rotation matrix is set to a <a href="../../../../nn/math/MTX34/Overview.html"><CODE>nn::math::MTX34</CODE></a> identity matrix. This setting is equivalent to disabling axial rotation.</td>
352          </tr> </table>
353      </div>
354    </a>
355<h2>Class Hierarchy</h2>
356    <div class="section">
357<p class="hierarchy"><span>ADLFireWall::NonCopyable</span><br />&nbsp;&nbsp;<b>nn::hid::CTR::GyroscopeReader</b>
358      </p>
359    </div>
360<h2>Revision History</h2>
361    <div class="section">
362      <dl class="history">
363        <dt>2011/03/15</dt>
364<dd>Explained the possibility of accelerometer recalibration from the HOME Menu.<br />
365        </dd>
366        <dt>2010/12/06</dt>
367<dd>Added explanation of conditions under which sampling stops.<br />
368        </dd>
369        <dt>2010/10/20</dt>
370<dd>Initial version.<br />
371        </dd>
372      </dl>
373    </div>
374  <hr><p>CONFIDENTIAL</p></body>
375</html>
376