CARLA
OpenDriveParser.cpp
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
8 
9 #include "carla/Logging.h"
20 #include "carla/road/MapBuilder.h"
21 
22 #include <pugixml/pugixml.hpp>
23 
24 namespace carla {
25 namespace opendrive {
26 
27  boost::optional<road::Map> OpenDriveParser::Load(const std::string &opendrive) {
29  pugi::xml_parse_result parse_result = xml.load_string(opendrive.c_str());
30 
31  if (parse_result == false) {
32  log_error("unable to parse the OpenDRIVE XML string");
33  return {};
34  }
35 
36  carla::road::MapBuilder map_builder;
37 
38  parser::GeoReferenceParser::Parse(xml, map_builder);
39  parser::RoadParser::Parse(xml, map_builder);
40  parser::JunctionParser::Parse(xml, map_builder);
41  parser::GeometryParser::Parse(xml, map_builder);
42  parser::LaneParser::Parse(xml, map_builder);
43  parser::ProfilesParser::Parse(xml, map_builder);
44  parser::TrafficGroupParser::Parse(xml, map_builder);
45  parser::SignalParser::Parse(xml, map_builder);
46  parser::ObjectParser::Parse(xml, map_builder);
47  parser::ControllerParser::Parse(xml, map_builder);
48 
49  return map_builder.Build();
50  }
51 
52 } // namespace opendrive
53 } // namespace carla
boost::optional< Map > Build()
Definition: MapBuilder.cpp:38
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static void log_error(Args &&... args)
Definition: Logging.h:110
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static boost::optional< road::Map > Load(const std::string &opendrive)
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
Definition: RoadParser.cpp:113
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
xml_parse_result load_string(const char_t *contents, unsigned int options=parse_default)
Definition: pugixml.cpp:7091
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
Definition: LaneParser.cpp:187