Poekseps
This commit is contained in:
@@ -281,13 +281,10 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
|
|
||||||
private void triggerColorBurst(boolean isGoodRep) {
|
private void triggerColorBurst(boolean isGoodRep) {
|
||||||
|
|
||||||
if (isGoodRep) {
|
int circleId = isGoodRep ? R.drawable.progress_circle_good : R.drawable.progress_circle_bad;
|
||||||
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_good));
|
int soundId = isGoodRep ? R.raw.good_sound : R.raw.wrong_sound;
|
||||||
new MediaPlayer().create(this, R.raw.good_sound).start();
|
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, circleId));
|
||||||
} else {
|
MediaPlayer.create(this, soundId).start();
|
||||||
progressCircle.setProgressDrawable(ContextCompat.getDrawable(this, R.drawable.progress_circle_bad));
|
|
||||||
new MediaPlayer().create(this, R.raw.wrong_sound).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectAnimator animator = ObjectAnimator.ofFloat(progressCircle, "alpha", 1f, 0f, 1f);
|
ObjectAnimator animator = ObjectAnimator.ofFloat(progressCircle, "alpha", 1f, 0f, 1f);
|
||||||
animator.setDuration(500); // Burst duration
|
animator.setDuration(500); // Burst duration
|
||||||
|
@@ -28,7 +28,7 @@ public class InputProcessor {
|
|||||||
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 final float sampleRate; // The sample rate of the motion sensor
|
||||||
private float exerciseDurationInSeconds;
|
private float exerciseRepetitionDurationInSeconds = 0.0f;
|
||||||
private int repetitionsRemaining = 0;
|
private int repetitionsRemaining = 0;
|
||||||
private int exercisesRemaining = 0;
|
private int exercisesRemaining = 0;
|
||||||
private float exerciseScore = 0.0F;
|
private float exerciseScore = 0.0F;
|
||||||
@@ -120,7 +120,7 @@ public class InputProcessor {
|
|||||||
this.targetRotationVectorPaths = new Vector3f[2][exercise.rightPath.getAngleVectors().length];
|
this.targetRotationVectorPaths = new Vector3f[2][exercise.rightPath.getAngleVectors().length];
|
||||||
this.targetRotationVectorPaths[0] = exercise.leftPath.getAngleVectors();
|
this.targetRotationVectorPaths[0] = exercise.leftPath.getAngleVectors();
|
||||||
this.targetRotationVectorPaths[1] = exercise.rightPath.getAngleVectors();
|
this.targetRotationVectorPaths[1] = exercise.rightPath.getAngleVectors();
|
||||||
this.exerciseDurationInSeconds = exercise.exerciseTimeInSeconds;
|
this.exerciseRepetitionDurationInSeconds = exercise.exerciseTimeInSeconds;
|
||||||
this.secondsPassed = 0.0D;
|
this.secondsPassed = 0.0D;
|
||||||
this.lastTime = System.currentTimeMillis();
|
this.lastTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
@@ -170,7 +170,7 @@ public class InputProcessor {
|
|||||||
public boolean hasFinished() {
|
public boolean hasFinished() {
|
||||||
return this.recordingMovement ?
|
return this.recordingMovement ?
|
||||||
(this.secondsPassed >= this.recordingDurationInSeconds) :
|
(this.secondsPassed >= this.recordingDurationInSeconds) :
|
||||||
(this.secondsPassed >= this.exerciseDurationInSeconds);
|
(this.secondsPassed >= this.exerciseRepetitionDurationInSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -356,6 +356,10 @@ public class InputProcessor {
|
|||||||
// Ensure the sensor ID is within the bounds of the array
|
// Ensure the sensor ID is within the bounds of the array
|
||||||
if (sensorId < 0 || sensorId >= selfRotationVectorPaths.length)
|
if (sensorId < 0 || sensorId >= selfRotationVectorPaths.length)
|
||||||
return 0.0d;
|
return 0.0d;
|
||||||
|
|
||||||
|
// Calculate the index of the rotational vector where we're currently at
|
||||||
|
int targetRotationIdx =
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
// Index of the current rotation vector
|
// Index of the current rotation vector
|
||||||
@@ -383,10 +387,10 @@ public class InputProcessor {
|
|||||||
*/
|
*/
|
||||||
public double getAverageError(int sensorId) {
|
public double getAverageError(int sensorId) {
|
||||||
double error = 0;
|
double error = 0;
|
||||||
for (int i = 0; i < this.exerciseDurationInSeconds; i++) {
|
for (int i = 0; i < this.exerciseRepetitionDurationInSeconds; i++) {
|
||||||
error += getError(sensorId, i);
|
error += getError(sensorId, i);
|
||||||
}
|
}
|
||||||
return error / this.exerciseDurationInSeconds;
|
return error / this.exerciseRepetitionDurationInSeconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float secondsPassed() {
|
public float secondsPassed() {
|
||||||
|
Reference in New Issue
Block a user