0
$\begingroup$

Gazebo Answers logo

Hi, I am trying to make a floating gripper for gazebo that will be used for reinforced learning, so far I want it to move up and down and close its claws. Currently I have a problem with spawning it in gazebo simulation, because I think the urdf is not parsed correctly, because the gravity is turned off only for the first link. The code for gripper is attached below. I guess I kinda messed up with the dummy links, but I can't find any example like that.

image description

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    Gripper file used for openai gym            | -->
<!-- |                                                | -->
<!-- =================================================================================== -->

 <robot name="Gripper">
 
   <gazebo reference="dummy_prismatic_link">
    <gravity>0</gravity>
    <mu1>0.5</mu1>
    <mu2>0.5</mu2>
    <material>Gazebo/Orange</material>
  </gazebo>

  <gazebo reference="dummy">
    <gravity>0</gravity>
    <mu1>0.5</mu1>
    <mu2>0.5</mu2>
    <material>Gazebo/Orange</material>
  </gazebo>

  <gazebo reference="gripper_main_body">
    <gravity>0</gravity>
    <mu1>0.5</mu1>
    <mu2>0.5</mu2>
    <material>Gazebo/Orange</material>
  </gazebo>
  <gazebo reference="gripper_finger1">
    <gravity>0</gravity>
    <mu1>0.5</mu1>
    <mu2>0.5</mu2>
    <material>Gazebo/Red</material>
  </gazebo>
  <gazebo reference="gripper_finger2">
    <gravity>0</gravity>
    <mu1>0.5</mu1>
    <mu2>0.5</mu2>
    <material>Gazebo/Red</material>
  </gazebo>
  
  <link name="world"/>

  <joint name="fixed" type="fixed">
    <parent link="world"/>
    <child link="dummy"/>
  </joint>

  <joint name="gripper_dummy" type="fixed">
    <parent link="dummy"/>
    <child link="dummy_prismatic_link"/>
    <origin rpy="0  0  0" xyz="0   0   0.5"/>
  </joint>

  <joint name="dummy_prismatic_joint" type="prismatic">
    <parent link="dummy_prismatic_link"/>
    <child link="gripper_main_body"/>
    <origin rpy="0  3.14159265  0" xyz="0   0   0"/>
    <axis xyz="0  0  1"/>
    <limit effort="1.0" lower="-0.0" upper="0.02" velocity="1.0"/>
    <dynamics damping="0.2"/>
  </joint>
  <transmission name="gripper_tran">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="gripper_joint">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="gripper_motor">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <joint name="gripper_joint1" type="prismatic">
    <parent link="gripper_main_body"/>
    <child link="gripper_finger1"/>
    <origin rpy="0  0  0" xyz="0.001   0.01375   0.12925"/>
    <axis xyz="0  1  0"/>
    <limit effort="1.0" lower="-0.01" upper="0.01" velocity="1.0"/>
    <dynamics damping="0.2"/>
  </joint>
  <transmission name="gripper_tran1">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="gripper_joint1">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="gripper_motor0">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>
  
  <joint name="gripper_joint2" type="prismatic">
    <parent link="gripper_main_body"/>
    <child link="gripper_finger2"/>
    <origin rpy="0  0  3.14159265" xyz="0.001   -0.012   0.12925"/>
    <axis xyz="0  1  0"/>
    <limit effort="1.0" lower="-0.01" upper="0.01" velocity="1.0"/>
    <dynamics damping="0.2"/>
  </joint>
  <transmission name="gripper_tran2">
    <type>transmission_interface/SimpleTransmission</type>
    <joint name="gripper_joint2">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
    </joint>
    <actuator name="gripper_motor2">
      <hardwareInterface>EffortJointInterface</hardwareInterface>
      <mechanicalReduction>1</mechanicalReduction>
    </actuator>
  </transmission>

  <link name="dummy">
    <collision name="dummy_collision">
      <origin rpy="0  0  0" xyz="0    0    0.5"/>
      <geometry>
        <cylinder length="0.014" radius="0.003"/>
      </geometry>
    </collision>
    <visual name="dummy_visual">
      <origin rpy="0  0  0" xyz="0    0    0.5"/>
      <geometry>
        <cylinder length="0.014" radius="0.003"/>
      </geometry>
    </visual>
  </link>
  
  <link name="dummy_prismatic_link">
    <inertial>
      <mass value="0.0001"/>
      <origin rpy="0  1.57079  0" xyz="0    0    0"/>
      <inertia ixx="0.00000001" ixy="0.0" ixz="0.0" iyy="0.0000000001" iyz="0.0" izz="0.0000000001"/>
    </inertial>
    <collision name="dummy_prismatic_link_collision">
      <origin rpy="0  0  0" xyz="0    0    0.058"/>
      <geometry>
        <cylinder length="0.001" radius="0.03"/>
      </geometry>
    </collision>
    <visual name="dummy_prismatic_link_visual">
      <origin rpy="0  0  0" xyz="0    0    0"/>
      <geometry>
        <cylinder length="0.001" radius="0.03"/>
      </geometry>
    </visual>
  </link>

  <link name="gripper_main_body">
    <inertial>
      <mass value="0.74"/>
      <origin rpy="0  0  0" xyz="0    0    0"/>
      <inertia ixx="0.0013751661166" ixy="0.0" ixz="0.0" iyy="0.0013751661166" iyz="0.0" izz="0.000333"/>
    </inertial>
    <collision name="gripper_main_body_collision">
      <origin rpy="0  0  0" xyz="0    0    00"/>
      <geometry>
        <cylinder length="0.14" radius="0.03"/>
      </geometry>
    </collision>
    <visual name="gripper_main_body_visual">
      <origin rpy="0  0  0" xyz="0    0    0"/>
      <geometry>
        <mesh filename= "model:///gripper/meshes/main_body.stl"/>
      </geometry>
    </visual>
  </link>
  
  <link name="gripper_finger1">
    <inertial>
      <mass value="0.075"/>
      <origin rpy="0  0  0" xyz="0  0  0.02"/>
      <inertia ixx="0.000012929682328125" ixy="0.0" ixz="0.0" iyy="0.000012929682328125" iyz="0.0" izz="0.000005859375"/>
    </inertial>
    <collision name="gripper_finger1_collision">
      <origin rpy="0  0  0" xyz="0  0  0"/>
      <geometry>
        <cylinder length="0.04" radius="0.0125"/>
      </geometry>
    </collision>
    <visual name="gripper_finger1_visual">
      <origin rpy="0  0  0" xyz="0  0  0"/>
     <geometry>
        <mesh filename= "model:///gripper/meshes/finger.stl"/>
      </geometry>
    </visual>
  </link>
  
  <link name="gripper_finger2">
    <inertial>
      <mass value="0.075"/>
      <origin rpy="0  0  0" xyz="0  0  0.02"/>
      <inertia ixx="0.000012929682328125" ixy="0.0" ixz="0.0" iyy="0.000012929682328125" iyz="0.0" izz="0.000005859375"/>
    </inertial>
    <collision name="gripper_finger2_collision">
      <origin rpy="0  0  0" xyz="0  0  0"/>
      <geometry>
        <cylinder length="0.04" radius="0.0125"/>
      </geometry>
    </collision>
    <visual name="gripper_finger2_visual">
      <origin rpy="0  0  0" xyz="0  0  0"/>
     <geometry>
        <mesh filename= "model:///gripper/meshes/finger.stl"/>
      </geometry>
    </visual>
  </link>

