Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Signed-off-by: hoangtungdinh <[email protected]>
  • Loading branch information
hoangtungdinh committed Sep 12, 2024
1 parent 559ee22 commit 1d717ba
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 54 deletions.
8 changes: 8 additions & 0 deletions qc_opendrive/base/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1757,3 +1757,11 @@ def get_middle_point_xyz_at_height_zero_from_lane_by_s(
else:
point_xyz = get_point_xyz_from_road(road, s, t, 0.0)
return point_xyz


def get_s_offset_from_access(access: etree._ElementTree) -> Union[None, float]:
s_offset = access.get("sOffset")
if s_offset is None:
return None
else:
return float(s_offset)
Original file line number Diff line number Diff line change
Expand Up @@ -65,66 +65,68 @@ def check_rule(checker_data: models.CheckerData) -> None:

access: etree._Element
for access in lane.iter("access"):
access_attr = access.attrib

if "rule" in access_attr:
s_offset = float(access_attr["sOffset"])
rule = access_attr["rule"]

for s_offset_info in access_s_offset_info:
if (
abs(s_offset_info.s_offset - s_offset) <= 1e-6
and rule != s_offset_info.rule
):
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=semantic_constants.CHECKER_ID,
description="At a given s-position, either only deny or only allow values shall be given, not mixed.",
level=IssueSeverity.ERROR,
rule_uid=rule_uid,
)
rule = access.get("rule")
if rule is None:
continue

s_offset = utils.get_s_offset_from_access(access)
if s_offset is None:
continue

for s_offset_info in access_s_offset_info:
if (
abs(s_offset_info.s_offset - s_offset) <= 1e-6
and rule != s_offset_info.rule
):
issue_id = checker_data.result.register_issue(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=semantic_constants.CHECKER_ID,
description="At a given s-position, either only deny or only allow values shall be given, not mixed.",
level=IssueSeverity.ERROR,
rule_uid=rule_uid,
)

path = checker_data.input_file_xml_root.getpath(access)
path = checker_data.input_file_xml_root.getpath(access)

previous_rule = s_offset_info.rule
current_rule = access_attr["rule"]
previous_rule = s_offset_info.rule
current_rule = rule

checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=semantic_constants.CHECKER_ID,
issue_id=issue_id,
xpath=path,
description=f"First encounter of {current_rule} having {previous_rule} before.",
)
checker_data.result.add_xml_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=semantic_constants.CHECKER_ID,
issue_id=issue_id,
xpath=path,
description=f"First encounter of {current_rule} having {previous_rule} before.",
)

if s_section is None:
continue
if s_section is None:
continue

s = s_section + s_offset + (length - s_offset) / 2.0
t = utils.get_t_middle_point_from_lane_by_s(
road, lane_section, lane, s
)
s = s_section + s_offset + (length - s_offset) / 2.0
t = utils.get_t_middle_point_from_lane_by_s(
road, lane_section, lane, s
)

if t is None:
continue
if t is None:
continue

inertial_point = utils.get_point_xyz_from_road(
road, s, t, 0.0
)
if inertial_point is not None:
checker_data.result.add_inertial_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=semantic_constants.CHECKER_ID,
issue_id=issue_id,
x=inertial_point.x,
y=inertial_point.y,
z=inertial_point.z,
description="Mixed access point.",
)

access_s_offset_info.append(
SOffsetInfo(
s_offset=float(access_attr["sOffset"]),
rule=access_attr["rule"],
inertial_point = utils.get_point_xyz_from_road(
road, s, t, 0.0
)
if inertial_point is not None:
checker_data.result.add_inertial_location(
checker_bundle_name=constants.BUNDLE_NAME,
checker_id=semantic_constants.CHECKER_ID,
issue_id=issue_id,
x=inertial_point.x,
y=inertial_point.y,
z=inertial_point.z,
description="Mixed access point.",
)

access_s_offset_info.append(
SOffsetInfo(
s_offset=s_offset,
rule=rule,
)
)

0 comments on commit 1d717ba

Please sign in to comment.