Neueste Datei-Release

l4P5 (beta-003)2009-05-05 20:38
Loc (beta-005)2009-05-05 20:33
wrj4p5 (alpha-011)2009-05-05 20:41

最近の更新

2012-01-01
2010-03-25
2009-12-26
2009-05-06
2009-04-12
2009-03-02
2008-12-20
2008-08-08

Wikiガイド

サイドバー

class Wrj4P5(WiiRemoteJ For Proce55ing)

Wrj4P5 is the base class for managing the available WiiRemotes and extensions. It provides you with methods

  • to get information from WiiRemotes and one of extensions,

and

on your sketch.

  • need class Loc .

Your sketch (PApplet)

  1. class PApplet
  2. [events for your sketch]
  3. void boardPressed(int bid) : button pressed on Balance Board.
  4. void buttonPressed(RimokonEvent ev, int rid) : some button pressed on WiiRemote.
  5. void nunchakuPressed(NunchukEvent ev, int rid) : some button/stick pressed.
  6. void kurakonPressed(KurakonEvent ev, int rid) : some button/stick pressed
  7. void guitarPressed(GuitarEvent ev, int rid) : some button/stick pressed.
  8. void drumPressed(DrumEvent ev, int rid) : some button/stick/Pedal pressed.
  9. void boardReleased(int bid) : button released on Balance Board.
  10. void buttonReleased(RimokonEvent ev, int rid) : some button released on WiiRemote.
  11. void nunchakuReleased(NunchukEvent ev, int rid) : some button/stick released.
  12. void kurakonReleased(KurakonEvent ev, int rid) : some button/stick released.
  13. void guitarReleased(GuitarEvent ev, int rid) : some button/stick released.
  14. void drumReleased(DrumEvent ev, int rid) : some button/stick/Pedal released.
  15. void disconnected(int rid) : some WiiRemote is disconnected.
  16. void exDisconnected(int rid) : a Extension is disconnected from some WiiRemote.

model of Wii

  1. class WRJ4P5
  2. [class member/method]
  3. PApplet parent;
  4. int dCount; : the number of WiiRemotes/Boards connected.(at most 7)
  5. int rCount; : the number of WiiRemotes connected.(at most 7)
  6. int bCount; : the number of Balance Boards connected.(at most 7)
  7. float ONE_G = 9.80665f; : Gravity_Unit(m/sec/sec)
  8. boolean IR, EX; : 'EX' is with extensions (no information of IR soptsize)
  9. : 'IR' is with IR soptsize (no information from any extention)
  10. WiiBoard board; : the first connected WiiRemote.
  11. WiiRimokon rimokon; : the first connected WiiRemote.
  12. WiiNunchaku nunchaku; : the Nunchuk of the first WiiRemote.
  13. WiiKurakon kurakon; : the ClassicController of the first WiiRemote.
  14. WiiGuitar guitar; : the WiiGuitar of the first WiiRemote.
  15. WiiBoard board(int bid) : the (bid+1)th Balance Board, or null
  16. WiiRimokon rimokon(int rid) : the (rid+1)th WiiRemote, or null
  17. WiiNunchaku nunchaku(int rid) : the (rid+1)th Nunchuk, or null
  18. WiiKurakon kurakon(int rid) : the (rid+1)th ClassicController, or null
  19. WiiGuitar guitar(int rid) : the (rid+1)th WiiGuitar, or null
  20. boolean isConnecting() : if connection is not completed, draws a splash screen
  21. 【constructor】
  22. Wrj4P5(PApplet parent) only constuctor you can use
  23. // connect, must call after the construction. (asynchronized process)
  24. Wrj4P5 connect() = connect(1)
  25. Wrj4P5 connect(int n) = connect(n, false, false)
  26. Wrj4P5 connect(boolean ir) = connect(1, ir, false)
  27. Wrj4P5 connect(int n, boolean ir) = connect(n, ir, false)
  28. Wrj4P5 connect(int n, boolean ir, boolean log) = connect(n, ir, log, 2)
  29. Wrj4P5 connect(int n, boolean ir, boolean log, int sense)
  30. int n : number of WiiRemotes/Boards to be connected.(1 is default)
  31. bool ir : EX(use extensions - default) / IR(use IR spotsize)
  32. bool log: do you want a detailed log?(false is default)
  33. int sense: sensitivity of IR-Camera, 0(lowest)/1/2(default)/3/4(highest)

