wiimote

Summary

wiimote
Version:

1.10.1

Description:

The wiimote package allows ROS nodes to communicate with a Nintendo Wiimote and its related peripherals, including the Nunchuk, Motion Plus, and (experimentally) the Classic. The package implements a ROS node that uses Bluetooth to communicate with the Wiimote device, obtaining accelerometer and gyro data, the state of LEDs, the IR camera, rumble (vibrator), buttons, joystick, and battery state. The node additionally enables ROS nodes to control the Wiimote’s LEDs and vibration for feedback to the human Wiimote operator. LEDs and vibration may be switched on and off, or made to operate according to a timed pattern.

Maintainers:
  • Jonathan Bohren <jbo AT jhu DOT edu>
Licenses:
  • GPL
Urls:
Authors:
  • Andreas Paepcke
  • Melonee Wise
BuildDepends:
BuildtoolDepends:
 
BuildExportDepends:
 
ExecDepends:
Exports:
  • <architecture_independent/>

Types

Message types

wiimote/IrSourceInfo
Field:
  • x (float64) –
  • y (float64) –
  • ir_size (int64) –

Sensor data pertaining to the Wiimote infrared camera. This message contains data for one of the four infrared light sources that the camera detects.

Each light is specified with a 2D position and a ‘source magnitude’ (ir_size). If the x dimension is set to INVALID_FLOAT, then no light was detected for the respective light. The Wiimote handles up to four light sources, and the wiimote_node.py software is written to that limit as well.

I am unsure what the ‘ir_size’ values represent. They are described as ‘source magnitude’ in some places. I assume this is signal amplitude, but it’s unclear. Note that current lowest level cwiid driver does not seem to pass the ir_size value to the cwiid Wiimote.c. For now this size will therefore be set INVALID

# Sensor data pertaining to the Wiimote infrared camera.
# This message contains data for one of the four infrared 
# light sources that the camera detects.
#
# Each light is specified with a 2D position and 
# a 'source magnitude' (ir_size). If the x dimension
# is set to INVALID_FLOAT, then no light was detected for 
# the respective light. The Wiimote handles up to
# four light sources, and the wiimote_node.py software
# is written to that limit as well.
#
# I am unsure what the 'ir_size' values represent. 
# They are described as 'source magnitude' in some places. I
# *assume* this is signal amplitude, but it's unclear. 
# Note that current lowest level cwiid driver does not 
# seem to pass the ir_size value to the cwiid Wiimote.c. 
# For now this size will therefore be set INVALID

float64 x 
float64 y 
int64 ir_size
wiimote/State
Constant:
  • INVALID (int8):-1
  • INVALID_FLOAT (float32):-1.0
  • MSG_BTN_1 (int8):0
  • MSG_BTN_2 (int8):1
  • MSG_BTN_A (int8):2
  • MSG_BTN_B (int8):3
  • MSG_BTN_PLUS (int8):4
  • MSG_BTN_MINUS (int8):5
  • MSG_BTN_LEFT (int8):6
  • MSG_BTN_RIGHT (int8):7
  • MSG_BTN_UP (int8):8
  • MSG_BTN_DOWN (int8):9
  • MSG_BTN_HOME (int8):10
  • MSG_BTN_Z (int8):0
  • MSG_BTN_C (int8):1
  • MSG_CLASSIC_BTN_X (int8):0
  • MSG_CLASSIC_BTN_Y (int8):1
  • MSG_CLASSIC_BTN_A (int8):2
  • MSG_CLASSIC_BTN_B (int8):3
  • MSG_CLASSIC_BTN_PLUS (int8):4
  • MSG_CLASSIC_BTN_MINUS (int8):5
  • MSG_CLASSIC_BTN_LEFT (int8):6
  • MSG_CLASSIC_BTN_RIGHT (int8):7
  • MSG_CLASSIC_BTN_UP (int8):8
  • MSG_CLASSIC_BTN_DOWN (int8):9
  • MSG_CLASSIC_BTN_HOME (int8):10
  • MSG_CLASSIC_BTN_L (int8):11
  • MSG_CLASSIC_BTN_R (int8):12
  • MSG_CLASSIC_BTN_ZL (int8):13
  • MSG_CLASSIC_BTN_ZR (int8):14
Field:
Note: For ease of manipulation this message often uses
int8[] when a bit vector would work. One might wish to use uint8[], but then Python takes the respective structure as a string and disallows item assignment.
#
#          Wiimote State message containing one complete Wiimote state

# Note: For ease of manipulation this message often uses
#       int8[] when a bit vector would work. One might
#       wish to use uint8[], but then Python takes
#       the respective structure as a string and disallows
#       item assignment.

int8    INVALID       = -1
float32 INVALID_FLOAT = -1.0

int8 MSG_BTN_1     = 0
int8 MSG_BTN_2     = 1
int8 MSG_BTN_A     = 2
int8 MSG_BTN_B     = 3
int8 MSG_BTN_PLUS  = 4
int8 MSG_BTN_MINUS = 5
int8 MSG_BTN_LEFT  = 6
int8 MSG_BTN_RIGHT = 7
int8 MSG_BTN_UP    = 8
int8 MSG_BTN_DOWN  = 9
int8 MSG_BTN_HOME  = 10
int8 MSG_BTN_Z     = 0
int8 MSG_BTN_C     = 1
int8 MSG_CLASSIC_BTN_X       = 0
int8 MSG_CLASSIC_BTN_Y       = 1
int8 MSG_CLASSIC_BTN_A       = 2
int8 MSG_CLASSIC_BTN_B       = 3
int8 MSG_CLASSIC_BTN_PLUS    = 4
int8 MSG_CLASSIC_BTN_MINUS   = 5
int8 MSG_CLASSIC_BTN_LEFT    = 6
int8 MSG_CLASSIC_BTN_RIGHT   = 7
int8 MSG_CLASSIC_BTN_UP      = 8
int8 MSG_CLASSIC_BTN_DOWN    = 9
int8 MSG_CLASSIC_BTN_HOME    = 10
int8 MSG_CLASSIC_BTN_L       = 11
int8 MSG_CLASSIC_BTN_R       = 12
int8 MSG_CLASSIC_BTN_ZL      = 13
int8 MSG_CLASSIC_BTN_ZR      = 14

