Robotics StackExchange | Archived questions

How to add png file as a logo to a mesh which of the type - stl. The model file is of the form .sdf.jinja

I have been trying to add image file to a mesh which is a stl file by using the following commands : 
  <script>
       <name>Logo/GTX</name> 
       <uri>model://gtx_cupcar/materials/scripts/logo.material</uri>
       <uri>model://gtx_cupcar/materials/logo/gtx.png</uri>
      </script>

in my sdf code. Using this code and making logo.material file like: material Logo/GTX { technique { pass { textureunit { texture gtx.png scale 150.0 1.0 } } } } But from above steps, I am not getting the desired results. No logo is being added on the model. Please guide us on what changes can be made in my .sdf.jinja file to load the image on the mesh file. The config file is given below - <?xml version="1.0"?> GTX Cup Car 1.0 gtxcupcar.sdf Benjamin Perseghetti bperseghetti@rudislabs.com A model of the GTX Cup Car.

Asked by GazeboGeek on 2021-05-03 13:16:44 UTC

Comments

please edit your question to add code formatting to the exerts from your logo.material file and .sdf.jinja file to make your question more readable. just highlight the sections of text corresponding to the files, and click the 101010 button

Asked by shonigmann on 2021-05-04 14:35:08 UTC

Please note: this reads like a Gazebo question.

Those should not be posted here, but over at answers.gazebosim.org.

Asked by gvdhoorn on 2021-05-05 02:59:34 UTC

Answers

I would strongly recommend applying your logo/texture to your model in advance, prior to importing it to gazebo, rather than trying to mess with things like material scripts. My preferred approach is using Blender (free and open source, though admittedly a bit of a learning curve) to add a texture map to my mesh (e.g. .stl) files, then export as collada (.dae) with textures. This is a much stronger approach, especially for something like a logo where the relative size, scale, and position of the logo matters.

If you absolutely need to use ogre material scripts, its possible... I would recommend starting by looking in ~/.gazebo/ogre.log (or the equivalent location if you aren't using Ubuntu) to see if there are any error messages (e.g. "texture file not found") that might help guide you. And if you still need help, please clarify your question first to make it easier for people to figure out where your problem is.

Asked by shonigmann on 2021-05-04 14:51:00 UTC

Comments