model of Balance Board

  1. class WiiBoard
  2. [members]
  3. float sensed[2][2]; // latest sensed by pressure sensors at each corner.(mesured by Kg)
  4. float psensed[2][2]; // previous sensed value.
  5. float weight; // = average of 4 sensor.(mesured by Kg)
  6. float pweight; // = previous average of 4 sensor
  7. float topRight; // = sensed[0][0], Top-Right
  8. float bottomLeft; // = sensed[1][1], Bottom-Left
  9. float topLeft; // = sensed[0][1], Top-Left
  10. float bottomRight; // = sensed[1][0], Bottom-Right
  11. boolean isIlluminated; //status of the LED on the board
  12. [connection/communication]
  13. :<status>
  14. void requestStatus() : command to start getting the newest status report
  15. boolean isReadingData() : check if getting status
  16. boolean isConnected() : has 'me' connected ?
  17. :<Battery>
  18. float getBatteryLevel() : get the latest battery level, 0(empty) to 1(full)
  19. :<LED Lights>
  20. boolean isLED() : check the LED illumination.
  21. void setLED(boolean illumination) : set the LED illumination.
  22. :<utils> 【New !
  23. Loc guessCoG() : the estimation of the center of gravity, (0,0) to (1,1)
  24. boolean isleftZone() : is the CoG on the left side of the board
  25. boolean isTopZone() : is the CoG on tne top side of the board
  26. boolean isCentralZone(float tol) : is the CoG on the central zone, gibven torelance
  27. boolean isCentralZone() : same as above, and the torelance is set to 0.4.

model of WiiRemote

  1. class WiiRimokon
  2. [members]
  3. Loc sensed; : latest sensed 3D(Loc) acceleration measured by Gravity Constant.
  4. Loc acc; : latest sensed 3D(Loc) acceleration(m/sec/sec)
  5. Loc[] irLights; : 2D position and size of each IRlights, 3rd is a size of IR spot
  6. WiiNunchaku nunchaku; : the Nunchuk connected, initial value w/o connection.
  7. WiiKurakon kurakon; : the ClassicController connected, initial value w/o connection
  8. WiiGuitar guitar; : the Gutar connected, initial value w/o connection.
  9. WiiDrum drum; : the Drum connected, initial value w/o connection.
  10. [TODO]
  11. // Loc vel; : latest sensed 3D(Loc) velocity(m/sec)
  12. // Loc pos; : latest sensed 3D(Loc) location(m)
  13. // Loc cursor; : latest sensed 2D(Loc) location(%) of the cross cursor.
  14. // Loc angAcc; : 3D(Loc) angular acceleration(rad/sec/sec) - will need a fixed nunchuk
  15. // Loc angVel; : 3D(Loc) angular velocity(rad/sec) - will need a fixed nunchuk
  16. // Loc direction; : 3D(Loc) normalized direction - will need a fixed nunchuk
  17. [connection/communication]
  18. :<Attitude of 'me'>
  19. float stablePitch() : current pich(radian), exact only in stable handling
  20. float stableRoll() : current roll(radian), exact only in stable handling
  21. [too many ToDo]
  22. :<status>
  23. void requestStatus() : command to start getting the newest status report
  24. boolean isReadingData() : check if getting status
  25. boolean isExtensionConnected() : has a extension connected
  26. boolean isConnected() : has 'me' connected ?
  27. :<Battery>
  28. float getBatteryLevel() : get the latest battery level, 0(empty) to 1(full)
  29. :<LED Lights>
  30. boolean isLED(int lid) : check the specified LED illumination.
  31. void setLED(int lid, boolean illumination) : set the specified LED illumination.
  32. boolean[] getLEDs() : check the all LEDs illumination.
  33. void setLEDs(boolean[] illumination) : set the each LEDs illumination.
  34. :<Speaker> !! [ToDo]
  35. void bufferSound(AudioInputStream audioIn) : prepare the prebufferd sound.(only one)
  36. float getVolume() : check the speaker's volume level, min(0) to max(1)
  37. void setVolume(float volume) : set the speaker's volume level, min(0) to max(1)
  38. boolean isPlaying() : check if playing sound.
  39. void playBuffer() : play the prebufferd sound.
  40. void play(AudioInputStream audioIn) : play the specified AudioInputStream sound.
  41. void stopSound() : stop sound.
  42. :<Vibrator>
  43. boolean isVibrating() : check if vibrating
  44. float getVibrationMagnitude(int magnitude) : get vibration magnitude.(0 to 1)
  45. void setVibrationMagnitude(int magnitude) : set vibration magnitude.(0 to 1)
  46. void startVibrating() : start vibration with current mag.
  47. void vibrateFor(long time) : vibration for given duration.(ms)
  48. void stopVibrating() : stop vibration.
  49. :<IRsenser>
  50. boolean isIRSensorEnabled() : check IRsensor enabled.

and

  1. class RimokonEvent - event from WiiRemote
  2. [Constants]
  3. static int A
  4. static int B
  5. static int DOWN
  6. static int HOME
  7. static int LEFT
  8. static int MINUS
  9. static int ONE
  10. static int PLUS
  11. static int RIGHT
  12. static int TWO
  13. static int UP
  14. [Constructor]
  15. RimokonEvent()
  16. [Method]
  17. boolean isPressed(int btnMask)
  18. boolean isOnlyPressed(int btnMask)
  19. boolean isAnyPressed(int btnMask)
  20. boolean wasPressed(int btnMask)
  21. boolean wasOnlyPressed(int btnMask)
  22. boolean wasReleased(int btnMask)

