0
$\begingroup$

Rosanswers logo

This question has been asked several times on this site (here and here) as well as on the Gazebo QA site (here and here) but its still not clear to me if mimic joints are supported in Gazebo. Or if they are, how they're suppose to be defined in a URDF.

If I use the mimic tag in the URDF joint and start Rviz, everything works as expected - if I move the parent joint, the child joint moves also. However, when I put the same model in Gazebo, it seems to ignore the mimic tag and only the parent joint moves.

I see that Gazebo has a gearbox type for it's joints, but I'm not sure how I would use that tag in a URDF since URDF joints don't have a gearbox type. If this is probably the right way to do things, could someone explain the basic idea of how to implement that?

Or, is the answer maybe that I should avoid URDF and use SDF for this portion of the robot? If so, can I include an SDF inside a URDF?


Originally posted by Airuno2L on ROS Answers with karma: 3460 on 2018-02-23

Post score: 6


Original comments

Comment by benedikt on 2022-05-10:
Is there a similar way to simulate the Robotiq 2f-85 gripper with Ignition Gazebo? I'm using ROS2 Galactic and Ignition Gazebo Fortress. I've seen that the MimicJointPlugin isn't available for Ignition Gazebo, just for Gazebo Classic.

Comment by Martin Günther on 2022-05-10:
For the Robotiq 2F gripper, I've actually found a better solution that gets rid of almost all mimic joints: https://github.com/DFKI-NI/mobipick/commit/4ddde5320667f265d02f857515f4f91c32a5d8c6 . This is for Gazebo Classic, but perhaps something similar is available for Ignition Gazebo.

Comment by benedikt on 2022-05-10:
Unfortunately, it seems like this solution doesn't work for Ignition Gazebo. Here it says:"[...] kinematic loops are not currently supported." The same is stated here and here. I guess this is the reason.

I'm getting the following error message with Ignition Gazebo Fortress:

[ign gazebo-6] [Err] [SDFFeatures.cc:1024] Asked to create a joint between links [left_inner_knuckle] as parent and [left_inner_finger] as child, but the child link already has a parent joint of type [RevoluteJoint].
[ign gazebo-6] [Err] [SDFFeatures.cc:1024] Asked to create a joint between links [right_inner_knuckle] as parent and [right_inner_finger] as child, but the child link already has a parent joint of type [RevoluteJoint].

Is there another solution that works with Ignition Gazebo?

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

I had a similar problem recently. AFAIK, Gazebo doesn't support mimic joints, and the gearbox joint cannot simulate arbitrary mimic joints. The way I've solved it is by adding a MimicJointPlugin to each mimic joint. What that plugin does is that it applies forces to the mimic joints so that they follow the mimiced joint.

This works in most cases, but it's not perfect; it depends on your use case. My use case was that I wanted to simulate a Robotiq 2 finger gripper, which is based on parallel kinematics. The end result using the MimicJointPlugin still had some issues, mainly that since URDF cannot represent closed kinematic chains, I had to break the loop somewhere (i.e., remove one joint in the closed chain), and that joint doesn't keep together when there is actually an object in the gripper; instead, the two loose ends of the chain flop around.

In SDF, you can actually represent closed kinematic chains. In many cases, this would even eliminate the need for mimic joints; if your mechanism is based on parallel kinematics, you can probably even just represent the closed kinematic chain directly and leave all joints unactuated except for the joint you're controlling, and things should just work because of physics. But I don't know if it's possible to just convert your URDF to SDF and use that in Gazebo together with ROS, and have everything else still work (like ros_control, sensor plugins, ...).

EDIT:

To work around a bug in Gazebo, you should set the pid_gains parameter like this (assuming that gripper_right_outer_knuckle_joint etc. are your mimic joints):

gazebo_ros_control:
  pid_gains:
    # the following gains are used by the gazebo_mimic_joint plugin
    gripper_right_outer_knuckle_joint:
      p: 20.0
      i: 0.1
      d: 0.0
      i_clamp: 0.2
      antiwindup: false
      publish_state: true
    gripper_left_inner_knuckle_joint:
      [...]

EDIT2:

I've written a tutorial package that demonstrates how to use the mimic joint plugin while avoiding the bug #612:

