Danfoa/robotiq_2finger_grippers

Model simulation in Gazebo9

bglima opened this issue · 5 comments

Hi! Would it be possible to show an example of how to spawn your models in Gazebo 9? Like a robotiq_2f_85_gripper_simulation package, for instance.

Hi @bglima, currently we are not using gazebo simulation, and thus this functionality is not yet supported. The Gazebo tutorials have information on how to add the necessary parameters to the URDF for it to be used in Gazebo.

@bglima I'm working on ROS kinetic and Gazebo 9 for the 2f_140 gripper. Currently, the urdf version for this gripper has some issues with the mimic joints in Gazebo so you need to take some steps to make it work with Gazebo.

  1. Fix the joint limits issue: ros-industrial/robotiq#119 (comment). (@Danfoa: This is a known issue that has been fixed in the official robotiq repo. I can help make a pull request for this to your repository if you want.)

  2. Install this ROS package roboticsgroup_gazebo_plugins, which is a plugin that enables the ability to add the mimic joint functionality that exists in URDF to Gazebo.

  3. Create a xacro file like this in the robotiq_2f_140_gripper_visualization/urdf folder (you can name the file anything you want, but I named it robotiq_arg2f.gazebo.xacro):

<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro">
    <xacro:macro name="robotiq_arg2f_gazebo" params="prefix">
        <gazebo>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_1">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}right_outer_knuckle_joint</mimicJoint>
                <multiplier>-1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_2">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}left_inner_knuckle_joint</mimicJoint>
                <multiplier>-1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_3">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}right_inner_knuckle_joint</mimicJoint>
                <multiplier>-1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_4">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}left_inner_finger_joint</mimicJoint>
                <multiplier>1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_5">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}right_inner_finger_joint</mimicJoint>
                <multiplier>1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
        </gazebo>
    </xacro:macro>
</robot>
  1. Then, in robotiq_arg2f_140_model_macro.xacro, import the xacro file you just created and
    add <xacro:robotiq_arg2f_gazebo prefix="${prefix}"/> to the very last line as follows:
<!-- Import the xacro file -->
<xacro:include filename="$(find robotiq_2f_140_gripper_visualization)/urdf/robotiq_arg2f.gazebo.xacro" />

<!-- Use it in the last xacro block -->
<xacro:macro name="robotiq_arg2f_140" params="prefix">
    <xacro:robotiq_arg2f_base_link prefix="${prefix}"/>
    <xacro:finger_links prefix="${prefix}" fingerprefix="left" stroke="140"/>
    <xacro:finger_links prefix="${prefix}" fingerprefix="right" stroke="140"/>
    <xacro:finger_joint prefix="${prefix}"/>
    <xacro:right_outer_knuckle_joint prefix="${prefix}"/>
    <xacro:robotiq_arg2f_transmission prefix="${prefix}"/>
    <xacro:robotiq_arg2f_gazebo prefix="${prefix}"/>
</xacro:macro>

Here is our urdf folder we're using to work with Gazebo 9: https://github.com/olinrobotics/robotiq_2finger_grippers/tree/xamyab/robotiq_2f_140_gripper_visualization/urdf

Here is the result:
Gripper

@bglima I'm working on ROS kinetic and Gazebo 9 for the 2f_140 gripper. Currently, the urdf version for this gripper has some issues with the mimic joints in Gazebo so you need to take some steps to make it work with Gazebo.

1. Fix the joint limits issue: [ros-industrial/robotiq#119 (comment)](https://github.com/ros-industrial/robotiq/pull/119#event-2449247301). (@Danfoa: This is [a known issue](https://github.com/ros-industrial/robotiq/issues/150) that has been fixed in the official robotiq repo. I can help make a pull request for this to your repository if you want.)

2. Install this ROS package [roboticsgroup_gazebo_plugins](https://github.com/olinrobotics/universal_robot/tree/hiro-xamyab/roboticsgroup_gazebo_plugins), which is a plugin that enables the ability to add the mimic joint functionality that exists in URDF to Gazebo.

3. Create a xacro file like this in the `robotiq_2f_140_gripper_visualization/urdf` folder (you can name the file anything you want, but I named it `robotiq_arg2f.gazebo.xacro`):
<?xml version="1.0"?>
<robot xmlns:xacro="http://wiki.ros.org/xacro">
    <xacro:macro name="robotiq_arg2f_gazebo" params="prefix">
        <gazebo>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_1">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}right_outer_knuckle_joint</mimicJoint>
                <multiplier>-1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_2">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}left_inner_knuckle_joint</mimicJoint>
                <multiplier>-1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_3">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}right_inner_knuckle_joint</mimicJoint>
                <multiplier>-1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_4">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}left_inner_finger_joint</mimicJoint>
                <multiplier>1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
            <plugin filename="libroboticsgroup_gazebo_mimic_joint_plugin.so" name="${prefix}mimic_robotiq_140_5">
                <joint>${prefix}finger_joint</joint>
                <mimicJoint>${prefix}right_inner_finger_joint</mimicJoint>
                <multiplier>1.0</multiplier>
                <offset>0.0</offset>
            </plugin>
        </gazebo>
    </xacro:macro>
</robot>
1. Then, in `robotiq_arg2f_140_model_macro.xacro`, import the xacro file you just created and
   add `<xacro:robotiq_arg2f_gazebo prefix="${prefix}"/>` to the very last line as follows:
<!-- Import the xacro file -->
<xacro:include filename="$(find robotiq_2f_140_gripper_visualization)/urdf/robotiq_arg2f.gazebo.xacro" />

<!-- Use it in the last xacro block -->
<xacro:macro name="robotiq_arg2f_140" params="prefix">
    <xacro:robotiq_arg2f_base_link prefix="${prefix}"/>
    <xacro:finger_links prefix="${prefix}" fingerprefix="left" stroke="140"/>
    <xacro:finger_links prefix="${prefix}" fingerprefix="right" stroke="140"/>
    <xacro:finger_joint prefix="${prefix}"/>
    <xacro:right_outer_knuckle_joint prefix="${prefix}"/>
    <xacro:robotiq_arg2f_transmission prefix="${prefix}"/>
    <xacro:robotiq_arg2f_gazebo prefix="${prefix}"/>
</xacro:macro>

Here is our urdf folder we're using to work with Gazebo 9: https://github.com/olinrobotics/robotiq_2finger_grippers/tree/xamyab/robotiq_2f_140_gripper_visualization/urdf

Here is the result:
Gripper

Hi, I am working on the dual arm system's simulation based on Gazebo. The model you built looks so cool. Would you like to share your model in the future?

@minhkhang1795 Please feel free to create the pull request, any improvement to the repository is more than welcomed. I will test and monitor this enhancement as soon as I have some time.

Thank you for the support