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

Revision history [back]

click to hide/show revision 1
initial version

If your geometry is not a mesh, i.e. you have a basic geometry in your visual tag (box, sphere, cylinder), this should work:

Create a material file example.material (your_package/media/materials/scripts/example.material)

material YourMaterial{
    technique
    {
        pass
        {
            texture_unit
            {
                texture your_material_image.jpg
                scale 1 1
            }
        }   
    }
}

Then, outside the <link> tag:

<gazebo reference="your_link"> <material>blabla</material> </gazebo> However, if your geometry is a mesh, then I am also trying to find out how to do it.

If your geometry is not a mesh, i.e. you have a basic geometry in your visual tag (box, sphere, cylinder), this should work:

Create a material file example.material (your_package/media/materials/scripts/example.material)

material YourMaterial{
    technique
    {
        pass
        {
            texture_unit
            {
                texture your_material_image.jpg
                scale 1 1
            }
        }   
    }
}

Then, outside the <link> tag:

<gazebo reference="your_link"> <material>blabla</material> <material>YourMaterial</material> </gazebo> However, if your geometry is a mesh, then I am also trying to find out how to do it.

If your geometry is not a mesh, i.e. you have a basic geometry in your visual tag (box, sphere, cylinder), this should work:

Create a material file example.material (your_package/media/materials/scripts/example.material)

material YourMaterial{
**YourMaterialName**{
    technique
    {
        pass
        {
            texture_unit
            {
                texture your_material_image.jpg
                scale 1 1
            }
        }   
    }
}

This file can have multiple materials, not just this one. Then, outside the <link> tag:tag of your URDF:

<gazebo reference="your_link"> <material>YourMaterial</material> <material>**YourMaterialName**</material> </gazebo>

However, if your geometry is a mesh, in addition you will need to prepare your mesh to receive the image. Open your mesh using Blender, then I am also trying to find out first imagine how to do it.

would you cut your solid with a scissor in order to put all surfaces in a plane. Then, select those edges, press Ctrl+E and select Mark Seam. The edges will become red. Split the window into 2 and in the new window choose UV/Image Editor as the Editor Type (bottom left corner). Then, press A to select everything, press U and choose Unwrap. At the UV/Image Editor will appear a geometry showing all your object faces. Now you can export to COLLADA (.dae) and put in your visual geometry mesh.

If you could not follow up the Blender steps, take a look at this tutorial: https://youtu.be/f2-FfB9kRmE

If your geometry is not a mesh, i.e. you have a basic geometry in your visual tag (box, sphere, cylinder), this should work:

Create a material file example.material (your_package/media/materials/scripts/example.material)

material **YourMaterialName**{
YourMaterialName{
    technique
    {
        pass
        {
            texture_unit
            {
                texture your_material_image.jpg
                scale 1 1
            }
        }   
    }
}

This file can have multiple materials, not just this one. Then, outside the <link> tag of your URDF:

<gazebo reference="your_link"> <material>**YourMaterialName**</material> <material>YourMaterialName</material> </gazebo>

However, if your geometry is a mesh, in addition you will need to prepare your mesh to receive the image. Open your mesh using Blender, then first imagine how would you cut your solid with a scissor in order to put all surfaces in a plane. Then, select those edges, press Ctrl+E and select Mark Seam. The edges will become red. Split the window into 2 and in the new window choose UV/Image Editor as the Editor Type (bottom left corner). Then, press A to select everything, press U and choose Unwrap. At the UV/Image Editor will appear a geometry showing all your object faces. Now you can export to COLLADA (.dae) and put in your visual geometry mesh.

If you could not follow up the Blender steps, take a look at this tutorial: https://youtu.be/f2-FfB9kRmE

If your geometry is not a mesh, i.e. you have a basic geometry in your visual tag (box, sphere, cylinder), this should work:

Create a material file example.material (your_package/media/materials/scripts/example.material)

material YourMaterialName{
    technique
    {
        pass
        {
            texture_unit
            {
                texture your_material_image.jpg
                scale 1 1
            }
        }   
    }
}

This file can have multiple materials, not just this one. Then, outside the <link> tag of your URDF:

<gazebo reference="your_link"> <material>YourMaterialName</material> </gazebo>

However, if your geometry is a mesh, in addition you will need to prepare your mesh to receive the image. Open your mesh using Blender, then first imagine how would you cut your solid with a scissor in order to put all surfaces in a plane. Then, select those edges, press Ctrl+E and select Mark Seam. The edges will become red. Split the window into 2 and in the new window choose UV/Image Editor as the Editor Type (bottom left corner). Then, press A to select everything, press U and choose Unwrap. At the UV/Image Editor will appear a geometry showing all your object faces. faces in a plane. Now you can export to COLLADA (.dae) and put in your visual geometry mesh.

If you could not follow up the Blender steps, take a look at this tutorial: https://youtu.be/f2-FfB9kRmE

If your geometry is not a mesh, i.e. you have a basic geometry in your visual tag (box, sphere, cylinder), this should work:

Create a material file example.material (your_package/media/materials/scripts/example.material)

material YourMaterialName{
    technique
    {
        pass
        {
            texture_unit
            {
                texture your_material_image.jpg
                scale 1 1
            }
        }   
    }
}

This file can have multiple materials, not just this one. Then, outside the <link> tag of your URDF:

<gazebo reference="your_link">
 <material>YourMaterialName</material>
</gazebo></gazebo>

However, if your geometry is a mesh, in addition you will need to prepare your mesh to receive the image. Open your mesh using Blender, then first imagine how would you cut your solid with a scissor in order to put all surfaces in a plane. Then, select those edges, press Ctrl+E and select Mark Seam. The edges will become red. Split the window into 2 and in the new window choose UV/Image Editor as the Editor Type (bottom left corner). Then, press A to select everything, press U and choose Unwrap. At the UV/Image Editor will appear a geometry showing all your object faces in a plane. Now you can export to COLLADA (.dae) and put in your visual geometry mesh.

If you could not follow up the Blender steps, take a look at this tutorial: https://youtu.be/f2-FfB9kRmE