Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch runtime_error if the message from laser is malformed #2511

Merged
merged 2 commits into from
Aug 17, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions nav2_costmap_2d/plugins/obstacle_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,12 @@ 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; //ignore this message
}

// buffer the point cloud
Expand Down Expand Up @@ -327,6 +333,12 @@ 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; //ignore this message
}

// buffer the point cloud
Expand Down