Skip to content

Commit f825ff0

Browse files
authored
chore(lanelet2_map_loader): enrich error message (#6245)
Signed-off-by: Takamasa Horibe <horibe.takamasa@gmail.com>
1 parent 295ed1d commit f825ff0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

map/map_loader/src/lanelet2_map_loader/lanelet2_map_loader_node.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ void Lanelet2MapLoaderNode::on_map_projector_info(
7474
// load map from file
7575
const auto map = load_map(lanelet2_filename, *msg);
7676
if (!map) {
77+
RCLCPP_ERROR(get_logger(), "Failed to load lanelet2_map. Not published.");
7778
return;
7879
}
7980

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

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

110+
if (!errors.empty()) {
111+
for (const auto & error : errors) {
112+
RCLCPP_ERROR_STREAM(rclcpp::get_logger("map_loader"), error);
113+
}
114+
}
115+
108116
// overwrite local_x, local_y
109117
for (lanelet::Point3d point : map->pointLayer) {
110118
if (point.hasAttribute("local_x")) {

0 commit comments

Comments
 (0)