# Infrastructure UML

---

The design for our project can be represented by the diagram below.

A simple linguistic representation of the diagram is as follows:

We have a Raspberry Pi, which runs a NodeJS server to handle all incoming requests.
This server is connected to a MariaDB database, which stores all the exercise data.
This data can then be received from the application we built for the Pepper robot.
We also have two ESP8266 modules, which are connected to the Pepper robot's Web Server.
These modules record angular motion via gyroscopes, and send this data to the web server on the Pepper robot.
The web server is a requirement to receive incoming data from the sensors, due to the ESP's not having a
dedicated bluetooth chip to communicate with the Pepper robot.
The parsed data on the application can then be shown to the user with some feedback regarding their performance.

``` mermaid
classDiagram

Raspberry Pi --> NodeJS
Raspberry Pi --> Database
NodeJS <--> Android Application : Request exercise data from database. Send ip adress to cache
Database <--> NodeJS : Database queries
NodeJS --> ESP8266 : Get pepper ip


ESP8266 --> Android Application : Send rotation data via WiFi to\n Pepper Web Server
namespace Server {
    class Raspberry Pi {
        +MariaDB
        +Apache2
        +NodeJS
        Database 
        Webserver 
    }

    class Database {
        +ExerciseID
        +ExerciseName
        +ExerciseShortDesc
        +ExerciseDescription
        +ExerciseVideo
        +ExerciseImage
        +GyroVectors
        +MuscleGroup
    }

    class NodeJS {
        +MariaDB
        +Handle requests
        +Cache pepper IP
    }
}

namespace Pepper {
    class Android Application {
        +Java
        +Android SDK
        +QiSDK
        +WebServer
        +Acquire rotation data from sensors
    }

}

namespace Hardware {
    class ESP8266{
        +RotationX
        +RotationY
        +RotationZ
        Send rotation data to Web Server
    }
}
```

