Skip to content

Commit

Permalink
When trying to enable contacts on links with no collisions, return false
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Apr 28, 2021
1 parent 081b6e8 commit 7aaa8d1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions cpp/scenario/gazebo/src/Link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,12 @@ bool Link::enableContactDetection(const bool enable)
ignition::gazebo::components::Collision(),
ignition::gazebo::components::ParentEntity(m_entity));

if (collisionEntities.empty()) {
sError << "Failed to enable contact detection, the link has no "
<< "collision elements" << std::endl;
return false;
}

// Create the contact sensor data component that enables the Physics
// system to extract contact information from the physics engine
for (const auto collisionEntity : collisionEntities) {
Expand Down

0 comments on commit 7aaa8d1

Please sign in to comment.