Skip to content

Commit

Permalink
Add option to suppress warning about missing child model (gazebosim#132)
Browse files Browse the repository at this point in the history
Signed-off-by: Addisu Z. Taddese <addisu@openrobotics.org>
  • Loading branch information
azeey committed May 28, 2020
1 parent 1a905ff commit 2ff2449
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
1. Allow battery plugin to work with joint force systems.
* [Pull Request 120](https://github.com/ignitionrobotics/ign-gazebo/pull/120)

1. DetachableJoint system: Add option to suppress warning about missing child model
* [Pull Request 132](https://github.com/ignitionrobotics/ign-gazebo/pull/132)

1. Make breadcrumb static after specified time
* [Pull Request 90](https://github.com/ignitionrobotics/ign-gazebo/pull/90)

Expand Down
6 changes: 5 additions & 1 deletion src/systems/detachable_joint/DetachableJoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ void DetachableJoint::Configure(const Entity &_entity,
"/detachable_joint/detach"};
this->topic = _sdf->Get<std::string>("topic", defaultTopic).first;

this->suppressChildWarning =
_sdf->Get<bool>("suppress_child_warning", this->suppressChildWarning)
.first;

this->validConfig = true;
}

Expand Down Expand Up @@ -151,7 +155,7 @@ void DetachableJoint::PreUpdate(
<< " could not be found.\n";
}
}
else
else if (!this->suppressChildWarning)
{
ignwarn << "Child Model " << this->childModelName
<< " could not be found.\n";
Expand Down
7 changes: 7 additions & 0 deletions src/systems/detachable_joint/DetachableJoint.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ namespace systems
/// creating a fixed joint with a link in the parent model.
///
/// <topic> (optional): Topic name to be used for detaching connections
///
/// <suppress_child_warning> (optional): If true, the system
/// will not print a warning message if a child model does not exist yet.
/// Otherwise, a warning message is printed. Defaults to false.

class IGNITION_GAZEBO_VISIBLE DetachableJoint
: public System,
Expand Down Expand Up @@ -84,6 +88,9 @@ namespace systems
/// \brief Topic to be used for detaching connections
private: std::string topic;

/// \brief Whether to suppress warning about missing child model.
private: bool suppressChildWarning{false};

/// \brief Entity of attachment link in the parent model
private: Entity parentLinkEntity{kNullEntity};

Expand Down

0 comments on commit 2ff2449

Please sign in to comment.