This project is designed to help users, even those with no prior experience, get started with using this Unity-based project. Follow the steps below to set up your environment and run the project.
Before you begin, ensure you have the following installed on your system:
-
Unity Editor: Version
2022.3.17f1.
You can download it from the Unity Hub. Download specific version from(https://unity.com/releases/editor/whats-new/2022.3.17). -
Python: Version
3.9.21.
-
Install Unity:
- Open Unity Hub.
- Add the Unity version
2022.3.17f1if not already installed. - Set up the project in Unity by opening the [DistanceGrasp] folder.
-
Install Python:
- Ensure Python
3.9.21is installed.
- Ensure Python
-
Install Required Python Packages:
- Navigate to the [python] directory.
- Install dependencies using
pip:pip install -r requirements.txt
This project is organized into three main components:
-
DistanceGrasp:
This is the Unity project folder, which contains all the necessary files to run the VR environment. You can open this folder in the Unity Editor to start the simulation or application. -
model:
This folder contains Python scripts and dependencies required to run the inference models. Make sure to install the required Python packages as outlined in the setup instructions. -
data_process:
This folder is used for generating and processing statistical data after experiments. It includes scripts and tools for post-experiment data analysis.
-
Prepare Anaconda3 Environment for model:
- Install [Anaconda3] if not already installed.
- Create a new environment for the project:
conda env create -f environment.yml
- Activate the environment:
conda activate grab
-
Configure VR Environment:
- Open the [DistanceGrasp] project using Unity Hub.
- Use a USB cable to connect your Meta Quest 2 headset to your computer.
- Follow the steps outlined in this video from 1:00 to 5:16 to configure the VR environment in Unity.
Follow these steps to run the project:
-
Run the Python Model:
- Navigate to the
modelfolder. - Locate the
app.pyfile and run it.
- Navigate to the
-
Open the Unity Project:
- Open the DistanceGrasp project using Unity Hub.
- In the Unity Editor, navigate to the
Assetsfolder and open theScenesfolder. - Select the
Simple_Test_2scene. - Click the Play button at the top center of the Unity Editor to start the simulation.
-
Conduct the Experiment:
- Wear the Meta Quest 2 headset.
- Interact with the VR environment to perform the experiment.
-
Perform Data Analysis:
- Navigate to the
DistanceGraspfolder, then go to theLogDatafolder. - Locate the folder named with the experiment's start timestamp (e.g.,
20250407_170650.731). This folder contains the raw data for the experiment. - Copy the name of this folder.
- Run the data_process.py script by giving the name of the folder, for example:
python data_process_new.py 20250407_170650.731
- After the script finishes, go back to the
LogDatafolder and open the experiment's timestamp folder. - Inside the
20250407_170650.731folder, you will find a CSV file containing the analysis results for the experiment insideprocessed_datafolder.
To customize the experiment settings, follow these steps:
-
Open the Scene:
- Open the
Simple_Test_2scene in the Unity Editor.
- Open the
-
Access the DataManager Object:
- In the Unity Editor, navigate to the Hierarchy panel (located in the top-left corner).
- Select the
DataManagerobject.
-
Modify Configurable Options:
-
In the Inspector panel (on the right side of the Unity Editor), you will see several configurable options:
-
TrackData Component - Prefab Folder Name:
- This determines the types of objects that appear in the scene.
- Available options:
Prefab_goodcasePrefab_goodcase_2Prefab_badcasePrefab_badcase_2
- Changing this value will alter the types of objects that appear in the scene.
-
SimpleTestManager - Time Limit:
- This sets the time limit for grasping each object.
- If the time limit is exceeded, the scene will automatically switch to the next object.
- You can set this to any positive integer value.
-
SimpleTestManager - Session Types:
- This defines the session types for the experiment.
- You can use any combination of the following uppercase letters:
G: Gesture-only method.O: Native pointing method.P: Optimized pointing method.C: Combination method (Gesture + Optimized Pointing).
- Example:
GCOPorGP. - After clicking the Play button, the experiment will proceed in the order defined by the session types. The session types are executed sequentially based on the alphabetical order of the letters provided.
-
-
-
Save Changes:
- After making the desired changes, save the scene to apply the new configuration.
Before starting the experiment by clicking the Play button in Unity, make sure that the app.py file in the model folder has been restarted. This ensures that the Python backend is properly initialized and ready to handle the experiment data.