carla/Docs/how_to_make_a_new_map.md

186 lines
9.0 KiB
Markdown
Raw Normal View History

2019-01-16 03:04:19 +08:00
<h1>How to make a new map with RoadRunner</h1>
2018-12-14 02:57:47 +08:00
![Town03](img/create_map_01.jpg)
<h2>RoadRunner</h2>
RoadRunner is a powerful software from Vector Zero to create 3D scenes. Using RoadRunner is easy, in a few steps you will be able to create an impressive scene. You can download
a trial of RoadRunner at:
2019-01-16 03:04:19 +08:00
![vectorzero](img/logo_vectorzero.jpg) [https://www.vectorzero.io/](https://www.vectorzero.io/)
<h2>Step 1 - Create your map in RoadRunner:</h2>
* Start by becoming familiar with the RoadRunner editor. Play with the controllers to define roads, sidewalks, etc. Please, keep in mind the following rules:
* Create your maps centered arround (0,0). This is required to maintain compatibility with CARLA maps.
* At the beginning of the map creation select Tools/TransformScene and aply a 180º rotation.
Currently OpenDrive appears rotated 180 degrees by default --We are working on fixing that.
![Roadrunner180](img/roadrunner180.jpg)
* Check that all conections and geometries seem correct.
![CheckGeometry](img/check_geometry.jpg)
* Visualize the OpenDrive road network by clicking on the "OpenDrivePrevewTool" button.
![checkopen](img/check_open.jpg)
!!! note
During the creation of the map, junctions (the union between two roads) might yield
some errors when building the OpenDrive file. Clicking on the
"OpenDrivePreviewTool" button lets you test the integrity of the current map. If
errors happen you shoud click on the "ManouverRoadsTool" button and then within the
details window, under junction, click on the "RebuildManouverRoads" button.
2018-12-14 02:57:47 +08:00
Even if nothing seems to happen the road should be fixed.
![maneuverroad](img/maneuver_road.jpg)
<h3>Exporting:</h3>
After verifying that everything is correct it is time to export the map to Unreal. You need export two files to create a map in Unreal.
* OpendDrive (.xodr) Information that cars need to circulate on the
2018-12-14 02:57:47 +08:00
map.
* Binaries (.fbx) All meshes you need to build the map, i.e., roads, lanemarking,
sidewalk, ect.
In order to export these files you need to follow these steps:
1. Select File - Export - OpenDrive (.xodr)
2018-12-14 02:57:47 +08:00
* Select File - Export - Filmbox (.fbx)
* Choose your export folder and Keep Merge Roads, Merge Marking and Merge
Terrain _Unchecked_.
* Under Options Check "ExportToTiles" to divide the map into chunks, this keeps
the render process a bit lighter. Be carefull though, subdividing the map too much
will also be inefficient. Some experimentation is needed here to get the
perfect point and it will depend on the map beeing created.
2018-12-14 02:57:47 +08:00
* Leave "Export individual Tiles" _Unchecked_, this will give you only one fbx
file with all the pieces, making easier to keep track of the map.
2018-12-14 02:57:47 +08:00
![Tutorial_RoadRunner](img/tutorial_roadrunner.jpg)
2018-12-14 02:57:47 +08:00
<h2>Step 2 - Unreal</h2>
<h2>Importing into Unreal:</h2>
* Start dragging your file from where it is saved to the "content browser" in
2018-12-14 02:57:47 +08:00
your unreal's project as you would do with any other asset.
* In the Import window make sure the following options are _unchecked_:
ForcefrontXAxis, Autogenerate collission, combine meshes.
* Make sure that ConvertSceneUnit is _checked_.
* You should Also _check_ "Import Materials" and "Import Textures" if you want
to use RoadRunner materials or use the method described at the end of the
next step to change them in batches.
2018-12-14 02:57:47 +08:00
![Tutorial_Roadrunner_UE4](img/tutorial_roadrunner_ue4.jpg)
<h2>Working with maps in Unreal:</h2>
First of all create a level with the Map name (this will be important later)
and save it inside Game/Carla/Maps/
Once everything is loaded up you should end with several staticMeshes in the folder
you have selected. Drag them all to the level and you will have
2019-01-16 03:04:19 +08:00
your map in Unreal! Congratulations!.
2018-12-14 02:57:47 +08:00
The time taken by the loading process will depend on how many pieces you cut the map into. Be patient! All the pieces share the same center pivot, so if they are positioned
2018-12-14 02:57:47 +08:00
in the same place they should fit as they did in the RoadRunner Editor. When
unreal finish loading the meshes must be centered at point (0, 0, 0).
2018-12-14 02:57:47 +08:00
![Transform_Map](img/transform.jpg)
<h3>Semantic Segmentation Ground Truth</h3>
Once you have loaded the correct map and materials, we will prepare the semantic
segmantation ground truth. In order for the semantic segmentation to work, you will need to save the different pieces of the map in their corresponding folder. This
2018-12-14 02:57:47 +08:00
is a bit difficult today as with the current version there is no name
identification for the different pieces but this is a just temporal issue from
Roadrunner side. Typically you will need only 3 Folders: ../Content/Static/
2018-12-14 02:57:47 +08:00
1- Road, 2-Terrain, 3- RoadLines.
<h3>How to put meshes in the right folder</h3>
Select the material of the items you want to change into a new folder. Importing the
assets creates a road material, a sidewalk material and so on.
1. Once selected rightclick and select "Asset Actions/Select actors Using this
asset". All actors using that material should be highlighted in the viewport.
2. Rightclick on them in the world and select "Browse to asset". All assets
using the first material you have chosen should be selected in the Content
2018-12-14 02:57:47 +08:00
browser.
2018-12-14 02:57:47 +08:00
3. Move them all to the corresponding folder and repeat for each category until
every road asset is clasified.
Roadrunner roads come with premade materials, but for CARLA weather to work
properly you will need to change the pavement materials to some of our own (Stored
under Carla/Static/GenericMaterials/WetPavement). To this end you can change the
materials one by one or you could remove the Roadrunner materials. This action will trigger the replace references window in which you can select and change the new material
2018-12-14 02:57:47 +08:00
for the meshes the last one was referencing.
<h2>Step 3 - Loading OpenDrive into CARLA</h2>
- In RoadRunner go into File/Export and choose OpenDrive(.xodr). In the Export
window choose the save folder and name the file with the same name as the map. Let everything else with the default values and press export.
2018-12-14 02:57:47 +08:00
- Copy the .xodr file inside the Content/Carla/Maps/OpenDrive folder.
- Open Your Unreal level and drag the OpenDriveActor inside the scene. This will
read the level name, search the Opendrive file with the same name and load
2018-12-14 02:57:47 +08:00
it.
- If everything goes right you should have your road information loaded into
2018-12-14 02:57:47 +08:00
your map. Congratulations!
2018-12-14 02:57:47 +08:00
!!! note
It is possible that the map that Opendrive generates is rotated. Maybe you did not rotate it in RoadRunner when you told you so? If this happens you only need to select all
map import from RoadRunner and rotate Z: by 180 degrees.
<h2>Setting up the traffic based on OpenDrive:</h2>
!!! Note
2019-01-16 03:04:19 +08:00
the current version of CARLA needs a CarlaMapGenerator spawned in order to use the server autopilot functionality. From the current version it is also to drive all vehicles using the new client nvaigation stack. However, if you still want to use the server autopilot you will need to create a CarlaMapGenerator for your city --never above or under it.
* You will need to place points for the vehicles to spawn. The actor that sets the
spawn position of the vehicles is called VehicleSpawnPoint. CARLA vehicles
2018-12-14 02:57:47 +08:00
must overlap with one of the RoutePlanner's trigger box for them to be
directed, otherwise they would drive straight until they find an obstacle. We
suggest placing the spawners 2 to 3 meters avobe each trigger box, not much
higher as if the spawn is too high it is not able to measure if there is any
vehicle under it before spawning and they would end up spawning on top of each
2018-12-14 02:57:47 +08:00
other. Spawning the vehicles a few meters behind the trigger boxes would also
work but that is a bit trickier.
* Spawners must always be oriented as the road dictates. This must be done by
hand but we will make some form of automation in the future.
2018-12-14 02:57:47 +08:00
2019-05-09 18:40:05 +08:00
* Traffic lights must be placed in every crossing in which vehicles might
conflict. These are the childs of "TrafficLightBase" and are stored inside
2018-12-14 02:57:47 +08:00
Game/Carla/Static/TrafficSigns/Streetlights_01.
2019-01-16 03:04:19 +08:00
Again, remember this is just needed to use the server autopilot. We recommend to start using new the client driving stack provided from 0.9.2 version.
<h2>Working with BP_TrafficLight and BP_TrafficLightGroups:</h2>
* One trafficlight must be placed at every entrance that needs regulation.
One TrafficLightGroup must be placed in every crossing that has street
2018-12-14 02:57:47 +08:00
lights. Adjust The triggerbox of each traffic light until it covers the roads
it affects.
2018-12-14 02:57:47 +08:00
* Once the actors of an Intersection are placed, open the corresponding group
and under TrafficLights store all TrafficLight actors involved.
2018-12-14 02:57:47 +08:00
* Trafficlight group works by Rotating whitch of the involved traffic light is
green each moment. You can configure the timing the Lights stays in green
(GreenTime), the time it stays yellow (YellowTime), and the time it takes
between one trafficlight goes red and the next one goes green (ChangeTime).
* These last steps are in an early stage and may require a some trial and
error from users. VehicleSpawner placement, Street light timing and
2018-12-14 02:57:47 +08:00
Traffic light StopperBoxes might need some tweaking and testing to fit
perfectly into the built city.