Skip to content

Commit

Permalink
Changed the order to validate in regulatory_element_details
Browse files Browse the repository at this point in the history
Signed-off-by: TaikiYamada4 <[email protected]>
  • Loading branch information
TaikiYamada4 committed Nov 14, 2024
1 parent ac6ff25 commit 78815f8
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,35 +63,6 @@ RegulatoryElementsDetailsForCrosswalksValidator::checkRegulatoryElementOfCrosswa
auto crosswalk_polygons = elem->getParameters<lanelet::ConstPolygon3d>(
lanelet::autoware::Crosswalk::AutowareRoleNameString::CrosswalkPolygon);

// If this is a crosswalk type regulatory element, the "refers" has to be a "crosswalk" subtype
// lanelet
const auto & issue_cw = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::Lanelet,
lanelet::utils::getId(),
"Refers of crosswalk regulatory element must have type of crosswalk.");
lanelet::autoware::validation::checkPrimitivesType(
refers, lanelet::AttributeValueString::Lanelet, lanelet::AttributeValueString::Crosswalk,
issue_cw, issues);

// If this is a crosswalk type regulatory element, the "ref_line" has to be a "stop_line" type
// linestring
const auto & issue_sl = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::LineString,
lanelet::utils::getId(),
"ref_line of crosswalk regulatory element must have type of stopline.");
lanelet::autoware::validation::checkPrimitivesType(
ref_lines, lanelet::AttributeValueString::StopLine, issue_sl, issues);

// If this is a crosswalk type regulatory element, the "crosswalk_polygon" has to be a
// "crosswalk_polygon" type polygon
const auto & issue_poly = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::Polygon,
lanelet::utils::getId(),
"Crosswalk polygon of crosswalk regulatory element must have type of Crosswalk_polygon.");
lanelet::autoware::validation::checkPrimitivesType(
crosswalk_polygons, lanelet::autoware::Crosswalk::AutowareRoleNameString::CrosswalkPolygon,
issue_poly, issues);

// Report warning if regulatory element does not have crosswalk polygon
if (crosswalk_polygons.empty()) {
issues.emplace_back(
Expand Down Expand Up @@ -121,6 +92,35 @@ RegulatoryElementsDetailsForCrosswalksValidator::checkRegulatoryElementOfCrosswa
elem->id(),
"Regulatory element of crosswalk must have only one lanelet of crosswalk(refers).");
}

// If this is a crosswalk type regulatory element, the "refers" has to be a "crosswalk" subtype
// lanelet
const auto & issue_cw = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::Lanelet,
lanelet::utils::getId(),
"Refers of crosswalk regulatory element must have type of crosswalk.");
lanelet::autoware::validation::checkPrimitivesType(
refers, lanelet::AttributeValueString::Lanelet, lanelet::AttributeValueString::Crosswalk,
issue_cw, issues);

// If this is a crosswalk type regulatory element, the "ref_line" has to be a "stop_line" type
// linestring
const auto & issue_sl = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::LineString,
lanelet::utils::getId(),
"ref_line of crosswalk regulatory element must have type of stopline.");
lanelet::autoware::validation::checkPrimitivesType(
ref_lines, lanelet::AttributeValueString::StopLine, issue_sl, issues);

// If this is a crosswalk type regulatory element, the "crosswalk_polygon" has to be a
// "crosswalk_polygon" type polygon
const auto & issue_poly = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::Polygon,
lanelet::utils::getId(),
"Crosswalk polygon of crosswalk regulatory element must have type of Crosswalk_polygon.");
lanelet::autoware::validation::checkPrimitivesType(
crosswalk_polygons, lanelet::autoware::Crosswalk::AutowareRoleNameString::CrosswalkPolygon,
issue_poly, issues);
}
return issues;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ RegulatoryElementsDetailsForTrafficLightsValidator::checkRegulatoryElementOfTraf
auto refers = elem->getParameters<lanelet::ConstLineString3d>(lanelet::RoleName::Refers);
// Get stop line referred by regulatory element
auto ref_lines = elem->getParameters<lanelet::ConstLineString3d>(lanelet::RoleName::RefLine);
const auto & issue_tl = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::LineString,
lanelet::utils::getId(),
"Refers of traffic light regulatory element must have type of traffic_light.");
lanelet::autoware::validation::checkPrimitivesType(
refers, lanelet::AttributeValueString::TrafficLight, issue_tl, issues);

const auto & issue_sl = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::LineString,
lanelet::utils::getId(),
"ref_line of traffic light regulatory element must have type of stop_line.");
lanelet::autoware::validation::checkPrimitivesType(
ref_lines, lanelet::AttributeValueString::StopLine, issue_sl, issues);

if (refers.empty()) {
issues.emplace_back(
Expand All @@ -106,6 +93,20 @@ RegulatoryElementsDetailsForTrafficLightsValidator::checkRegulatoryElementOfTraf
lanelet::validation::Severity::Error, lanelet::validation::Primitive::RegulatoryElement,
elem->id(), "Regulatory element of traffic light must have a stop line(ref_line).");
}

const auto & issue_tl = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::LineString,
lanelet::utils::getId(),
"Refers of traffic light regulatory element must have type of traffic_light.");
lanelet::autoware::validation::checkPrimitivesType(
refers, lanelet::AttributeValueString::TrafficLight, issue_tl, issues);

const auto & issue_sl = lanelet::validation::Issue(
lanelet::validation::Severity::Error, lanelet::validation::Primitive::LineString,
lanelet::utils::getId(),
"ref_line of traffic light regulatory element must have type of stop_line.");
lanelet::autoware::validation::checkPrimitivesType(
ref_lines, lanelet::AttributeValueString::StopLine, issue_sl, issues);
}
return issues;
}
Expand Down

0 comments on commit 78815f8

Please sign in to comment.