Setting up AirSim with Unreal Engine 5.1.1
Mayan Iyer, Srijan K. Pal and Jiarong Hong
Mechanical Engineering & Saint Anthony Falls Laboratory, University of Minnesota
Windows 10
Desktop development with C++
Windows 10 SDK 10.0.19041
Latest .NET Framework SDK under ‘Individual Components’ (should be there on top)
[These can be downloaded later after installing Visual Studio 2022 using Visual Studio Installer and then going into ‘Modify’]
[Colosseum repo (for UE5.1.1) can be used in place of AirSim repo (Colosseum preferred)]
Change directory to D:
git clone https://github.com/CodexLabsLLC/Colosseum.git (preferred)
(or) git clone https://github.com/Microsoft/AirSim.git;
cd Colosseum; (or) cd AirSim;
build.cmd;
Unreal Engine 5.1.1
Go to the ‘Viewport’ tab. In the ‘Components’ window, select the ‘BodyMesh’.
In the ‘Details’ window change the static mesh to the one from the DroneModel.fbx that was imported.
Change material (color if required)
Windows Subsystem for Linux (WSL2)
sudo apt-get install ros-melodic-tf2-sensor-msgs ros-melodic-tf2-geometry-msgs ros-melodic-mavros*
pip3 install "git+https://github.com/catkin/catkin_tools.git#egg=catkin_tools"
git clone https://github.com/CodexLabsLLC/Colosseum;
cd Colosseum;
./setup.sh;
./build.sh;
gc;
source ~/.bashrc;
cd ros;
catkin build;
AirSim and WSL 2 Integration
The network access is enabled using this command in WSL.
nano ~/.bashrc;
export WSL_HOST_IP=$(ip route | awk '/^default via/ {print $3}')
source ~/.bashrc;
Windows firewall needs to be deactivated for WSL with this command in PowerShell
(Change – Profile to Domain or Private depending on the type of network) –
Set-NetFirewallProfile -Profile Public -DisabledInterfaceAliases "vEthernet (WSL)"
AirSim and WSL 2 Integration (contd.)
(Enter this command in every terminal opened or add this line to the ~/.bashrc)
source <PATH_TO_COLOSSEUM>/ros/devel/setup.bash;
(Replace <PATH_TO_COLOSSEUM> with the your path to Colosseum directory. The command should be similar to: source ~/Colosseum/ros/devel/setup.bash; )
AirSim and WSL 2 Integration (contd.)
(for single drone autonomous smoke tracking open the UMore Park)
(this node needs to be launched in a terminal every time connecting to UE; use instead of roscore) -
roslaunch airsim_ros_pkgs airsim_node.launch output:=screen host:=$WSL_HOST_IP
AirSim with PX4 SITL and MAVROS in WSL 2
Steps to integrate PX4 SITL and MAVROS with AirSim
git clone https://github.com/PX4/PX4-Autopilot;
cd PX4-Autopilot;
git checkout v1.12.1;
cd <PATH_TO_COLOSSEUM>/ros;
catkin init;
wstool init src;
sudo apt-get install python-catkin-tools python-rosinstall-generator -y;
rosinstall_generator --rosdistro melodic mavlink | tee /tmp/mavros.rosinstall;
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall;
AirSim with PX4 SITL and MAVROS in WSL 2 (contd.)
(Remaining Commands continued from the last slide -)
wstool merge -t src /tmp/mavros.rosinstall;
wstool update -t src -j4;
rosdep install –from-paths src –ignore-src -y;
sudo ./src/mavros/mavros/scripts/install_geographiclib_datasets.sh;
catkin build;
source devel/setup.bash;
Get the IPv4 of WSL2. You need to export this IP by adding a line in .bashrc file –
nano ~/.bashrc;
Then add this line at the end (replace <IP> with the IPv4 of WSL 2 you get from above step)
export PX4_SIM_HOST_ADDR=<IP>
Save, exit and source the .bashrc file- source ~/.bashrc;
Swarm Setup
Steps to launch swarm of drones in the Unreal Engine Simulation
You should see a message on the top left saying ‘Waiting for TCP connection…’
cd PX4-Autopilot;
./Tools/sitl_multiple_run.sh n;
(Where n is the number of drones in the swarm)
Example for 2 drones (n=2) run - ./Tools/sitl_multiple_run.sh 2;
Swarm Setup (contd.)
roslaunch mavros px4_swarm.launch ns:=drone1 fcu_url:=udp://:14030@127.0.0.1:14030 tgt_system:=1;
roslaunch mavros px4_swarm.launch ns:=drone2 fcu_url:=udp://:14031@127.0.0.1:14031 tgt_system:=2;
…
roslaunch mavros px4_swarm.launch ns:=drone1 fcu_url:=udp://:1403n-1@127.0.0.1:1403n-1 tgt_system:=n;
(Where n is the number of drones)