-
Notifications
You must be signed in to change notification settings - Fork 2
PhysioADAPT
Welcome to PhysioADAPT Module Wiki page.
In the root directory there are three folders: Assets, Library and ProjectSettings. Those are native Unity folders that can be found by default in any Unity 3D project.
The PhysioADAPT project is based on the PhysioVR architecture and is structured into seven main groups that can be found inside the Assets folder.
The seven groups are directories which contain all the related assets and scripts organized in subdirectories.
Data Flow Diagram of the PhysioADAPT Module:
# CONNECTORThis module is responsible for establishing the connection with PhysioSENSE and with PhysioWOz. The connection is done through User Datagram Protocol (UDP) and comprises two main scripts:
- UDPReceiver.cs
The UDPReceiver is used to receive information in the local IP through a configurable port (1111 as default). It has three main methods, the Init(), that is used to create the new thread for the method ReceiveData() which establishes the connection to receive the message. It also has the method LocalIPAdress() that returns a string to display on the interface with the information of the local IP address.
- UDPSender.cs
The UDPSender is used to send information to a configurable IP and Port (1112 as default) where PhysioWOz is installed. Both PhysioWOz and PhysioSENSE have also implemented a UDPSender so PhysioADAPT can receive incoming messages which must follow the same protocol.
The two main methods of the UDPSender are the Init() which is used to create a new UDPClient, and the SendStringMessage() which receives the message as parameter, encodes it to binary format and sends the data through the UDPClient.
In order to the system identify the different incoming variables, the message (string) it's required to be configured using the following protocol:
Sensor Data:
**S_**variableName,type,value
The S_ aims to distinguish from other incoming values, so for example: "S_LgWatch,HR,75" will indicate the system that the variable LgWatch is a sensor data. Sensor data is processed in the game according to its type, so if there is an environment that uses HR signal for adaptability, the system will know that the LgWatch is the one that needs to be used.
Environment variables:
There are two types of environment variables, the Updatable and the ReadOnly.
The updatable can be changed from PhysioWOz or from the Adapter module by the use of physiological adaptation. The updatable can be distinguished in two subcategories depending on their type: Boolean and Range when considering integer or float variables.
The readOnly variables are usually informative variables important to be displayed in the PhysioWOz and also to the modules Adapter and Data Exporter.
In order to identify the different environment variables, the message (string) should be configured using the following protocol:
**R_**VariableName,value (for readOnly variables)
**UB_**VariableName,value (for updatable variables of type boolean)
**UR_**VariableName,value,minimum,maximum (for updatable variables integer or float within a range of minimun and maximum values)
Good examples of readOnly variables are the ones that relate with the user performance or input, for example score, position, duration, etc: "R_Score,100".
While the updatable are the ones that can depend on the support. For example, if the system receives the following string message: "UB_RainTrigger,true", the system will identify the RainTrigger variable as an updatable variable that is actually set to the boolean value of true. The type contained in the updatable variables is very important for the PhysioWOz to recognize which interface elements should instantiate. In this last example, the PhysioWOz will instantiate a checkbox (since the type is boolean). If the Range type is used, PhysioWOz will instantiate a slider allowing to manually change the value of the variable within the provided minimum and maximum values.
The UDP prefab is a Unity empty game object with the two UDP scripts attached. This object will allow to be instantiated and be always present in the game to keep the UDP connection.
# MANAGERThe Manager module contains the main interface that displays the multiple options available and the DataManager.cs script wich is responsible to parse the incoming messages and instantiate/update the different vatiables. The main interface is controlled by the UINavigation.cs script that leads the user through the different screens to enable the interaction with PhysioADAPT. The textures used in the interface elements can be found in the UITextures folder.
The PhysioADAPT UI is comprised by 5 screens which can be edited according to the final application needs. These screens leads the user to establish the UDP connection, both for receive and send data. Once the connection is established it allows to visualise the streaming data and choose the desired environment.
# ADAPTERThis module is responsible for receiving and processing the sensors data, and changing environment parameters accordingly.
Sensors data can vary depending of the hardware being used to get physiological data from sensors, so this module uses Sensor classes that are instantiated at the moment of reception. More information about sensors data protocol can be found in the Connector topic.
This directory is the home for the different VR SDK's which enable environments to be experienced with a virtual reality headset such as Google Cardboard. At the moment of release this framework was implemented with the Google Cardboard SDK. Inside the Cardboard directory is also possible to find a DemoScene which can be very useful as a starting point or for testing purposes.
# ENVIRONMENTSIn this directory are stored the different environments developped by the community. The EmoCat is the first environment that can serve as an example for future contributions. All the assets and scripts related to the environment are stored inside the environment folder. A readme file is included inside the folder for instructions and guidelines of usage and development.
It's not known exactly how many environments PhysioVR can support in the same application. Since this is a mobile platform it is recommended that the build includes only one environment due to memory reasons. But the possibility to include and select from multiple environments is implemented and documented in the project. See the readme file included in the Environments folder for more information.
Each environment is responsible to return and receive the correspondant updatable and readOnly variables using the same default methods that can be found in the provided environment example.
# DATA EXPORTERThe Data Exporter is an optional module that can be found in both PhysioVR and PhysioWOz. The responsibility of this module is to receive all the available variables and their correspondant values and then store them in an external CSV file.
An external database stored in the cloud provided with a dashboard for data analysis will be a great add-on to this project in the future.
# PLUGINSThis is a Unity 3D special folder reserved for plugins. It is being used so far for the Google Cardboard SDK plugin.