Merge branch 'main' of https://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-4/muupooviixee66
This commit is contained in:
@@ -134,7 +134,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
// the canvas properly.
|
// the canvas properly.
|
||||||
this.fetchExerciseAsync((exercise) -> {
|
this.fetchExerciseAsync((exercise) -> {
|
||||||
// Acquire paths from the exercise and provide them to the motion processor
|
// Acquire paths from the exercise and provide them to the motion processor
|
||||||
motionProcessor = new InputProcessor(SENSOR_SAMPLE_RATE, this);
|
motionProcessor = new InputProcessor(this);
|
||||||
motionProcessor.useExercise(exercise);
|
motionProcessor.useExercise(exercise);
|
||||||
/* TODO: Remove if not needed */
|
/* TODO: Remove if not needed */
|
||||||
motionProcessor.setRecording(true, 10);
|
motionProcessor.setRecording(true, 10);
|
||||||
@@ -197,6 +197,9 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
Log.e("FitnessActivity", "VideoView is null. Check your layout XML.");
|
Log.e("FitnessActivity", "VideoView is null. Check your layout XML.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Start checking for user movement once the video has loaded
|
||||||
|
this.motionProcessor.startCheckingUserMovement();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@@ -27,9 +27,7 @@ public class InputProcessor {
|
|||||||
//private Vector3f[][] selfRotationVectorPaths; // Relative path of the motion data
|
//private Vector3f[][] selfRotationVectorPaths; // Relative path of the motion data
|
||||||
private Vector3f[][] targetRotationVectorPaths; // Target path of the motion data
|
private Vector3f[][] targetRotationVectorPaths; // Target path of the motion data
|
||||||
|
|
||||||
private final float sampleRate; // The sample rate of the motion sensor
|
|
||||||
private float exerciseRepetitionDurationInSeconds = 0.0f;
|
private float exerciseRepetitionDurationInSeconds = 0.0f;
|
||||||
private int repetitionsRemaining = 0;
|
|
||||||
private int exercisesRemaining = 0;
|
private int exercisesRemaining = 0;
|
||||||
|
|
||||||
private float errorCheckInterval_s;
|
private float errorCheckInterval_s;
|
||||||
@@ -75,11 +73,8 @@ public class InputProcessor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for the motion processor.
|
* Constructor for the motion processor.
|
||||||
*
|
|
||||||
* @param inputSampleRate The sample rate of the motion sensor.
|
|
||||||
*/
|
*/
|
||||||
public InputProcessor(float inputSampleRate, FitnessActivity parentActivity) {
|
public InputProcessor(FitnessActivity parentActivity) {
|
||||||
this.sampleRate = inputSampleRate;
|
|
||||||
this.parentActivity = parentActivity;
|
this.parentActivity = parentActivity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +95,15 @@ public class InputProcessor {
|
|||||||
this.exercisesRemaining = 1;
|
this.exercisesRemaining = 1;
|
||||||
this.nextExercise(exercise);
|
this.nextExercise(exercise);
|
||||||
Pepper.say(STARTING_PHRASES[(int) Math.floor(Math.random() * STARTING_PHRASES.length)]);
|
Pepper.say(STARTING_PHRASES[(int) Math.floor(Math.random() * STARTING_PHRASES.length)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function that starts checking for user movement.
|
||||||
|
* This function will start a thread that will check for user movement
|
||||||
|
* and compare the last rotation vectors to the target rotation vectors.
|
||||||
|
*/
|
||||||
|
public void startCheckingUserMovement()
|
||||||
|
{
|
||||||
// Error checking thread.
|
// Error checking thread.
|
||||||
(new Thread(() -> {
|
(new Thread(() -> {
|
||||||
while (this.exercisesRemaining > 0)
|
while (this.exercisesRemaining > 0)
|
||||||
|
Reference in New Issue
Block a user