Running the VR simulation

Set up the Oculus Headset

1. Connect your headset to the computer using a USB-C wire and turn on the headset.
2. When prompted, Allow device to access data from the computer.
3. If Guardian is not found, create Guardian using the controller.
4. Turn on Oculus desktop program, go to device and make sure the headset is connected.
5. Enable Oculus Link, use this video as a reference.
6. Important: Oculus link must be enabled before turning on the Unreal Engine, or you will not be able to click the Run Simulation button.

Set up the Unreal Engine

1. Navigate to your CARLA project source foler, and then \Unreal\CarlaUE4, double click CarlaUE4.uproject to launch the project.
2. Inside Unreal Editor, navigate to Content\Carla\Maps and double click to select the map.
3. Inside the Unreal Editor, click >> on the top right corner to expand the toolbar, choose Active Play Mode > VR Preview.
4. Click Play to start simulation, you should be able to see the animation in your Oculus headset. Select VR Mode using spacebar
5. The first time you play the simulation, UE4 will show a white screen for a few minutes.

Set up G29 Wheel Server (Optional)

This step is optional. Only do it if you want the automatic wheel turning. You do NOT need to implement this step to read the wheel input as it is already included in the Python script. For further information on implementation, click here.

1. Open a new command window and navigate to directory G29/test.
2. Start the NodeJS express server by running node angle_phy.js.
3. You should be seeing a list of wheel information followed by wheel ready. If you encounter an error, your wheel might not be connected or your driver is not update to date.
4. Make sure the server is running before executing any related python scripts.

Set up the Flask Server (Optional)

This step is optional. However, not doing it will result in no animation inside the vehicle.

1. Open a new command window and navigate to directory G29/test.
2. Start the server by running python angle_sim.py.
3. You should be seeing a warning message followed by the server information.
4. Open page 127.0.0.1:5000/get_steer in a browser to verify that the server is running.

Run the Scenario Demo

1. Navigate to Carla_Build\PythonAPI\VR_Scripts
2. Run the selected python script using a terminal or an IDE. Some scripts will strictly require the wheel server and/or the Flask server to be running.
3. Important: Unreal Engine needs play the VR simulation before executing any Python script.
4. Important: Always terminate the Python script before exiting Unreal simulation.

Driver's View Calibration (Optional)

The view by default it aligned to the driver's seat. However, additional calibration might be needed to adjust the view. To do this, open a map and type init in the top right search box. Click on Level Initializer. Change the offsets X, Y, Z for an adjustment in the absolute position. Currently there is no way to change the orientation. Adjustments can only be made while the simulation is NOT running.

Running the MR simulation

Most steps for running the MR simulation is the same as VR. Instead of using Oculus Link, you should compile the Unity project under Unity\CARLAUnityMR folder as Apk, and install it on Quest 2.

Set up the Scenario Demo for MR

1. Click play on the Unreal scene
2. Open the compiled CARLAUnityMR App on Quest2
3. Open NDI to Spout.exe under SPOUTtoNDI\bin
4. Select MR Mode using spacebar
5. Navigate to Carla\PythonAPI\VR_Scripts and run the script
6. Always terminate the Python script before exiting Unreal simulation.

Note: this implementation runs MR at a low quality and is not recommended to use.