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

DetachableJoint system: Add option to suppress warning about missing child model #132

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
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