set light properties through ros topic or service interface?
Is it possible to set light properties through the ros topic or service interface on /gazebo? For example any of the properties set in the sdf file and available through menus in the gui I'd like to be able to adjust:
<light type="spot" name="base_light">
<!-- Frames don't work in 5.0.1 XML Element[frame], child of element[light] not defined in SDF. Ignoring[frame]. You may have an incorrect SDF file, or an sdformat version that doesn't support this element. -->
<!--frame name="base_link"-->
<pose>0 0 0.1 1.57 0 0</pose>
<diffuse>.9 .9 .9 1</diffuse>
<specular>.1 .1 .1 1</specular>
<attenuation>
<range>20</range>
</attenuation>
<spot>
<inner_angle>0.4</inner_angle>
<outer_angle>1.0</outer_angle>
<falloff>1.0</falloff>
</spot>
<direction>0 0 -1</direction>
<cast_shadows>true</cast_shadows>
</light>
If not that, what about gz command line or gazebojs?
I'm using Ubuntu 14.04 with ROS Jade and Gazebo 5.0.1.
Asked by Lucas Walter on 2016-03-14 18:53:03 UTC
Answers
Gazebo does not use ros topics or services directly. Try using the command line tools provided in Gazebo.
Check if a topic exists that might offer a solution. In this case, just list the topics with
gz topic -l
The
/gazebo/default/light/modify
looks promisingLet's see what message is advertised on the topic with
gz topic -i /gazebo/default/light/modify
Looks like we can send a Light message.
Now try writing a program to send a light message.
Asked by nkoenig on 2016-03-15 10:40:41 UTC
Comments
I created two lights in my sdf, one directional and one spotlight, and they both have a _light
in their names, and they appear in the gui. gz topic --list
shows /gazebo/default/light, but no modify. There is a /gazebo/world/modify
, and a default pose and model modify.
Asked by Lucas Walter on 2016-03-15 11:12:21 UTC
The modify topic may only be in a newer version of gazebo. Sounds like you'll have to write a plugin to achieve the affect you desire.
Asked by nkoenig on 2016-03-15 11:23:03 UTC
I believe that in earlier gazebo versions, /gazebo/default/light
works just like the new modify topic. But if you try to modify a light by giving the name of a light which doesn't exist, it will create a new light.
Asked by chapulina on 2016-03-15 12:24:40 UTC
Comments