Main Content

Exporting to Apollo

Apollo Overview

RoadRunner can export road scenes to Baidu Apollo® formats. You can export to Apollo 3.0 and 5.0 XML formats and Apollo 5.0 binary format.

Before you export to any Apollo format, ensure that your scene’s world origin is set in the World Settings Tool. Once you are ready to export, navigate to File > Export > Apollo (.bin, .xml) to open the export options window. Make sure you choose the appropriate Apollo version before completing your export, and ensure that you specify the file extension (.xml or .bin) you intend to export to. Exports to the binary format will include a human readable .txt representation of the protobuf data serialized in the .bin counterpart.

About the Different Apollo Maps

Apollo’s Dreamview front-end tool can visualize and simulate routing on RoadRunner Apollo exports. A complete map is composed of the following files for proper simulation:

  • base_map.bin — A protobuf representation of HDMap information. The representation might be accompanied with a human-readable .txt version.

  • sim_map.bin — A downscaled version of base_map.bin used for faster visualization at runtime. The file might be accompanied with a .txt version.

  • routing_map.bin — Topological map information used for generating routes.

  • default_end_way_point.txt — A start point for routing.

Given either a binary or XML export from RoadRunner, these files can be generated using various tools provided by the Apollo codebase.

Generating Necessary Map Files

Note

If you have not yet set up your Apollo Docker environment, follow this guide to do so.

Binary maps can be generated from XML by using the following command in the Apollo Docker environment:

bazel-bin/modules/maps/tools/proto_map_generator --map_dir=INPUT_DIR
--output_dir=OUTPUT_DIR
INPUT_DIR is the name of the directory containing the XML file, and OUTPUT_DIR is the desired output directory. Within the input directory, ensure the XML file is named base_map.xml before running it. This will generate a binary file named base_map.bin and a text file version named base_map.txt in the output directory specified.

With this .bin file or a .bin file exported directly from RoadRunner, a sim_map can be generated with the following command:

bazel-bin/modules/maps/tools/sim_map_generator --map_dir=INPUT_DIR
--output_dir=OUTPUT_DIR
Again, ensure that the .bin file is named base_map.bin before running it.

A routing map can be generated with the following command:

scripts/generate_routing_topo_graph.sh --map_dir=INPUT_DIR
More information about the different Apollo map types can be found here.

Visualizing Maps in Apollo Dreamview

Once you have all of the components for an Apollo map, you can visualize and simulate it in the Dreamview front-end.

Create a folder for your map in apollo/modules/maps/data, and add all the map files to that folder. Rename the folder to what you would like to appear in the Dreamview map selection drop-down. Restart Dreamview to refresh the maps in your data folder.

Once Dreamview starts, select your newly added map and a test vehicle in the top-right corner. Ensure that the standard mode is selected.

Go to the Tasks tab on the left, and enable Sim Control to render the map.

Routing Simulations in Apollo Dreamview

To run a road simulation in Dreamview, ensure that Routing is enabled in the Modules window. In the routing window, define a route on the map by using at least two waypoints. Click Send Route Request to run the simulation.

Visualizing Maps in LGSVL

LGSVL has the ability to import Apollo 5.0 binary files for editing and visualization.

Note

If you have not yet set up LGSVL with Unity®, follow this guide to do so.

To import an Apollo map into LGSVL, open the HD Map Import window under Simulator > Import HD Map. Under Import Format, select Apollo 5 HD Map, and optionally modify the Distance and Delta Threshold values. Click "..." to open the file browser and select the binary file export. Click import to add the map to the scene.

More information about importing maps into LGSVL can be found here.

Apollo User Asset Configuration

The Apollo exporter uses a configuration XML file to map RoadRunner props, signals, signs, and markings to the appropriate <object> or <signal> "id" and "subtype". This process works the same way as the OpenDRIVE® asset configuration.

Exporting a Custom Prop or Signal

  1. Copy the ApolloAssetData.xml file located in the RoadRunner install location under AssetsInstall/ResourceAssets to the Project folder in your project (next to the Project.rrproj file).

  2. Open the new ApolloAssetData.xml file in a text editor.

  3. Add entries for new objects, markings, or signals.

  4. Save your file and export an Apollo file.

You do not need to restart RoadRunner after creating or modifying the ApolloAssetData.xml file.

The format of an ApolloAssetData.xml file is the same as the format of an OpenDRIVEAssetData.xml file. For a detailed definition of this format, see Exporting to OpenDRIVE. The template file in the AssetsInstall/ResourceAssets folder also contains examples for a traffic light, stop sign, and yield sign.

Exporting a Traffic Signal with Multiple Variances

Here is the definition of the format to properly set a traffic signal’s asset data for different variances and subsignals.

<Signals>
	<Signal>
		<Type>trafficLight</Type>
		<SubType>mix3Vertical</SubType>
		<SubSignals>
			<Variant>1</Variant>
			<SubSignal>
				<LightName>light_red</LightName>
				<Type>circle</Type>
			</SubSignal>
			<SubSignal>
				<LightName>light_yellow</LightName>
				<Type>circle</Type>
			</SubSignal>
			<SubSignal>
				<LightName>light_green</LightName>
				<Type>circle</Type>
			</SubSignal>	
		</SubSignals>
		<SubSignals>
			<Variant>2</Variant>
			<SubSignal>
				<LightName>light_red</LightName>
				<Type>arrowLeft</Type>
			</SubSignal>
			<SubSignal>
				<LightName>light_yellow</LightName>
				<Type>arrowLeft</Type>
			</SubSignal>
			<SubSignal>
				<LightName>light_green</LightName>
				<Type>arrowLeft</Type>
			</SubSignal>
		</SubSignals>
		<SubSignals>
			<Variant>3</Variant>
			<SubSignal>
				<LightName>light_red</LightName>
				<Type>arrowRight</Type>
			</SubSignal>
			<SubSignal>
				<LightName>light_yellow</LightName>
				<Type>arrowRight</Type>
			</SubSignal>
			<SubSignal>
				<LightName>light_green</LightName>
				<Type>arrowRight</Type>
			</SubSignal>
		</SubSignals>
		<FilePath>Props/Signals/Signal_3Light_Post01.fbx</FilePath>
	</Signal>
</Signals>

Unsupported Features

The following data records are currently unsupported for export.

  • Route View Record (<routeView> … </routeView> and its children)

  • Lane Overlap Group (<laneOverlapGroup> … </laneOverlapGroup> and its children)