model of Nunchuk

  1. class Nunchaku
  2. [members]
  3. Loc sensed // latest senced 3D(Loc) acceleration measured by G.
  4. Loc acc // latest senced 3D(Loc) acceleration(m/sec/sec)
  5. Loc stick // latest senced 2D(Loc) location(%) of the stick.
  6. // [TODO!]
  7. // public Loc vel // latest senced 3D(Loc) velocity(m/sec)
  8. // public Loc pos // latest senced 3D(Loc) location(m)
  9. :<Attitude>
  10. float stablePitch() // pitch(radian), exact only in stable handling
  11. float stableRoll() // roll(radian), exact only in stable handling

and

  1. class NunchakuEvent
  2. [Constants]
  3. static int C
  4. static int Z
  5. Loc Stick
  6. [Constructor]
  7. NunchakuEvent()
  8. [Method]
  9. boolean isPressed(int btnMask)
  10. boolean isOnlyPressed(int btnMask)
  11. boolean isAnyPressed(int btnMask)
  12. boolean wasPressed(int btnMask)
  13. boolean wasOnlyPressed(int btnMask)
  14. boolean wasReleased(int btnMask)

model of Classic Controller

  1. class Kurakon
  2. [propaties]
  3. Loc lStick 
  4. Loc rStick
  5. float lTrigger; // latest sensed pressure(%) of the left trigger button.
  6. float rTrigger; // latest sensed pressure(%) of the right trigger button.

and

  1. class KurakonEvent
  2. [Constants]
  3. static int A
  4. static int B
  5. static int DPAD_DOWN
  6. static int DPAD_RIGHT
  7. static int DPAD_LEFT
  8. static int DPAD_UP
  9. static int HOME
  10. static int MINUS
  11. static int PLUS
  12. static int LEFT_TRIGGER
  13. static int RIGHT_TRIGGER
  14. static int LEFT_Z
  15. static int RIGHT_Z
  16. static int X
  17. static int Y
  18. [Constructor]
  19. KurakonEvent()
  20. [Method]
  21. boolean isPressed(int btnMask)
  22. boolean isOnlyPressed(int btnMask)
  23. boolean isAnyPressed(int btnMask)
  24. boolean wasPressed(int btnMask)
  25. boolean wasOnlyPressed(int btnMask)
  26. boolean wasReleased(int btnMask)

model of Guitar

  1. class WiiGuitar
  2. [propaties]
  3. Loc stick // latest sensed 2D(Loc) location(%) of the stick.
  4. float whammy // latest sensed pressure(%) of the WhammyBar.

and

  1. class GuitarEvent
  2. [Constants]
  3. static int BLUE
  4. static int GREEN
  5. static int ORANGE
  6. static int RED
  7. static int STRUM_DOWN
  8. static int STRUM_UP
  9. static int YELLOW
  10. static int MINUS
  11. static int PLUS
  12. [Constructor]
  13. GuitarEvent()
  14. [Method]
  15. boolean isAnyPressed(int button) // check the given button is pressed.
  16. boolean isOnlyPressed(int button) // check the given button is pressed.
  17. boolean isPressed(int button) // check the given button is pressed.
  18. boolean wasOnlyPressed(int button) // check the given button was pressed.
  19. boolean wasPressed(int button) // check the given button was pressed.
  20. boolean wasReleased(int button) // check the given button was released.
  21. Loc getStick() // get the current stick 2D(Loc) position. (-1 to 1)
  22. float getWhammyBar() // get the current amount the whammy bar is pushed. (0 to 1)

new face! model of Drum

  1. class WiiDrum
  2. [propaties]
  3. Loc stick // latest sensed 2D(Loc) location(%) of the stick.

and

  1. class DrumEvent
  2. [Constants]
  3. static int BLUE
  4. static int GREEN
  5. static int ORANGE
  6. static int RED
  7. static int PEDAL
  8. static int YELLOW
  9. static int MINUS
  10. static int PLUS
  11. [Constructor]
  12. DrumEvent()
  13. [Method]
  14. boolean isAnyPressed(int button) // check the given button is pressed.
  15. boolean isOnlyPressed(int button) // check the given button is pressed.
  16. boolean isPressed(int button) // check the given button is pressed.
  17. boolean wasOnlyPressed(int button) // check the given button was pressed.
  18. boolean wasPressed(int button) // check the given button was pressed.
  19. boolean wasReleased(int button) // check the given button was released.
  20. Loc getStick() // get the current stick 2D(Loc) position. (-1 to 1)
  21. float getSoftness() // no hit (0.0) to the hardest hit(1.0), (0 to 1)
  22. int getSoftnessPad() // pad id, the softness was sensed. (symbal/bass)