Skip to content

Convert Sumo .net.xml road network files into road geometry inside Unreal

License

Notifications You must be signed in to change notification settings

dymons/Sumo2Unreal

 
 

Repository files navigation

Sumo2Unreal

Introduction

This project is an importer for SUMO's .net.xml road network files into the Unreal Engine 4 environment. This is important to bridge the capabilities of SUMO as a road network generator/convertor and traffic simulator to the Unreal Engine which is the preferred choice to create simulation software for testing self-driving cars.

The input taken by this importer is a SUMO's .net.xml road network file format and the output is a network of roads on the Unreal Editor. The .net.xml file is created using NETGENERATE. The files created using NETGENERATE can be viewed using NETEDIT. We have provided some files which we generated in the S2U_Screenshots folder.


Description

Sumo2Unreal has the capability to procedurally generate 2D road meshes (with road and sidewalk materials and textures) in Unreal Engine 4 based on road data received from an XML file. In this project, the xml file is generated using Netgenerate from the SUMO traffic simulator's suite of applications. Sumo2Unreal also has the capability to place splines along these roads. Stop signs are placed on road intersections created by the IntGen application. Stop signs also contain the required materials and textures.

Results from Netgenerate's default road networks.

The results shown below are from the typical road network xml files generated by Netgenerate. These include grid networks, spider networks and random networks. These road network files are then imported into Unreal Engine 4.22 using Sumo2Unreal. The white lines visible in the screenshots below are splines drawn within edges since the ultimate purpose of these roads is simulation testing of autonomous vehicles. These splines help in communicating road information to the AI agents (which may be vehicles, pedestrians or cyclists) in the simulation. Road information can include approaching turns or stop signs.

1. Small spider network -

NETGENERATE Command -

netgenerate --spider --spider.arm-number=4 --spider.circle-number=3 --spider.space-radius=100 --output-file=MySUMOFile.net.xml

(The output by default goes into the 'net.net.xml' file, but you can add a -o parameter to specify file name)

Output as seen on NETEDIT Application - spider01_netedit

Output on the Unreal Editor after running our importer - spider01_unreal

2. Large Spider Network

NETGENERATE Command

netgenerate --spider

Output - spider02_unreal

3. Basic Grid Network

NETGENERATE Command

netgenerate --grid

Output - grid01_unreal

4. A Random Network

NETGENERATE Command

netgenerate --rand

Output - rand_unreal

5. Townsimpy

XML files generated using town-sim-py which were then imported into UE4 using this importer.

Outputs - townsimpy01


Results from IntGen - a road intersection generator.

XML files generated using specifications from IntGen. The output of IntGen is a json file which contains a description for one road intersection. The traffic control for this road intersection defaults to stop signs. Other details for this road intersection include number of turn lanes, number of incoming roads, number of lanes for each incoming road.

1. Three way intersection.

Below is an example of a three way intersection generated on IntGen and Netgenerate. This was then imported into UE4 using Sumo2Unreal. This road intersection includes one turn lane and one of the incoming roads is four laned. intgen1

2. Four way intersection.

Below is an example of a four way intersection generated on IntGen and Netgenerate. This road intersection also contains one turn lane and one of the incoming roads is four laned. The menu on the right side presents the details of the road that is available via the spline. These details include the ID of the connected splines, the length of a spline (shown in the 'distance' field), the speed limit of a spline and a boolean representing whether a stop sign is 'attached' to this spline or not. This information is sufficient for a car behavior tree to drive itself on these and make a turn at the given intersection. intgen2

Getting Started

  1. Please have a look at the wiki pages for requirements, instructions on how to run the code and resources to learn if you want to contribute.

  2. Track our progress here.


Guideline for running cars on these roads.

  1. For running cars, one would need a 3D model of a vehicle. This 3D model can be included in the project as a uasset file.

  2. The behavior of cars can be defined using behavior trees. Examples of task nodes include stopping for stop signs or other vehicles and changing splines. The AI perception system can be used to sense various objects in the scene.

  3. Communication of road data to the vehicle is done using splines. Once a spline is connected to a car, that spline can be used to switch to other splines and also to get information such as whether a stop sign is present at the end of spline or not.

References

For selecting the correct order of vertices for creating triangles, we are using the earcut polygon triangulation library.


Future release plans.

Upcoming features for the next release are listed below.

  1. Lane markings : These include arrows for turn lanes, stop line markings and broken lane markings. These will be added to the meshes in the form of decals.

  2. Pedestrian crossing meshes : Here meshes are necessary to enable pedestrian navigation.

About

Convert Sumo .net.xml road network files into road geometry inside Unreal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 60.3%
  • CMake 38.2%
  • C# 1.4%
  • C 0.1%