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

Revision history [back]

click to hide/show revision 1
initial version

hello, @Weasfas yes,I tried your method and got the same error like below:

Warning [parser.cc:950] XML Element[plugin], child of element[link] not defined in SDF. Ignoring[plugin]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.

But I find the solution first you can refer to link:original author solution second,the reason to your warning is that this block below

    <material>
      <ambient>0 0 0 1</ambient>
      <diffuse>0 0 0 1</diffuse>
      <specular>0 0 0 1</specular>
      <emissive>0 1 0 1</emissive>
    </material>

can not be include in link tag ,because they are SDF format,which will not be recognize by xacro. The solution is

<gazebo reference="led_link_0"> <visual> <material> <ambient>0 0 0 1</ambient> <diffuse>0 0 0 1</diffuse> <specular>0 0 0 1</specular> <emissive>0 1 0 1</emissive> </material> </visual> </gazebo>

only give "material" in gazebo tag with reference name(your link)


Third,I can not add flashlight by adding libFlashLightPlugin.so,However, below is my code for constant white light and colored emissive link

<joint name="${robot_namespace}/led_joint_0" type="fixed"> <origin xyz="0 0 0" rpy="0 0 0"/> <parent link="${robot_namespace}/base_link"/> <child link="led_link_0"/> </joint>

<link name="led_link_0">
  <visual>
    <origin xyz="0.17 0 -0.1" rpy="0 0 0" />
    <geometry>
      <cylinder radius="0.01" length="0.05"/>
    </geometry>
  </visual>
</link><!--it is useless to define light tag here, it helps to define light tag in gazebo tag below-->

<gazebo reference="${robot_namespace}/led_link_0">
  <visual>
    <material>
      <ambient>0 0 0 1</ambient>
      <diffuse>0 0 0 1</diffuse>
      <specular>0 0 0 1</specular>
      <emissive>0 1 0 1</emissive>
    </material>
  </visual>
  <light name ='${robot_namespace}/led_link_0/led' type = 'point'>
    <pose>-0.025 0 0.5 0 0 0</pose><!--you can place light position here ,and it is useless to give position in link-->
  </light>
  <plugin name='light_control' filename='libFlashLightPlugin.so'>
  <enable>true</enable>
  <light>
    <id>${robot_namespace}/led_link_0/led</id>
    <duration>0.3</duration>
    <interval>0.4</interval>
    <color>0.1 1 0.1</color>
    <enable>true</enable>
  </light>
  </plugin>
</gazebo>

Forth, if you want a emissive link and constant white light, above is a solution.another approach to make your link lighted is adding below tag outside of link tag

<gazebo reference="led_link_0">
  <material>Gazebo/GreenGlow</material>
</gazebo>

hello, @Weasfas yes,I tried your method and got the same error like below:

Warning [parser.cc:950] XML Element[plugin], child of element[link] not defined in SDF. Ignoring[plugin]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.

But I find the solution first you can refer to link:original author solution second,the reason to your warning is that this block below

    <material>
      <ambient>0 0 0 1</ambient>
      <diffuse>0 0 0 1</diffuse>
      <specular>0 0 0 1</specular>
      <emissive>0 1 0 1</emissive>
    </material>

can not be include in link tag ,because they are SDF format,which will not be recognize by xacro. The the solution is is

<gazebo reference="led_link_0"> <visual> <material> <ambient>0 0 0 1</ambient> <diffuse>0 0 0 1</diffuse> <specular>0 0 0 1</specular> <emissive>0 1 0 1</emissive> </material> </visual> </gazebo>

only give "material" in gazebo tag with reference name(your link)


Third,I can not add flashlight by adding libFlashLightPlugin.so,However, below is my code for constant white light and colored emissive link

<joint name="${robot_namespace}/led_joint_0" type="fixed"> <origin xyz="0 0 0" rpy="0 0 0"/> <parent link="${robot_namespace}/base_link"/> <child link="led_link_0"/> </joint>

