array intialization

This commit is contained in:
2024-06-10 10:51:20 +02:00
parent 1e958005f6
commit e91deedcc3
2 changed files with 14 additions and 4 deletions

View File

@@ -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;
}
}
});

View File

@@ -25,11 +25,13 @@ import java.util.List;
public class InputProcessor {
private List<Vector3f>[] selfRotationVectorPaths = null; // Relative path of the motion data
private List<Vector3f>[] 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