Gazebo | Ignition | Community
Ask Your Question

How to use AttachLightPlugin in robot ?

asked 2017-11-20 09:58:00 -0500

patrickelectric gravatar image

It's possible to run the and, 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 ?

Here is my code.

edit retag flag offensive close merge delete


It looks like you're putting the light inside `<robot>`, which becomes a `<model>`. But the lights must be in the `<world>`.

chapulina gravatar imagechapulina ( 2017-11-20 10:22:40 -0500 )edit

Ok, the lights need to be inside world ? I want my robot to work with any world, is that not possible ?

patrickelectric gravatar imagepatrickelectric ( 2017-11-20 10:27:16 -0500 )edit

This feature is being actively worked on and should be available in a coming Gazebo 7 release:

chapulina gravatar imagechapulina ( 2017-11-20 11:14:04 -0500 )edit

Besides putting the <light> in the <world>, you need to wrap your <plugin> tag with <gazebo>. <gazebo><plugin ...=""> ... </plugin></gazebo>

aschmid gravatar imageaschmid ( 2018-09-03 08:17:05 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-08-31 15:16:22 -0500

brschettini gravatar image

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>

After this, try using the gazebo tag inside your robot (you missed the gazebo tag):

    <plugin name="attach_light" filename="">

That worked fine by me. Note that I was succeeded only after I updated Gazebo to the 7.14 version.

edit flag offensive delete link more


The feature to spawn a light in any world mentioned by @chapulina ( was released in Gazebo 7.10.Did you have to explicitly specify the light in the world even in Gazebo 7.14?

srsidd gravatar imagesrsidd ( 2018-10-18 15:58:21 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-11-20 09:58:00 -0500

Seen: 590 times

Last updated: Nov 20 '17