Texturing a urdf object dynamically
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?