https://github.com/mintar/mimic_joint_gazebo_tutorial


Originally posted by Martin Günther with karma: 11816 on 2018-02-23

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by Airuno2L on 2018-02-23:
I did a brief test of the MimicJointPlugin and it seems to work perfectly. Thanks!!! My application is kind of like a chain/pulley system so it doesn't need to 100% perfect, just as long as the output seems close to the input, which it looks good after my quick check.

Comment by Airuno2L on 2018-03-01:
Actually the plugin is doing something weird to my model. I'm using it for a 6 wheeled skid steer robot. All the wheels spin as expected but the robot wouldn't move. Then, just messing around, I picked the robot up and let it drop and it falls really really slow like its in outer space.

Comment by Airuno2L on 2018-03-01:
Then I commented out the plugin in the URDF and picked the robot up again and let it drop and it fell at a normal speed.

Comment by Airuno2L on 2018-03-01:
Also when the plugin was active and the robot would fall slowly, I simultaneously dropped other items like bricks, etc. and they fell at normal speed when the robot with the plugin would fall really really slow. So it seems like the plugin is doing something weird to the robot model.

Comment by Martin Günther on 2018-03-01:
That's a bug in Gazebo: https://github.com/ros-simulation/gazebo_ros_pkgs/issues/612#issuecomment-369634532 . See the comments for possible workarounds.

Comment by Martin Günther on 2018-03-01:
For the mimic joint plugin, you can work around this problem by setting the pid_gains parameters for your joints.

Comment by Martin Günther on 2018-03-01:
I've updated my answer.

Comment by Airuno2L on 2018-03-06:
I've tried a bunch of variations but I can't seem to get this fix to work. Should I set pid_gains for all joints, or just mimic joints? All my joints, including mimics, have SimpleTransmissions and EffortJointInterfaces, is that correct?

Comment by Airuno2L on 2018-03-06:
What might help the most is an example URDF with corresponding yaml file. Do you know if there is one anywhere that uses this fix? Thanks for your help so far!

Comment by Martin Günther on 2018-03-06:
If you use EffortJointInterfaces, you need to set a different set of parameters. Unfortunately I can't make the model that I'm working on public just yet, but I'll see if I can come up with a simplified example.

Comment by Martin Günther on 2018-03-06:
I've written a tutorial package for you and updated my answer. Have fun!

Comment by Airuno2L on 2018-03-06:
Wow thanks! I've got it working now, I wasn't setting hasPID and was also setting up transmissions for my mimic joints. I owe you a beer if we ever cross paths!

FWIW, my joints have EffortJointInterfaces not PositionJointInterfaces and they had the same problem and this solution fixed it.

Comment by Airuno2L on 2018-03-06:
To clarify for others, I'm using hardware_interface/EffortJointInterfaces and effort_controllers/JointEffortControllers

Comment by scliu on 2018-06-08:
hello, I also use the Robotiq_85 2 finger gripper in gazebo but it fall apart when the simulation run. However, it work well in RVIZ.

Comment by dhruvkr on 2018-07-09:
Hi Im getting an error after applying the plugin stating : No mimicJoint element present. MimicJointPlugin could not be loaded

 <joint name="table_handR" type="fixed">
<parent link="RSoftHand"/>
<child link="table"/>
<origin rpy="0 0 0" xyz="0 0 0"/>

Comment by dhruvkr on 2018-07-09:
in continuation:

<joint name="table_handL" type="fixed">
<parent link="LSoftHand"/>
<child link="table"/>
<mimic joint="table_handR" multiplier="1.0" offset="0.0"/>
<origin rpy="0 0 0" xyz="0 0 0"/>

Comment by dhruvkr on 2018-07-09:
And finally:

<plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="mimic_table_handL">
  <joint="table_handR"/>
  <mimicJoint="table_handL"/>
  <multiplier="1.0"/>
  <!-- <robotNamespace=""/> -->
 </plugin>
$\endgroup$
0
$\begingroup$

Rosanswers logo

closed_loop_plugin is to solve the issue that URDF not support Closed loop chains.

https://github.com/wojiaojiao/pegasus_gazebo_plugins


Originally posted by Angel-J with karma: 21 on 2019-05-19

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.