Texture model from URDF

asked 2022-09-01 13:09:54 -0500

MarqRazz gravatar image

Gazebo Version: Fortress

ROS Version: Humble

I am working on testing out an extrinsic camera calibration library and I would like to use Gazebo as my ground truth but I need to attach a calibration grid to the end of my robot arm and I'm struggling to get it to render properly in simulation.

In my URDF I have the following (see below) and you can see that I have tried several different methods (they are commented out) but the only way I have been able to change the material of this link is with the <material name=""> <color rgba="1.0 0 0 1" /> </material> tag which is not super useful because its a single color (I need to map an image to the surface).

Inside the <gazebo reference= block I have tried with and without the <visual name="visual"> blocks and when I don't include them I get the following message when I start the simulation. [ign gazebo-4] Warning [parser_urdf.cc:1184] Attribute value string not set

If anyone has suggestions or tips on how I can get this working I would really appreciate your help!

<link name="cal_grid_link">
  <inertial>
    <origin xyz="0 0 0" rpy="0 0 0" />
    <mass value="0.1" />
    <inertia ixx="0.00021268" ixy="5.21E-06" ixz="2.91E-06" iyy="0.00106371" iyz="1.1E-07" izz="0.00108465" />
  </inertial>
  <collision name="collision">
    <geometry>
      <box size="0.1 0.2 0.01"/>
    </geometry>
  </collision>
  <visual name="visual">
    <geometry>
      <box size="0.1 0.2 0.01"/>
    </geometry>  
    <!-- <material name="green"> Does NOT work!!!
      <ambient>1 1 1 1</ambient>
      <diffuse>0 1 0 1</diffuse>
      <specular>0 0 0.3 1</specular>
  </material>       -->
  <material name="">
    <color rgba="1.0 0 0 1" />
  </material>
  </visual>
</link>
<gazebo reference="cal_grid_link">
  <!-- <visual name="visual">   Does NOT work!!!
    <material>
      <script>
          <uri>file://media/materials/scripts/gazebo.material</uri>
          <name>Gazebo/Red</name>
      </script>
    </material>
  </visual> -->
  <!-- <visual>  Does NOT work!!!
    <material name="cal_pattern">      
      <diffuse>1 1 1 1</diffuse>
      <specular>0.4 0.4 0.4 1</specular>
      <pbr>
        <metal>
          <albedo_map>file:///root/calibration_ws/src/ros2_kortex/kortex_description/arms/gen3_lite/6dof/meshes/materials/textures/pattern.png</albedo_map>
        </metal>
      </pbr>
    </material>  
  </visual> -->
</gazebo>
<joint name="cal_grid_joint" type="fixed">
  <origin xyz="0.3 0.3 0.3" rpy="0 0 0" />
  <parent link="${prefix}upper_wrist_link" />
  <child link="cal_grid_link" />
</joint>
edit retag flag offensive close merge delete

Comments

I've run out of ideas here, if there are any Gazebo experts out there I could really use your help!

I tried to embed the texture into the mesh with Blender and it works in Rviz but not in Ignition Gazebo.

image description

MarqRazz gravatar imageMarqRazz ( 2022-09-06 13:29:37 -0500 )edit