Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Change color of a link runtime

Hi, I'd like to change the color of a link runtime, i.e. accessing (via C++ API) to the material property of link1 in the following sdf:

    <model name ='sphere'>
        <pose>0 0 0 0 0 0</pose>
        <link name ='link1'>
          <pose>0 0 0 0 0 0</pose>
          <visual name ='visual'>
                <ambient>1 0 0 1</ambient>
                <diffuse>0 0 0 1</diffuse>

Looking at the documentation ( I was able to find several methods to access to other similar properties (e.g. gazebo::physics::Model::SetCollideMode) and also to the link (e.g. LinkPtr gazebo::physics::Model::GetLink) but nothing to access to visual and material properties. How can I do it?