ros-simulation / gazebo_ros_demos

Example robots and code for interfacing Gazebo with ROS
351 stars 227 forks source link

How to apply color using a URDF? #31

Open felixvd opened 6 years ago

felixvd commented 6 years ago

I am trying to assign color to an object in Gazebo from my URDF file, but I don't see what's going wrong. There is either a mistake I am not finding because it fails silently, or something else is not right.

Google turns up threads that go nowhere, or whose solutions don't seem to work, or that contradict the official doc: http://answers.gazebosim.org/question/6209/gazebo-is-not-displaying-all-the-colours-of-a-urdf-model/
http://answers.gazebosim.org/question/13718/how-to-add-a-colormaterial-to-a-stl-mesh-in-an-urdf-file/

In the documentation, the link to the rrbot.gazebo file is dead (it should go here), and just using the tag in that way does not seem to work either.

When I try to put a tag like this into the top level of my URDF file and start up gazebo, I get WARNING: unrecognized tag gazebo:

  <gazebo reference="robot_base">
    <material>Gazebo/Gray</material>
  </gazebo>

If I add it into the link's description, the part also stays white. What could be the issue? And why do I get that warning even when I don't use the tag? Hm.

felixvd commented 6 years ago

As an update, I got it to work by setting the reference on the same level as the link (not inside the link's tags), but only with "Gazebo/Grey" and not "Gazebo/Gray".

Fellfalla commented 4 years ago

Make sure your tags have no name attribute