</robot>

Result from gz sdf -p command:

<sdf version='1.6'>
  <model name='Gripper'>
    <link name='dummy'>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <inertial>
        <pose frame=''>0 0 0.5 0 -0 0</pose>
        <mass>0.0001</mass>
        <inertia>
          <ixx>1e-10</ixx>
          <ixy>0</ixy>
          <ixz>-6.26348e-14</ixz>
          <iyy>1e-10</iyy>
          <iyz>0</iyz>
          <izz>1e-08</izz>
        </inertia>
      </inertial>
      <collision name='dummy_collision_collision'>
        <pose frame=''>0 0 0.5 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>0.014</length>
            <radius>0.003</radius>
          </cylinder>
        </geometry>
        <surface>
          <contact>
            <ode/>
          </contact>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>0.5</mu2>
            </ode>
          </friction>
        </surface>
      </collision>
      <collision name='dummy_prismatic_link_collision_collision_1'>
        <pose frame=''>0 0 0.558 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>0.001</length>
            <radius>0.03</radius>
          </cylinder>
        </geometry>
        <surface>
          <contact>
            <ode/>
          </contact>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>0.5</mu2>
            </ode>
          </friction>
        </surface>
      </collision>
      <visual name='dummy_visual_visual'>
        <pose frame=''>0 0 0.5 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>0.014</length>
            <radius>0.003</radius>
          </cylinder>
        </geometry>
        <material>
          <script>
            <name>Gazebo/Orange</name>
            <uri>file://media/materials/scripts/gazebo.material</uri>
          </script>
        </material>
      </visual>
      <visual name='dummy_prismatic_link_visual_visual_1'>
        <pose frame=''>0 0 0.5 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>0.001</length>
            <radius>0.03</radius>
          </cylinder>
        </geometry>
        <material>
          <script>
            <name>Gazebo/Orange</name>
            <uri>file://media/materials/scripts/gazebo.material</uri>
          </script>
        </material>
      </visual>
      <velocity_decay/>
      <gravity>0</gravity>
      <gravity>1</gravity>
      <velocity_decay/>
      <self_collide>0</self_collide>
      <gravity>0</gravity>
    </link>
    <joint name='fixed' type='revolute'>
      <child>dummy</child>
      <parent>world</parent>
      <axis>
        <limit>
          <lower>0</lower>
          <upper>0</upper>
        </limit>
        <dynamics>
          <damping>0</damping>
          <friction>0</friction>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
        </dynamics>
        <use_parent_model_frame>1</use_parent_model_frame>
        <xyz>0 0 1</xyz>
      </axis>
    </joint>
    <link name='gripper_main_body'>
      <pose frame=''>0 0 0.5 3.14159 0 3.14159</pose>
      <inertial>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <mass>0.74</mass>
        <inertia>
          <ixx>0.00137517</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.00137517</iyy>
          <iyz>0</iyz>
          <izz>0.000333</izz>
        </inertia>
      </inertial>
      <collision name='gripper_main_body_collision_collision'>
        <pose frame=''>0 0 0.065 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>0.14</length>
            <radius>0.03</radius>
          </cylinder>
        </geometry>
        <surface>
          <contact>
            <ode/>
          </contact>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>0.5</mu2>
            </ode>
          </friction>
        </surface>
      </collision>
      <visual name='gripper_main_body_visual_visual'>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <geometry>
          <mesh>
            <scale>1 1 1</scale>
            <uri>model:///gripper/meshes/main_body.stl</uri>
          </mesh>
        </geometry>
        <material>
          <script>
            <name>Gazebo/Orange</name>
            <uri>file://media/materials/scripts/gazebo.material</uri>
          </script>
        </material>
      </visual>
      <gravity>1</gravity>
      <velocity_decay/>
      <self_collide>0</self_collide>
      <gravity>0</gravity>
    </link>
    <joint name='dummy_prismatic_joint' type='prismatic'>
      <child>gripper_main_body</child>
      <parent>dummy</parent>
      <axis>
        <xyz>0 0 -1</xyz>
        <limit>
          <lower>-0</lower>
          <upper>0.02</upper>
          <effort>1</effort>
          <velocity>1</velocity>
        </limit>
        <dynamics>
          <damping>0.2</damping>
          <friction>0</friction>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
        </dynamics>
        <use_parent_model_frame>1</use_parent_model_frame>
      </axis>
    </joint>
    <link name='gripper_finger1'>
      <pose frame=''>-0.001 0.01375 0.37075 3.14159 0 3.14159</pose>
      <inertial>
        <pose frame=''>0 0 0.02 0 -0 0</pose>
        <mass>0.075</mass>
        <inertia>
          <ixx>1.29297e-05</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>1.29297e-05</iyy>
          <iyz>0</iyz>
          <izz>5.85938e-06</izz>
        </inertia>
      </inertial>
      <collision name='gripper_finger1_collision_collision'>
        <pose frame=''>0 0 0.035 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>0.04</length>
            <radius>0.0125</radius>
          </cylinder>
        </geometry>
        <surface>
          <contact>
            <ode/>
          </contact>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>0.5</mu2>
            </ode>
          </friction>
        </surface>
      </collision>
      <visual name='gripper_finger1_visual_visual'>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <geometry>
          <mesh>
            <scale>1 1 1</scale>
            <uri>model:///gripper/meshes/finger.stl</uri>
          </mesh>
        </geometry>
        <material>
          <script>
            <name>Gazebo/Red</name>
            <uri>file://media/materials/scripts/gazebo.material</uri>
          </script>
        </material>
      </visual>
      <gravity>1</gravity>
      <velocity_decay/>
      <self_collide>0</self_collide>
      <gravity>0</gravity>
    </link>
    <joint name='gripper_joint1' type='prismatic'>
      <child>gripper_finger1</child>
      <parent>gripper_main_body</parent>
      <axis>
        <xyz>0 1 0</xyz>
        <limit>
          <lower>-0.01</lower>
          <upper>0.01</upper>
          <effort>1</effort>
          <velocity>1</velocity>
        </limit>
        <dynamics>
          <damping>0.2</damping>
          <friction>0</friction>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
        </dynamics>
        <use_parent_model_frame>1</use_parent_model_frame>
      </axis>
    </joint>
    <link name='gripper_finger2'>
      <pose frame=''>-0.001 -0.012 0.37075 3.14159 -0 0</pose>
      <inertial>
        <pose frame=''>0 0 0.02 0 -0 0</pose>
        <mass>0.075</mass>
        <inertia>
          <ixx>1.29297e-05</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>1.29297e-05</iyy>
          <iyz>0</iyz>
          <izz>5.85938e-06</izz>
        </inertia>
      </inertial>
      <collision name='gripper_finger2_collision_collision'>
        <pose frame=''>0 0 0.035 0 -0 0</pose>
        <geometry>
          <cylinder>
            <length>0.04</length>
            <radius>0.0125</radius>
          </cylinder>
        </geometry>
        <surface>
          <contact>
            <ode/>
          </contact>
          <friction>
            <ode>
              <mu>0.5</mu>
              <mu2>0.5</mu2>
            </ode>
          </friction>
        </surface>
      </collision>
      <visual name='gripper_finger2_visual_visual'>
        <pose frame=''>0 0 0 0 -0 0</pose>
        <geometry>
          <mesh>
            <scale>1 1 1</scale>
            <uri>model:///gripper/meshes/finger.stl</uri>
          </mesh>
        </geometry>
        <material>
          <script>
            <name>Gazebo/Red</name>
            <uri>file://media/materials/scripts/gazebo.material</uri>
          </script>
        </material>
      </visual>
      <gravity>1</gravity>
      <velocity_decay/>
      <self_collide>0</self_collide>
      <gravity>0</gravity>
    </link>
    <joint name='gripper_joint2' type='prismatic'>
      <child>gripper_finger2</child>
      <parent>gripper_main_body</parent>
      <axis>
        <xyz>0 -1 0</xyz>
        <limit>
          <lower>-0.01</lower>
          <upper>0.01</upper>
          <effort>1</effort>
          <velocity>1</velocity>
        </limit>
        <dynamics>
          <damping>0.2</damping>
          <friction>0</friction>
          <spring_reference>0</spring_reference>
          <spring_stiffness>0</spring_stiffness>
        </dynamics>
        <use_parent_model_frame>1</use_parent_model_frame>
      </axis>
    </joint>
  </model>
