Ask Your Question
0

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

asked 2021-05-03 13:16:44 -0500

GazeboGeek gravatar image
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 { texture_unit { 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 - <model> <name>GTX Cup Car</name> <version>1.0</version> <sdf version="1.5">gtx_cupcar.sdf</sdf> <author> <name>Benjamin Perseghetti</name> <email>bperseghetti@rudislabs.com> </author> <description>A model of the GTX Cup Car.</description> </model>

edit retag flag offensive close merge delete

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

shonigmann gravatar image shonigmann  ( 2021-05-04 14:35:08 -0500 )edit

Please note: this reads like a Gazebo question.

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

gvdhoorn gravatar image gvdhoorn  ( 2021-05-05 02:59:34 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-04 14:51:00 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-05-03 13:16:44 -0500

Seen: 38 times

Last updated: May 04