Skip to content

Setup Unity Project

Info

It is advised to checkout the Quick Start Demo tutorial before reading this section.

This page is a tutorial for setting up a AWSIM Unity project.

Environment preparation

System setup

  1. Make sure your machine meets the required hardware specifications.
    • NOTE: PC requirements may vary depending on simulation contents which may change as the simulator develops
  2. Prepare a desktop PC with Ubuntu 22.04 installed.
  3. Install Nvidia drivers and Vulkan Graphics API.
  4. Install git.
  5. Set the ROS 2 middleware and the localhost only mode in ~/.profile (or, in ~/.bash_profile or ~/bash_login if either of those exists) file:

    export ROS_LOCALHOST_ONLY=1
    export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
    

    Warning

    A system restart is required for these changes to work.

  6. Set the system optimizations by adding this code to the very bottom of your ~/.bashrc file:

    if [ ! -e /tmp/cycloneDDS_configured ]; then
        sudo sysctl -w net.core.rmem_max=2147483647
        sudo ip link set lo multicast on
        touch /tmp/cycloneDDS_configured
    fi
    

    Info

    As a result, each time you run the terminal (bash prompt), your OS will be configured for the best ROS 2 performance. Make sure you open your terminal at least one before running any instance of AWSIM (or Editor running the AWSIM).

  1. Make sure your machine meets the required hardware specifications.
    • NOTE: PC requirements may vary depending on simulation contents which may change as the simulator develops
  2. Prepare a desktop PC with Windows 10 or 11 (64 bit) installed.
  3. Install git.
  4. Install Microsoft Visual C++ Redistributable packages for Visual Studio 2015, 2017, 2019, and 2022 (X64 Architecture)

ROS 2

AWSIM comes with a standalone flavor of Ros2ForUnity. This means that, to avoid internal conflicts between different ROS 2 versions, you shouldn't run the Editor or AWSIM binary with ROS 2 sourced.

Warning

Do not run the AWSIM, Unity Hub, or the Editor with ROS 2 sourced.

  • Make sure that the terminal which you are using to run Unity Hub, Editor, or AWSIM doesn't have ROS 2 sourced.
  • It is common to have ROS 2 sourced automatically with ~/.bashrc or ~/.profile. Make sure it is not obscuring your working environment:
    • Running Unity Hub from the Ubuntu GUI menu takes the environment configuration from ~/.profile.
    • Running Unity Hub from the terminal uses the current terminal configuration from ~/.profile and ~/.bashrc.
    • Running Unity Editor from the UnityHub inherits the environment setup from the Unity Hub.

Warning

Currently, there are cases where the Nvidia driver version is too high, resulting in Segmentation fault. In that case, please lower the Nvidia driver version (550 is recommended.)

The easiest way to be sure about your version is by using 'Software & Updates' in Ubuntu.

alt text

  • Make sure your Windows environment variables are ROS 2 free.

Unity installation

Info

AWSIM's Unity version is currently unity 6

Follow the steps below to install Unity on your machine:

  1. Install UnityHub to manage Unity projects. Please go to Unity download page and download latest UnityHub.AppImage.
  2. Install Unity 6 via UnityHub.

    • Open new terminal, navigate to directory where UnityHub.AppImage is download and execute the following command (or find the unityhub icon and run it):
      ./UnityHub.AppImage
      
    • Make sure you have the V2X repository cloned and ROS 2 is not sourced.
      git clone https://github.com/tlab-wide/V2X_E2E_Simulator.git
      
    • Now we add the project to unity hub
    • In this step, you have to select either 'V2X_E2E_Simulator' or 'AWSIM' (you will only see one of these options in your setup sequence).

    • Then, you will see this error (if you don't already have the exact version of Unity 6). alt text

    • To fix this issue, install the correct version by clicking on the warning sign and selecting the shown version. alt text
    • Only select the Linux Build Support. If you add other packages, you won't face any problems, but the installation will take longer. You can also install other packages later. alt text
    • After successful installation the version will be available under the Installs tab in Unity Hub (your Unity6 can be different in minor version section).

Warning

If you get the safe mode dialog when starting UnityEditor, you may need to install openssl.

  1. download libssl
    $ wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl1.0/libssl1.0.0_1.0.2n-1ubuntu5.13_amd64.deb
  2. install
    sudo dpkg -i libssl1.0.0_1.0.2n-1ubuntu5.13_amd64.deb

Import external packages

To properly run and use AWSIM project in Unity it is required to download map package which is not included in the repository.

  1. Download and import the latest Kashiwa unity package which is currently Kashiwa_7.8.unitypackage

    Download Map files (unitypackage)

  2. In Unity Editor, from the menu bar at the top, select Assets -> Import Package -> Custom Package... and navigate the Kashiwa_7.8.unitypackage file (or each version that you desire or download, in the image picture bleongs to Kashiwa_7.4.11.unitypackage).
    alt text

  3. Nishishinjuku package has been successfully imported under Assets/AWSIM/Externals/directory.

Info

The Externals directory is added to the .gitignore because the map has a large file size and should not be directly uploaded to the repository.

*NOTE: There is a high probability that the engine may crash once during the installation of this package due to the excessive RAM required, but there is no problem, and the installation will complete after a minute.

Run the demo in Editor

The following steps describe how to run the demo in Unity Editor:

  1. Open the AutowareSimulation.unity scene placed under Assets/AWSIM/Scenes/Main or Assets/V2x/scenes/ directory
  2. Run the simulation by clicking Play button placed at the top section of Editor.
alt text