diff --git a/code/arduino/Movement-sensor-code/Connectivity.h b/code/arduino/Movement-sensor-code/Connectivity.h index 27cfe94..3df3524 100644 --- a/code/arduino/Movement-sensor-code/Connectivity.h +++ b/code/arduino/Movement-sensor-code/Connectivity.h @@ -1,5 +1,5 @@ -#ifndef Connectivity_h -#define Connectivity_h +#ifndef MOVEMENTSENSORCODE_CONNECTIVITY_h +#define MOVEMENTSENSORCODE_CONNECTIVITY_h #include "Arduino.h" #include @@ -30,4 +30,4 @@ private: }; -#endif \ No newline at end of file +#endif // MOVEMENTSENSORCODE_CONNECTIVITY_h \ No newline at end of file diff --git a/code/arduino/Movement-sensor-code/Movement-sensor-code.ino b/code/arduino/Movement-sensor-code/Movement-sensor-code.ino index 4a17a93..6acc498 100644 --- a/code/arduino/Movement-sensor-code/Movement-sensor-code.ino +++ b/code/arduino/Movement-sensor-code/Movement-sensor-code.ino @@ -9,9 +9,10 @@ void setup() { } void loop() { - SensorManager::RotationQuaternions Rotation = sensorManager.getQuaternions(); - // SensorManager::acceleration rotationAcceleration = sensorManager.getAcelleration(); + SensorManager::eulerAngles Rotation = sensorManager.getEulerAngles(); +//static structure +// TODO: redo json for esp8266 and in android studio struct acceleration { float x = 9; float y = 9; @@ -19,22 +20,22 @@ struct acceleration { } accelData; if (!ipAquired) { - serverIp = connectivity.fetchIPAddress(); // Assign the value here + serverIp = connectivity.fetchIPAddress(); //Fetch pepper ip address ipAquired = true; } unsigned long lastTime = 0; // will store the last time the code was run unsigned long currentTime = millis(); - if (currentTime - lastTime >= 100) { // 100 ms has passed + if (currentTime - lastTime >= 100) { // do everything inside every 100 ms memset(buffer, 0, BUFFER_SIZE); sprintf( buffer, "{\"deviceId\": %d, \"rotationX\": %f, \"rotationY\": %f, \"rotationZ\": %f, \"accelerationX\": %f, \"accelerationY\": %f, \"accelerationZ\": %f, \"type\": %s}", DEVICE_ID, - Rotation.i, - Rotation.j, - Rotation.k, - Rotation.w, + Rotation.roll, + Rotation.pitch, + Rotation.yaw, + accelData.x, accelData.y, accelData.z, "data"); @@ -45,6 +46,3 @@ struct acceleration { lastTime = currentTime; } } -//acceleration.X -//acceleration.Y -//acceleration.Z \ No newline at end of file diff --git a/code/arduino/Movement-sensor-code/SensorManager.h b/code/arduino/Movement-sensor-code/SensorManager.h index d1a0e4e..141ffd8 100644 --- a/code/arduino/Movement-sensor-code/SensorManager.h +++ b/code/arduino/Movement-sensor-code/SensorManager.h @@ -1,5 +1,5 @@ -#ifndef SensorManager_h -#define SensorManager_h +#ifndef MOVEMENTSENSORCODE_SENSORMANAGER_H +#define MOVEMENTSENSORCODE_SENSORMANAGER_H #include "Arduino.h" #include "SparkFun_BNO080_Arduino_Library.h" @@ -23,6 +23,8 @@ public: acceleration getAcelleration(); bool sensorTap(); +private: + struct RotationQuaternions { float i; float j; @@ -31,9 +33,7 @@ public: }; RotationQuaternions getQuaternions(); -private: - BNO080 myIMU; }; -#endif \ No newline at end of file +#endif // MOVEMENTSENSORCODE_SENSORMANAGER_H \ No newline at end of file diff --git a/code/arduino/Movement-sensor-code/headerFIle.h b/code/arduino/Movement-sensor-code/headerFIle.h index cc25dec..1c21dcb 100644 --- a/code/arduino/Movement-sensor-code/headerFIle.h +++ b/code/arduino/Movement-sensor-code/headerFIle.h @@ -8,11 +8,10 @@ Connectivity connectivity; WebSocketsClient webSocket; #define USE_SERIAL Serial -#define ssid "msi 5556" -#define pass "abc12345" +#define ssid "1235678i" +#define pass "12345678" #define BUFFER_SIZE 1024 -#define DEVICE_ID 1 -#define IP_ADDRESS "192.168.137.12" +#define DEVICE_ID 0 char *buffer = (char *)malloc(sizeof(char) * BUFFER_SIZE); const char* serverIp = NULL; // Declare serverIp here diff --git a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java index 6a58910..1350a78 100644 --- a/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java +++ b/code/src/Fitbot/app/src/main/java/com/example/fitbot/ui/activities/FitnessActivity.java @@ -2,7 +2,9 @@ package com.example.fitbot.ui.activities; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; +import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; +import android.animation.ValueAnimator; import android.app.Dialog; import android.content.Context; import android.content.res.ColorStateList; @@ -97,6 +99,12 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall ProgressBar loadingCircle = findViewById(R.id.loadingCircle); loadingCircle.setIndeterminateTintList(ColorStateList.valueOf(Color.RED)); + // Shimmer animation for loading elements + View shimmerFitnessTitle = findViewById(R.id.textViewFitnessTitle); + View shimmerFitnessText = findViewById(R.id.textViewFitnessShortDescription); + shimmerAnimation(shimmerFitnessTitle); + shimmerAnimation(shimmerFitnessText); + // Navigation Buttons NavigationManager.setupButtonNavigation(this, R.id.homeButtonFitness, MainActivity.class); NavigationManager.setupButtonNavigation(this, R.id.skipButtonFitness, MainActivity.class); //Needs to skip exercises once those are implemented @@ -298,4 +306,19 @@ public class FitnessActivity extends RobotActivity implements RobotLifecycleCall }); animator.start(); } + + public void shimmerAnimation(View view) { + ObjectAnimator animator = ObjectAnimator.ofObject( + view, + "backgroundColor", + new ArgbEvaluator(), + ContextCompat.getColor(view.getContext(), R.color.shimmerStartColor), + ContextCompat.getColor(view.getContext(), R.color.shimmerEndColor) + ); + animator.setDuration(1000); + animator.setRepeatCount(ValueAnimator.INFINITE); + animator.setRepeatMode(ValueAnimator.REVERSE); + animator.start(); + } + } \ No newline at end of file diff --git a/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml b/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml index 641d8d9..261cb35 100644 --- a/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml +++ b/code/src/Fitbot/app/src/main/res/layout/activity_fitness.xml @@ -97,7 +97,6 @@ android:textAlignment="center" /> - #000000 #000000 #00000000 + #EFEFEF + #DDDDDD diff --git a/code/src/Fitbot/app/src/main/res/values/strings.xml b/code/src/Fitbot/app/src/main/res/values/strings.xml index 3b473fe..1925160 100644 --- a/code/src/Fitbot/app/src/main/res/values/strings.xml +++ b/code/src/Fitbot/app/src/main/res/values/strings.xml @@ -25,7 +25,9 @@ Title - Exercise description Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. + Description + + Exercise description Exercise title \ No newline at end of file diff --git a/code/src/Fitbot/gradle.properties b/code/src/Fitbot/gradle.properties index c5abf2b..2ab3bb7 100644 --- a/code/src/Fitbot/gradle.properties +++ b/code/src/Fitbot/gradle.properties @@ -15,4 +15,3 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -#android.enableJetifier=true \ No newline at end of file diff --git a/docs/documentation/diagrams/UML-esp8266.md b/docs/documentation/diagrams/UML-esp8266.md new file mode 100644 index 0000000..bc7fad5 --- /dev/null +++ b/docs/documentation/diagrams/UML-esp8266.md @@ -0,0 +1,61 @@ +# UML esp8266 diagram + +```mermaid +classDiagram + +Connectivity --> Movement-sensor-code +SensorManager --> Movement-sensor-code +namespace ESP8266 { + + class Movement-sensor-code { + + struct RotationQuaternion + + PepperIP + setup() + loop() + connectWifi() + sensorSetup() + getPepperIP() + httpPost() + } + + class Connectivity { + + void connectWiFi(char* ssid, char* pass) + + void websocketSetup(char* ip, uint16_t port, char* adress) + + void sendData(float roll, float pitch, float yaw); + + int httpPost(const char *serverAddress, const char *serverSubPath, const unsigned short serverPort, const + char *data, const size_t dataLength, const char *contentType) + + const char* fetchIPAddress() + + -ESP8266WiFiMulti wifi; + -WiFiClient wifi_client; + } + + class SensorManager { + + struct eulerAngles( + float roll; + float pitch; + float yaw; + ); + + struct acceleration ( + float x; + float y; + float z; + ); + + eulerAngles getEulerAngles() + + acceleration getAcelleration() + + bool sensorTap() + + + - struct RotationQuaternions ( + float i; + float j; + float k; + float w; + ); + - RotationQuaternions getQuaternions() + + - BNO080 myIMU + } + + +} +``` \ No newline at end of file