Commit balls
This commit is contained in:
@@ -89,7 +89,7 @@ public class PersonalMotionPreviewElement extends View {
|
||||
|
||||
this.exercise = exercise;
|
||||
this.path = exercise.getPath();
|
||||
this.motionProcessor = new MotionProcessor();
|
||||
this.motionProcessor = new MotionProcessor(qiContext);
|
||||
this.motionProcessor.startListening();
|
||||
this.motionProcessor.setMotionDataEventHandler((processed, preprocessed, sampleIndex, sampleRate, deviceId) -> {
|
||||
// TODO: Implement the calculation of the `performingPath` based on the motion data
|
||||
|
@@ -2,6 +2,8 @@ package com.example.fitbot.util.processing;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.aldebaran.qi.sdk.QiContext;
|
||||
import com.example.fitbot.util.FitnessCycle;
|
||||
import com.example.fitbot.util.path.GesturePath;
|
||||
import com.example.fitbot.util.server.IWebServerHandler;
|
||||
import com.example.fitbot.util.server.WebServer;
|
||||
@@ -26,7 +28,11 @@ public class MotionProcessor {
|
||||
private GesturePath path;
|
||||
private WebServer server;
|
||||
|
||||
public MotionProcessor() {}
|
||||
private QiContext context;
|
||||
|
||||
private long lastMessage = System.nanoTime();
|
||||
|
||||
public MotionProcessor(QiContext context) {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -64,6 +70,12 @@ public class MotionProcessor {
|
||||
* @param data The data to parse.
|
||||
*/
|
||||
public void parsePacket(@NotNull String data) {
|
||||
|
||||
if ( System.nanoTime() - lastMessage < 2 * 1E9)
|
||||
return;
|
||||
lastMessage = System.nanoTime();
|
||||
FitnessCycle.say("Informatie ontvangen", context);
|
||||
/*
|
||||
// If the message starts with 'data', it's a data packet.
|
||||
if ( data.startsWith("data")) {
|
||||
Log.i("MotionProcessor", "Received data packet: " + data.split(" ")[1]);
|
||||
@@ -82,7 +94,7 @@ public class MotionProcessor {
|
||||
Log.i("MotionProcessor", "Device calibrated at " + ZERO.toString());
|
||||
} else if ( data.startsWith("sampleRate")) {
|
||||
this.sampleRate = Float.parseFloat(data.split(" ")[1]);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user