|
|
|
|
@ -144,13 +144,19 @@ def _lane_payload(route_index, options):
|
|
|
|
|
lane_axis = (opts.get("lane_axis") or "y").lower()
|
|
|
|
|
if lane_axis not in {"x", "y", "z"}:
|
|
|
|
|
lane_axis = "y"
|
|
|
|
|
lane_index = int(route_index or 0)
|
|
|
|
|
lane_index = max(int(route_index or 0), 0)
|
|
|
|
|
lane_spacing = float(opts.get("lane_spacing", 0.0) or 0.0)
|
|
|
|
|
if lane_index <= 0:
|
|
|
|
|
lane_offset = 0.0
|
|
|
|
|
else:
|
|
|
|
|
lane_order = (lane_index + 1) // 2
|
|
|
|
|
lane_direction = 1.0 if lane_index % 2 == 1 else -1.0
|
|
|
|
|
lane_offset = float(lane_order) * lane_spacing * lane_direction
|
|
|
|
|
return {
|
|
|
|
|
"index": lane_index,
|
|
|
|
|
"axis": lane_axis,
|
|
|
|
|
"spacing_mm": lane_spacing,
|
|
|
|
|
"offset_mm": float(lane_index) * lane_spacing,
|
|
|
|
|
"offset_mm": lane_offset,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -809,6 +815,7 @@ def collect_obstacles(doc, exclude=None, options=None):
|
|
|
|
|
continue
|
|
|
|
|
if RoutingNetwork.is_route_carrier(obj) or WiringObjects.is_routed_wire_object(obj):
|
|
|
|
|
continue
|
|
|
|
|
raw_bbox = _bbox_payload(obj, clearance=0.0)
|
|
|
|
|
bbox = _bbox_payload(obj, clearance=clearance)
|
|
|
|
|
if bbox is None:
|
|
|
|
|
continue
|
|
|
|
|
@ -823,6 +830,7 @@ def collect_obstacles(doc, exclude=None, options=None):
|
|
|
|
|
"label": getattr(obj, "Label", ""),
|
|
|
|
|
"type_id": getattr(obj, "TypeId", ""),
|
|
|
|
|
"bbox": bbox,
|
|
|
|
|
"raw_bbox": raw_bbox or bbox,
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
return obstacles
|
|
|
|
|
@ -871,8 +879,12 @@ def detect_collisions(points, obstacles, ignored_segment_indices=None):
|
|
|
|
|
collisions.append(
|
|
|
|
|
{
|
|
|
|
|
"segment_index": index,
|
|
|
|
|
"segment_start": _point_payload(start),
|
|
|
|
|
"segment_end": _point_payload(end),
|
|
|
|
|
"obstacle_name": obstacle.get("name", ""),
|
|
|
|
|
"obstacle_label": obstacle.get("label", ""),
|
|
|
|
|
"obstacle_bbox": dict(obstacle.get("raw_bbox") or obstacle.get("bbox") or {}),
|
|
|
|
|
"collision_bbox": dict(obstacle.get("bbox", {}) or {}),
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
return collisions
|
|
|
|
|
|