Gazebo | Ignition | Community
Ask Your Question

Texturing a urdf object dynamically

asked 2013-02-12 14:01:04 -0600

ewall gravatar image

I'm trying to dynamically generate a grid in Gazebo- I need to be able to specify length and width of each cell as well as the number of columns and rows. The grid will be a checkerboard pattern of two colors used for tracking while simulating two quadcopters. So far I have written a C++ program to generate a .urdf file that creates the correct number of links and joints with the appropriate colors. Launching this was fine as long as the grid was a 3x3 or smaller. Beyond that, Gazebo was somehow overloaded- the object would be spawned and collisions would work as expected, but you couldn't see anything.

So now I'm taking a different approach- generating a single box and texturing it with a dynamically generated .png image. I can generate the image file as expected, but I'm not sure how to apply the image to the box. I've tried applying a <texture> tag with the file name of the image, but that doesn't work. I just need the image applied to the top face- Any suggestions for how to do this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-02-12 14:41:08 -0600

Stefan Kohlbrecher gravatar image

I'm not sure this is the best option (it's probably one of the more hacky ones, but the first one that comes to my mind ;) ), nevertheless it should work in principle: If you embed the textures in COLLADA files that you use for your URDF, you can either change the texture name in your COLLADA files (by opening and changing them) or you could put every COLLADA mesh into it's own folder with it's associated texture and reference those different folders in your URDF. A example of COLLADA with embedded texture is this. If you do not need a texture, but only color, you should be able to use material colors instead of textures, which is simpler.

Also, for you application it likely makes sense to model the grid parts as SDF files and give them the static attribute (which means they are not objects that have to be dynamically simulated, increasing speed and stability of simulation). Last time I checked this wasn't possible for URDF models.

edit flag offensive delete link more

answered 2013-07-24 11:24:11 -0600

nkoenig gravatar image

If your grid is just a visualization, then you should just create a texture that is applied to applied to a plane. This is most efficient for rendering and physics.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2013-02-12 14:01:04 -0600

Seen: 1,515 times

Last updated: Jul 24 '13