ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
6

How to do mimic joints that work in Gazebo?

asked 2018-02-23 06:55:00 -0600

Airuno2L gravatar image

updated 2018-02-23 06:55:54 -0600

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?

edit retag flag offensive close merge delete

Comments

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.

benedikt gravatar image benedikt  ( 2022-05-10 10:05:17 -0600 )edit

For the Robotiq 2F gripper, I've actually found a better solution that gets rid of almostall mimic joints: https://github.com/DFKI-NI/mobipick/c... . This is for Gazebo Classic, but perhaps something similar is available for Ignition Gazebo.

Martin Günther gravatar image Martin Günther  ( 2022-05-10 10:19:10 -0600 )edit

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?

benedikt gravatar image benedikt  ( 2022-05-10 11:27:03 -0600 )edit

2 Answers

Sort by » oldest newest most voted
4

answered 2018-02-23 07:24:06 -0600

updated 2018-03-06 10:48:51 -0600

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...

edit flag offensive delete link more

Comments

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.

Airuno2L gravatar image Airuno2L  ( 2018-02-23 15:15:39 -0600 )edit

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.

Airuno2L gravatar image Airuno2L  ( 2018-03-01 11:15:04 -0600 )edit

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.

Airuno2L gravatar image Airuno2L  ( 2018-03-01 11:15:45 -0600 )edit

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.

Airuno2L gravatar image Airuno2L  ( 2018-03-01 11:17:04 -0600 )edit

That's a bug in Gazebo: https://github.com/ros-simulation/gaz... . See the comments for possible workarounds.

Martin Günther gravatar image Martin Günther  ( 2018-03-01 11:37:41 -0600 )edit

For the mimic joint plugin, you can work around this problem by setting the pid_gains parameters for your joints.

Martin Günther gravatar image Martin Günther  ( 2018-03-01 11:39:19 -0600 )edit

I've updated my answer.

Martin Günther gravatar image Martin Günther  ( 2018-03-01 11:43:33 -0600 )edit
1

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?

Airuno2L gravatar image Airuno2L  ( 2018-03-06 06:59:54 -0600 )edit
2

answered 2019-05-19 21:14:04 -0600

Angel-J gravatar image

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

https://github.com/wojiaojiao/pegasus...

edit flag offensive delete link more

Question Tools

4 followers

Stats

Asked: 2018-02-23 06:55:00 -0600

Seen: 6,845 times

Last updated: May 10 '22