Home | Tutorials | Wiki | Issues
Ask Your Question

Add a light to Turtlebot

asked 2017-10-03 12:31:36 -0500

Ash_100 gravatar image

How can I add a structure indicating head-lamp to Turtlebot and then attached point/spot light to that structure? I am using ROS kinetic and Gazebo 7.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-10-03 13:08:15 -0500

You can use the AttachLightPlugin, here's an example.

edit flag offensive delete link more


Thanks. I am already using it. I was able to build it successfully and test it. But I have two questions (1) How to dynamically turn off/on the green spot light? (2) How such a light could be integrated to Turtlebot since I can't find Turtlebot description in SDF format, therefore, can't attach a light to a link?

Ash_100 gravatar imageAsh_100 ( 2017-10-03 13:33:11 -0500 )edit

@Ash_100 Did you managed to turn ON/OFF the light dynamically? I have seen your [other question](http://answers.gazebosim.org/question/17381/different-classes-for-light/) but did not managed to interact with the rendering part from the model plugin.

rreignier gravatar imagerreignier ( 2017-11-07 11:44:31 -0500 )edit

To turn lights on/off, you can send a Gazebo message to ~/visual altering its emissive values. An example here: https://bitbucket.org/osrf/gazebo/src/4f8e0728b55fd2827cbab3395d792bef218a5aae/examples/stand_alone/stop_light/stop_light.cc?at=citysim&fileviewer=file-view-default

chapulina gravatar imagechapulina ( 2017-11-08 14:05:00 -0500 )edit

@chapuline Thanks!< I was sending a message to ~/light/modify to change the colors of diffuse and specular (between Black and White). Which solution would you recommend?

rreignier gravatar imagerreignier ( 2017-11-09 04:42:04 -0500 )edit

Also, since I have added the AttachLightPlugin (on 9 lights), I have noticed that gzclient (v8.1 from OSRF repos) leaks memory quite quickly so I cannot keep simulation more than 10 minutes open. Did you also notice that behavior?

rreignier gravatar imagerreignier ( 2017-11-09 13:53:19 -0500 )edit

ha, I'm pretty sure I deleted the earlier comment right after I posted and realized you were taking ab out real lights, not "visual LEDs". Bug in Gazebo Answers... Anyway, ~/light/modify should be the way to go, this is how gzclient does it.

chapulina gravatar imagechapulina ( 2017-11-09 14:34:23 -0500 )edit

As for performance, you could wait for the next Gazebo 7 release ;) https://bitbucket.org/osrf/gazebo/pull-requests/2807/add-light-as-child-of-link/diff

chapulina gravatar imagechapulina ( 2017-11-09 14:35:28 -0500 )edit

Interesting. Thanks! When you talk about performance, you refer to my memory leak issue? About "Visual LEDs", I cannot attach them to links, right? An about the mentioned PR, if it lands in Gazebo 7, it should also arrives in Gazebo 8, isn't it?

rreignier gravatar imagerreignier ( 2017-11-09 15:17:31 -0500 )edit

Yes, memory leak relates to performance. By "visual LEDs" I mean changing the emissive color of a visual like this, so it's not a light and will not affect objects around it: https://twitter.com/chapulinaBR/status/920436448024596481. Sure, the PR will first need to land on gz7 and then be ported to gz8.

chapulina gravatar imagechapulina ( 2017-11-09 15:28:32 -0500 )edit

Ok thanks, I see the difference now. Indeed, I need the real lights. So I am now waiting for the merge of the PR.

rreignier gravatar imagerreignier ( 2017-11-10 03:10:07 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-10-03 12:31:36 -0500

Seen: 686 times

Last updated: Oct 03 '17