UNetyEmu: Unity-based simulator for aerial and non-aerial vehicles with network emulator integration
UNetyEmu is a novel simulation framework combining Unity and Mininet-WiFi, enabling realistic multi-vehicle experiments with both aerial and ground mobility alongside network emulation. Researchers can study smart city applications like 5G vehicular communication, edge computing, and UAV coordination. By integrating Unity’s 3D simulation and Mininet-WiFi’s real-time network emulation, UNetyEmu provides an environment for evaluating UAV navigation, network performance, and collaborative autonomy in urban settings.
This repository is structured as follows, according to the files generated by a Unity project:
- Assets : Files and resources used to create scenarios, objects, algorithms, etc.
- DepthCameraImages : Folder used to store the depth camera sensor captures.
- MissionsLogs : Folder used to save .csv files with different indicators during drone flight (position, altitude, orientation, speed, battery level, current status, etc.).
- Models : Folder where the 3D models used in the scenes are stored, together with their materials and textures.
- Resources : Folder that contains information about animations, prefabs models, user interface, and above all the configurable JSON files for the instantiation of the drones in the scenes.
- Scenes : The three scenes available in UNetyEmu.
- Scripts : Folder that stores all the C# Scripts used in the scenes, as well as the Python Scripts for plotting the results, and the Mininet-Wifi configuration files.
- Algorithms : Algorithms designed for drone flight such as path planning and obstacle avoidance.
- CameraSettings : Scripts that control the movement of the main camera within Unity scenes.
- Controllers : PID controller for flight dynamics.
- GeneralManagementScripts : Scripts for the simulation of a logistics center for package delivery using drones.
- GeneralSettings : Essential configuration script to obtain the information of the drones that will be instantiated in the scenes.
- GetFeatures : Components created to access the physical characteristics of the drone (unladen weight, estimated flight time, initial battery level, motor thrust, etc.)
- Network : Folder that contains the base station representation and communication scripts inside Unity.
- mininet : Python scripts to run from Mininet-Wifi and test the connection to the network emulator
- PlayersDynamics : Scripts designed to simulate the dynamics of a drone.
- Sensors : Scripts designed to simulate a 360-degree LiDAR sensor and depth camera.
- TextMesh Pro : Unity folder created by one of the packages.
- Tree_Textures : Unity folder created by one of the packages.
- ImagesDoc : Images used in the documentation of UNetyEmu
- Packages : Used Unity packages.
- ProjectSettings : Unity folder that contains the project configurations.
- .gitignore : Description of folders and files ignored when using GitHub
- Assembly-CSharp-Editor.csproj : Unity file that contains references and settings for scripts running in the project
- Assembly-CSharp.csproj : Unity file that handles scripts that are located in any folder called Editor inside of the project
- LICENSE : Apache License 2.0
- README : This current file that shows the requirements for evaluation mentioned in SBRC25.
The ribbons considered are: "Artefatos Disponíveis (SeloD)", "Artefatos Funcionais (SeloF)", and "Experimentos Reprodutíveis (SeloR)".
In order to take advantage of all the network features of Mininet-Wifi on Linux
, and also to take advantage of the compatibility and optimization of Unity on Windows
, UNetyEmu uses both operating systems. Therefore, we use Unity on Windows 11
, and Mininet-Wifi in a virtual machine with Lubuntu 20.04
.
In this first version of UNetyEmu, we present three different scenarios. The scenarios include a simple version to discover different features of UNetyEmu (such as different types of drones, different sensors, different algorithms), to a complex one covering a logistical packet delivery scenario using the Mininet-Wifi network emulator.
The First
and Second Scenarios
do not use network emulation, so you simply need to:
- Unity account (Free accounts for personal or student use)
- Unity Hub
- Unity 2022.3.22f1 (Tested version of the editor)
- Unity Hub
- Python (Tested on 3.13.1) or Python from the Microsoft Store
- Pip 21.2.3 (or higher) (Make sure the PATH environment variable knows it)
- [Pandas] (pip install pandas)
- [Seaborn] (pip install seaborn)
- [Matplotlib] (pip install matplotlib)
- [Numpy] (pip install numpy)
- Pip 21.2.3 (or higher) (Make sure the PATH environment variable knows it)
For the Third Scenario
we show the integration with Mininet-Wifi, so you also need the following:
- VirtualBox 7.1.4 (Only tested on Windows)
- Mininet-WiFi (Pre-configured Virtual Machine image)
- .NET SDK 9.0 (Required for integration with VSCode and Unity libraries)
- Scapy
- Npcap 1.8 (or higher)
- WinPcap
To help understand the algorithms and codes created in UNetyEmu, we recommend using:
- VSCode with the following extensions:
- Unity
- C# Dev Kit
- C#
- .NET Install Tool
- Python
- Pylance
- Rainbow CSV
The execution of this artifact is risk-free for evaluators. UNetyEmu uses as its core operation, documented frameworks and openly available online such as Unity and Mininet-Wifi.
To install UNetyEmu and run the first two scenarios, follow the next subsections:
- Getting started with Unity
- UNetyEmu Basic Setup using Unity
To run the third scenario, follow, in addition to the subsections mentioned above, those related to Mininet-Wifi. In other words, follow the next subsections:
- Getting started with Unity
- UNetyEmu Basic Setup using Unity
- Getting started with Mininet-Wifi
- UNetyEmu Basic Setup using Mininet-Wifi.
-
Before anything, make sure you create or have access to a Unity account. Unity has free plans for student (post-secondary and high school) or personal use;
-
Download, install and open Unity Hub. You will need to
Sign in
with your user account;
- If this is your first time in
Unity Hub
, you will probably see a recommendation to install the latest version of Unity that we don't need it, therefore, simply selectSkip installation
;
- Go to
Preferences
and make sure you have activated your license to be able to install the correct version of theUnity Editor
and correctly load the UNetyEmu project;
- Now, go to
Installs -> Install Editor -> Archive
and click on the linkdownload archive
, this will open a website with all versions of the Unity Editor available for download;
- Search for version
2022.3.22f1
and select theInstall
button on the website, this will redirect toUnity Hub
;
Continue
with the installation of theUnity Editor
and wait for it to finish. Now, you are ready to load the UNetyEmu project inUnity Hub
using theUnity Editor
just installed. If you had any problems with the installation of theUnity Editor
, follow the Unity installation manual.
-
Downloaded the file
UNetyEmu.zip
related to our proposal or cloned the repository https://github.com/intrig-unicamp/UNetyEmu; -
Open
Unity Hub
, go toProjects -> Add -> Add project from disk
;
- Find the
UNetyEmu
folder, and select Open;
NOTE:
Unity
needs the whole folder namedUNetyEmu
to open the project correctly
- Once the project has been loaded, select it once to open;
- Wait for Unity to open the project;
- If this is the first time you open a
Unity
project, you will notice thatUnity Editor
contains important toolbars and windows. On the left side is theHierarchy
, in the center are theScene
andGame
windows, while on the right side is theInspector
. Also, at the bottom left are theProject
folders and to the right is theConsole
, where messages will be displayed during the simulation of the scenarios;
If you find any messages about rebuilding libraries or
.meta
files, don't worry, you can simply disregard them and click on theClear
button in theConsole
;
- In the
Projects
window, find theAssets / Scenes
folder. Here you will find the three scenarios available in UNetyEmu.
This setup process consists of performing different configuration steps so that network emulation really happens when communicating Unity
in Windows
with Mininet-Wifi
in Linux
using a VM
. Therefore, we will detail what to do in each operating system [Windows] and [Linux VM].
The Mininet-WiFi VM image is around 7.4GB and is currently named as mn-wifi-vm.ova
. To import it, do the following:
-
Install and open the Oracle VirtualBox Manager;
-
Go to
File -> Import Appliance
;
- Find and open the
mn-wifi-vm.ova
file. SelectFinish
and wait for the appliance to be imported;
After we import mn-wifi-vm.ova
:
-
Go to
Settings -> Network
in VirtualBox; -
Set
Adapter 1
to Bridged Mode and Promiscous Mode: Allow All;
- Then, add
Adapter 2
as Host-Only Mode and Promiscuous Mode: Allow All;
Some users reported there might be a bug in VirtualBox regarding the number of virtual adapters being limited to 1. To fix this, follow this link. In addition, if the VM is not running and is saved, you will need to start the
mn-wifi
VM. Then, right click on the VM and selectStop -> Power Off
. You cannot add a network adapter in the saved state.
- Check which network adapter is the Host-Only Network. For instance, in the image below it is
192.168.56.1/24
;
- Given the Host-Only Network's IP, find and run
PowerShell
as administrator and add a persistent rule to forward traffic directly through Adapter 1 in the VM;
route -p add 10.0.0.0 mask 255.0.0.0 192.168.56.101 metric 1
- Do the same to allow traffic through Docker built-in interface at the VM;
route -p add 172.17.0.0 mask 255.0.0.0 192.168.56.101 metric 1
- Make sure your
route print
looks like this for IPv4 rules;
NOTE:
192.168.56.101
is the IP of the Host-Only Adapter. Make sure you replace the rules with the correct IP if it differs from the guidelines.
- Start the
Mininet-Wifi VM
. Open a terminal, and run;
ifconfig
- Identify which interface is Bridged and Host-Only;
We already identified the Host-Only Network (Step 7) as
192.168.56.1/24
. Consequently,enp0s8
is the Host-Only virtual interface (Adapter 2
) where most of the traffic will go through after we install the routing rules on the Host-side - i.e., where Unity is running -, whileenp0s3
is the Bridge Adapter (Adapter 1
)
- Since
Adapter 1
is the Bridge andAdapter 2
is the Host-Only. We need to open the C# ScriptUNetyEmu/Assets/Scripts/Network/BaseStationMininetWifi.cs
and simply make sure that theadapterIndex
variable is set to1
(Adapter 2), because the iteractive messages toMininet-Wifi
follow a specific route through this adapter. Also, make sure that thevmName
variable matches with the virtual machine name;
- Besides the routing configuration at the host (Unity-side), we have to EITHER
a.
disable the firewall orb.
create inbound/outbound rules;
- Search for:
Windows Defender Firewall with Advanced Security
, and click onWindows Defender Firewall Properties
- Change the
Firewall state
toOff
, then selectApply
and thenOk
;
NOTE: When you have finished using UNetyEmu, do not forget to re-enable the Firewall.
- Search for:
Windows Defender Firewall with Advanced Security
. We are going to create rules for both inbound and outbound, for both TCP and UDP, allowing traffic on all ports;
- Select
Inbound Rules
, and thenNew rule
- Rule Type as
Port
;
- For simplicity, make all ports available;
NOTE: Remember that this process is for both
TCP
andUDP
and in both casesinbound
andoutbound
rules are created.
- Mark to
Allow the connection
;
- Uncheck Public and keep Domain and Private checked (for security reasons);
- Name the rule as
Allow All TCP From VM
. Repeat the procedure for Outbound rules, and name it asAllow All TCP to VM
;
NOTE: Consider all the steps were made sucessfully in order for the simulation to work!
Once all the initial configurations are finished to correctly use the Mininet-Wifi
network emulator, we are going to copy the necessary UNetyEmu files inside the virtual machine.
-
Copy all scripts from
UNetyEmu\Assets\Scripts\Network\mininet
to a folder in the the VM; -
Make sure the script
remove_running_containers.sh
, which is among the copied files, has permission to execute:
sudo chmod +x remove_running_containers.sh
Sometimes the substring '\r' ends up being copied along with the script, preventing it from being correctly recognized. To avoid this, you can apply a filter with
sed
- e.g.,sed -i 's/\r$//' remove_running_containers.sh
- Run the following command to remove any open containers:
sudo ./remove_running_containers.sh
Now, you are ready to run the Third Scenario Demo
.
For a minimum test of UNetyEmu operation, we will run the First Scenario Demo
and we will check the PID controller designed for the drone flight dynamics.
In the Projects
window, find the Assets / Scenes
and open the First Scenario
scene by double clicking.
As you can see, this scenario shows a small environment with buildings, trees, and static objects. A blue DronePad marks the drone's starting position and orientation, while the red DronePads indicate landing targets.
Run the simulation by clicking the Start button
above the Game
window.
Once the simulation has started, the Main Camera
will zoom in on a drone that has been instantiated on the blue DronePad. Click anywhere inside the Game
window. Then, you can use the arrows
on your keyboard to move the drone's target position (white sphere) up, down, left rotation and right rotation. In addition, you can use the U, J, H and K
keyboard keys to move the target position forward, backward, left and right, respectively.
If the drone is moving and following the white sphere (target), congratulations you have successfully installed UNetyEmu with its preliminary features.
The following section will complement this demonstration with the use of the sensors available on the drone. In addition, we will show you how to remove some
Gizmos
that can disturb the view of the simulation (such as the image of the white camera that moves together with the drone).
Can you find the 5 red DronePads that are in the scene? Try to land on them. Remember that the keys on the keyboard change only the position and orientation of the
target
(white sphere), i.e. we do not change the position of the drone directly with the keyboard. The drone uses aPID controller
to follow the target.
UNetyEmu offers a versatile platform for assessing drone behavior, physics interactions, and network performance. This work explores three distinct scenarios that highlight different aspects of drone operations. The first scenario focuses on basic maneuvering and sensor functionality; The second extends to multi-drone coordination for tasks such as package delivery and obstacle avoidance; and third integrates network emulation, allowing for the validation of drone communication and performance under realistic network conditions. Collectively, these scenarios illustrate the potential of UNetyEmu for research in drone navigation, smart city logistics, and 5G-enabled aerial networks.
In the Scene
window you can see the position and orientation of each object in the scene. In addition, the Game
window shows the view of the Main Camera belonging to the scenario.
If you cannot see any objects in the
Scene
window, you can double-click on any object in theHierarchy
window.
This scenario showcases a 360-degree LiDAR sensor, and a depth camera sensor. In addition, we demonstrate the operation of a PID controller that allows the Drone to follow a white sphere representing its target position and orientation.
The goal of this Demo is to understand sensor functionality, PID control, and drone maneuvering by landing on red DronePads while avoiding obstacles.
In the Projects
window, find the Assets / Scenes
and open the Second Scenario
scene by double clicking.
The second scenario features four blue DronePads, each hosting a drone equipped with unique sensors, algorithms, and route planning strategies. This scenario showcases UNetyEmu’s capability to simulate multiple drones with distinct behaviors simultaneously.
A logistics center assigns missions to the drones through simulated message exchanges, enabling dynamic coordination and task management. Two drones handle package deliveries, receiving pickup and drop-off locations, a predefined route, and speed/altitude constraints. They follow their assigned paths autonomously without using sensor feedback. The logistics center randomly selects pickup and delivery points.
The third drone, equipped with a depth camera, follows a predefined path while capturing images every 30 seconds. Using a 360-degree LiDAR sensor, the fourth drone follows a trajectory while performing real-time obstacle avoidance by shifting right when detecting objects.
In the Projects
window, find the Assets / Scenes
and open the Third Scenario
scene by double clicking.
- Run;
sudo python mininet_topo.py
- The script will create the topology and wait for Unity messages;
NOTE: After executing the following step on the first execution attempt, an error may occur because the image
ramonfontes/socket_position:python35
is not found and, consequently, downloaded automatically. If you want to avoid this, please download the docker images manually from DockerHub withdocker pull ramonfontes/socket_position:python35
. Otherwise, repeat step 1 above after the automatic download procedure.
- Press Play in Unity:
- Observe virtual drones appearing in the VM, with its positioning being dinamically modified as they move at Unity-side
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/