|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.EventObject
wiiremotej.event.WREvent
wiiremotej.event.WRAccelerationEvent
public class WRAccelerationEvent
Acceleration event for Nintendo (R) Wii Remote (TM). Contains data returned from accelerometer. Note that the yaw is not available, as it is hard to determine from gravity, assuming the remote is being held level. WRAcceleration events can be either from the Wii Remote or the nunchuk. However, the 2 and 3-argument constructors are for Wii Remote data only. Note that pitch and roll are only calculated if the Wii Remote is roughly still. These values have no meaning if the Wii Remote is in motion. In addition, accelerometer data is meaningless during read operations.
Field Summary |
---|
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
WRAccelerationEvent(WiiRemote source,
byte[] data)
Creates a new WRAccelerationEvent from the given input data array. |
|
WRAccelerationEvent(WiiRemote source,
byte[] packet1,
byte[] packet2)
Creates a new WRAccelerationEvent from the given interleaved input. |
|
WRAccelerationEvent(WiiRemote source,
double xAcceleration,
double yAcceleration,
double zAcceleration)
Creates a new WRAccelerationEvent from the given acceleration values. |
Method Summary | |
---|---|
double |
getPitch()
Returns the pitch of the remote, in radians from -PI to PI. |
double |
getRoll()
Returns the roll of the remote, in radians from 0 to 2PI. |
double |
getXAcceleration()
Returns the X-Acceleration of the remote, in terms of G's. |
double |
getYAcceleration()
Returns the Y-Acceleration of the remote, in terms of G's. |
double |
getZAcceleration()
Returns the Z-Acceleration of the remote, in terms of G's. |
boolean |
isStill()
Returns true if the remote is not being moved; otherwise false . |
Methods inherited from class wiiremotej.event.WREvent |
---|
getSource |
Methods inherited from class java.util.EventObject |
---|
toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public WRAccelerationEvent(WiiRemote source, byte[] data)
source
- the WiiRemote triggering this event.data
- the byte data to process for acceleration data.public WRAccelerationEvent(WiiRemote source, byte[] packet1, byte[] packet2)
source
- the WiiRemote triggering this event.packet1
- the first packet of interleaved data to parse for acceleration data.packet2
- the second packet of interleaved data to parse for acceleration data.public WRAccelerationEvent(WiiRemote source, double xAcceleration, double yAcceleration, double zAcceleration)
source
- the WiiRemote triggering this event.xAcceleration
- the X acceleration detected by the remote (in Gs).yAcceleration
- the Y acceleration detected by the remote (in Gs).zAcceleration
- the Z acceleration detected by the remote (in Gs).Method Detail |
---|
public boolean isStill()
true
if the remote is not being moved; otherwise false
. This method checks the magnitude of the acceleration against 1 G.
If it is close to 1G (0.7-1.4), then the remote is considered still. Therefore, the remote could actually be moving, when isStill returns true, however, this
would be unlikely.
true
if the remote is not being moved; otherwise false
.public double getXAcceleration()
public double getYAcceleration()
public double getZAcceleration()
public double getPitch()
public double getRoll()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |