Kinect Multi-point project
Update (5/9/2013): I have removed DELMID environment variable from the mix (can be re-added if you wish to use file mode for sending coordinates to vbscript). Added
Player0XCoords/Player0YCoords environment variable for testing x,y coordinates of player 1,
Player1XCoords/Player1YCoords environment variable for testing x,y coordinates of player 2, and so on. Added
USERNUM environment variable which tells the vbscript how many devices to initialize. Please change the environment variables as needed for your classroom.
Update (3/28/2013): I have decided to use environment variables for the number of mouse devices (numdevs) and the boolean value for destroying all devices (killdevs). In addition, now I have a new check for DELMID environment variable which just
1. True - deletes the *.mid file and waits until the program is finished recreating it and returns the status to false to continue.
2. False - does nothing unless already in the loop and then exits continues accepting program input.
This source will be uploaded soon! I will leave in the files for anyone that needs backwards compatibility. I still need to work on the kinect code but the above enhancements will be in kinectmultpoint v0.9.
I have just updated today 2/7/2013 the program files to include a new version of vbscript file combined with updated kinect code. Note: the shell command in module is commented out to vbscript file so that you do not inadvertly trigger
the vbs file during program execution until the Kinect code is tested some more.
Follow the instructions and help below but you might need a special program to find the devices input report or report descriptor if you wish to emulate your own device (go to usb.org to find out about generic devices).
The mouse data file contains data for movement movement and is constantly being written to by main kinect program and read by vbscript.
Note: the bolded section below is now optional but I will still include it in the vbscript file for backwards compatibility.
Here is the structure of the file that initializes setup for the script once executed and tells the script when to stop responding to input and kill all the devices (*.mdc file):
1. Number of mouse devices to create (limited to 40 but any user can change this limitation in the vbscript file).
2. Boolean value on wheter to destroy and remove the emulated devices (false until the program is closed).
In addition, here are the mousedata file file contents (*.mid file):
x position here (relative to last position)
y position here (relative to last postion)
leftclickstatus (true or false)
'line 4 (not used right now)
might have for right click in future (true or false)
'next lines repeat for each mouse device
Current limitations on amount of players is 40 but change the array subscript number for all arrays to something higher then 40 if need be in the vbscript file. Also, change needs to be done on the port hot plugging procedures because they only support
20 users or players. Note: to do so might require an external powered usb hub because of the massive power Kinect and more then likely a big main power supply to the computer.
use shell in vb.net to softhehcicfg /REMOVE and INSTALL under the program files\dsf\softehci folder.
InputReport(0) = CByte(1)
InputReport(1) = CByte(0)
InputReport(2) = CByte(0)
InputReport(3) = CByte(0)
InputReport(4) = CByte(0)
The mouse is down in this sample and the mouse is at x,y coordinates (0,0).
For reference on the dsf code:
BUTTON X Y WHEEL PAN
InputReport(0) = CByte(mouse click converted to hex here) - Button state of mouse (0- down and 1- up but you already knew that)
InputReport(1) = CByte(x coordinates converted to hex here) - x coordinates of mouse on screen (relative)
InputReport(2) = CByte(y coordinates converted to hex here) - y coordinates of mouse on screen (relative)
InputReport(3) = CByte(0) - default value for wheel that never changes. - mouse wheel value only for advanced coders/users that want to change mouse wheel value.
InputReport(4) = CByte(0) - default value for pan that never changes. - mouse screen pan values for advanced coders/users only!
Also, remember for button state must go up and down states both for mouse_click subs in vb.net or other multimouse programs to function/register it as a click (which is you holding down the mouse and releasing) properly.
Excuse me if i get a little rough in this conversation with the wdk guys. Here is a link to where they divulge more about the input report and i believe talked about left and right mouse clicking but not for sure:
I think 0 and 1 are the states for the left mosue click but im not for sure about a right mouse click but this is still a work in progress or I might leave it out but wdk team might be able to tell you how to put it back in or post above might have
info to help you.
Thought i would post the above for anyone wondering how to test the mouse emulation script.