151 std::vector<Road> roads;
154 Road road { 0,
"", 0.0, -1, 0, 0, {}, {}, {} };
157 road.
id = node_road.attribute(
"id").as_uint();
158 road.name = node_road.attribute(
"name").value();
159 road.length = node_road.attribute(
"length").as_double();
160 road.junction_id = node_road.attribute(
"junction").as_int();
165 if (link.
child(
"predecessor")) {
168 if (link.
child(
"successor")) {
177 type.
s = node_type.attribute(
"s").as_double();
178 type.type = node_type.attribute(
"type").value();
188 road.speed.emplace_back(type);
192 for (
pugi::xml_node node_offset : node_road.child(
"lanes").children(
"laneOffset")) {
193 LaneOffset offset { 0.0, 0.0, 0.0, 0.0, 0.0 };
194 offset.
s = node_offset.attribute(
"s").as_double();
195 offset.a = node_offset.attribute(
"a").as_double();
196 offset.b = node_offset.attribute(
"b").as_double();
197 offset.c = node_offset.attribute(
"c").as_double();
198 offset.d = node_offset.attribute(
"d").as_double();
199 road.section_offsets.emplace_back(offset);
202 if(road.section_offsets.size() == 0) {
203 LaneOffset offset { 0.0, 0.0, 0.0, 0.0, 0.0 };
204 road.section_offsets.emplace_back(offset);
208 for (
pugi::xml_node node_section : node_road.child(
"lanes").children(
"laneSection")) {
211 section.
s = node_section.attribute(
"s").as_double();
214 for (
pugi::xml_node node_lane : node_section.child(
"left").children(
"lane")) {
217 lane.
id = node_lane.attribute(
"id").as_int();
219 lane.level = node_lane.attribute(
"level").as_bool();
224 if (link2.
child(
"predecessor")) {
227 if (link2.
child(
"successor")) {
233 section.lanes.emplace_back(lane);
237 for (
pugi::xml_node node_lane : node_section.child(
"center").children(
"lane")) {
240 lane.
id = node_lane.attribute(
"id").as_int();
242 lane.level = node_lane.attribute(
"level").as_bool();
247 if (link2.
child(
"predecessor")) {
250 if (link2.
child(
"successor")) {
256 section.lanes.emplace_back(lane);
260 for (
pugi::xml_node node_lane : node_section.child(
"right").children(
"lane")) {
263 lane.
id = node_lane.attribute(
"id").as_int();
265 lane.level = node_lane.attribute(
"level").as_bool();
270 if (link2.
child(
"predecessor")) {
273 if (link2.
child(
"successor")) {
279 section.lanes.emplace_back(lane);
283 road.sections.emplace_back(section);
287 roads.emplace_back(road);
324 for (
auto const r : roads) {
333 for (
auto const s : r.speed) {
338 for (
auto const s : r.section_offsets) {
344 for (
auto const s : r.sections) {
348 for (
auto const l : s.lanes) {
350 static_cast<uint32_t
>(l.type), l.level, l.predecessor, l.successor);
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)
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)