How to interact with VR glove using different programming methods
Main call flow
Regardless of the chosen programming language, the call flow will be as follows :
- Launch Senso software (if not launched at startup)
- Initiate connection (can be controlled by 3rd software or autoconnect)
- Receiving and sending JSON-formed TCP or UDP packets
Senso GUI interface is just wizard tool for simplifying process of creation configuration files and visualizing data.
It isn't necessary to use this tool, though it can be fastest way to start.
Connector
This executable module is necessary for both SteamVR and non-VR application.
After software installation process, this executable named Senso_DK3_connector.exe
is launched and added to autorun folder, so it can be launched automatically after loading of Windows.
Purpose of Senso_DK3_connector.exe
is to provide access to RF USB dongles and also to provide tracking data.
When launched it's shown in system tray as blue palm icon
By default, it is started with several parameters
C:\Senso_DK3\Senso_DK3_connector.exe /prc=127.0.0.1:53453 /prc=127.0.0.1:53454
By default, it accepts incoming TCP/UDP connections on local address/port 127.0.0.1:53452
though it can be changed by keywords.
This port is used mostly, for scanning and raw data transfer.
SteamVR driver, driver_senso.dll
also uses this application in order to work with VR glove.
Additional ports 127.0.0.1:53453
and 127.0.0.1:53454
are instances for using them from 3rd software.
How to use
In order to get list of gloves available nearby, configure and connect to them, there are two ways, depends on user
- Autoconnect with predefined values
- Fully controlled connection
Let's start with the easiest one, autoconnect.
Autoconnection method
also for SteamVR configuration, if it is installed
Launch Senso GUI. It will launch Senso_DK3_connector.exe
(if not launched earlier) and perform scan.
Then, choose preferred glove, press `Save and calibrate' and perform procedure until full calibration.
Please note the information line highlighted in blue in the photo below.
This string is all you need to launch software manually
"Senso_DK3_processing.exe /ini=C:\Senso_DK3\config_data\configuration_AC_4D_16_E8_46_A9.ini"
Whenever you need to connect to the glove, just run it exactly as shown and you'll have another console window with some basic information and connection debug data.
Immediately after it, you can connect to TCP or UDP port and receive all data you need. And also send vibration commands.
To check if everything works as intended, you can launch telnet localhost 53450
or telnet localhost 53451
depends on glove type (left or right).
When glove is connected and running you'll probably see stream of JSON-formed data like this :
{"src":"ac:4d:16:e8:46:a9","version":"3.1","name":"SensoDK3","glove":"lh","fullname":"SensoDK3","type":"raw_data","data":{"imu_0":[2,0.00000000,0.00110262,-0.00063160,0.00008398,-0.25996500,-0.88780500,9.75353652],"imu_1":[2,-2.41025470,-2.04380556,-0.67045531,-1,-1789.05313197,102.00000000,-868.00000000],"imu_2":[2,-1.00534389,-1.90823484,-13.24182684,-1,-324.00000000,53.00000000,2027.38016332],"imu_3":[1,-0.14290632,2.25457056,0.31876343,-1,-641.00000000,-357.00000000,1864.80381665],"imu_4":[2,-0.69300588,-0.72811609,-1.80241868,-1,-316.00000000,-488.00000000,1983.88140417],"imu_5":[1,0.29049898,-0.40648841,3.71720142,-1,72.00000000,-608.00000000,1895.26005613],"imu_6":[2,1.49120558,-3.25252258,8.06511755,-1,-313.00000000,214.00000000,1997.08152683],"imu_7":[2,1.61326412,-1.34645840,-0.18661699,-1,-325.00000000,-209.00000000,1969.08099767],"imu_8":[0,0.00000000,0.00000000,0.00000000,-1,0.00000000,0.00000000,0.00000000]}}
{"src":"ac:4d:16:e8:46:a9","version":"3.1","name":"SensoDK3","fullname":"SensoDK3","type":"position","data":{"type":"lh","ts":"13361748156571","palm":{"pos":[0.000,0.000,0.000],"spd":[0.000,0.000,0.000],"quat":[0.988134,-0.005059,-0.153314,-0.007751],"grv":[-0.260,-0.888,9.754],"lia":[0.013,0.045,-0.013],"delta":0.009900,"tilt":-0.007621},"gests":[0.30793,0.97657,0.20096,-0.36145,-0.28588,-0.20933,0.25797,-0.16608,0.01249,0.35713],"wrist":{"quat":[0.869849,0.486973,0.064211,-0.045786],"grv":[-8.775,0.500,-4.258],"lia":[-1.053,-0.125,-0.101],"delta":0.009900,"tilt":0.999695},"bones":{"bone_0":[0.988134,-0.153314,0.007751,0.005059],"bone_1":[0.89513,0.34480,-0.23341,0.15929],"bone_2":[0.98416,0.08190,-0.05739,-0.14638],"bone_3":[0.99391,-0.08266,0.06322,0.03614],"bone_4":[0.99966,-0.02262,-0.00507,0.01191],"bone_5":[0.98817,0.02491,-0.00382,-0.15130],"bone_6":[0.99909,0.01630,-0.02522,-0.03018],"bone_7":[0.99916,-0.03916,-0.01079,0.00609],"bone_8":[0.99971,0.01099,-0.00472,0.02088],"bone_9":[0.99350,0.03263,-0.00537,0.10896],"bone_10":[0.98798,-0.14926,0.02017,0.03471],"bone_11":[0.99853,0.03267,-0.00279,-0.04312],"bone_12":[0.99945,0.00351,0.02897,0.01570],"bone_13":[0.97595,-0.20068,0.08426,-0.01214],"bone_14":[0.99707,0.04339,-0.04010,-0.04861],"bone_15":[0.99880,-0.00073,0.04896,0.00165]},"fingers":[{"ang":[-0.092688,0.185752],"quat":[0.9060,0.3737,-0.0127,0.1982],"q":[0.906020,0.198216,0.373734,-0.012714],"bend":0.201,"quat2":[0.994945,-0.088808,-0.034900,-0.031300],"spd":-0.0012,"grv":[-1.594,-1.025,9.658],"lia":[-0.122,-0.198,0.006],"grv2":[-1.589,0.260,9.944],"lia2":[0.186,0.047,0.211]},{"ang":[-0.361529,0.013665],"quat":[0.982672,-0.180464,0.037918,0.018717],"spd":-0.0090,"grv":[-3.144,-1.751,9.147],"lia":[-0.033,0.001,0.012]},{"ang":[-0.285992,0.001425],"quat":[0.988458,-0.143046,0.049200,0.008234],"spd":-0.0039,"grv":[-1.550,-2.394,9.731],"lia":[-0.049,0.052,0.326]},{"ang":[-0.209471,0.016080],"quat":[0.994239,-0.104360,-0.022771,0.008931],"spd":-0.0157,"grv":[0.353,-2.982,9.296],"lia":[0.013,-0.054,-0.046]},{"ang":[0.257173,-0.042943],"quat":[0.971457,0.129491,-0.198648,-0.006456],"spd":-0.0615,"grv":[-1.535,1.050,9.796],"lia":[0.164,-0.068,0.289]}],"m1":[-172,213,77],"h_rssi":-49,"h_gain":15,"g_rssi":-46,"g_gain":15}}
{"src":"ac:4d:16:e8:46:a9","version":"3.1","name":"SensoDK3","glove":"lh","fullname":"SensoDK3","type":"raw_data","data":{"imu_0":[2,0.00000000,0.00110262,-0.00063160,0.00008398,-0.25996500,-0.88780500,9.75353652],"imu_1":[2,-2.41025470,-2.04380556,-0.67045531,-1,-1789.05313197,102.00000000,-868.00000000],"imu_2":[2,-1.00534389,-1.90823484,-13.24182684,-1,-324.00000000,53.00000000,2027.38016332],"imu_3":[1,-0.14290632,2.25457056,0.31876343,-1,-641.00000000,-357.00000000,1864.80381665],"imu_4":[2,-0.69300588,-0.72811609,-1.80241868,-1,-316.00000000,-488.00000000,1983.88140417],"imu_5":[1,0.29049898,-0.40648841,3.71720142,-1,72.00000000,-608.00000000,1895.26005613],"imu_6":[2,1.49120558,-3.25252258,8.06511755,-1,-313.00000000,214.00000000,1997.08152683],"imu_7":[2,1.61326412,-1.34645840,-0.18661699,-1,-325.00000000,-209.00000000,1969.08099767],"imu_8":[0,0.00000000,0.00000000,0.00000000,-1,0.00000000,0.00000000,0.00000000]}}
{"src":"ac:4d:16:e8:46:a9","version":"3.1","name":"SensoDK3","fullname":"SensoDK3","type":"position","data":{"type":"lh","ts":"13361748156571","palm":{"pos":[0.000,0.000,0.000],"spd":[0.000,0.000,0.000],"quat":[0.988134,-0.005059,-0.153314,-0.007751],"grv":[-0.260,-0.888,9.754],"lia":[0.013,0.045,-0.013],"delta":0.009900,"tilt":-0.007621},"gests":[0.30793,0.97657,0.20096,-0.36145,-0.28588,-0.20933,0.25797,-0.16608,0.01249,0.35713],"wrist":{"quat":[0.869849,0.486973,0.064211,-0.045786],"grv":[-8.775,0.500,-4.258],"lia":[-1.053,-0.125,-0.101],"delta":0.009900,"tilt":0.999695},"bones":{"bone_0":[0.988134,-0.153314,0.007751,0.005059],"bone_1":[0.89513,0.34480,-0.23341,0.15929],"bone_2":[0.98416,0.08190,-0.05739,-0.14638],"bone_3":[0.99391,-0.08266,0.06322,0.03614],"bone_4":[0.99966,-0.02262,-0.00507,0.01191],"bone_5":[0.98817,0.02491,-0.00382,-0.15130],"bone_6":[0.99909,0.01630,-0.02522,-0.03018],"bone_7":[0.99916,-0.03916,-0.01079,0.00609],"bone_8":[0.99971,0.01099,-0.00472,0.02088],"bone_9":[0.99350,0.03263,-0.00537,0.10896],"bone_10":[0.98798,-0.14926,0.02017,0.03471],"bone_11":[0.99853,0.03267,-0.00279,-0.04312],"bone_12":[0.99945,0.00351,0.02897,0.01570],"bone_13":[0.97595,-0.20068,0.08426,-0.01214],"bone_14":[0.99707,0.04339,-0.04010,-0.04861],"bone_15":[0.99880,-0.00073,0.04896,0.00165]},"fingers":[{"ang":[-0.092688,0.185752],"quat":[0.9060,0.3737,-0.0127,0.1982],"q":[0.906020,0.198216,0.373734,-0.012714],"bend":0.201,"quat2":[0.994945,-0.088808,-0.034900,-0.031300],"spd":-0.0012,"grv":[-1.594,-1.025,9.658],"lia":[-0.122,-0.198,0.006],"grv2":[-1.589,0.260,9.944],"lia2":[0.186,0.047,0.211]},{"ang":[-0.361529,0.013665],"quat":[0.982672,-0.180464,0.037918,0.018717],"spd":-0.0090,"grv":[-3.144,-1.751,9.147],"lia":[-0.033,0.001,0.012]},{"ang":[-0.285992,0.001425],"quat":[0.988458,-0.143046,0.049200,0.008234],"spd":-0.0039,"grv":[-1.550,-2.394,9.731],"lia":[-0.049,0.052,0.326]},{"ang":[-0.209471,0.016080],"quat":[0.994239,-0.104360,-0.022771,0.008931],"spd":-0.0157,"grv":[0.353,-2.982,9.296],"lia":[0.013,-0.054,-0.046]},{"ang":[0.257173,-0.042943],"quat":[0.971457,0.129491,-0.198648,-0.006456],"spd":-0.0615,"grv":[-1.535,1.050,9.796],"lia":[0.164,-0.068,0.289]}],"m1":[-172,213,77],"h_rssi":-49,"h_gain":15,"g_rssi":-46,"g_gain":15}}
So now you can just use any programming language to work with this information, decode it and use as you wish.
In order to switch on vibration all you need is to send similar JSON packet which has vibration motor name and special effect Here are examples for all fingers and wrist
{"type":"vibration","data":{"type":"thumb","code":"20"}}
{"type":"vibration","data":{"type":"index","code":"20 21 22"}}
{"type":"vibration","data":{"type":"middle","code":"20"}}
{"type":"vibration","data":{"type":"third","code":"20"}}
{"type":"vibration","data":{"type":"little","code":"20"}}
{"type":"vibration","data":{"type":"wrist","code":"20"}}
Instead of name 'thumb','index' etc, could be used their numeric values 0..6
Codes are vibration effects, you can see all of them in Senso GUI
In case of several (up to 8 effects separated by space) there will be chain of several effects as sequence.
Manual connection method
This is method similar to describer earlier, except that you can perform scan, choose proper glove and do everything manually from your software.
For this, all you need just connect to 127.0.0.1:53453
or 127.0.0.1:53454
ports (make sure that Senso_DK3_connector.exe
is launched
Then, send 'scan' and other methods
Methods are :
- list of available adapters -
{"type":"adapters"}
- scan for available gloves -
{"type":"scan"}
- choose left or right glove -
{"type":"configure","param":"left"}
or{"type":"configure","param":"right"}
- choose glove by MAC address -
{"type":"configure","param":"mac","value":"ac:4d:16:e8:46:a9"}
- connect to some glove -
{"type":"connect"}
- disconnect -
{"type":"disconnect"}
Example
Here is a PHP sample script with all mentioned things glove_test.php