Skip to content

Commit

Permalink
Allow removal of model that has joint_position_controller plugin. (#2252
Browse files Browse the repository at this point in the history
)

* Temporary fix for #2165 until #2217 is resolved.

Signed-off-by: Johan Rutgeerts <[email protected]>

* Added comment to clarify the added code.

Signed-off-by: Johan Rutgeerts <[email protected]>

---------

Signed-off-by: Johan Rutgeerts <[email protected]>
  • Loading branch information
jrutgeer authored Nov 22, 2023
1 parent 14f8796 commit 8b40b54
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/systems/joint_position_controller/JointPositionController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,21 @@ void JointPositionController::PreUpdate(
{
GZ_PROFILE("JointPositionController::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 << "JointPositionController model no longer valid. "
<< "Disabling plugin." << std::endl;
this->dataPtr->model = Model(kNullEntity);
return;
}

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
Expand Down

0 comments on commit 8b40b54

Please sign in to comment.