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

Add entity validation to OdometryPublisher #2326

Merged
Merged
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
24 changes: 24 additions & 0 deletions src/systems/odometry_publisher/OdometryPublisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,21 @@ void OdometryPublisher::PreUpdate(const gz::sim::UpdateInfo &_info,
{
GZ_PROFILE("OdometryPublisher::PreUpdate");

// \TODO(anyone) This is a temporary fix for
// gazebosim/gz-sim#2165 until gazebosim/gz-sim#2217 is resolved.
if (kNullEntity == this->dataPtr->model.Entity())
{
return;
}

if (!this->dataPtr->model.Valid(_ecm))
{
gzwarn << "OdometryPublisher model no longer valid. "
<< "Disabling plugin." << std::endl;
this->dataPtr->model = Model(kNullEntity);
return;
azeey marked this conversation as resolved.
Show resolved Hide resolved
}

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
Expand All @@ -301,6 +316,15 @@ void OdometryPublisher::PostUpdate(const UpdateInfo &_info,
const EntityComponentManager &_ecm)
{
GZ_PROFILE("OdometryPublisher::PostUpdate");

// \TODO(anyone) This is a temporary fix for
// gazebosim/gz-sim#2165 until gazebosim/gz-sim#2217 is resolved.
if (kNullEntity == this->dataPtr->model.Entity())
{
return;
}


// Nothing left to do if paused.
if (_info.paused)
return;
Expand Down
Loading