From bf8d7a386b2a76b06618542f770aa66ef6bc6c11 Mon Sep 17 00:00:00 2001 From: Olivier Stasse <ostasse@laas.fr> Date: Tue, 22 Oct 2019 08:20:00 +0200 Subject: [PATCH] Makes SpringPlugin.cc resilient to GAZEBO version --- src/SpringPlugin.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/SpringPlugin.cc b/src/SpringPlugin.cc index 300fc2d..487dd25 100644 --- a/src/SpringPlugin.cc +++ b/src/SpringPlugin.cc @@ -63,12 +63,17 @@ void SpringPlugin::Init() boost::bind(&SpringPlugin::ExplicitUpdate, this)); } - + ///////////////////////////////////////////////// void SpringPlugin::ExplicitUpdate() { +#if GAZEBO_MAJOR_VERSION < 9 common::Time currTime = this->model->GetWorld()->GetSimTime(); +#else + common::Time currTime = this->model->GetWorld()->SimTime(); +#endif + common::Time stepTime = currTime - this->prevUpdateTime; this->prevUpdateTime = currTime; @@ -78,4 +83,3 @@ void SpringPlugin::ExplicitUpdate() -this->kdExplicit * vel; this->jointExplicit->SetForce(0, force); } - -- GitLab