Leap Motionを2台以上使ってみたい機会があったので、IP指定してWebSocketでデータ取得する方式の環境構築のメモ
Leap Motionのドライバーはインストール済みの想定です
##LEAP Motion の WebSocketサーバー
ビジュアライザー診断などのLeap Motionドライバーには、起動時にWebSocketサーバーが起動しているようです
ws://localhost:6437/
##config.jsonに追記
下記の情報をconfig.jsonに追記
Leap Motionのドライバーは停止したほうが良かったです
"images_mode": 2,
"websockets_allow_remote": true,
"websockets_enabled": true
2箇所ほどありますが、編集できる方のみでもOKかもです
C:/ProgramData/Leap Motion/config.json
C:/Users/Username/AppData/Roaming/Leap Motion/config.json
{
"configuration": {
"image_processing_auto_flip": true,
"image_processing_flipped": false,
"images_mode": 2,
"websockets_allow_remote": true,
"websockets_enabled": true
}
}
Windowsファイヤーウォール「ファイヤーウォールによるアプリケーションの許可」への追加
コントロール パネル\すべてのコントロール パネル項目\Windows Defender ファイアウォール\許可されたアプリ
「別のアプリの許可」から3つLeap Motionのexeを追加しました
C:\Program Files\Leap Motion\Core Services
LeapControlPanel.exe
LeapSvc.exe
Recalibrate.exe
##PC再起動
再起動しないと反映されなかったようなので。。
別PCは再起しなくてもできたので、規則がわかりません。。
##取得できたデータ
{"currentFrameRate":85.811661,"devices":[],"hands":[{"direction":[-0.174163,-0.504862,-0.845448],"id":200,"palmNormal":[0.524506,-0.774201,0.354268],"palmPosition":[15.470428,276.754761,-43.167252],"palmVelocity":[8.048999,-102.844597,1.154462],"timeVisible":1.555471}],"id":563536,"pointables":[{"direction":[-0.319512,-0.901732,-0.291190],"handId":200,"id":2000,"length":50.776791,"timeVisible":1.555471,"tipPosition":[-22.385941,202.880341,-14.876396],"width":21.074820},{"direction":[0.050678,-0.890562,-0.452031],"handId":200,"id":2001,"length":56.992455,"timeVisible":1.555471,"tipPosition":[-15.500284,197.979477,-96.916260],"width":20.130669},{"direction":[0.074383,-0.855941,-0.511696],"handId":200,"id":2002,"length":64.708893,"timeVisible":1.555471,"tipPosition":[6.423775,203.599457,-118.352493],"width":19.770990},{"direction":[0.203443,-0.811137,-0.548332],"handId":200,"id":2003,"length":62.036518,"timeVisible":1.555471,"tipPosition":[37.534515,220.833786,-121.149231],"width":18.813351},{"direction":[0.385315,-0.769903,-0.508706],"handId":200,"id":2004,"length":48.716534,"timeVisible":1.555471,"tipPosition":[68.231056,244.532608,-106.366425],"width":16.711489}],"timestamp":17154280370}
###参考サイト
Raspberry Pi 3BでLeap Motionを使う
https://www.pentacreation.com/blog/2016/10/161008.html
leapmotion/leapjs
https://github.com/leapmotion/leapjs
LEAP Motion と WebSocket
https://gist.github.com/uupaa/6102441