Created
April 7, 2017 23:25
-
-
Save danaabs/2f43542a255e724dc8dd511a149ee73d to your computer and use it in GitHub Desktop.
Notch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Runnable mLogRealTimeData = new Runnable() { | |
@Override | |
public void run() { | |
// Index of first new frame in the last update | |
int startingFrame = mRealTimeData.getStartingFrame(); | |
// Elapsed time since the last update | |
long millisSinceUpdate = System.currentTimeMillis() - mUpdateStartTime; | |
// Recording frequency | |
float frequency = mRealTimeData.getFrequency(); | |
// Milliseconds per frame | |
float millisPerFrame = 1000.f / frequency; | |
// Slect the current frame from the last update | |
int currentFrame = startingFrame + (int)(millisSinceUpdate / millisPerFrame); | |
// Show the last frame until a new update comes | |
if (currentFrame > mRealTimeData.getFrameCount() - 1) currentFrame = mRealTimeData.getFrameCount() - 1; | |
// Logging data for measured bones | |
Log.d("REALTIME", "Current frame:" + currentFrame); | |
for (Bone b : mNotchService.getNetwork().getDevices().keySet()) { | |
//fvec3 a=mRealTimeData.getPos(b,currentFrame); | |
Log.d("REALTIME", b.getName() + " " | |
// Orientation (quaternion) | |
+ mRealTimeData.getQ(b,currentFrame) + " " | |
// Position of the bone (end of vector) | |
+ mRealTimeData.getPos(b,currentFrame)); | |
mSocket.emit("newmessage",b.getName() + " " | |
// Orientation (quaternion) | |
+ mRealTimeData.getQ(b,currentFrame) + " " | |
// Position of the bone (end of vector) | |
+ mRealTimeData.getPos(b,currentFrame)); | |
} | |
mHandler.postDelayed(mLogRealTimeData,mRefreshTime); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment