Merge remote-tracking branch 'origin/main'

This commit is contained in:
Luca Warmenhoven
2024-06-05 13:25:01 +02:00
4 changed files with 31 additions and 30 deletions

View File

@@ -16,15 +16,18 @@ import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.view.View;
import android.widget.Button;
import android.widget.VideoView;
import com.aldebaran.qi.Future;
import com.aldebaran.qi.sdk.QiContext;
import com.aldebaran.qi.sdk.QiSDK;
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.conversationstatus.SpeechBarDisplayStrategy;
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.exercise.Exercise;
import com.example.fitbot.exercise.ExerciseManager;
@@ -50,6 +53,8 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
private TextView exerciseShortDescriptionTextView;
//private TextView exerciseDescriptionTextView;
private static String exerciseVideoUrl;
private Animate animate;
private VideoView videoView;
private final Object lock = new Object();
@@ -73,6 +78,7 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
super.onCreate(savedInstanceState);
QiSDK.register(this, this);
setContentView(R.layout.activity_fitness);
videoView = findViewById(R.id.videoView);
// Fill empty objects with exercise data
this.exerciseNameTextView = findViewById(R.id.textViewFitnessTitle);
@@ -127,6 +133,23 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
motionProcessor.setRecording(true, 10);
motionProcessor.startListening();
if ( videoView.isPlaying() )
{
Animation animationarmraise = AnimationBuilder.with(qiContext) // Create the builder with the context.
.withResources(R.raw.armraise) // Set the animation resource.
.build(); // Build the animation.
animate = AnimateBuilder.with(qiContext) // Create the builder with the context.
.withAnimation(animationarmraise) // Set the animation.
.build(); // Build the animate action.
Future<Void> animateFuture = animate.async().run();
}
else
{
Log.e("FitnessActivity", "VideoView is null. Check your layout XML.");
}
}, (n) -> {
int randomMessageIndex = (int) Math.floor(Math.random() * EXERCISE_NOT_FOUND_MESSAGES.length);
Pepper.say(EXERCISE_NOT_FOUND_MESSAGES[randomMessageIndex]);
@@ -146,17 +169,16 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
new Thread(() -> {
Exercise exercise = ExerciseManager.fetchExerciseFromDatabase();
if (exercise == null) {
onFailedFetch.handle(null);
runOnUiThread(() -> onFailedFetch.handle(null));
} else {
onSuccessfulFetch.handle(exercise);
this.runOnUiThread(() -> {
runOnUiThread(() -> {
onSuccessfulFetch.handle(exercise);
exerciseNameTextView.setText(exercise.name);
exerciseShortDescriptionTextView.setText(exercise.shortDescription);
// exerciseDescriptionTextView.setText(exercise.description);
exerciseVideoUrl = exercise.videoUrl;
// Play the video
VideoView videoView = findViewById(R.id.videoView);
playVideo(videoView, this);
// When the video has started playing remove the loading circle
@@ -275,5 +297,4 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall
});
animator.start();
}
}

View File

@@ -136,11 +136,6 @@
</RelativeLayout>
<com.example.fitbot.ui.components.ExerciseStatusElement
android:id="@+id/personalMotionPreviewElement"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<Button

View File

@@ -31,4 +31,6 @@ RTSP is collection of protocols used for streaming media such as videos over ne
Due to its limited support we are not uising it in our project. We were already having issues with other things that are not supported on android or mobile apps and we did not want to risk getting more issues while working on our project since we were already using up our limited time. It is a very interesting option though since it will enable more advanced videos. It also is realy complex which makes it a less atractive option since we are already learning a lot of new things and if we were to want to learn more things we would rather learn something with a low learning curve.
# Conclusion
# Conclusion
We still used HTTP for its simplicity and because we did not need a fancy data protocol. If i were to make this project again i would still use HTTP because is will make the making of the project easy. If we were to expend our project i would UDP if we were to make it like a game. Then we might be able to make our own wii sports with pepper. Since the loss of some data wont really matter

View File

@@ -1,17 +0,0 @@
# Ideas for hardware
# making a balance bord
Since We are not able to connect the wii fit bord we have to come up with a solution. We thought of it for some time and what we want to do with it. Origanlly we wanted to use the balance bord for excersises such as standing on one leg. This is a simple leg excersise we wanted to have. We thaugt of multiple solutions to still have this excersise. However we still needed to think of a design for the frame.
# the frame
We wanted it to have a similar style to the balance bord. howevere since we can make or own we wanted to make it a bit taller. This makes it easier to implement some other excersise such as the step up. This is na excersise that benefits from a taller box than the wii fit box.
## LDR
We can use a LDR to determine if someone is standing on the bord
## Knock sensor
![alt text](../assets/knocksensor.png)