Skip to content

Latest commit

 

History

History
 
 

opendrive_to_apollo

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

opendrive2apollo

To be used outside of apollo's docker container

Introduction

A tool for converting standard OpenDRIVE map to Apollo's HDMap XODR format, the generated HDMap XODR map then can be converted to pb map (Protocol Buffers) map as used by Apollo. This implemetation works for all our maps, but is not comprehensive, see the Ommitted Features section!

Background

Since Apollo does not support native OpenDrive-formatted maps, errors occur during the loading of a map file.
According to the GitHub issue 3864 (ApolloAuto#3864), there is no way of converting an existing OpenDrive map to an Apollo map. (18.6.18)

Install opendrive2apollo

We use pygraphviz for visualizing the road topology, which is why we need to install graphviz first

sudo apt-get install -y graphviz-dev

Install a virtual environment with all required dependencies. (execute the first time only!)

bash install.sh

We then go into the virtual environment (Execute every time after openning a new terminal!)

source dev_into.sh 

Conversion steps

Step 1: Use opendrive2apollo to create an Apollo HDMap

  • Inout: OpenDRIVE map
  • Output: Apollo HDMap
# input and output path need to be absolute (except the maps in test_maps)
bazel run //modules:converter -- -m /apollo/modules/test_maps/Osterwaldstrasse_v1.xodr -o ~/Desktop/osterwald.txt -d 0.1

Arguments of opendrive2apollo converter

  • -m: absolute path of input OpenDRIVE map
  • -o: absolute path of output Apollo HDMap
  • -d: distance value to discretize lines (<2 is recommended)
  • -p: plot the discretized HDmap with matplotlib
  • --debug: ignore all checkings to prevent known issues mentioned below

Step 2: Show the map contour (optional)

bazel run //modules:converter -- -m modules/test_maps/Osterwaldstrasse_v1.xodr -p

Step 3: Show lane connections (optional)

  • -m: absolute path of input Apollo HDMap (generated by opendrive2apollo)
  • -o: absolute path of connections in dot style pdf
# input needs to be absolute path
# show lane connections in matplotlib and output a dot file
bazel run //modules/visualization_tools:lane_connection_visualization -- -m ~/Desktop/osterwald.txt -o ~/Desktop/dot.pdf

where ~/Desktop/osterwald.txt is the file we created in the previous step

Usage within Apollo

Step 4: Convert the Apollo HDMap to the internal pb map format using Apollo' map generator

  • Input: Apollo HDMap
  • Output: pb map (that's what we want to generate)

Copy the map into the apollo docker container:

docker cp osterwald.txt apollo_dev_kessler:/apollo/osterwald.txt

Start Apollo as usual

source scripts/apollo_base.sh # execute every time after openning a new terminal
sudo bash docker/scripts/dev_start.sh
sudo bash docker/scripts/dev_into.sh

Input and output path in apollo/modules/map/tools/proto_map_generator parameters need to be modified first

bazel run modules/map/tools:proto_map_generator

Step 5: Visualize Map inside apollo

# install a gui backend for matplotlib if needed:
sudo apt-get install python3-tk

python3 modules/tools/mapshow/mapshow.py -m base_map.bin
# at Apollo root directory
source scripts/apollo_base.sh
python modules/tools/mapshow/mapshow.py -m base_map_guericke_straße.txt

Requirements on the map to be later used in Apollo

  1. In the header of OpenDRIVE map, east and west cannot be the same for projecting points
  2. Apollo checks longitude zone of east (max longitude) and west (min longitude), they must be in the same zone
  3. A correct geoReference is necessary to project points in Apollo proto map generator

Ommitted Features

  1. elevation (OpenDRIVE 5.3.5, z axis in HDMap)
  2. roadMark (OpenDRIVE 5.3.7.2.1.1.4, boderType in HDMap)
  3. we assume starting s coordinate of each laneSection intersect with the coordinate of one of the geometries
  4. Traffic lights

Related information

Known Issues

  • The converter is very slow. This is due to the number of projections done by pyproj
  • Internal Proj Error: proj_create: Error -38 (failed to load datum shift file): vgridshift: could not find required grid(s). -> The egm96_15.gtx cannot be located. pyproj in the venv is somehow lacking this file. Workaround: Provide the absolute path to the file.