From dfe867d2d1af480f4429bfc65f5264f7299ed58d Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Thu, 31 Oct 2019 19:01:30 +0100
Subject: [PATCH] fix Gazebo 9

---
 CMakeLists.txt      | 1 -
 src/SpringPlugin.cc | 4 ++++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5cb1df5..6ced02e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)
 
-
 SET(PROJECT_ORG pyrene-dev)
 SET(PROJECT_NAME talos_data)
 SET(PROJECT_DESCRIPTION "Talos urdf model, srdf model and other data")
diff --git a/src/SpringPlugin.cc b/src/SpringPlugin.cc
index 452b09b..957c8b5 100644
--- a/src/SpringPlugin.cc
+++ b/src/SpringPlugin.cc
@@ -65,7 +65,11 @@ void SpringPlugin::ExplicitUpdate() {
   common::Time stepTime = currTime - this->prevUpdateTime;
   this->prevUpdateTime = currTime;
 
+#if GAZEBO_MAJOR_VERSION < 9
   double pos = this->jointExplicit->GetAngle(0).Radian();
+#else
+  double pos = this->jointExplicit->Position(0);
+#endif
   double vel = this->jointExplicit->GetVelocity(0);
   double force = -this->kpExplicit * pos - this->kdExplicit * vel;
   this->jointExplicit->SetForce(0, force);
-- 
GitLab