Adding lights at execution time in Gazebo-Fuerte [closed]

asked 2013-02-14 01:46:21 -0500

maurizio gravatar image

Hi,

I am running some simulations in Gazebo: the environment is an apartment with several rooms. During the simulation I need to switch on and off the light depending on the events that happen in the apartment.

In ROS-Electric I did it with the code below, but in Fuerte this code results in a link that oscillates like a pendulum... I tried to take a look in the forum but I didn't get any result... Do you see mistakes in the following code or should I go in another direction? In the second case, I didn't find useful links to add the light a run time.

Thanks

from shell:

rosrun gazebo spawn_model -file "path_to_the_urdf_file" -urdf -model light_k

the file related to the light is:

<?xml version="1.0" ?>

<robot name="light_kitchen" xmlns:xi="http://www.w3.org/2001/XInclude"
    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:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
    xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering"
    xmlns:renderable="http://playerstage.sourceforge.net/gazebo/xmlschema/#renderable"
    xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
    xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics">

  <link name="bulb_k">
   <inertial>
    <mass value="1" />
            <com xyz="1.81 3.59 2.15" />
            <inertia ixx="0" ixy="0.0" ixz="0.0" iyy="0" iyz="0.0" izz="0" />
        </inertial>

        <visual>
            <origin xyz="1.81 3.59 2.15" rpy="0 0 0" />  <!--   definition of the visual postion of the object!! -->
            <geometry>
                <sphere radius="0.0001" />
            </geometry>
        </visual>
        <collision>
            <origin xyz="1.81 3.59 2.15" rpy="0 0 0" />
            <geometry>
                <sphere radius="0.0001" />
            </geometry>
        </collision>
    </link>

    <gazebo reference="bulb_k">
        <model:renderable name="light_k">
            <xyz>0.0 0.0 0.0</xyz>
            <static>true</static>
            <light>
                <type>point</type>
                <diffuseColor>0.1 0.1 0.1</diffuseColor>
                <specularColor>.01 .01 .01</specularColor>
                <attenuation>0.1 0.1 0.0001</attenuation>
                <range>4</range>
            </light>
        </model:renderable>
    </gazebo>
</robot>
edit retag flag offensive reopen merge delete

Closed for the following reason Gazebo Question: The Gazebo community prefers to answer questions at: http://answers.gazebosim.org by tfoote
close date 2015-10-27 01:06:17.127460

Comments

This question is more likely to get a response on answers.gazebosim.org

joq gravatar imagejoq ( 2013-02-14 07:35:30 -0500 )edit