Road Network Parameters

Introduction

When a maliput backend is implemented, it is expected to be used with a specific set of parameters that somehow modifies the loader behavior. Some of these parameters may be optional, but some others are mandatory, therefore it is important to document the parameters that a maliput backend expects.

maliput provides a plugin interface to discover and load the maliput backends. When a maliput backend is loaded, it is expected to provide a set of parameters that are meant to be passed to the backend loader.

Note

For more information about the plugin interface see Getting Started:Maliput Python Interface and Maliput Plugin Architecture .

Parameters for each maliput backend

maliput doesn’t impose any restriction on the parameters that a maliput backend may request, however it is expected that the parameters are passed as a string dictionary of key-value pairs to the backend loader. For documentation purposes, it is desirable that the keys are documented somewhere so that the users of the backend can know what parameters can be used and how.

The maliput backends here provided, have their parameters documented via doxygen comments in the header files, in general located at the <maliput_backend>/builder/params.h file, where a doxygen module is created for the road geometry builder keys. It is recommended to follow this pattern when documenting the parameters of a maliput backend.

Maliput Backend’s builder keys

Maliput Backend

Parameters

maliput_dragway

parameters

maliput_multilane

parameters

maliput_malidrive

parameters

maliput_osm

parameters

Using maliput plugin architecture to load a Road Network

After a maliput backend is installed, it can be loaded using the plugin interface. The plugin interface provides a way to discover the maliput backends that are available in the system and to load them.

Using the keys for the maliput backends shown above, the following code snippet shows how to load a maliput backend.

 1#include <map>
 2#include <memory>
 3#include <string>
 4
 5#include <maliput/api/road_network.h>
 6#include <maliput/plugin/create_road_network.h>
 7
 8// Using maliput_malidrive as example.
 9const std::string road_network_loader_plugin_id{"maliput_malidrive"};
10const std::map<std::string, std::string> loader_parameters {
11  {"opendrive_file", "<path_to_opendrive_file>"},
12  {"linear_tolerance", "5e-2"},
13  {"angular_tolerance", "1e-3"},
14};
15
16// Create maliput::api::RoadNetwork instance.
17std::unique_ptr<maliput::api::RoadNetwork> road_network = maliput::plugin::CreateRoadNetwork(road_network_loader_plugin_id, loader_parameters);

Note

maliput_py provides bindings to python to achieve similar behavior. See Getting Started:Maliput Python Interface .

Obtain list of parameters for a maliput backend

There are two ways to obtain the list of parameters for a maliput backend:

  1. Programmatically using the plugin interface.

 1#include <map>
 2#include <memory>
 3#include <string>
 4
 5#include <maliput/plugin/create_road_network.h>
 6#include <maliput/plugin/road_network_loader.h>
 7
 8const std::string road_network_loader_plugin_id{"maliput_malidrive"};
 9// Create maliput::plugin::RoadNetworkLoader instance.
10std::unique_ptr<maliput::plugin::RoadNetworkLoader> road_network_loader = maliput::plugin::MakeRoadNetworkLoader(road_network_loader_plugin_id);
11const std::map<std::string, std::string> default_parameters = road_network_loader->GetDefaultParameters();
  1. maliput_query application(provided by maliput_integration package) can be used to obtain the list of parameters for a maliput backend.

maliput_query -- GetMaliputBackendParameters maliput_malidrive

Note

maliput_query is a command line application that can be used to query maliput backends for information. See maliput_query for more information. Under the hood, it uses the plugin interface to obtain the information.