jAER project on SourceForge

org.ine.telluride.jaer.wowwee
Class WowWeeAliveHardwareInterface

java.lang.Object
  extended by net.sf.jaer.hardwareinterface.usb.silabs.SiLabsC8051F320_USBIO_ServoController
      extended by org.ine.telluride.jaer.wowwee.WowWeeAliveHardwareInterface
All Implemented Interfaces:
de.thesycon.usbio.PnPNotifyInterface, de.thesycon.usbio.UsbIoErrorCodes, HardwareInterface, ServoInterface

public class WowWeeAliveHardwareInterface
extends SiLabsC8051F320_USBIO_ServoController

For controlling WowWee Alive toys (specifically the WowWee Alive Chimp toy) using the USB Servo board using UsbIo interface to USB. For Telluride 2007. Note that the Chimp definitely uses a different code than the Robosapiens. The Robosapiens uses a 12 bit code based on 1200 baud 4T/1T long/short 0/1 bits and an 8T start bit. The Chimp uses an 11 bit code with equal-length 0/1 bit codes.

To use WowWeeAliveHardwareInterface, construct this type directly because ServoInterfaceFactory will not make these objects for you yet.

The byte codes for control of the WowWee Alive chimp can be found in the deviceFirmwarePCBLayout\SiLabsC8051F320\wowweeControlFirmware folder in the file Wowwee Chimp codes.txt. This file is reproduced here

 Control Code Modulation

The RF radio control is modulated with a simple digital code to specify the different features. For modulating the signals yourself, the signal looks something like this (timing values are approximate, but they work for me):

        Each code is 11 data bits with a specific start and stop sequence. Signal from the radio is normally random noise. When driven from the PC, keep the signal low until needed (ie. the start bit will start with a low->high transition). Start bit: (assuming the signal has been low for some time), the signal goes high for 8.4ms. Data bits: for each of 11 data bits, an encoded signal is sent (total time per bit ~6.4ms) Sends the most significant data bit first If the data bit is 0: signal goes low for ~2.2ms, and high for 4.2ms If the data bit is 1: signal goes low for ~4.2ms, and high for ~2.2s Stop bit: When completed, signal goes low for at least 6.4ms.

        The signal described above is the demodulated digital signal found on the pink wire described above.


        Control Codes

        Here are the code numbers (as used by the driver software).
        There are 3 different types of control codes.
        The first kind is a simple button press (eg: Demo), the second kind is on of the 6 skits (depends on mood).
        For the first two modes, when you press a button, the code is usually sent 8 times by the RF transmitter (the remote) to make sure it gets through.

LSB first in controller, codes assume MSB first!!!!!!!!!!!!!!!!! 


              Simple Controls (same regardless of mood switches)

 $009 = DEMO button
 $00A = Program button
 $00B = Alive button

        Undocumented/Internal

      # $006 = enter "chirp" mode (debug mode)
      # $00? = exit "chirp" mode

        Skit buttons (influenced by current mood)

      # $000 + MOOD = "X" button
      # $001 + MOOD = "Y" button
      # $002 + MOOD = "Z" button
      # $003 + MOOD = "A" button
      # $004 + MOOD = "B" button
      # $005 + MOOD - "C" button

        NOTE: MOOD = $000 (Curious) or $100 (Happy) or $200 (Fearful) or $300 (Feisty)
        The last kind is the most complicated where two different joystick settings are sent in the same 11 bit code. Which joystick is sent depends on the mood settings (see the manual for how the mood switches influence the functions).
        For the full range of motions, you need to send two different kinds of codes (eg: Mood $000 and Mood $300)
        In the regular remote, the code is sent while the joystick is down (???IIRC).


 $400 + MOOD + RIGHT_DIRECTION*16 + LEFT_DIRECTION


        MOOD is one of the values described above ($000, $100, $200 or $300).
        RIGHT_DIRECTION is the position of the right joystick (value 0->8).
        LEFT_DIRECTION is the position of the left joystick (value 0->8)>


        The joystick positions (RIGHT_DIRECTION & LEFT_DIRECTION) are specified in 4 bits each:


 0 = joystick in center position
 1 = joystick up
 2 = joystick down
 3 = joystick left
 4 = joystick right
 5 = joystick up and left
 6 = joystick up and right
 7 = joystick down and left
 8 = joystick down and right


Addendum by Ping Wang - 7/2007

We were not able to get the codes above to work using the wowwee.java class object.
Instead, we did a complete remapping of the behaviors through a systematic test of its reactions.  

Some of the codes are:
b, c, d, f, 2, 4, 6, 8 - various crys and laughs
205 - possible head turn
400, 402, etc. - longer laughs and crys, set movements

Here are the codes that were used for the gesture tracking demo:
"909" - nose sniff
"904" - happy laughing  
"102" - happy chrip
"906" - angry cry



Author:
tobi delbruck, christina savin, ping wang, Telluride 2007

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.jaer.hardwareinterface.usb.silabs.SiLabsC8051F320_USBIO_ServoController
SiLabsC8051F320_USBIO_ServoController.ServoCommand
 
Field Summary
 byte CMD_WOWWEE
           
 
Fields inherited from class net.sf.jaer.hardwareinterface.usb.silabs.SiLabsC8051F320_USBIO_ServoController
deviceDescriptor, ENDPOINT_OUT_LENGTH, gDevList, GUID, gUsbIo, interfaceNumber, NUM_SERVOS, numberOfStringDescriptors, PID, SERVO_QUEUE_LENGTH, stringDescriptor1, stringDescriptor2, stringDescriptor3, VID
 
Fields inherited from interface de.thesycon.usbio.UsbIoErrorCodes
USBIO_ERR_ADDITIONAL_EVENT_SIGNALLED, USBIO_ERR_ALREADY_BOUND, USBIO_ERR_ALREADY_CONFIGURED, USBIO_ERR_BABBLE_DETECTED, USBIO_ERR_BAD_START_FRAME, USBIO_ERR_BTSTUFF, USBIO_ERR_BUFFER_OVERRUN, USBIO_ERR_BUFFER_UNDERRUN, USBIO_ERR_BULK_RESTRICTION, USBIO_ERR_CANCELED, USBIO_ERR_CONTROL_NOT_SUPPORTED, USBIO_ERR_CONTROL_RESTRICTION, USBIO_ERR_CRC, USBIO_ERR_DATA_BUFFER_ERROR, USBIO_ERR_DATA_OVERRUN, USBIO_ERR_DATA_TOGGLE_MISMATCH, USBIO_ERR_DATA_UNDERRUN, USBIO_ERR_DEMO_EXPIRED, USBIO_ERR_DEV_NOT_RESPONDING, USBIO_ERR_DEVICE_GONE, USBIO_ERR_DEVICE_NOT_FOUND, USBIO_ERR_DEVICE_NOT_OPEN, USBIO_ERR_DEVICE_NOT_PRESENT, USBIO_ERR_ENDPOINT_HALTED, USBIO_ERR_EP0_RESTRICTION, USBIO_ERR_ERROR_BUSY, USBIO_ERR_ERROR_SHORT_TRANSFER, USBIO_ERR_FAILED, USBIO_ERR_FIFO, USBIO_ERR_FRAME_CONTROL_NOT_OWNED, USBIO_ERR_FRAME_CONTROL_OWNED, USBIO_ERR_INSUFFICIENT_RESOURCES, USBIO_ERR_INTERFACE_NOT_FOUND, USBIO_ERR_INTERNAL_HC_ERROR, USBIO_ERR_INTERRUPT_RESTRICTION, USBIO_ERR_INVALID_CONFIGURATION_DESCRIPTOR, USBIO_ERR_INVALID_DEVICE_STATE, USBIO_ERR_INVALID_DIRECTION, USBIO_ERR_INVALID_FUNCTION_PARAM, USBIO_ERR_INVALID_INBUFFER, USBIO_ERR_INVALID_IOCTL, USBIO_ERR_INVALID_ISO_PACKET, USBIO_ERR_INVALID_OUTBUFFER, USBIO_ERR_INVALID_PARAM, USBIO_ERR_INVALID_PARAMETER, USBIO_ERR_INVALID_PIPE_FLAGS, USBIO_ERR_INVALID_PIPE_HANDLE, USBIO_ERR_INVALID_POWER_STATE, USBIO_ERR_INVALID_RECIPIENT, USBIO_ERR_INVALID_TYPE, USBIO_ERR_INVALID_URB_FUNCTION, USBIO_ERR_ISO_NA_LATE_USBPORT, USBIO_ERR_ISO_NOT_ACCESSED_BY_HW, USBIO_ERR_ISO_NOT_ACCESSED_LATE, USBIO_ERR_ISO_RESTRICTION, USBIO_ERR_ISO_TD_ERROR, USBIO_ERR_ISOCH_REQUEST_FAILED, USBIO_ERR_LOAD_SETUP_API_FAILED, USBIO_ERR_NO_BANDWIDTH, USBIO_ERR_NO_MEMORY, USBIO_ERR_NO_SUCH_DEVICE_INSTANCE, USBIO_ERR_NOT_ACCESSED, USBIO_ERR_NOT_BOUND, USBIO_ERR_NOT_CONFIGURED, USBIO_ERR_NOT_SUPPORTED, USBIO_ERR_OPEN_PIPES, USBIO_ERR_OUT_OF_ADDRESS_SPACE, USBIO_ERR_OUT_OF_MEMORY, USBIO_ERR_PENDING_REQUESTS, USBIO_ERR_PID_CHECK_FAILURE, USBIO_ERR_PIPE_NOT_FOUND, USBIO_ERR_PIPE_RESTRICTION, USBIO_ERR_PIPE_SIZE_RESTRICTION, USBIO_ERR_POOL_EMPTY, USBIO_ERR_POWER_DOWN, USBIO_ERR_REQUEST_FAILED, USBIO_ERR_RESERVED1, USBIO_ERR_RESERVED2, USBIO_ERR_SET_CONFIG_FAILED, USBIO_ERR_SET_CONFIGURATION_FAILED, USBIO_ERR_STALL_PID, USBIO_ERR_STATUS_NOT_MAPPED, USBIO_ERR_SUCCESS, USBIO_ERR_TIMEOUT, USBIO_ERR_TOO_MUCH_ISO_PACKETS, USBIO_ERR_UNEXPECTED_PID, USBIO_ERR_USBD_BUFFER_TOO_SMALL, USBIO_ERR_USBD_INTERFACE_NOT_FOUND, USBIO_ERR_USBD_TIMEOUT, USBIO_ERR_VERSION_MISMATCH, USBIO_ERR_VID_RESTRICTION, USBIO_ERR_XACT_ERROR
 
Constructor Summary
WowWeeAliveHardwareInterface()
          Creates a new instance of WowWeeAliveHardwareInterface
 
Method Summary
 void sendWowWeeCmd(short command)
          send command to toy.
 
Methods inherited from class net.sf.jaer.hardwareinterface.usb.silabs.SiLabsC8051F320_USBIO_ServoController
checkServoCommandThread, close, disableAllServos, disableServo, getDID, getLastServoValue, getLastServoValues, getNumberOfStringDescriptors, getNumServos, getPID, getServo, getStringDescriptors, getTypeName, getVID, getVIDPID, hasStringIdentifier, isOpen, main, onAdd, onRemove, open, setAllServoValues, setPort2, setServoPWMFrequencyHz, setServoValue, submitCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CMD_WOWWEE

public final byte CMD_WOWWEE
See Also:
Constant Field Values
Constructor Detail

WowWeeAliveHardwareInterface

public WowWeeAliveHardwareInterface()
Creates a new instance of WowWeeAliveHardwareInterface

Method Detail

sendWowWeeCmd

public void sendWowWeeCmd(short command)
send command to toy. The first byte (0x3) of command is sent by default and does not need to be included in the cmd array.

Parameters:
command - last 2 bytes of the command.

jAER project on SourceForge