Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo, xml path and descriptions #116

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion qc_opendrive/base/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from dataclasses import dataclass
from enum import Enum
from lxml import etree
from typing import Union, Optional
from typing import Optional

from qc_baselib import Configuration, Result

Expand Down Expand Up @@ -78,6 +78,7 @@ class LaneSectionWithLength:
class OffsetPoly3:
poly3: Poly3
s_offset: float
xml_element: Optional[etree._ElementTree] = None


class LaneDirection(str, Enum):
Expand Down
5 changes: 5 additions & 0 deletions qc_opendrive/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ def get_poly3_from_width(
d=to_float(width.get("d")),
),
s_offset=to_float(width.get("sOffset")),
xml_element=width,
)

if is_valid_offset_poly3(offset_poly3):
Expand Down Expand Up @@ -795,6 +796,7 @@ def get_borders_from_lane(lane: etree._ElementTree) -> List[models.OffsetPoly3]:
d=to_float(border.get("d")),
),
s_offset=to_float(border.get("sOffset")),
xml_element=border,
)
if is_valid_offset_poly3(offset_poly3):
border_list.append(offset_poly3)
Expand Down Expand Up @@ -868,6 +870,7 @@ def get_road_elevations(road: etree._ElementTree) -> List[models.OffsetPoly3]:
d=to_float(elevation.get("d")),
),
s_offset=to_float(elevation.get("s")),
xml_element=elevation,
)

if is_valid_offset_poly3(offset_poly3):
Expand All @@ -892,6 +895,7 @@ def get_road_superelevations(road: etree._ElementTree) -> List[models.OffsetPoly
d=to_float(superelevation.get("d")),
),
s_offset=to_float(superelevation.get("s")),
xml_element=superelevation,
)

if is_valid_offset_poly3(offset_poly3):
Expand All @@ -916,6 +920,7 @@ def get_lane_offsets_from_road(road: etree._ElementTree) -> List[models.OffsetPo
d=to_float(lane_offset.get("d")),
),
s_offset=to_float(lane_offset.get("s")),
xml_element=lane_offset,
)

if is_valid_offset_poly3(offset_poly3):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _check_all_roads(checker_data: models.CheckerData) -> None:
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(geometry),
description=f"",
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
)

s_coordinate = utils.get_s_from_geometry(geometry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _check_all_roads(checker_data: models.CheckerData) -> None:
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(geometry),
description=f"",
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
)

s_coordinate = utils.get_s_from_geometry(geometry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def _check_all_roads(checker_data: models.CheckerData) -> None:
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(geometry),
description=f"",
description=f"Length does not match the actual curve length. The estimated absolute error from numerical integration is {estimated_error}",
)

s_coordinate = utils.get_s_from_geometry(geometry)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ def _raise_issue(
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(left_lane),
description=f"",
description=f"Outer lane border intersects or stays within inner lane border.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(right_lane),
description=f"",
description=f"Outer lane border intersects or stays within inner lane border.",
)

s_section = utils.get_s_from_lane_section(lane_section_with_length.lane_section)
Expand Down
110 changes: 87 additions & 23 deletions qc_opendrive/checks/performance/performance_avoid_redundant_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _check_road_superelevations(
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
description=f"Redudant superelevation declaration.",
description=f"Redundant superelevation declaration.",
level=IssueSeverity.WARNING,
rule_uid=RULE_UID,
)
Expand All @@ -36,8 +36,20 @@ def _check_road_superelevations(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(road),
description=f"",
xpath=checker_data.input_file_xml_root.getpath(
current_superelevation.xml_element
),
description=f"Redundant superelevation declaration.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(
next_superelevation.xml_element
),
description=f"Redundant superelevation declaration.",
)

inertial_point = utils.get_point_xyz_from_road_reference_line(
Expand All @@ -51,7 +63,7 @@ def _check_road_superelevations(
x=inertial_point.x,
y=inertial_point.y,
z=inertial_point.z,
description="Redudant superelevation declaration.",
description="Redundant superelevation declaration.",
)


Expand All @@ -66,7 +78,7 @@ def _check_road_elevations(
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
description=f"Redudant elevation declaration.",
description=f"Redundant elevation declaration.",
level=IssueSeverity.WARNING,
rule_uid=RULE_UID,
)
Expand All @@ -75,8 +87,20 @@ def _check_road_elevations(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(road),
description=f"",
xpath=checker_data.input_file_xml_root.getpath(
current_elevation.xml_element
),
description=f"Redundant elevation declaration.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(
next_elevation.xml_element
),
description=f"Redundant elevation declaration.",
)

