From a89796cc6546a5222051bde9fa70bab96ee55058 Mon Sep 17 00:00:00 2001 From: Johan Rutgeerts Date: Tue, 21 Nov 2023 09:39:47 +0100 Subject: [PATCH] Temporary fix for gazebosim/gz-sim#2165 until gazebosim/gz-sim#2217 is resolved. Signed-off-by: Johan Rutgeerts --- .../JointPositionController.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/systems/joint_position_controller/JointPositionController.cc b/src/systems/joint_position_controller/JointPositionController.cc index 154b1f8ccc..ac3d6b92ff 100644 --- a/src/systems/joint_position_controller/JointPositionController.cc +++ b/src/systems/joint_position_controller/JointPositionController.cc @@ -320,6 +320,19 @@ void JointPositionController::PreUpdate( { GZ_PROFILE("JointPositionController::PreUpdate"); + 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()) {