ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

If you just want to color parts differently, you can either use materials or textures. A working example using materials can be found in the hector_quadrotor_urdf package. In this package, you can find urdf, meshes and the blender model of a quadrotor with differently colored parts. This should give you a pretty good idea of how material based coloring works. Material based coloring is pretty easy as you can just assign materials on a per face basis and you don't have to care about uv unwrapping etc. in Blender. If you use materials it should be noted that gazebo (in electric at least) apparently calculates bounding boxes based on materials. I'm not sure if other collision checking mechanisms (e.g. collision checking for arm_navigation etc.) also do this. I'd recommend using a plain .stl for the collision model for this reason.

Texture based coloring also works with Blender 2.62, but I had some troubles with using alpha for textures. A example of a urdf model using both textures (logo on main body) and materials (hokuyo LIDAR, Kinect) can be seen here:

image description

As can be seen, there are still some quirks in the electric versions of gazebo and rviz. The color of the LIDAR for example looks like intended in gazebo, but bright yellow in rviz. Haven't tried fuerte yet, but I think there a fixes in the work for some of the ambient color and rendering problems both in rviz and gazebo.

click to hide/show revision 2
mention setting emissive and ambient terms manually

If you just want to color parts differently, you can either use materials or textures. A working example using materials can be found in the hector_quadrotor_urdf package. In this package, you can find urdf, meshes and the blender model of a quadrotor with differently colored parts. This should give you a pretty good idea of how material based coloring works. Material based coloring is pretty easy as you can just assign materials on a per face basis and you don't have to care about uv unwrapping etc. in Blender. If you use materials it should be noted that gazebo (in electric at least) apparently calculates bounding boxes based on materials. I'm not sure if other collision checking mechanisms (e.g. collision checking for arm_navigation etc.) also do this. I'd recommend using a plain .stl for the collision model for this reason.

Texture based coloring also works with Blender 2.62, but I had some troubles with using alpha for textures. A example of a urdf model using both textures (logo on main body) and materials (hokuyo LIDAR, Kinect) can be seen here:

image description

As can be seen, there are still some quirks in the electric versions of gazebo and rviz. The color of the LIDAR for example looks like intended in gazebo, but bright yellow in rviz. Haven't tried fuerte yet, but I think there a fixes in the work for some of the ambient color and rendering problems both in rviz and gazebo.

/edit: If you don't care about proper shading, you can try manually setting emissive and ambient terms for the materials you use as described here in the overview section.