Fixed ending lane control bug
This commit is contained in:
parent
116edcdc69
commit
642a36d75e
|
@ -105,6 +105,7 @@ static const float MAX_WPT_RADIANS = 0.087f; // 5º
|
|||
static float const DELTA = 25.0f;
|
||||
static float const Z_DELTA = 500.0f;
|
||||
static float const STRAIGHT_DEG = 19.0f;
|
||||
static const double MIN_LANE_WIDTH = 1.0f;
|
||||
} // namespace Map
|
||||
|
||||
namespace TrafficLight {
|
||||
|
|
|
@ -180,6 +180,11 @@ namespace traffic_manager {
|
|||
// Setting segment predecessors and successors.
|
||||
SegmentId waypoint_segment_id = GetSegmentId(connection.first);
|
||||
SegmentId successor_segment_id = GetSegmentId(connection.second);
|
||||
if (waypoint_segment_id == successor_segment_id){
|
||||
// If both topology waypoints are at the same segment, ignore them.
|
||||
// This happens at lanes that have either no successor or predecessor connections.
|
||||
continue;
|
||||
}
|
||||
using SegIdVectorPair = std::pair<std::vector<SegmentId>, std::vector<SegmentId>>;
|
||||
SegIdVectorPair &connection_first = segment_topology[waypoint_segment_id];
|
||||
SegIdVectorPair &connection_second = segment_topology[successor_segment_id];
|
||||
|
@ -226,8 +231,11 @@ namespace traffic_manager {
|
|||
assert(_world_map != nullptr && "No map reference found.");
|
||||
auto raw_dense_topology = _world_map->GenerateWaypoints(MAP_RESOLUTION);
|
||||
for (auto &waypoint_ptr: raw_dense_topology) {
|
||||
if (waypoint_ptr->GetLaneWidth() > MIN_LANE_WIDTH){
|
||||
// Avoid making the vehicles move through very narrow lanes
|
||||
segment_map[GetSegmentId(waypoint_ptr)].emplace_back(std::make_shared<SimpleWaypoint>(waypoint_ptr));
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Processing waypoints.
|
||||
auto distance_squared = [](cg::Location l1, cg::Location l2) {
|
||||
|
|
Loading…
Reference in New Issue