Skip to content

Commit

Permalink
Merge pull request #1498 from tier4/fix/canonicalize_function
Browse files Browse the repository at this point in the history
Fix/canonicalize function
  • Loading branch information
hakuturu583 authored Dec 24, 2024
2 parents 5a45ec9 + a0a075b commit e8bd614
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion simulation/traffic_simulator/src/utils/pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ auto canonicalize(
if (lanelet_pose == LaneletPose()) {
return std::nullopt;
} else {
return CanonicalizedLaneletPose(lanelet_pose, hdmap_utils_ptr);
try {
return CanonicalizedLaneletPose(lanelet_pose, hdmap_utils_ptr);
} catch (const common::SemanticError &) {
return std::nullopt;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions simulation/traffic_simulator/test/src/utils/test_pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ TEST_F(PoseTest, canonicalize_invalid)
traffic_simulator::pose::canonicalize(
traffic_simulator::pose::quietNaNLaneletPose(), hdmap_utils),
std::runtime_error);
EXPECT_FALSE(traffic_simulator::pose::canonicalize(
traffic_simulator::helper::constructLaneletPose(203, 1000.0, 0.0), hdmap_utils));
}

/**
Expand Down

0 comments on commit e8bd614

Please sign in to comment.