Robotics StackExchange | Archived questions

Add flash light plugin on URDF

Hello,

I am doing a simulator for a submarine with uuv simulator with URDF file format.

I tried to use to plugin flash light on my code, but it seems the plugin is not imported .. !

I have no error, my code :

 <!-- Vehicle macro -->
  <xacro:macro name="submarine_base" params="namespace *gazebo">

      <link name="${namespace}/base_link">

        <inertia ixx="0.6" ixy="0" ixz="0"
                 iyy="30.0" iyz="0"
                 izz="35.0" />
        </inertial>

        <visual>
          <origin xyz="0 0 0" rpy="0 0 0"/>
          <geometry>
            <mesh filename="${visual_mesh_file}" scale="1 1 1" />
          </geometry>
        </visual>

        <collision>
          <origin xyz="0 0 0" rpy="0 0 0"/>
          <geometry>
            <mesh filename="${collision_mesh_file}" scale="1 1 1" />
          </geometry>
        </collision>
        <light>
            <id>cylinder/light_source1</id>
            <duration>0.5</duration>
            <interval>0.5</interval>
        </light>
      </link>

    <gazebo reference="${namespace}/base_link">
      <plugin name='light_control' filename='libFlashLightPlugin.so'>
          <enable>true</enable>
          <light>
            <id>cylinder/light_source1</id>
            <duration>0.5</duration>
            <interval>0.5</interval>
          </light>
       </plugin>
      <selfCollide>false</selfCollide>
    </gazebo>

    ....

  </xacro:macro>

</robot>

I have tried to put a light instance into the link and into the , but nothing to do ... What did I do wrong ?

Thank you very much !

Asked by TheGreatLebowski on 2019-12-16 08:48:29 UTC

Comments

Have you tried this? Going off of the tag names I see in this tutorial:

<gazebo reference="${namespace}/base_link">
<light name='cylinder/light_source1' type='spot'>
</light>
  <plugin name='light_control' filename='libFlashLightPlugin.so'>
      <enable>true</enable>
      <light>
        <id>cylinder/light_source1</id>
        <duration>0.5</duration>
        <interval>0.5</interval>
      </light>
   </plugin>
  <selfCollide>false</selfCollide>
</gazebo>

Asked by johnconn on 2019-12-17 00:44:37 UTC

It works perfectly ! Thank you very much for your help !

Asked by TheGreatLebowski on 2019-12-17 06:58:34 UTC

I'm glad that worked. Make sure to close the question if you're all set!

Asked by johnconn on 2019-12-17 10:10:57 UTC

hello, I have seen tutorial given by johnconn, but it is SDF format, I try libFlashLightPlugin in sdf, it works! however, I fail to run this plugin in xacro file. here is my code:

<joint name="${robot_namespace}/led_joint" type="fixed">
  <origin xyz="0 0 0" rpy="0 0 0" />
  <parent link="${robot_namespace}/base_link" />
  <child link="led_link" />
</joint>
<link name="led_link">
  <visual name="led">
    <origin xyz="0 0 -0.2" rpy="0 0 0" />
    <geometry>
     ...
    </geometry>
  </visual>
  <light name="led" type="point">
    ...
  </light>
</link>
<gazebo>
  <light> name ='led_link/led' type = 'point'</light>
  <plugin name='light_control' filename='libFlashLightPlugin.so'>
  <enable>true</enable>
  <light>
    <id>led_link/led</id>
    <duration>0.3</duration>
    <interval>0.4</interval>
    <color>0.5 1 0.8</color>
  </light>
  </plugin>
</gazebo>

Asked by myboyhood on 2020-04-08 03:09:31 UTC

Answers