-
Notifications
You must be signed in to change notification settings - Fork 29
run_generator command
The run_generator
command is the main entry point to the system. It allows to build a city model from a chosen source and generate a set of files to describe it. The only mandatory argument you need to provide to this command is the builder it should use to generate the city model. Below we tell the runner to use the SimpleCityBuilder
:
$ python terminus/run_generator.py --builder=SimpleCityBuilder
Building city using SimpleCityBuilder
Generating RNDF file
Generating monolane file
Unless otherwise stated, the output files describing the city will be placed in the generated_worlds/
directory, starting with the city
prefix. For this particular case you should see:
$ ll ./generated_worlds/
total 112
drwxrwxr-x 2 andres andres 4096 jun 20 11:26 ./
drwxrwxr-x 9 andres andres 4096 jun 16 15:15 ../
-rw-rw-r-- 1 andres andres 5976 jun 20 11:26 city_gazebo_7.world
-rw-rw-r-- 1 andres andres 1828 jun 20 11:26 city_gazebo_8.world
-rw-rw-r-- 1 andres andres 51561 jun 20 11:26 city_monolane.yaml
-rw-rw-r-- 1 andres andres 6572 jun 20 11:26 city.rndf
Even though the previous command generated four files to describe the road network of the city (one for the RNDF format, another for monolane and two SDF versions), we still need to post-process those files to get a visual representation of them. In order to avoid that repetitive process and provide extra debug information we added a --debug
flag that can be passed to the run_generator
command. By doing so you will get:
- Statistics of the city being generated.
- 2D plots of the road network layout, using both polyline geometry and lines+arcs geometry.
- If the RNDF visualizer in this repo has been compiled (see here), it will generate an SVG file depicting the road network, showing the waypoints and the exit-entry connections.
- If Drake has been compiled in your machine and you set up the
DRAKE_DISTRO
environment variable to point to its root path, the generator will run theyaml_to_obj
tool to create anobj
file representing the monolane road.
To test this out run:
$ python terminus/run_generator.py --builder=SimpleCityBuilder --debug
Building city using SimpleCityBuilder
====================================
Statistics for Simple City
====================================
Roads: 12
Intersections: 25
Lanes: 16
Buildings: 0
Blocks: 0
Polyline Geometry
Waypoints: 136
Intersections: 104
Average waypoints: 8.5
Average intersections: 6.5
Lines and Arcs Geometry
Waypoints: 143
Intersections: 111
Average waypoints: 8.9375
Average intersections: 6.9375
====================================
Generating street plots
Generating RNDF file
Generating SVG for RNDF
Generating Gazebo 7 SDF
Generating Gazebo 8 SDF
Generating monolane file
Generating OBJ for monolane
And check the contents of the output directory:
ll ./generated_worlds/
total 13040
drwxrwxr-x 2 andres andres 4096 jun 20 11:31 ./
drwxrwxr-x 9 andres andres 4096 jun 16 15:15 ../
-rw-rw-r-- 1 andres andres 5976 jun 20 11:31 city_gazebo_7.world
-rw-rw-r-- 1 andres andres 1828 jun 20 11:31 city_gazebo_8.world
-rw-rw-r-- 1 andres andres 445 jun 20 11:31 city_monolane.mtl
-rw-rw-r-- 1 andres andres 13008242 jun 20 11:31 city_monolane.obj
-rw-rw-r-- 1 andres andres 51561 jun 20 11:31 city_monolane.yaml
-rw-rw-r-- 1 andres andres 6572 jun 20 11:31 city.rndf
-rw-rw-r-- 1 andres andres 68005 jun 20 11:31 city_streets_lines_and_arcs.png
-rw-rw-r-- 1 andres andres 68064 jun 20 11:31 city_streets_polyline.png
-rw-rw-r-- 1 andres andres 43108 jun 20 11:31 city.svg
Note: In this particular case it is the same as the polyline version, since all the streets are straight segments