Skip to content

Commit

Permalink
reflect comment
Browse files Browse the repository at this point in the history
Signed-off-by: Mamoru Sobue <[email protected]>
  • Loading branch information
soblin committed Nov 6, 2024
1 parent 369ac54 commit 902c88f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
9 changes: 4 additions & 5 deletions map/autoware_lanelet2_map_validator/src/common/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@ namespace validation
std::unique_ptr<lanelet::Projector> getProjector(
const std::string & projector_type, const lanelet::GPSPoint & origin)
{
if (projector_type == projector_names::mgrs) {
return std::make_unique<lanelet::projection::MGRSProjector>();
} else if (projector_type == projector_names::transverse_mercator) {
if (projector_type == projector_names::transverse_mercator) {
return std::make_unique<lanelet::projection::TransverseMercatorProjector>(
lanelet::Origin{origin});
} else if (projector_type == projector_names::utm) {
}
if (projector_type == projector_names::utm) {
return std::make_unique<lanelet::projection::UtmProjector>(lanelet::Origin{origin});
}
return nullptr;
return std::make_unique<lanelet::projection::MGRSProjector>();
}

std::vector<lanelet::validation::DetectedIssues> validateMap(
Expand Down
14 changes: 10 additions & 4 deletions map/autoware_lanelet2_map_validator/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,19 @@ using json = nlohmann::json;
#define NORMAL_RED "\033[31m"
#define FONT_RESET "\033[0m"

lanelet::validation::ValidationConfig replace_validator(
const lanelet::validation::ValidationConfig & input, const std::string & validator_name)
{
auto temp = input;
temp.checksFilter = validator_name;
return temp;
}

void process_requirements(
json json_config, const lanelet::autoware::validation::MetaConfig & validator_config)
{
uint64_t warning_count = 0;
uint64_t error_count = 0;
lanelet::autoware::validation::MetaConfig temp_validator_config = validator_config;

for (auto & requirement : json_config["requirements"]) {
std::string id = requirement["id"];
Expand All @@ -51,13 +58,12 @@ void process_requirements(
std::map<std::string, bool> temp_validation_results;

for (auto & validator : requirement["validators"]) {
std::string validator_name = validator["name"];
temp_validator_config.command_line_config.validationConfig.checksFilter = validator_name;
const std::string validator_name = validator["name"];

std::vector<lanelet::validation::DetectedIssues> temp_issues =
lanelet::autoware::validation::validateMap(
validator_config.projector_type, validator_config.command_line_config.mapFile,
validator_config.command_line_config.validationConfig);
replace_validator(validator_config.command_line_config.validationConfig, validator_name));

if (temp_issues.empty()) {
// Validator passed
Expand Down

0 comments on commit 902c88f

Please sign in to comment.