Add fix for gazebo_ros_pkgs#612
authorMartin Günther <martin.guenther@dfki.de>
Fri, 16 Mar 2018 15:59:13 +0000 (16:59 +0100)
committerMartin Günther <martin.guenther@dfki.de>
Fri, 16 Mar 2018 15:59:13 +0000 (16:59 +0100)
This issue also affects the mimic joint plugin:

    https://github.com/ros-simulation/gazebo_ros_pkgs/issues/612

The commit here fixes that issue for Gazebo 9. We should change the
GAZEBO_MAJOR_VERSION check to >= 7 if the following PR gets backported
to Gazebo 7 and 8:

    https://bitbucket.org/osrf/gazebo/pull-requests/2814/fix-issue-2111-by-providing-options-to/diff

src/mimic_joint_plugin.cpp

index 7a2c516..f9de9ee 100644 (file)
@@ -169,7 +169,9 @@ namespace gazebo {
                 mimic_joint_->SetForce(0, effort);
             }
             else {
-#if GAZEBO_MAJOR_VERSION > 2
+#if GAZEBO_MAJOR_VERSION >= 9
+                mimic_joint_->SetPosition(0, angle, true);
+#elif GAZEBO_MAJOR_VERSION > 2
                 mimic_joint_->SetPosition(0, angle);
 #else
                 mimic_joint_->SetAngle(0, math::Angle(angle));