gazebosim / ros_gz

Integration between ROS (1 and 2) and Gazebo simulation
https://gazebosim.org
Apache License 2.0
211 stars 125 forks source link

Adding geometry to UR5e Flange Link creates .world file "lump"? #535

Open lcbw opened 2 months ago

lcbw commented 2 months ago

Environment

Description

      <joint name='wrist_3-flange' type='fixed'>
        <pose relative_to='robot2/wrist_3_link'>0 0 0 0 0 0</pose>
        <parent>robot2/wrist_3_link</parent>
        <child>robot2/flange_link</child>
      </joint>
       <link name='flange_link'>
        <pose relative_to='flange_joint'>0 0 0 0 0 0</pose>
        <inertial>
          <pose>0 0 0 0 -0 0</pose>
          <mass>1.219</mass>
          <inertia>
            <ixx>1.1e-09</ixx>
            <ixy>0</ixy>
            <ixz>0</ixz>
            <iyy>1.1e-09</iyy>
            <iyz>0</iyz>
            <izz>1.1e-09</izz>
          </inertia>
        </inertial>
        <collision name='flange_link_collision'>
          <pose>0 0 0 1.57079 -1.57079 3.14159</pose>
          <geometry>
            <box>
              <size>0.01 0.01 0.01</size>
            </box>
          </geometry>
          <max_contacts>10</max_contacts>
          <surface>
            <contact>
              <ode/>
            </contact>
            <bounce/>
            <friction>
              <torsional>
                <ode/>
              </torsional>
              <ode/>
            </friction>
          </surface>
        </collision>
        <visual name='flange_link_visual'>
          <pose>0 0 0 1.57079 -1.57079 3.14159</pose>
          <geometry>
            <box>
              <size>0.01 0.01 0.01</size>
            </box>
          </geometry>
        </visual>
        <self_collide>0</self_collide>
        <enable_wind>0</enable_wind>
        <kinematic>0</kinematic>
      </link>

Steps to reproduce

  1. Copy the ur_macro.xacro file and make the following edit:

    
    <link name="${tf_prefix}wrist_3_link">
      <xacro:get_visual_params name="wrist_3" type="visual_offset"/>
      <visual>
        <origin xyz="0 0 ${visual_params}" rpy="${pi/2} 0 0"/>
        <geometry>
          <xacro:get_mesh name="wrist_3" type="visual"/>
        </geometry>
      </visual>
      <collision>
        <origin xyz="0 0 ${visual_params}" rpy="${pi/2} 0 0"/>
        <geometry>
          <xacro:get_mesh name="wrist_3" type="collision"/>
        </geometry>
      </collision>
      <xacro:cylinder_inertial radius="${wrist_3_inertia_radius}" length="${wrist_3_inertia_length}"  mass="${wrist_3_mass}">
        <origin xyz="0.0 0.0 ${-0.5 * wrist_3_inertia_length}" rpy="0 0 0" />
      </xacro:cylinder_inertial>
    </link>
    <!-- Modd'd ROS-Industrial 'tool0' frame - all-zeros tool frame -->
    <link name="${tf_prefix}flange_link">
      <visual>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <box size="0.01 0.01 0.01"/>
        </geometry>
      </visual>
      <collision>
        <origin xyz="0 0 0" rpy="0 0 0"/>
        <geometry>
          <box size="0.01 0.01 0.01"/>
        </geometry>
      </collision>
      <inertial>
          <mass value="2e-06"/>
          <inertia ixx="1.1e-09" ixy="0" ixz="0" iyy="1.1e-09" iyz="0" izz="1.1e-09"/>
      </inertial>
    </link>
    .....
    
    <joint name="${tf_prefix}wrist_3_joint" type="revolute">
      <parent link="${tf_prefix}wrist_2_link" />
      <child link="${tf_prefix}wrist_3_link" />
      <origin xyz="${wrist_3_x} ${wrist_3_y} ${wrist_3_z}" rpy="${wrist_3_roll} ${wrist_3_pitch} ${wrist_3_yaw}" />
      <axis xyz="0 0 1" />
      <limit lower="${wrist_3_lower_limit}" upper="${wrist_3_upper_limit}"
             effort="${wrist_3_effort_limit}" velocity="${wrist_3_velocity_limit}"/>
      <xacro:if value="${safety_limits}">
         <safety_controller soft_lower_limit="${wrist_3_lower_limit + safety_pos_margin}" soft_upper_limit="${wrist_3_upper_limit - safety_pos_margin}" k_position="${safety_k_position}" k_velocity="0.0"/>
      </xacro:if>
      <dynamics damping="0" friction="0"/>
    </joint>
    <!-- ROS-Industrial 'flange' frame - attachment point for EEF models -->
    <joint name="${tf_prefix}wrist_3-flange" type="fixed">
      <parent link="${tf_prefix}wrist_3_link" />
      <child link="${tf_prefix}flange_link" />
      <origin xyz="0 0 0" rpy="0 ${-pi/2.0} ${-pi/2.0}" />
      <axis xyz="0 0 1.0"/>
      <dynamics damping="0" friction="0"/>
    </joint>
2. Autogenerate a .world gazebo file and launch gazebo using the following commands: 
# Gazebo nodes
gazebo = IncludeLaunchDescription(
    PythonLaunchDescriptionSource(
        [FindPackageShare("gazebo_ros"), "/launch", "/gazebo.launch.py"]
    ),
)

# Spawn robot
gazebo_spawn_robot = Node(
    package="gazebo_ros",
    executable="spawn_entity.py",
    name="spawn_ur",
    arguments=["-entity", "armatrix", "-topic", "robot_description"],
    output="screen",
)

3. Save off the .world file generated by using the Save As... menu in the Gazebo UI. 

## Output
<!-- Provide screenshots, console logs, backtraces, and/or anything that could
be useful to us resolving this issue -->
(Output is same as above)