Skip to content

Commit

Permalink
chore(lanelet2_map_loader): enrich error message (autowarefoundation#…
Browse files Browse the repository at this point in the history
…6245)

Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
  • Loading branch information
TakaHoribe authored and karishma1911 committed Jun 3, 2024
1 parent 0f40ff5 commit ff93aa5
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void Lanelet2MapLoaderNode::on_map_projector_info(
// load map from file
const auto map = load_map(lanelet2_filename, *msg);
if (!map) {
RCLCPP_ERROR(get_logger(), "Failed to load lanelet2_map. Not published.");
return;
}

Expand All @@ -87,6 +88,7 @@ void Lanelet2MapLoaderNode::on_map_projector_info(
pub_map_bin_ =
create_publisher<HADMapBin>("output/lanelet2_map", rclcpp::QoS{1}.transient_local());
pub_map_bin_->publish(map_bin_msg);
RCLCPP_INFO(get_logger(), "Succeeded to load lanelet2_map. Map is published.");
}

lanelet::LaneletMapPtr Lanelet2MapLoaderNode::load_map(
Expand All @@ -105,6 +107,12 @@ lanelet::LaneletMapPtr Lanelet2MapLoaderNode::load_map(
const lanelet::projection::LocalProjector projector;
const lanelet::LaneletMapPtr map = lanelet::load(lanelet2_filename, projector, &errors);

if (!errors.empty()) {
for (const auto & error : errors) {
RCLCPP_ERROR_STREAM(rclcpp::get_logger("map_loader"), error);
}
}

// overwrite local_x, local_y
for (lanelet::Point3d point : map->pointLayer) {
if (point.hasAttribute("local_x")) {
Expand Down

0 comments on commit ff93aa5

Please sign in to comment.