Skip to content

Unreal Simulation Setup

Devon Ash edited this page Feb 4, 2019 · 19 revisions

Prerequisites

Install Unreal and Simbotic

Unreal

git clone -b 4.21 git@github.com:EpicGames/UnrealEngine.git
cd UnrealEngine
./Setup.sh
./GenerateProjectFiles.sh
make

(Option 1) Using Simbotic instead of AirSim

git clone --recursive git@github.com:VertexStudio/Simbotic.git

Environment variables:

export SIMBOTIC_UE4=/path/to/UE4_21
export SIMBOTIC_ROOT=/path/to/Simbotic

Generate project files and build:

cd $SIMBOTIC_ROOT
./generate.sh
./build_airsim.sh
./build.sh

Run sim:

./run.sh

Important: After launching Simbotic by calling run.sh you have to press play inside the running Unreal editor.

(Option 2) Using AirSim directly (instructions found here from https://microsoft.github.io/AirSim/docs/build_linux/)

Important: If you are using the most recent gpc-unreal branch (as per the clone above), your "using_airlib.mpb" file will be pointing to $(AIRSIM_ROOT) rather than $(SIMBOTIC_ROOT). If you wish to use Simbotic (in development) please see the above instructions. (AirSim is default in gpc-unreal as of Monday, Feb 4th, 2019, but we are pending a change over to use Simbotic when it is more feature complete)

Clone AirSim and build it: bash

   # go to the folder where you clone GitHub projects
   git clone https://github.com/Microsoft/AirSim.git
   cd AirSim
   ./setup.sh
   ./build.sh

Set your $(AIRSIM_ROOT) to be wherever you installed AirSim.

Once AirSim is set up by following above steps, you can,

  1. Go to UnrealEngine folder and start Unreal by running UnrealEngine/Engine/Binaries/Linux/UE4Editor. When Unreal Engine prompts for opening or creating project, select Browse and choose 2. AirSim/Unreal/Environments/Blocks (or your custom Unreal project).
  2. If you get prompts to convert project, look for More Options or Convert-In-Place option. If you get prompted to build, chose Yes. If you get prompted to disable AirSim plugin, choose No.
  3. After Unreal Editor loads, press Play button. Tip: go to 'Edit->Editor Preferences', in the 'Search' box type 'CPU' and ensure that the 'Use Less CPU when in Background' is unchecked.

MADARA and GAMS

git clone -b gpc-unreal git@github.com:jredmondson/gams.git
export UNREAL_ROOT=/path/to/unreal
export SIMBOTIC_ROOT=/path/to/Simbotic
export SIMBOTIC_UE4=/path/to/unreal

Build

./scripts/linux/base_build.sh madara gams airlib clang

Important: Add the environment variables which are printed by the base_build script to your .bashrc or activation script.

Waypoint Demo

Launch Simbotic and press play inside the Unreal Editor.

$GAMS_ROOT/scripts/simulation/waypoints/waypoints.pl

Configuring Additional Demos

If you are using Option 1 (AirSim directly) you may wish to try other demos out. These are all experimental at the moment and are currently pending bug fixes and on-going development. However, you may:

  1. Modify your ~/Documents/AirSim/settings.json file to add more or remove agents. The file looks like this:
{
  "SettingsVersion": 1.2,
  "SimMode": "Multirotor",
  "Vehicles": 
  { 
  "agent.0": 
        {
          "VehicleType": "SimpleFlight",
          "X": 0,
          "Y": 0,
          "Z": -2,
          "Yaw": -180
        }
   }
}

Adding more statements of agents with the vehicle name following the pattern of agent.XX (agent.1,... agent.2 etc) will tell AirSim to load in more agents with that vehicle name. These vehicle names are important as that is what the AirLib compiled GAMS controller will use to associate what commands to the respective robot over AirLib's RPC API.

  1. Modify the MADARA files (*.mf) inside of $GAMS_ROOT/scripts/simulation/

After adding more agents to the above .json, we must now configure the simulation files to reflect that there are more agents. In this example, we will add more agents to the waypoints.pl scripts.

2.1 Adding more agents to waypoints.pl

Clone this wiki locally