Fix topology with ending lanes
This commit is contained in:
parent
5003e58d7c
commit
46d50df7c5
|
@ -1,5 +1,6 @@
|
|||
## Latest
|
||||
|
||||
* Fix a bug at `Map.get_topology()`, causing lanes with no successors to not be part of it.
|
||||
* Added new ConstantVelocityAgent
|
||||
* Added new parameter to the TrafficManager, `set_desired_speed`, to set a vehicle's speed.
|
||||
* Added 4 new attributes to all vehicles:
|
||||
|
|
|
@ -711,9 +711,19 @@ namespace road {
|
|||
for (const auto &pair : _data.GetRoads()) {
|
||||
const auto &road = pair.second;
|
||||
ForEachDrivableLane(road, [&](auto &&waypoint) {
|
||||
auto successors = GetSuccessors(waypoint);
|
||||
if (successors.size() == 0){
|
||||
auto distance = static_cast<float>(GetDistanceAtEndOfLane(GetLane(waypoint)));
|
||||
auto last_waypoint = GetWaypoint(waypoint.road_id, waypoint.lane_id, distance);
|
||||
if (last_waypoint.has_value()){
|
||||
result.push_back({waypoint, *last_waypoint});
|
||||
}
|
||||
}
|
||||
else{
|
||||
for (auto &&successor : GetSuccessors(waypoint)) {
|
||||
result.push_back({waypoint, successor});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -110,9 +110,15 @@ class GlobalRoutePlanner(object):
|
|||
w = wp1.next(self._sampling_resolution)[0]
|
||||
while w.transform.location.distance(endloc) > self._sampling_resolution:
|
||||
seg_dict['path'].append(w)
|
||||
w = w.next(self._sampling_resolution)[0]
|
||||
next_ws = w.next(self._sampling_resolution)
|
||||
if len(next_ws) == 0:
|
||||
break
|
||||
w = next_ws[0]
|
||||
else:
|
||||
seg_dict['path'].append(wp1.next(self._sampling_resolution)[0])
|
||||
next_wps = wp1.next(self._sampling_resolution)
|
||||
if len(next_wps) == 0:
|
||||
break
|
||||
seg_dict['path'].append(next_wps[0])
|
||||
self._topology.append(seg_dict)
|
||||
|
||||
def _build_graph(self):
|
||||
|
|
Loading…
Reference in New Issue