Gazebo | Ignition | Community
Ask Your Question

Is it possible to change the color of an object in a Plugin?

asked 2019-10-12 05:21:53 -0600

PeterHer gravatar image

Hi All,

I have this piece of sdf code:

<link name="crossbar_back_top">
  <pose>0 0.6 1.03125 1.57 0 1.57</pose>
  <collision name="collision">
        <size>0.0625 0.0625 2.650</size>
  <visual name="visual">
        <size>0.0625 0.0625 2.650</size>

Can I change the color of the material like:

sdf::ElementPtr elementPtr = myModelPtr->GetSDF(); if (elementPtr->HasElement("")) // <<--- What to insert here? { .... }

Thanks, Peter

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-14 07:47:46 -0600

chapulina gravatar image

I recommend you publish a message to ~/visual with the new color. See an example here.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-10-12 05:21:53 -0600

Seen: 181 times

Last updated: Oct 14 '19