diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java index 5b681fc..8ab63fd 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java @@ -189,6 +189,8 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall EXERCISE_VIDEO_REPETITION++; if (progress >= 10) { runOnUiThread(() -> NavigationManager.navigateToActivity(this, EndScreenActivity.class)); + InputProcessor.exercisesRemaining = 1; + } } }); diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java index c3fc778..9d07109 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/util/processing/InputProcessor.java @@ -25,11 +25,13 @@ import java.util.List; public class InputProcessor { - private List[] selfRotationVectorPaths = null; // Relative path of the motion data + private List[] selfRotationVectorPaths = null; + + // Relative path of the motion data private Vector3f[][] targetRotationVectorPaths; // Target path of the motion data private float exerciseRepetitionDurationInSeconds = 0.0f; - private int exercisesRemaining = 1; + public static int exercisesRemaining = 1; private float errorCheckInterval_s; private int checksPerformed = 0; @@ -77,6 +79,10 @@ public class InputProcessor { */ public InputProcessor(FitnessActivity parentActivity) { this.parentActivity = parentActivity; + + // Initialize each ArrayList in the array + this.selfRotationVectorPaths[0] = new ArrayList<>(); + this.selfRotationVectorPaths[1] = new ArrayList<>(); } /** @@ -89,11 +95,13 @@ public class InputProcessor { * * @param exercise The exercise to use the paths for. */ + + public void useExercise(Exercise exercise) { if (this.recordingMovement) throw new IllegalStateException("Cannot change exercise while recording movement."); - this.exercisesRemaining = 1; + exercisesRemaining = 1; this.nextExercise(exercise); Pepper.say(STARTING_PHRASES[(int) Math.floor(Math.random() * STARTING_PHRASES.length)]); } @@ -108,7 +116,7 @@ public class InputProcessor { (new Thread(() -> { Log.i("InputProcessor", "Movement Checking Thread started"); - while (this.exercisesRemaining > 0) { + while (exercisesRemaining > 0) { if ( this.totalChecks == 0 || this.selfRotationVectorPaths == null || this.selfRotationVectorPaths.length == 0