Ask Your Question
2

Adding lights in Gazebo world

asked 2012-07-11 02:21:48 -0600

prasanna.kumar gravatar image

updated 2012-07-11 02:27:17 -0600

Hi, I have created the model of a house in gazebo with furniture and doors. Now I would like to add lights to the environment. That is by calling a service I want to switch on and off the light. Going by the tutorials I created a model file

<?xml version="1.0" ?>
<model:renderable xmlns:gazebo="http://playerstage.sourceforge.net/gazebo/xmlschema/#gz" xmlns:model="http://playerstage.sourceforge.net/gazebo/xmlschema/#model" xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor" xmlns:body="http://playerstage.sourceforge.net/gazebo/xmlschema/#body" xmlns:geom="http://playerstage.sourceforge.net/gazebo/xmlschema/#geom" xmlns:joint="http://playerstage.sourceforge.net/gazebo/xmlschema/#joint" xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller" xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface" xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering" xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics" xmlns:renderable="http://playerstage.sourceforge.net/gazebo/xmlschema/#renderable" name="light_model">
  <xyz>10 10 2</xyz>
    <enableGravity>false</enableGravity>
    <light>
      <type>point</type>
      <diffuseColor>0.8 0.8 0.8</diffuseColor>
      <specularColor>.4 .4 .4</specularColor>
      <attenuation>0.2 0.1 0</attenuation>
      <range>2</range>
    </light>
</model:renderable>

I saved this as light.model and I tried to spawn this light model by using

rosrun gazebo spawn_model -file `rospack find angen_gazebo`/objects/light.model -gazebo -model light -x 1 -y 1 -z 2

but I get the following error

[ERROR] [1342008109.535068231, 576.982000000]: GazeboROSNode SpawnModel Failure: input model_xml not Gazebo XML, or cannot be converted to Gazebo XML

I am not able to understand the error. Please help me with this or Is there any other way to control the lights in a gazebo environment ? Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2012-07-12 20:34:29 -0600

JonW gravatar image

Are you using gazebo 1.0 or later? This looks like the pre-1.0 gazebo format.

A description of the current format can be found on the gazebo website here.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2012-07-11 02:21:48 -0600

Seen: 1,110 times

Last updated: Jul 12 '12