How to use AttachLightPlugin in robot ?
It's possible to run the touch_plugin_demo.world
and attach_lights.world
, but after some work I was not able to add the same functionality of attach_lights in my model.
The light need to be declared inside world
and linked in robot
?
Asked by patrickelectric on 2017-11-20 10:58:00 UTC
Answers
You need to put a light inside your world, as @chapulina told.
Please try to insert a custom light inside your world, like this one:
<light type="spot" name="test_light"> <pose>0 0 0 0 0 0</pose> <diffuse>1 1 1 0.5</diffuse> <specular>.1 .1 .1 1</specular> <attenuation> <range>10</range> <linear>0.5</linear> <constant>0.8</constant> <quadratic>0.01</quadratic> </attenuation> <cast_shadows>true</cast_shadows> </light>
After this, try using the gazebo tag inside your robot (you missed the gazebo tag):
<gazebo> <plugin name="attach_light" filename="libAttachLightPlugin.so"> <link> <link_name>${namespace}/light${suffix}_link</link_name> <light> <pose>${light_pose}</pose> <light_name>${light_name}</light_name> </light> </link> </plugin> </gazebo>
That worked fine by me. Note that I was succeeded only after I updated Gazebo to the 7.14 version.
Asked by brschettini on 2018-08-31 15:16:22 UTC
Comments
The feature to spawn a light in any world mentioned by @chapulina (https://bitbucket.org/osrf/gazebo/pull-requests/2807/add-light-as-child-of-link/diff) was released in Gazebo 7.10.Did you have to explicitly specify the light in the world even in Gazebo 7.14?
Asked by srsidd on 2018-10-18 15:58:21 UTC
Comments
It looks like you're putting the light inside
<robot>
, which becomes a<model>
. But the lights must be in the<world>
.Asked by chapulina on 2017-11-20 11:22:40 UTC
Ok, the lights need to be inside world ? I want my robot to work with any world, is that not possible ?
Asked by patrickelectric on 2017-11-20 11:27:16 UTC
This feature is being actively worked on and should be available in a coming Gazebo 7 release: https://bitbucket.org/osrf/gazebo/pull-requests/2807/add-light-as-child-of-link/diff
Asked by chapulina on 2017-11-20 12:14:04 UTC
Besides putting the in the , you need to wrap your tag with .
Asked by aschmid on 2018-09-03 08:17:05 UTC