<link name="led_link_0">
  <visual>
    <origin xyz="0.17 0 -0.1" rpy="0 0 0" />
    <geometry>
      <cylinder radius="0.01" length="0.05"/>
    </geometry>
  </visual>
</link><!--it is useless to define light tag here, it helps to define light tag in gazebo tag below-->

<gazebo reference="${robot_namespace}/led_link_0">
  <visual>
    <material>
      <ambient>0 0 0 1</ambient>
      <diffuse>0 0 0 1</diffuse>
      <specular>0 0 0 1</specular>
      <emissive>0 1 0 1</emissive>
    </material>
  </visual>
  <light name ='${robot_namespace}/led_link_0/led' type = 'point'>
    <pose>-0.025 0 0.5 0 0 0</pose><!--you can place light position here ,and it is useless to give position in link-->
  </light>
  <plugin name='light_control' filename='libFlashLightPlugin.so'>
  <enable>true</enable>
  <light>
    <id>${robot_namespace}/led_link_0/led</id>
    <duration>0.3</duration>
    <interval>0.4</interval>
    <color>0.1 1 0.1</color>
    <enable>true</enable>
  </light>
  </plugin>
</gazebo>

Forth, if you want a emissive link and constant white light, above is a solution.another approach to make your link lighted is adding below tag outside of link tag

<gazebo reference="led_link_0">
  <material>Gazebo/GreenGlow</material>
</gazebo>

hello, @Weasfas yes,I tried your method and got the same error like below:

Warning [parser.cc:950] XML Element[plugin], child of element[link] not defined in SDF. Ignoring[plugin]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element.

But I find the solution first you can refer to link:original author solution second,the reason to your warning is that this block below

    <material>
      <ambient>0 0 0 1</ambient>
      <diffuse>0 0 0 1</diffuse>
      <specular>0 0 0 1</specular>
      <emissive>0 1 0 1</emissive>
    </material>

can not be include in link tag ,because they are SDF format,which will not be recognize by xacro. the solution is

<gazebo reference="led_link_0"> <visual> <material> <ambient>0 0 0 1</ambient> <diffuse>0 0 0 1</diffuse> <specular>0 0 0 1</specular> <emissive>0 1 0 1</emissive> </material> </visual> </gazebo>

only give "material" in gazebo tag with reference name(your link)


Third,I can not add flashlight by adding libFlashLightPlugin.so,However, below is my code for constant white light and colored emissive link

<joint name="${robot_namespace}/led_joint_0" type="fixed"> <origin xyz="0 0 0" rpy="0 0 0"/> <parent link="${robot_namespace}/base_link"/> <child link="led_link_0"/> </joint>

<link name="led_link_0">
  <visual>
    <origin xyz="0.17 0 -0.1" rpy="0 0 0" />
    <geometry>
      <cylinder radius="0.01" length="0.05"/>
    </geometry>
  </visual>
</link><!--it is useless to define light tag here, it helps to define light tag in gazebo tag below-->

<gazebo reference="${robot_namespace}/led_link_0">
  <visual>
    <material>
      <ambient>0 0 0 1</ambient>
      <diffuse>0 0 0 1</diffuse>
      <specular>0 0 0 1</specular>
      <emissive>0 1 0 1</emissive>
    </material>
  </visual>
  <light name ='${robot_namespace}/led_link_0/led' type = 'point'>
    <pose>-0.025 0 0.5 0 0 0</pose><!--you can place light position here ,and it is useless to give position in link-->
  </light>
  <plugin name='light_control' filename='libFlashLightPlugin.so'>
  <enable>true</enable>
  <light>
    <id>${robot_namespace}/led_link_0/led</id>
    <duration>0.3</duration>
    <interval>0.4</interval>
    <color>0.1 1 0.1</color>
    <enable>true</enable>
  </light>
  </plugin>
</gazebo>

Forth, if you want a emissive link and constant white light, above is a solution.another approach to make your link lighted is adding below tag outside of link tag

<gazebo reference="led_link_0">
  <material>Gazebo/GreenGlow</material>
</gazebo>