Add flash light plugin on URDF [closed]

asked 2019-12-16 07:52:32 -0500

TheGreatLebowski gravatar image

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 <gazebo>, but nothing to do ... What did I do wrong ?

Thank you very much !

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by TheGreatLebowski
close date 2019-12-17 09:12:34.476363

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>
johnconn gravatar image johnconn  ( 2019-12-16 23:44:37 -0500 )edit

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

TheGreatLebowski gravatar image TheGreatLebowski  ( 2019-12-17 05:58:34 -0500 )edit

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

johnconn gravatar image johnconn  ( 2019-12-17 09:10:57 -0500 )edit

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>
myboyhood gravatar image myboyhood  ( 2020-04-08 03:09:31 -0500 )edit