inertial_point = utils.get_point_xyz_from_road_reference_line(
Expand All @@ -90,7 +114,7 @@ def _check_road_elevations(
x=inertial_point.x,
y=inertial_point.y,
z=inertial_point.z,
description="Redudant elevation declaration.",
description="Redundant elevation declaration.",
)


Expand All @@ -105,7 +129,7 @@ def _check_lane_offsets(
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
description=f"Redudant lane offset declaration.",
description=f"Redundant lane offset declaration.",
level=IssueSeverity.WARNING,
rule_uid=RULE_UID,
)
Expand All @@ -114,8 +138,20 @@ def _check_lane_offsets(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(road),
description=f"",
xpath=checker_data.input_file_xml_root.getpath(
current_lane_offset.xml_element
),
description=f"Redundant lane offset declaration.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(
next_lane_offset.xml_element
),
description=f"Redundant lane offset declaration.",
)

s = next_lane_offset.s_offset
Expand All @@ -133,7 +169,7 @@ def _check_lane_offsets(
x=inertial_point.x,
y=inertial_point.y,
z=inertial_point.z,
description="Redudant lane offset declaration.",
description="Redundant lane offset declaration.",
)


Expand All @@ -159,7 +195,7 @@ def _check_road_plan_view(
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
description=f"Redudant line geometry declaration.",
description=f"Redundant line geometry declaration.",
level=IssueSeverity.WARNING,
rule_uid=RULE_UID,
)
Expand All @@ -168,8 +204,16 @@ def _check_road_plan_view(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(road),
description=f"",
xpath=checker_data.input_file_xml_root.getpath(current_geometry),
description=f"Redundant line geometry declaration.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(next_geometry),
description=f"Redundant line geometry declaration.",
)

s_offset = utils.get_s_from_geometry(next_geometry)
Expand Down Expand Up @@ -203,7 +247,7 @@ def _check_lane_widths(
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
description=f"Redudant lane width declaration.",
description=f"Redundant lane width declaration.",
level=IssueSeverity.WARNING,
rule_uid=RULE_UID,
)
Expand All @@ -212,8 +256,18 @@ def _check_lane_widths(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(lane),
description=f"",
xpath=checker_data.input_file_xml_root.getpath(
current_width.xml_element
),
description=f"Redundant lane width declaration.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(next_width.xml_element),
description=f"Redundant lane width declaration.",
)

s_section = utils.get_s_from_lane_section(lane_section)
Expand All @@ -235,7 +289,7 @@ def _check_lane_widths(
x=inertial_point.x,
y=inertial_point.y,
z=inertial_point.z,
description="Redudant lane width declaration.",
description="Redundant lane width declaration.",
)


Expand All @@ -253,7 +307,7 @@ def _check_lane_borders(
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
description=f"Redudant lane border declaration.",
description=f"Redundant lane border declaration.",
level=IssueSeverity.WARNING,
rule_uid=RULE_UID,
)
Expand All @@ -262,8 +316,18 @@ def _check_lane_borders(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(lane),
description=f"",
xpath=checker_data.input_file_xml_root.getpath(
current_border.xml_element
),
description=f"Redundant lane border declaration.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(next_border.xml_element),
description=f"Redundant lane border declaration.",
)

s_section = utils.get_s_from_lane_section(lane_section)
Expand All @@ -285,7 +349,7 @@ def _check_lane_borders(
x=inertial_point.x,
y=inertial_point.y,
z=inertial_point.z,
description="Redudant lane border declaration.",
description="Redundant lane border declaration.",
)


Expand Down
24 changes: 12 additions & 12 deletions qc_opendrive/checks/semantic/road_lane_level_true_one_side.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def _check_level_change_between_lane_sections(
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=warning,
description="",
description="Lane levels are not the same in two consecutive lane sections",
)


Expand Down Expand Up @@ -223,7 +223,15 @@ def _check_level_change_linkage_roads(
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=root.getpath(lane),
description="",
description="Lane levels are not the same between two connected roads.",
)

result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=root.getpath(other_lane),
description="Lane levels are not the same between two connected roads.",
)

s = None
Expand Down Expand Up @@ -392,23 +400,15 @@ def _check_level_among_junctions(
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(incoming_lane),
description="",
)

issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
description="Lane levels are not the same between junction and incoming road.",
level=IssueSeverity.WARNING,
rule_uid=RULE_UID,
description="Lane levels are not the same between incoming road and junction.",
)

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(connection_lane),
description="",
description="Lane levels are not the same between incoming road and junction.",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _check_two_lane_sections_one_direction(
checker_id=CHECKER_ID,
issue_id=issue_id,
xpath=checker_data.input_file_xml_root.getpath(connecting_lane),
description="",
description="Missing lane link.",
)


Expand Down
Loading