I'm trying to display an image on top of a box in a .urdf file. How could I achieve this?
2 Answers
This ROS Answers response walks you through the steps. My answer is a summary of that post.
To add your image, called a texture, you first create a material file, let's call it box.material
and input your image file:
material YourMaterialName{
technique
{
pass
{
texture_unit
{
texture your_material_image.jpg
scale 1 1
}
}
}
}
Then, in your URDF file, you add a reference to the material above the link, like so:
<gazebo reference="your_link">
<material>YourMaterialName</material>
</gazebo>
Note that this approach only works for URDF primitives (boxes, cylinders, etc). If you are using a mesh file for your URDF you will need to use a different approach with a more complex material file.
I recomend you to watch this ROS Developers Live Class where it is explained how to build a URDF model of a robot: https://youtu.be/q01dDxeHTMs
The key point here is that you understand what is the difference between the collision and visual of the model, as well as the pose of those.
-
3$\begingroup$ Hello @Ricardo Tellez, it looks like you are an employee (or owner?) of The Construct, the publisher of the youtube video linked. Your post appears to promote this youtube channel without disclosure of affiliation. Please edit your post and disclose your affiliation. $\endgroup$– Ben ♦Sep 15, 2020 at 11:51