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 22 span.virtual_style 23 { 24 font-size : 8pt; 25 color : white; 26 font-weight : bold; 27 background : #0a0; 28 border-left : solid 1px #0f0; 29 border-top : solid 1px #0f0; 30 border-right : solid 1px #060; 31 border-bottom : solid 1px #060; 32 padding-left : 2px; 33 padding-right : 2px; 34 } 35 36 span.protected_style 37 { 38 font-size : 8pt; 39 color : white; 40 font-weight : bold; 41 background : #444; 42 border-left : solid 1px #ccc; 43 border-top : solid 1px #ccc; 44 border-right : solid 1px #222; 45 border-bottom : solid 1px #222; 46 padding-left : 2px; 47 padding-right : 2px; 48 } 49 --></style> 50<title>nn::hid::CTR::GyroscopeReader</title> 51 </head> 52 <body> 53<h1><CODE>nn::hid::CTR::GyroscopeReader</CODE> Class</h1> 54<h2>Syntax</h2> 55 <div class="section"> 56 <pre class="definition">class GyroscopeReader : private ADLFireWall::NonCopyable<GyroscopeReader></pre> 57 </div> 58<h2>Description</h2> 59 <div class="section"> 60<p>Class for loading sampling data from the gyro sensor.</p><h3>Sampling Rate</h3><p> 61Samples 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> 62This 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. 63 64<h3>Conditions to Start Sampling</h3><p> 65Gyro sensor sampling halts when the system is asleep, and when there are no instances of the <CODE>GyroscopeReader</CODE> class. 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>nn::hid::CTR::Gyroscope::WaitSampling</CODE> function, 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. 66 </p><h3>Correction Processing</h3><p> 67This 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. 68</p><h3>Output Value Processing Features</h3><p> 69This class includes the following features to process output values.<table><tr><th>Zero-Point Play Tolerance</th><td>Sampling results within an optional radius from the zero point are output as the zero point. Use this when you want to ignore small movements.</td></tr><tr><th>Axial Rotation</th><td>Apply an optional rotational matrix to sampling results before output. Use this to output gyro sensor values that mimic a tilt.</td></tr></table><BR />All processing features are disabled by default. Configure and enable them as needed. For details, see the various function references. 70</p><h3>Axis Orientation</h3><p> 71The 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 indicated by the touch screen face.</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>Miscellaneous Notes</h3><p> 72This class maintains an internal instance of the <CODE>AccelerometerReader</CODE> class for acceleration correction. The accelerometer is consequently started up once this instance is generated. 73 </p></div> 74 <a name="function" id="function"> 75<h2>Member Functions</h2> 76 <div class="section"> 77 <table class="members"> 78 <tr> 79<th class="category" colspan="3">Constructors/Destructors</th> 80 </tr> 81 <tr> 82 <td width="100"> </td> 83 <th> 84<a href="../../../../nn/hid/CTR/GyroscopeReader/GyroscopeReader.html"><CODE>GyroscopeReader</CODE></a> 85 </th> 86<td>Constructor.</td> 87 </tr> 88 <tr> 89 <td width="100"> </td> 90 <th> 91<a href="../../../../nn/hid/CTR/GyroscopeReader/~GyroscopeReader.html"><CODE>~GyroscopeReader</CODE></a> 92 </th> 93<td>Destructor.</td> 94 </tr> 95 <tr> 96<th class="category" colspan="3">Reading Sampling Data</th> 97 </tr> 98 <tr> 99 <td width="100"> </td> 100 <th> 101<a href="../../../../nn/hid/CTR/GyroscopeReader/Read.html"><CODE>Read</CODE></a> 102 </th> 103<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> 104 </tr> 105 <tr> 106 <td width="100"> </td> 107 <th> 108<a href="../../../../nn/hid/CTR/GyroscopeReader/ReadLatest.html"><CODE>ReadLatest</CODE></a> 109 </th> 110<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> 111 </tr> 112 <tr> 113<th class="category" colspan="3">Reset</th> 114 </tr> 115 <tr> 116 <td width="100"> </td> 117 <th> 118<a href="../../../../nn/hid/CTR/GyroscopeReader/Reset.html"><CODE>Reset</CODE></a> 119 </th> 120<td>Initializes the internal state.</td> 121 </tr> 122 <tr> 123<th class="category" colspan="3">Output Value Settings</th> 124 </tr> 125 <tr> 126 <td width="100"> </td> 127 <th> 128<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAngle.html"><CODE>SetAngle</CODE></a> 129 </th> 130<td>Resets the <code>angle</code> member of the <CODE><a href="../../../../nn/hid/CTR/GyroscopeStatus/Overview.html">GyroscopeStatus</a></CODE> structure (obtained by the <CODE>Read</CODE> function) to an arbitrary value.</td> 131 </tr> 132 <tr> 133 <td width="100"> </td> 134 <th> 135<a href="../../../../nn/hid/CTR/GyroscopeReader/SetDirection.html"><CODE>SetDirection</CODE></a> 136 </th> 137<td>Resets the <code>direction</code> member of the <CODE><a href="../../../../nn/hid/CTR/GyroscopeStatus/Overview.html">GyroscopeStatus</a></CODE> structure (obtained by the <CODE>Read</CODE> function) to an arbitrary value.</td> 138 </tr> 139 <tr> 140 <td width="100"> </td> 141 <th> 142<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAngleMagnification.html"><CODE>SetAngleMagnification</CODE></a> 143 </th> 144<td>Sets individual scaling factors to apply for each axis when calculating angular velocity.</td> 145 </tr> 146 <tr> 147 <td width="100"> </td> 148 <th> 149<a href="../../../../nn/hid/CTR/GyroscopeReader/SetDirectionMagnification.html"><CODE>SetDirectionMagnification</CODE></a> 150 </th> 151<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>Read</CODE> function.</td> 152 </tr> 153 <tr> 154<th class="category" colspan="3">Zero-Point Play Tolerance</th> 155 </tr> 156 <tr> 157 <td width="100"> </td> 158 <th> 159<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableZeroPlay.html"><CODE>EnableZeroPlay</CODE></a> 160 </th> 161<td>Enables zero-point play tolerance.</td> 162 </tr> 163 <tr> 164 <td width="100"> </td> 165 <th> 166<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableZeroPlay.html"><CODE>DisableZeroPlay</CODE></a> 167 </th> 168<td>Disables the zero-point play tolerance.</td> 169 </tr> 170 <tr> 171 <td width="100"> </td> 172 <th> 173<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableZeroPlay.html"><CODE>IsEnableZeroPlay</CODE></a> 174 </th> 175<td>Checks whether zero-point play tolerance is enabled.</td> 176 </tr> 177 <tr> 178 <td width="100"> </td> 179 <th> 180<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroPlayEffect.html"><CODE>GetZeroPlayEffect</CODE></a> 181 </th> 182<td>Gets the strength of correction applied by the zero-point play tolerance.</td> 183 </tr> 184 <tr> 185 <td width="100"> </td> 186 <th> 187<a href="../../../../nn/hid/CTR/GyroscopeReader/SetZeroPlayParam.html"><CODE>SetZeroPlayParam</CODE></a> 188 </th> 189<td>Sets the zero-point (at-rest) play tolerance.</td> 190 </tr> 191 <tr> 192 <td width="100"> </td> 193 <th> 194<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroPlayParam.html"><CODE>GetZeroPlayParam</CODE></a> 195 </th> 196<td>Gets the zero-point play tolerance.</td> 197 </tr> 198 <tr> 199 <td width="100"> </td> 200 <th> 201<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetZeroPlayParam.html"><CODE>ResetZeroPlayParam</CODE></a> 202 </th> 203<td>Initializes the zero-point play tolerance.</td> 204 </tr> 205 <tr> 206<th class="category" colspan="3">Zero-Point Drift Correction</th> 207 </tr> 208 <tr> 209 <td width="100"> </td> 210 <th> 211<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableZeroDrift.html"><CODE>EnableZeroDrift</CODE></a> 212 </th> 213<td>Enables zero-point drift correction.</td> 214 </tr> 215 <tr> 216 <td width="100"> </td> 217 <th> 218<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableZeroDrift.html"><CODE>DisableZeroDrift</CODE></a> 219 </th> 220<td>Disables zero-point drift correction.</td> 221 </tr> 222 <tr> 223 <td width="100"> </td> 224 <th> 225<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableZeroDrift.html"><CODE>IsEnableZeroDrift</CODE></a> 226 </th> 227<td>Checks whether zero-point drift correction is enabled.</td> 228 </tr> 229 <tr> 230 <td width="100"> </td> 231 <th> 232<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroDriftEffect.html"><CODE>GetZeroDriftEffect</CODE></a> 233 </th> 234<td>Gets the strength of zero-point drift correction.</td> 235 </tr> 236 <tr> 237 <td width="100"> </td> 238 <th> 239<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetZeroDriftMode.html"><CODE>ResetZeroDriftMode</CODE></a> 240 </th> 241<td>Initializes the zero-point drift correction mode.</td> 242 </tr> 243 <tr> 244 <td width="100"> </td> 245 <th> 246<a href="../../../../nn/hid/CTR/GyroscopeReader/SetZeroDriftMode.html"><CODE>SetZeroDriftMode</CODE></a> 247 </th> 248<td>Sets the zero-point drift correction mode.</td> 249 </tr> 250 <tr> 251 <td width="100"> </td> 252 <th> 253<a href="../../../../nn/hid/CTR/GyroscopeReader/GetZeroDriftMode.html"><CODE>GetZeroDriftMode</CODE></a> 254 </th> 255<td>Gets the zero-point drift correction mode.</td> 256 </tr> 257 <tr> 258<th class="category" colspan="3">Acceleration Correction</th> 259 </tr> 260 <tr> 261 <td width="100"> </td> 262 <th> 263<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableAccRevise.html"><CODE>EnableAccRevise</CODE></a> 264 </th> 265<td>Enables acceleration correction.</td> 266 </tr> 267 <tr> 268 <td width="100"> </td> 269 <th> 270<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableAccRevise.html"><CODE>DisableAccRevise</CODE></a> 271 </th> 272<td>Disables acceleration correction.</td> 273 </tr> 274 <tr> 275 <td width="100"> </td> 276 <th> 277<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableAccRevise.html"><CODE>IsEnableAccRevise</CODE></a> 278 </th> 279<td>Checks whether acceleration correction is enabled.</td> 280 </tr> 281 <tr> 282 <td width="100"> </td> 283 <th> 284<a href="../../../../nn/hid/CTR/GyroscopeReader/GetAccReviseEffect.html"><CODE>GetAccReviseEffect</CODE></a> 285 </th> 286<td>Gets the strength of acceleration correction.</td> 287 </tr> 288 <tr> 289 <td width="100"> </td> 290 <th> 291<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAccReviseParam.html"><CODE>SetAccReviseParam</CODE></a> 292 </th> 293<td>Sets the weight and enabled range for acceleration correction.</td> 294 </tr> 295 <tr> 296 <td width="100"> </td> 297 <th> 298<a href="../../../../nn/hid/CTR/GyroscopeReader/GetAccReviseParam.html"><CODE>GetAccReviseParam</CODE></a> 299 </th> 300<td>Gets the weight and enabled range for acceleration correction.</td> 301 </tr> 302 <tr> 303 <td width="100"> </td> 304 <th> 305<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetAccReviseParam.html"><CODE>ResetAccReviseParam</CODE></a> 306 </th> 307<td>Initializes the weight and enabled range for acceleration correction.</td> 308 </tr> 309 <tr> 310<th class="category" colspan="3">Axial Rotation</th> 311 </tr> 312 <tr> 313 <td width="100"> </td> 314 <th> 315<a href="../../../../nn/hid/CTR/GyroscopeReader/EnableAxisRotation.html"><CODE>EnableAxisRotation</CODE></a> 316 </th> 317<td>Enables axial rotation.</td> 318 </tr> 319 <tr> 320 <td width="100"> </td> 321 <th> 322<a href="../../../../nn/hid/CTR/GyroscopeReader/DisableAxisRotation.html"><CODE>DisableAxisRotation</CODE></a> 323 </th> 324<td>Disables axial rotation.</td> 325 </tr> 326 <tr> 327 <td width="100"> </td> 328 <th> 329<a href="../../../../nn/hid/CTR/GyroscopeReader/IsEnableAxisRotation.html"><CODE>IsEnableAxisRotation</CODE></a> 330 </th> 331<td>Checks whether axial rotation is enabled or disabled.</td> 332 </tr> 333 <tr> 334 <td width="100"> </td> 335 <th> 336<a href="../../../../nn/hid/CTR/GyroscopeReader/SetAxisRotationMatrix.html"><CODE>SetAxisRotationMatrix</CODE></a> 337 </th> 338<td>Sets the rotation matrix used for axial rotation.</td> 339 </tr> 340 <tr> 341 <td width="100"> </td> 342 <th> 343<a href="../../../../nn/hid/CTR/GyroscopeReader/GetAxisRotationMatrix.html"><CODE>GetAxisRotationMatrix</CODE></a> 344 </th> 345<td>Gets the rotation matrix used for axial rotation.</td> 346 </tr> 347 <tr> 348 <td width="100"> </td> 349 <th> 350<a href="../../../../nn/hid/CTR/GyroscopeReader/ResetAxisRotationMatrix.html"><CODE>ResetAxisRotationMatrix</CODE></a> 351 </th> 352<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> 353 </tr> </table> 354 </div> 355 </a> 356<h2>Class Hierarchy</h2> 357 <div class="section"> 358<p class="hierarchy"><span>ADLFireWall::NonCopyable</span><br /> <b>nn::hid::CTR::GyroscopeReader</b> 359 </p> 360 </div> 361<h2>Revision History</h2> 362 <div class="section"> 363 <dl class="history"> 364 <dt>2010/10/20</dt> 365<dd>Initial version.<br /> 366 </dd> 367 </dl> 368 </div> 369 <hr><p>CONFIDENTIAL</p></body> 370</html>