</sdf>

Originally posted by Fiddle on Gazebo Answers with karma: 35 on 2017-12-12

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

If I understood correctly, your intention is that by turning off gravity, the links will stay fixed in the world, correct?

I haven't played much with turning off gravity for some links in a model, but I suspect that even if that works, your gripper would move once it starts having contact with the models it is grasping.

If my assumption is correct and you want the arm to be fixed, I suggest you use a fixed joint to the world. Here's an SDF example, you should be able to achieve the same result with URDF, I think.

Update

There is a known issue with gravity tags when converting from URDF to SDF:

https://bitbucket.org/osrf/sdformat/issues/71/incorrect-urdf-to-sdf-conversion-of


Originally posted by chapulina with karma: 7504 on 2017-12-12

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Fiddle on 2017-12-13:
I want to turn off the gravity for almost all links, except the dummy ones, so I can still move it up and down, while it still is in the air

Comment by chapulina on 2017-12-13:
I see, have you tried writing a simple SDF model with some links gravity turned off? That would confirm the problem happens when using URDF.

Comment by Fiddle on 2017-12-13:
I ran the urdf file through the gz sdf command and the way it handles gravity tags seems a little strange to me: 1

   <velocity_decay/>

  <self_collide>0</self_collide>

  <gravity>0</gravity>

Maybe while loading the model Gazebo reads only the first tag? I'd rather use urdf, since I'll need to connect it to the main robot later anyway.

Comment by chapulina on 2017-12-13:
Ahh sorry I only saw the rest of your question now. It looks like this is a known issue: https://bitbucket.org/osrf/sdformat/issues/71/incorrect-urdf-to-sdf-conversion-of

Comment by Fiddle on 2017-12-14:
Thanks, that works! No I have another little problem, but I'll post it in another question to not make a mess out of this one. http://answers.gazebosim.org/question/18109/movement-of-smaller-links-affecting-the-whole-body/

$\endgroup$

Your Answer

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