61 std::vector<RoadTypeSpeed>
speed;
68 if (str ==
"driving") {
70 }
else if (str ==
"stop") {
72 }
else if (str ==
"shoulder") {
74 }
else if (str ==
"biking") {
76 }
else if (str ==
"sidewalk") {
78 }
else if (str ==
"border") {
80 }
else if (str ==
"restricted") {
82 }
else if (str ==
"parking") {
84 }
else if (str ==
"bidirectional") {
86 }
else if (str ==
"median") {
88 }
else if (str ==
"special1") {
90 }
else if (str ==
"special2") {
92 }
else if (str ==
"special3") {
94 }
else if (str ==
"roadworks") {
96 }
else if (str ==
"tram") {
98 }
else if (str ==
"rail") {
100 }
else if (str ==
"entry") {
102 }
else if (str ==
"exit") {
104 }
else if (str ==
"offramp") {
106 }
else if (str ==
"onramp") {
117 std::vector<Road> roads;
120 Road road { 0,
"", 0.0, -1, 0, 0, {}, {}, {} };
123 road.
id = node_road.attribute(
"id").as_uint();
124 road.name = node_road.attribute(
"name").value();
125 road.length = node_road.attribute(
"length").as_double();
126 road.junction_id = node_road.attribute(
"junction").as_int();
131 if (link.
child(
"predecessor")) {
134 if (link.
child(
"successor")) {
143 type.
s = node_type.attribute(
"s").as_double();
144 type.type = node_type.attribute(
"type").value();
154 road.speed.emplace_back(type);
159 LaneOffset offset { 0.0, 0.0, 0.0, 0.0, 0.0 };
160 offset.
s = node_offset.attribute(
"s").as_double();
161 offset.a = node_offset.attribute(
"a").as_double();
162 offset.b = node_offset.attribute(
"b").as_double();
163 offset.c = node_offset.attribute(
"c").as_double();
164 offset.d = node_offset.attribute(
"d").as_double();
165 road.section_offsets.emplace_back(offset);
168 if(road.section_offsets.size() == 0) {
169 LaneOffset offset { 0.0, 0.0, 0.0, 0.0, 0.0 };
170 road.section_offsets.emplace_back(offset);
177 section.
s = node_section.attribute(
"s").as_double();
183 lane.id = node_lane.attribute(
"id").as_int();
185 lane.level = node_lane.attribute(
"level").as_bool();
190 if (link2.
child(
"predecessor")) {
193 if (link2.
child(
"successor")) {
199 section.lanes.emplace_back(lane);
206 lane.id = node_lane.attribute(
"id").as_int();
208 lane.level = node_lane.attribute(
"level").as_bool();
213 if (link2.
child(
"predecessor")) {
216 if (link2.
child(
"successor")) {
222 section.lanes.emplace_back(lane);
229 lane.id = node_lane.attribute(
"id").as_int();
231 lane.level = node_lane.attribute(
"level").as_bool();
236 if (link2.
child(
"predecessor")) {
239 if (link2.
child(
"successor")) {
245 section.lanes.emplace_back(lane);
249 road.sections.emplace_back(section);
253 roads.emplace_back(road);
290 for (
auto const r : roads) {
299 for (
auto const s : r.speed) {
304 for (
auto const s : r.section_offsets) {
310 for (
auto const s : r.sections) {
314 for (
auto const l :
s.lanes) {
316 static_cast<uint32_t>(l.type), l.level, l.predecessor, l.successor);
const char_t * value() const
double as_double(double def=0) const
unsigned int as_uint(unsigned int def=0) const
std::vector< Lane > lanes
This file contains definitions of common data structures used in traffic manager. ...
void CreateSectionOffset(Road *road, const double s, const double a, const double b, const double c, const double d)
xml_attribute attribute(const char_t *name) const
static void Parse(const pugi::xml_document &xml, carla::road::MapBuilder &map_builder)
road::Lane::LaneType type
int as_int(int def=0) const
xml_node child(const char_t *name) const
carla::road::LaneSection * AddRoadSection(carla::road::Road *road, const SectionId id, const double s)
carla::road::Lane * AddRoadSectionLane(carla::road::LaneSection *section, const LaneId lane_id, const uint32_t lane_type, const bool lane_level, const LaneId predecessor, const LaneId successor)
static road::Lane::LaneType StringToLaneType(std::string &&str)
LaneType
Can be used as flags.
std::vector< LaneOffset > section_offsets
static void ToLower(WritableRangeT &str)
std::vector< RoadTypeSpeed > speed
void CreateRoadSpeed(Road *road, const double s, const std::string type, const double max, const std::string unit)
std::vector< LaneSection > sections
xml_object_range< xml_node_iterator > children() const
carla::road::Road * AddRoad(const RoadId road_id, const std::string name, const double length, const JuncId junction_id, const RoadId predecessor, const RoadId successor)