#-----------------------------
# Header
#----------------------

Header header

#----------------------
# Gyro reading
#-----------------------------
# In radians/sec. If reading is invalid,
# for instance b/c no gyro is attached to the Wii, then
# set first element of covariance to -1 (same as imu_data.msg):
# Covariance matrix (roll, pitch, yaw) in radians^2/sec^2.

geometry_msgs/Vector3 angular_velocity_zeroed
geometry_msgs/Vector3 angular_velocity_raw
float64[9] angular_velocity_covariance

#----------------------
# Accelerometer reading
#-----------------------------
# Acceleration in m/sec^2. Covariance matrix
# (x,y,z) in m^2/sec^4.  (all same as imu_data.msg)

geometry_msgs/Vector3 linear_acceleration_zeroed
geometry_msgs/Vector3 linear_acceleration_raw
float64[9] linear_acceleration_covariance

#------------------------------
# Nunchuk Accelerometer reading
#------------------------------
geometry_msgs/Vector3 nunchuk_acceleration_zeroed
geometry_msgs/Vector3 nunchuk_acceleration_raw

#-----------------
# Nunchuk Joystick
#-----------------
float32[2] nunchuk_joystick_zeroed
float32[2] nunchuk_joystick_raw

#----------------------
# Wiimote buttons
#-----------------------------
# Mappings from Wiimote button name
# to array position are defined above.
#
bool[11] buttons
bool[2] nunchuk_buttons

#----------------------
# Wiimote LED states:
#-----------------------------

bool[4] LEDs

#----------------------
# Wiimote Rumble
#-----------------------------
# State (True or False)

bool rumble

#----------------------
# IR Light sensor (Camera)
#-----------------------------
# The Wiimote handles up to four light sources, 
# and the wiimote_node.py software is written to 
# that limit as well. For future expansion
# we make the following array extensible, rather
# than locking its length down to four:

wiimote/IrSourceInfo[] ir_tracking

#----------------------
# Wiimote battery
#-----------------------------
# A battery reading consists of two numbers: 
# the battery percentage, and the raw reading.
# Maximum battery is 208 units (unknown how this
# relates to electrical properties): 

float32 raw_battery
float32 percent_battery

#----------------------
# Time of most recent zeroing:
#-----------------------------

time zeroing_time

#----------------------
# Error vector
#-----------------------------
# For error condition definitions see wiimoteConstants.py
# Value of zero means all is well. (Currently NOT used).

uint64 errors
wiimote/TimedSwitch
Constant:
  • ON (int8):1
  • OFF (int8):0
  • NO_CHANGE (int8):-2
  • REPEAT (int8):-1
  • FOREVER (int8):-1
Field:
  • switch_mode (int8) –
  • num_cycles (int32) –
  • pulse_pattern[] (float32) –
TimedSwitch allows sender to:

o turn a switch on, o turn a switch off, and o repeat an on/off pattern forever or for a

given number of times.
Fields (refer to definitions of constants in the definition body):
o switch_mode:
ON: turn on (num_cycles and pulse_pattern fields are ignored)

OFF: turn off (num_cycles and pulse_pattern fields are ignored)

NO_CHANGE: leave LED in its current state
REPEAT: repeat an on/off pattern for as long
as is indicated in the num_cycles field. The pattern is defined in the pulse_pattern field.
o num_cycles:
n>=0: run the pattern that is defined in pulse_pattern
n times.
n==FOREVER: run the pattern that is defined in pulse_pattern
until a new TimedSwitch message is sent.
o pulse_pattern:

A series of time durations in fractions of a second. The first number is the duration for having the switch on. The second number is the duration for which the switch is off. The third is an ‘on’ period again, etc. A pattern is terminated with the end of the array.

Example: [1,1] specifies an on-off sequence of 1 second.

# TimedSwitch allows sender to:
#    o turn a switch on,
#    o turn a switch off, and
#    o repeat an on/off pattern forever or for a
#          given number of times.
# Fields (refer to definitions of constants in the definition body):
#     o switch_mode:
#         ON: turn on  (num_cycles and pulse_pattern fields are ignored)
#        OFF: turn off (num_cycles and pulse_pattern fields are ignored)
#  NO_CHANGE: leave LED in its current state
#     REPEAT: repeat an on/off pattern for as long
#             as is indicated in the num_cycles field. The
#             pattern is defined in the pulse_pattern field.
#
#     o num_cycles:
#          n>=0: run the pattern that is defined in pulse_pattern
#                n times.
#          n==FOREVER: run the pattern that is defined in pulse_pattern
#                       until a new TimedSwitch message is sent.              
#
#     o pulse_pattern:
#          A series of time durations in fractions of a second. The
#          first number is the duration for having the switch on.
#          The second number is the duration for which the switch
#          is off. The third is an 'on' period again, etc.
#          A pattern is terminated with the end of the array.
#           
#          Example: [1,1] specifies an on-off sequence of 1 second.               

int8 ON        =  1
int8 OFF       =  0
int8 NO_CHANGE = -2
int8 REPEAT    = -1
int8 FOREVER   = -1

int8 switch_mode
int32 num_cycles
float32[] pulse_pattern