WRAccelerationEvent
Keywords: wiiremotej.event.WRAccelerationEvent class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## wiiremotej.event
Class WRAccelerationEvent

    java.lang.Object
      java.util.EventObject
          wiiremotej.event.WREvent
              wiiremotej.event.WRAccelerationEvent

All Implemented Interfaces:
  java.io.Serializable

    public class WRAccelerationEvent

extends WREvent

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.

See Also:
  Serialized Form

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

### WRAccelerationEvent

    public WRAccelerationEvent(WiiRemote source,
                               byte[] data)

  Creates a new WRAccelerationEvent from the given input data array. This array contains ALL of the bits directly from Wii Remote input (including HID header).

  Parameters:
    `source` - the WiiRemote triggering this event.
    `data` - the byte data to process for acceleration data.

### WRAccelerationEvent

    public WRAccelerationEvent(WiiRemote source,
                               byte[] packet1,
                               byte[] packet2)

  Creates a new WRAccelerationEvent from the given interleaved input.

  Parameters:
    `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.

### WRAccelerationEvent

    public WRAccelerationEvent(WiiRemote source,
                               double xAcceleration,
                               double yAcceleration,
                               double zAcceleration)

  Creates a new WRAccelerationEvent from the given acceleration values.

  Parameters:
    `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

### isStill

    public boolean isStill()

  Returns `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.

  Returns:
    `true` if the remote is not being moved; otherwise `false`.

### getXAcceleration

    public double getXAcceleration()

  Returns the X-Acceleration of the remote, in terms of G's.

  Returns:
    the X-Acceleration of the remote, in terms of G's.

### getYAcceleration

    public double getYAcceleration()

  Returns the Y-Acceleration of the remote, in terms of G's.

  Returns:
    the Y-Acceleration of the remote, in terms of G's.

### getZAcceleration

    public double getZAcceleration()

  Returns the Z-Acceleration of the remote, in terms of G's.

  Returns:
    the Z-Acceleration of the remote, in terms of G's.

### getPitch

    public double getPitch()

  Returns the pitch of the remote, in radians from -PI to PI.

  Returns:
    the pitch of the remote, in radians from -PI to PI. Returns Double.NaN if unknown (because the WiiRemote is in motion).

### getRoll

    public double getRoll()

  Returns the roll of the remote, in radians from 0 to 2PI. Note that if you pitch the remote greater than PI radians from the axis, it will be assumed that it was rolled and yawed to attain that pitch.

  Returns:
    the roll of the remote, in radians from 0 to 2PI. Returns Double.NaN if unknown (because the WiiRemote is in motion).

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD