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);
158 for (
pugi::xml_node node_offset : node_road.child(
"lanes").children(
"laneOffset")) {
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);
174 for (
pugi::xml_node node_section : node_road.child(
"lanes").children(
"laneSection")) {
177 section.
s = node_section.attribute(
"s").as_double();
180 for (
pugi::xml_node node_lane : node_section.child(
"left").children(
"lane")) {
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);
203 for (
pugi::xml_node node_lane : node_section.child(
"center").children(
"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);
226 for (
pugi::xml_node node_lane : node_section.child(
"right").children(
"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);
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)