Fixed more issues, added more logging
This commit is contained in:
@@ -18,16 +18,12 @@ import android.widget.ProgressBar;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.VideoView;
|
import android.widget.VideoView;
|
||||||
|
|
||||||
import com.aldebaran.qi.Future;
|
|
||||||
import com.aldebaran.qi.sdk.QiContext;
|
import com.aldebaran.qi.sdk.QiContext;
|
||||||
import com.aldebaran.qi.sdk.QiSDK;
|
import com.aldebaran.qi.sdk.QiSDK;
|
||||||
import com.aldebaran.qi.sdk.RobotLifecycleCallbacks;
|
import com.aldebaran.qi.sdk.RobotLifecycleCallbacks;
|
||||||
import com.aldebaran.qi.sdk.builder.AnimateBuilder;
|
|
||||||
import com.aldebaran.qi.sdk.builder.AnimationBuilder;
|
|
||||||
import com.aldebaran.qi.sdk.design.activity.RobotActivity;
|
import com.aldebaran.qi.sdk.design.activity.RobotActivity;
|
||||||
import com.aldebaran.qi.sdk.design.activity.conversationstatus.SpeechBarDisplayStrategy;
|
import com.aldebaran.qi.sdk.design.activity.conversationstatus.SpeechBarDisplayStrategy;
|
||||||
import com.aldebaran.qi.sdk.object.actuation.Animate;
|
import com.aldebaran.qi.sdk.object.actuation.Animate;
|
||||||
import com.aldebaran.qi.sdk.object.actuation.Animation;
|
|
||||||
import com.example.fitbot.R;
|
import com.example.fitbot.R;
|
||||||
import com.example.fitbot.exercise.Exercise;
|
import com.example.fitbot.exercise.Exercise;
|
||||||
import com.example.fitbot.exercise.ExerciseManager;
|
import com.example.fitbot.exercise.ExerciseManager;
|
||||||
@@ -71,7 +67,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
|
|
||||||
private static final float SENSOR_SAMPLE_RATE = 10.0f;
|
private static final float SENSOR_SAMPLE_RATE = 10.0f;
|
||||||
private static final int EXERCISE_COUNT = 5;
|
private static final int EXERCISE_COUNT = 5;
|
||||||
private static int EXERCISE_REP = 1;
|
private static int EXERCISE_VIDEO_REPETITION = 1;
|
||||||
private static final float EXERCISE_SPEED_MULTIPLIER = 1.0f;
|
private static final float EXERCISE_SPEED_MULTIPLIER = 1.0f;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -87,7 +83,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
//this.exerciseDescriptionTextView = findViewById(R.id.textViewDialogDescription);
|
//this.exerciseDescriptionTextView = findViewById(R.id.textViewDialogDescription);
|
||||||
|
|
||||||
// Set the repetition count for the exercise
|
// Set the repetition count for the exercise
|
||||||
EXERCISE_REP = 1;
|
EXERCISE_VIDEO_REPETITION = 1;
|
||||||
|
|
||||||
progressCircle = findViewById(R.id.progressCircle);
|
progressCircle = findViewById(R.id.progressCircle);
|
||||||
progressText = findViewById(R.id.progressText);
|
progressText = findViewById(R.id.progressText);
|
||||||
@@ -185,9 +181,9 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
});
|
});
|
||||||
|
|
||||||
videoView.setOnCompletionListener(mp -> {
|
videoView.setOnCompletionListener(mp -> {
|
||||||
if (EXERCISE_REP < EXERCISE_COUNT) {
|
if (EXERCISE_VIDEO_REPETITION < ExerciseManager.DEFAULT_EXERCISE_REPETITIONS) {
|
||||||
videoView.start(); // start the video again
|
videoView.start(); // start the video again
|
||||||
EXERCISE_REP++;
|
EXERCISE_VIDEO_REPETITION++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -260,8 +256,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void incrementProgress() {
|
public void incrementProgress() {
|
||||||
if (progress < maxProgress) {
|
if (progress++ < maxProgress) {
|
||||||
progress++;
|
|
||||||
triggerColorBurst(true);
|
triggerColorBurst(true);
|
||||||
updateProgress();
|
updateProgress();
|
||||||
}
|
}
|
||||||
|
@@ -104,9 +104,12 @@ public class InputProcessor {
|
|||||||
public void startCheckingUserMovement() {
|
public void startCheckingUserMovement() {
|
||||||
// Error checking thread.
|
// Error checking thread.
|
||||||
(new Thread(() -> {
|
(new Thread(() -> {
|
||||||
|
Log.i("InputProcessor", "Movement Checking Thread started");
|
||||||
while (this.exercisesRemaining > 0) {
|
while (this.exercisesRemaining > 0) {
|
||||||
boolean isFaulty = this.isFaultyMovement();
|
boolean isFaulty = this.isFaultyMovement();
|
||||||
|
|
||||||
|
Log.i("InputProcessor", "Movement checked: " + (isFaulty ? "Faulty" : "Good"));
|
||||||
|
|
||||||
if (isFaulty) {
|
if (isFaulty) {
|
||||||
this.onInadequateRepetition();
|
this.onInadequateRepetition();
|
||||||
} else this.onAdequateRepetition();
|
} else this.onAdequateRepetition();
|
||||||
@@ -146,6 +149,8 @@ public class InputProcessor {
|
|||||||
|
|
||||||
this.errorCheckInterval_s = this.exerciseRepetitionDurationInSeconds * ExerciseManager.DEFAULT_EXERCISE_REPETITIONS / 6.0f;
|
this.errorCheckInterval_s = this.exerciseRepetitionDurationInSeconds * ExerciseManager.DEFAULT_EXERCISE_REPETITIONS / 6.0f;
|
||||||
|
|
||||||
|
Log.i("InputProcessor", "Exercise error checking interval: " + this.errorCheckInterval_s);
|
||||||
|
|
||||||
this.selfRotationVectorPaths = new ArrayList[2];
|
this.selfRotationVectorPaths = new ArrayList[2];
|
||||||
this.selfRotationVectorPaths[0] = new ArrayList<>();
|
this.selfRotationVectorPaths[0] = new ArrayList<>();
|
||||||
this.selfRotationVectorPaths[1] = new ArrayList<>();
|
this.selfRotationVectorPaths[1] = new ArrayList<>();
|
||||||
@@ -163,6 +168,7 @@ public class InputProcessor {
|
|||||||
*/
|
*/
|
||||||
public void onAdequateRepetition() {
|
public void onAdequateRepetition() {
|
||||||
ExerciseManager.TOTAL_REPETITIONS_PERFORMED++;
|
ExerciseManager.TOTAL_REPETITIONS_PERFORMED++;
|
||||||
|
Log.i("InputProcessor", "Adequate repetition performed");
|
||||||
this.parentActivity.incrementProgress();
|
this.parentActivity.incrementProgress();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,6 +176,7 @@ public class InputProcessor {
|
|||||||
* Method that is called whenever the user performs a bad repetition.
|
* Method that is called whenever the user performs a bad repetition.
|
||||||
*/
|
*/
|
||||||
public void onInadequateRepetition() {
|
public void onInadequateRepetition() {
|
||||||
|
Log.i("InputProcessor", "Inadequate repetition performed");
|
||||||
this.parentActivity.triggerColorBurst(false);
|
this.parentActivity.triggerColorBurst(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,6 +240,8 @@ public class InputProcessor {
|
|||||||
private void acquireExercise() {
|
private void acquireExercise() {
|
||||||
this.exercisesRemaining--;
|
this.exercisesRemaining--;
|
||||||
|
|
||||||
|
Log.i("MotionProcessor", "Fetching exercise data.");
|
||||||
|
|
||||||
this.parentActivity.fetchExerciseAsync(this::nextExercise, (nil) -> {
|
this.parentActivity.fetchExerciseAsync(this::nextExercise, (nil) -> {
|
||||||
|
|
||||||
Log.i("MotionProcessor", "Failed to fetch exercise data.");
|
Log.i("MotionProcessor", "Failed to fetch exercise data.");
|
||||||
|
Reference in New Issue
Block a user