Merge branch 'main' of ssh://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-4/muupooviixee66
This commit is contained in:
@@ -279,13 +279,10 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
||||
|
||||
public void triggerColorBurst(boolean isGoodRep) {
|
||||
|
||||
if (isGoodRep) {
|
||||
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_good));
|
||||
new MediaPlayer().create(this, R.raw.good_sound).start();
|
||||
} else {
|
||||
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_bad));
|
||||
new MediaPlayer().create(this, R.raw.wrong_sound).start();
|
||||
}
|
||||
int circleId = isGoodRep ? R.drawable.progress_circle_good : R.drawable.progress_circle_bad;
|
||||
int soundId = isGoodRep ? R.raw.good_sound : R.raw.wrong_sound;
|
||||
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, circleId));
|
||||
MediaPlayer.create(this, soundId).start();
|
||||
|
||||
ObjectAnimator animator = ObjectAnimator.ofFloat(progressCircle, "alpha", 1f, 0f, 1f);
|
||||
animator.setDuration(500); // Burst duration
|
||||
|
@@ -28,7 +28,7 @@ public class InputProcessor {
|
||||
private Vector3f[][] targetRotationVectorPaths; // Target path of the motion data
|
||||
|
||||
private final float sampleRate; // The sample rate of the motion sensor
|
||||
private float exerciseDurationInSeconds;
|
||||
private float exerciseRepetitionDurationInSeconds = 0.0f;
|
||||
private int repetitionsRemaining = 0;
|
||||
private int exercisesRemaining = 0;
|
||||
private float exerciseScore = 0.0F;
|
||||
@@ -120,7 +120,7 @@ public class InputProcessor {
|
||||
this.targetRotationVectorPaths = new Vector3f[2][exercise.rightPath.getAngleVectors().length];
|
||||
this.targetRotationVectorPaths[0] = exercise.leftPath.getAngleVectors();
|
||||
this.targetRotationVectorPaths[1] = exercise.rightPath.getAngleVectors();
|
||||
this.exerciseDurationInSeconds = exercise.exerciseTimeInSeconds;
|
||||
this.exerciseRepetitionDurationInSeconds = exercise.exerciseTimeInSeconds;
|
||||
this.secondsPassed = 0.0D;
|
||||
this.lastTime = System.currentTimeMillis();
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public class InputProcessor {
|
||||
public boolean hasFinished() {
|
||||
return this.recordingMovement ?
|
||||
(this.secondsPassed >= this.recordingDurationInSeconds) :
|
||||
(this.secondsPassed >= this.exerciseDurationInSeconds);
|
||||
(this.secondsPassed >= this.exerciseRepetitionDurationInSeconds);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,6 +366,10 @@ public class InputProcessor {
|
||||
// Ensure the sensor ID is within the bounds of the array
|
||||
if (sensorId < 0 || sensorId >= selfRotationVectorPaths.length)
|
||||
return 0.0d;
|
||||
|
||||
// Calculate the index of the rotational vector where we're currently at
|
||||
int targetRotationIdx =
|
||||
|
||||
/*
|
||||
|
||||
// Index of the current rotation vector
|
||||
@@ -393,10 +397,10 @@ public class InputProcessor {
|
||||
*/
|
||||
public double getAverageError(int sensorId) {
|
||||
double error = 0;
|
||||
for (int i = 0; i < this.exerciseDurationInSeconds; i++) {
|
||||
for (int i = 0; i < this.exerciseRepetitionDurationInSeconds; i++) {
|
||||
error += getError(sensorId, i);
|
||||
}
|
||||
return error / this.exerciseDurationInSeconds;
|
||||
return error / this.exerciseRepetitionDurationInSeconds;
|
||||
}
|
||||
|
||||
public float secondsPassed() {
|
||||
|
Reference in New Issue
Block a user