Skip to content

Commit

Permalink
Do not segfault when a mesh resource is not found.
Browse files Browse the repository at this point in the history
  • Loading branch information
peci1 committed Jan 22, 2024
1 parent 4a7fe90 commit 988ce4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/RobotBodyFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1024,6 +1024,13 @@ void RobotBodyFilter<T>::addRobotMaskFromUrdf(const string& urdfModel) {
const auto collisionShape = constructShape(*collision->geometry);
const auto shapeName = collision->name.empty() ? NAME_LINK_COLLISION_NR : NAME_LINK_COLLISON_NAME;

// if the shape could not be constructed, ignore it (e.g. mesh was not found)
if (collisionShape == nullptr) {
ROS_WARN("Could not construct shape for collision %s, ignoring it.", shapeName.c_str());
++collisionIndex;
continue;
}

// add the collision shape to shapeMask; the inflation parameters come into play here
const auto containsTestInflation = this->getLinkInflationForContainsTest(collisionNames);
const auto shadowTestInflation = this->getLinkInflationForShadowTest(collisionNames);
Expand Down

0 comments on commit 988ce4a

Please sign in to comment.