Skip to content

Commit

Permalink
add entity validation to OdometryPublisher system
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Bogdanov <[email protected]>
  • Loading branch information
Bogdanov-am committed Mar 1, 2024
1 parent 633ce72 commit 89a9a54
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/systems/odometry_publisher/OdometryPublisher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ void OdometryPublisher::PreUpdate(const gz::sim::UpdateInfo &_info,
{
GZ_PROFILE("OdometryPublisher::PreUpdate");

if (!this->dataPtr->model.Valid(_ecm)) {
return;

Check warning on line 282 in src/systems/odometry_publisher/OdometryPublisher.cc

View check run for this annotation

Codecov / codecov/patch

src/systems/odometry_publisher/OdometryPublisher.cc#L282

Added line #L282 was not covered by tests
}

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
Expand Down Expand Up @@ -305,6 +309,10 @@ void OdometryPublisher::PostUpdate(const UpdateInfo &_info,
if (_info.paused)
return;

if (!this->dataPtr->model.Valid(_ecm)) {
return;

Check warning on line 313 in src/systems/odometry_publisher/OdometryPublisher.cc

View check run for this annotation

Codecov / codecov/patch

src/systems/odometry_publisher/OdometryPublisher.cc#L313

Added line #L313 was not covered by tests
}

this->dataPtr->UpdateOdometry(_info, _ecm);
}

Expand Down

0 comments on commit 89a9a54

Please sign in to comment.