AdSense

2016年8月27日土曜日

ウェアラブル活動量計Mi bandのAndroid SDKを動かしてみる

格安の心拍・活動量計である XiaomiのMi Bandが届いたので、自作AndroidアプリでBLE接続してみた。


買ったのは安かった一つ古いこの型です。
 
なお、最新はこちらで、時間も見れます。



自作Androidアプリといっても
中国語ですがSDKはこちらを使用しました。
https://github.com/pangliang/miband-sdk-android

中国語なので、ログのコメントなどを英語か日本語に書き換えます。

Android Studioに読み込ませると、
特に苦労することなく動きました。


BLEの通信コマンドが一通り使えるのとCharactaristicsが読めるので、ここから拡張していくと良さそうです。




Xtion + OpenNI + Processingで自分を別の角度からみる

以前ISITの吉永さんに教えていただいたこちらのAR幽体離脱体験が面白かったので、


手元にあるXtionを使って近しいことができないかやってみる。

勉強会で教わった、Mac + Kinect + OpenFramework(OfxOpenKinect)で、Kinectだとできたことが、どうもXtionだとOfxOpenKinectでは動かない。
ググると OpenFramework(ofxOpenNI)が使えるような情報があり、環境を作ってみるが、デバイスがエラーを吐いてしまう。

[warning] ofxOpenNIDevice[0]: Using a NASTY hack to silence SIGNAL errors on exit - read the comments at line ~1712 of ofxOpenNI.cpp
[notice ] ofxOpenNIDevice[0]: Init context...
[notice ] ofxOpenNIDevice[0]: openni driver version: 1.5.4.0
[notice ] ofxOpenNIDevice[0]: Adding licence...
[notice ] ofxOpenNIDevice[0]: Init device...
[warning] ofxOpenNIDevice[0]: Device: PrimeSense/SensorKinect/5.1.0.25failed:The device is not connected!
[notice ] ofxOpenNIDevice[0]: Found0devices connected
[warning] ofxOpenNIDevice[0]: REAL Device could not be initialized - you can still use an ONI
[notice ] ofxOpenNIDevice[0]: Adding generator typeXN_NODE_TYPE_DEPTH
[ error ] ofxOpenNIDevice[0]: setGeneratorResolution() called on invalid generator!
[notice ] ofxOpenNIDevice[0]: Starting ofxOpenNI with threading
[warning] ofThread: - name: Thread 1 - Calling startThread with verbose is deprecated.
[warning] ofGLRenderer: draw(): texture is not allocated
[warning] ofGLRenderer: draw(): texture is not allocated
[warning] ofGLRenderer: draw(): texture is not allocated

[warning] ofGLRenderer: draw(): texture is not allocated


試したのはこちらの記事
http://www.myu.ac.jp/~xkozima/lab/ofTutorial5.html

他参考)
https://sites.google.com/site/mylabteu/tips/openframeworks

で、困ったところ、
OpenNIのProcessingのexampleで「AlternativeViewpoint3d」というのがあり、
これで似たようなことができることに気づく。


ARやVRゴーグルとは遠いが、とりあえず自分の姿をリアルタイムで様々な角度から見ることができた。

一旦OpenFrameworkは諦めて、
Processingで試してみることにする。