diff --git a/nav2_costmap_2d/plugins/obstacle_layer.cpp b/nav2_costmap_2d/plugins/obstacle_layer.cpp index 11a79558ab5..164227a21b7 100644 --- a/nav2_costmap_2d/plugins/obstacle_layer.cpp +++ b/nav2_costmap_2d/plugins/obstacle_layer.cpp @@ -291,6 +291,13 @@ ObstacleLayer::laserScanCallback( global_frame_.c_str(), ex.what()); projector_.projectLaser(*message, cloud); + } catch (std::runtime_error & ex) { + RCLCPP_WARN( + logger_, + "transformLaserScanToPointCloud error, it seems the message from laser is malformed." + " Ignore this message. what(): %s", + ex.what()); + return; } // buffer the point cloud @@ -327,6 +334,13 @@ ObstacleLayer::laserScanValidInfCallback( "High fidelity enabled, but TF returned a transform exception to frame %s: %s", global_frame_.c_str(), ex.what()); projector_.projectLaser(message, cloud); + } catch (std::runtime_error & ex) { + RCLCPP_WARN( + logger_, + "transformLaserScanToPointCloud error, it seems the message from laser is malformed." + " Ignore this message. what(): %s", + ex.what()); + return; } // buffer the point cloud