kn::Nunchuk Class Reference

Structure to save motion's parameters. More...

#include <WiimoteNunchuk.hpp>

Inherits kn::InputController.

Collaboration diagram for kn::Nunchuk:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Nunchuk (void)
 Pointer to the wiimote with which the nunchuk is connected.
 Nunchuk (wiimote *wiimote)
 Constructor for nunchuk.
 ~Nunchuk (void)
 Destructor for nunchuk.
void addEvent (const unsigned int &event)
 Add an event for the nunchuk.
void clearEvents (void)
 Delete all events of the queue.
unsigned int popEvent (void)
 Return the oldest event of the queue.
unsigned int topEvent (void)
 Return the oldest event of the queue.
unsigned int popError (void)
 Should return the oldest error of the queue.
unsigned int topError (void)
 Return the oldest error of the queue.
float getRoll (void) const
 Return the roll value of the nunchuck.
float getAbsoluteRoll (void) const
 Return the absolute roll value of the nunchuck.
float getPitch (void) const
 Return the pitch value of the nunchuck.
float getAbsolutePitch (void) const
 Return the absolute pitch value of the nunchuck.
float getXForce (void) const
 Return acceleration on X axis.
float getYForce (void) const
 Return acceleration on Y axis.
float getZForce (void) const
 Return acceleration on Z axis.
float getJoystickAngle (void) const
 Returns the angle at which the joystick is being held.
float getJoystickMagnitude (void) const
 Returns the magnitude at which the joystick is being held.
bool isConnected (void) const
 Returns if the nunchuck is connected or not.


Detailed Description

Structure to save motion's parameters.

Parameters are nearly the same for wiimote and nunchuk

wiimotemotion.png

Motions of the wiimote

Author:
Frankoi Structure to save the parameters ralated to the nunchuk's joystick Class for Nunchuk control

Definition at line 102 of file WiimoteNunchuk.hpp.


Constructor & Destructor Documentation

kn::Nunchuk::Nunchuk ( void   )  [inline]

Pointer to the wiimote with which the nunchuk is connected.

Default constructor

Author:
Frankoi

Definition at line 119 of file WiimoteNunchuk.hpp.

kn::Nunchuk::Nunchuk ( wiimote *  wiimote  ) 

Constructor for nunchuk.

Parameters:
wiimote the wiimote with which the nunchuk is connected
Author:
Frankoi

Definition at line 33 of file WiimoteNunchuk.cpp.

kn::Nunchuk::~Nunchuk ( void   )  [inline]

Destructor for nunchuk.

Author:
Frankoi

Definition at line 137 of file WiimoteNunchuk.hpp.


Member Function Documentation

void kn::Nunchuk::addEvent ( const unsigned int &  event  ) 

Add an event for the nunchuk.

Author:
Frankoi

Definition at line 38 of file WiimoteNunchuk.cpp.

void kn::Nunchuk::clearEvents ( void   ) 

Delete all events of the queue.

Author:
Frankoi

Definition at line 46 of file WiimoteNunchuk.cpp.

float kn::Nunchuk::getAbsolutePitch ( void   )  const [inline]

Return the absolute pitch value of the nunchuck.

In degree and between -180 to 180. It is the value directly emitted by the nunchuck

Returns:
absolute pitch
Author:
Frankoi

Definition at line 240 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getAbsoluteRoll ( void   )  const [inline]

Return the absolute roll value of the nunchuck.

In degree and between -180 to 180. It is the value directly emitted by the nunchuck

Returns:
absolute roll
Author:
Frankoi

Definition at line 218 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getJoystickAngle ( void   )  const [inline]

Returns the angle at which the joystick is being held.

Straight up is 0 degrees, to the right is 90 degrees, down is 180 degrees, and to the left is 270 degrees.

The angle can often be 'not a number' (nan). This may occur if the joystick is in the central position.

Returns:
angle of the joystick
Author:
Frankoi

Definition at line 289 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getJoystickMagnitude ( void   )  const [inline]

Returns the magnitude at which the joystick is being held.

In the center is 0, and at the far edges is 1. So if the magnitude is 0.5 then the joystick is half way between the middle and outter edge.

Returns:
magnitude of the joystick
Author:
Frankoi

Definition at line 300 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getPitch ( void   )  const [inline]

Return the pitch value of the nunchuck.

In degree and between -180 to 180. Value is smoothed by the wiiuse interface

Returns:
pitch
Author:
Frankoi

Definition at line 229 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getRoll ( void   )  const [inline]

Return the roll value of the nunchuck.

In degree and between -180 to 180. Value is smoothed by the wiiuse interface

Returns:
roll
Author:
Frankoi

Definition at line 207 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getXForce ( void   )  const [inline]

Return acceleration on X axis.

The accelerometer is sensitive to within +/- 3 gravity units.

Returns:
X axis acceleration
Author:
Frankoi

Definition at line 251 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getYForce ( void   )  const [inline]

Return acceleration on Y axis.

The accelerometer is sensitive to within +/- 3 gravity units.

Returns:
Y axis acceleration
Author:
Frankoi

Definition at line 262 of file WiimoteNunchuk.hpp.

float kn::Nunchuk::getZForce ( void   )  const [inline]

Return acceleration on Z axis.

The accelerometer is sensitive to within +/- 3 gravity units.

Returns:
Z axis acceleration
Author:
Frankoi

Definition at line 273 of file WiimoteNunchuk.hpp.

bool kn::Nunchuk::isConnected ( void   )  const [inline]

Returns if the nunchuck is connected or not.

Returns:
true or false depending on nunchuck connection
Author:
Frankoi

Definition at line 309 of file WiimoteNunchuk.hpp.

unsigned int kn::Nunchuk::popError ( void   )  [inline, virtual]

Should return the oldest error of the queue.

The error should be removed from the queue.

Error managing is not implemented because there is no error message for the moment. However the method is required because of InputController class heritage

Returns:
0
Author:
Frankoi

Implements kn::InputController.

Definition at line 184 of file WiimoteNunchuk.hpp.

unsigned int kn::Nunchuk::popEvent ( void   )  [inline, virtual]

Return the oldest event of the queue.

The event is removed from the queue

Returns:
the oldest event
Author:
Frankoi

Implements kn::InputController.

Definition at line 163 of file WiimoteNunchuk.hpp.

unsigned int kn::Nunchuk::topError ( void   )  [inline, virtual]

Return the oldest error of the queue.

Error managing is not implemented because there is no error message for the moment. However the method is required because of InputController class heritage

Returns:
0
Author:
Frankoi

Implements kn::InputController.

Definition at line 196 of file WiimoteNunchuk.hpp.

unsigned int kn::Nunchuk::topEvent ( void   )  [inline, virtual]

Return the oldest event of the queue.

Returns:
the oldest event
Author:
Frankoi

Implements kn::InputController.

Definition at line 172 of file WiimoteNunchuk.hpp.


The documentation for this class was generated from the following files:

Generated on Thu Nov 12 16:06:36 2009 for OpenKraken-controller by  doxygen 1.5.8