Gazebo | Ignition | Community
Ask Your Question

prasanna.kumar's profile - activity

2015-10-31 12:30:02 -0500 marked best answer Spawning a light source in gazebo world

Is there a way to spawn light sources in a gazebo world through .urdf or .model files (similar to spawning solid models)? I was successful in doing so in electric but it is not possible in fuerte. Is there a way ?

2015-10-31 12:24:37 -0500 marked best answer Specify xacro properties in launch file

I am working on ros-fuerte-gazebo. I have a world in which I want to spawn doors to different rooms.

Is there a way to specify the values for <xacro:property> tags in launch file ? I want to use a single *.urdf.xacro file using different values for the same property. Is it possible ?

For eg.: In door.urdf.xacro

<xacro:property name = room value = "workroom" />
<link name = "${room}_door">
....

I would like to specify the value "workroom" for the property room in the launch file so that I can use the same *.urdf.xacro file for all the rooms in my gazebo world (kitchen, bedroom etc..). I know I can use TinyXML but it will be easier and simpler if I can specify the properties in launch file. Or is there any other way out ?

Thanks!

PS: I know this is more a ros question than a gazebo question. I am posting here hoping some gazebo enthusiast would help me out.

2015-10-31 12:12:57 -0500 marked best answer Addiing light models in ros-fuerte

I was working for sometime in electric and I used the following light.urdf to spawn the model of light in gazebo.

<?xml version="1.0" ?>

<robot name="light_livingroom" xmlns:xi="http://www.w3.org/2001/XInclude"
  <link name="bulb_livingroom">
   <inertial>
    <mass value="1" />
            <com xyz="7.6 4.2 1.5" />
            <inertia ixx="1" ixy="0.0" ixz="0.0" iyy="1" iyz="0.0" izz="1" />
        </inertial>

        <visual>
            <origin xyz="7.6 4.2 1.5" rpy="0 0 0" />  <!--   definition of the visual postion of the object!! -->
            <geometry>
                <sphere radius="0.0001" />
            </geometry>
        </visual>
        <collision>
            <origin xyz="7.6 4.2 1.5" rpy="0 0 0" />
            <geometry>
                <sphere radius="0.0001" />
            </geometry>
        </collision>
    </link>

    <gazebo reference="bulb_livingroom">
        <model:renderable name="light_livingroom">
            <xyz>7.6 4.2 1.5</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>

When I try to spawn the same file in gazebo fuerte. The bulb model seens to oscillate under the ground. I tried replacing the content replacing model content with this

<gazebo reference="bulb_livingroom">
            <light type="directional" name="light_livingroom" cast_shadows="false">
                                <origin pose="7.6 4.2 1.5 0 0 0"/>
                                <diffuse rgba=".9 .9 .9 1"/>
                                <specular rgba=".1 .1 .1 1"/>
                                <attenuation range="20"/>
                                <direction xyz="0 0 -1"/>
                        </light>
    </gazebo>

Now, the bulb goes to (7.6, 4.2, 1.5) but no light comes out. Is my code wrong ? and is there a way to spawn custom light models in gazebo-fuerte ? Could someone give me a sample snippet if possible ?

Thanks.

2015-01-19 22:48:44 -0500 received badge  Famous Question (source)
2014-11-04 13:27:50 -0500 marked best answer using custom material for an object

I recently migrated to ROS fuerte from electric. I have an object (floor) in ROS electric for which I used the material Gazebo/LightWood. Now that Gazebo/LightWood material is no longer supported in ROS fuerte, how do I use LightWood texture for my object. I do not want my object to look plain in one colour (brown or sienna). I tried the following code but I got errors.

<visual name='floor_3_geom_visual' cast_shadows='1' laser_retro='0.000000' transparency='0.000000'>
          <origin pose='0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000'/>
          <geometry>
            <box size='4.465000 4.000000 0.050000'/>

            <material> <texture filename="/home/angenuser/Desktop/hardwood_floor.jpg"/>
        </material>

          </geometry>

        </visual>

And also, in general could someone give me the code snippet on how to add custom image to an object using a .jpg file. Eg situation: I have a tele-conferencing robot and I would like to put up a static jpg image on its screen.

2014-07-02 10:04:12 -0500 marked best answer problem with including a model

When I try to include a model in my world file, I get the following error in ROS-fuerte.

Error [SystemPaths.cc:262] cannot load file [models/angen_empty.model]in GAZEBO_RESOURCE_PATH[/home/angenuser/ros_workspace/angen_gazebo/Media/models]
Warning [parser.cc:348] Gazebo SDF has no gazebo element
Entity: line 2: parser error : Start tag expected, '<' not found

^
Error [parser_deprecated.cc:1365] Could not parse the xml
Entity: line 2: parser error : Start tag expected, '<' not found

^
Error [parser_deprecated.cc:1307] Could not parse the xml
Error [parser.cc:263] parse as old deprecated model file failed.
Error [parser.cc:500] Unable to read file[]
Error [parser.cc:557] Error reading element
Error [parser.cc:557] Error reading element
Error [parser.cc:340] Unable to parse sdf element[gazebo]
Error [parser.cc:263] parse as old deprecated model file failed.
Error [Server.cc:196] Unable to read sdf file[/home/angenuser/ros_workspace/angen_cognitive_environment/angen_gazebo/worlds/try.world]
[gazebo-2] process has died [pid 6314, exit code 255, cmd /opt/ros/fuerte/stacks/simulator_gazebo/gazebo/scripts/gazebo -u /home/angenuser/ros_workspace/angen_cognitive_environment/angen_gazebo/worlds/try.world __name:=gazebo __log:=/home/angenuser/.ros/log/dfdc436c-909c-11e2-9418-dc0ea13f6144/gazebo-2.log].
log file: /home/angenuser/.ros/log/dfdc436c-909c-11e2-9418-dc0ea13f6144/gazebo-2*.log

I attached the following code to the empty.world

<model name='angen_model' static='1'>
      <origin pose='0 0 0 0 0 0'/>
      <include filename='angen_empty.model'/>
</model>

I recently converted the .model file I am using to the new format using gzsdf recently. I works well as .world file but when I remove the world tags and use just the model, I get the errors.

Is this the problem with gazebo or am I doing a mistake ? Can someone tell a proper way to add a .model file to a world.

Thanks, Prasanna

2014-05-21 02:20:54 -0500 received badge  Taxonomist
2014-01-21 06:42:53 -0500 received badge  Famous Question (source)
2013-10-06 01:52:50 -0500 received badge  Famous Question (source)
2013-09-24 09:23:24 -0500 received badge  Popular Question (source)
2013-09-24 09:23:24 -0500 received badge  Notable Question (source)
2013-09-22 22:12:36 -0500 received badge  Famous Question (source)
2013-07-24 11:11:27 -0500 received badge  Famous Question (source)
2013-07-23 19:04:32 -0500 received badge  Notable Question (source)
2013-07-04 03:53:01 -0500 received badge  Notable Question (source)
2013-07-04 03:53:01 -0500 received badge  Popular Question (source)
2013-07-02 22:58:33 -0500 received badge  Notable Question (source)
2013-06-20 19:04:41 -0500 received badge  Famous Question (source)
2013-06-18 15:38:23 -0500 commented answer Adding light source as a model in Groovy-Gazebo

Hi, I know that I can insert light model from the insert tab on the GUI, I need to do it programatically. I have an apartment model and each room has a light bulb. When I run rosrun angenapps lightcontrol ON workroom, a light source should be spawned inside the bulb model(giving the impression of switching ON a light bulb). I was doing this in ROS-Electric using the above mentioned URDF model but I am not able to do the same in Fuerte or Groovy. Can you tell me a way to do it programatically ?

2013-06-18 06:57:45 -0500 asked a question Adding light source as a model in Groovy-Gazebo

I have been trying find an answer to this question for a very long time but I still haven't! "How to add light sources in the gazebo world dynamically ?" I am using ROS-Groovy (Gazebo 1.5.0).

In electric (pre-1.0 SDF) there was this <model:renderable> option where I was able to spawn light source as a model after launch the gazebo world in any pose I wanted.

<?xml version="1.0" ?>
<robot name="light_balcony">
  <link name="bulb_balcony">
   <inertial>
    <mass value="1" />
            <com xyz="11.27 3.15 2.25" />
            <inertia ixx="0" ixy="0.0" ixz="0.0" iyy="0" iyz="0.0" izz="0" />
        </inertial>

        <visual>
            <origin xyz="11.27 3.15 2.25" rpy="0 0 0" />  <!--   definition of the visual postion of the object!! -->
            <geometry>
                <sphere radius="0.0001" />
            </geometry>
        </visual>
        <collision>
            <origin xyz="11.27 3.15 2.25" rpy="0 0 0" />
            <geometry>
                <sphere radius="0.0001" />
            </geometry>
        </collision>
    </link>

    <gazebo reference="bulb_balcony">
        <model:renderable name="light_balcony">
            <xyz>11.27 3.15 2.25</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>

When I switched to fuerte, it was no longer an option and even in groovy, I am not able to find a way out :( I am able to add a light to my world file but what I really want is adding it dynamically similar to adding a model. Taking advice from @AndreiHaidu and others (here, and many other pages), I tried a lot like adding

<include>
        <uri>model://sun</uri>
        <pose>0.3 0.2 5.0 0 0 0</pose>
    </include>

or

<light type="directional" name="my_light">
            <pose>0 0 30 0 0 0</pose>
            <diffuse>.9 .9 .9 1</diffuse>
            <specular>.1 .1 .1 1</specular>
            <attenuation>
                <range>20</range>
            </attenuation>
            <direction>0 0 -1</direction>
            <cast_shadows>true</cast_shadows>
        </light>

I have tried these in different sdf formats too. All threw errors. Finally when I tried this,

    <gazebo version='1.0'>
    <model name='apartment_floor0' static='1'>
     <origin pose='-5 -5 0 0 0 0'/>
       <link name='ow_2_body' gravity='1' self_collide='0' kinematic='0'>
            <origin pose='0 0 0 0 0 0'/>
            <collision name='ow_2_geom' laser_retro='0.000000'>
              <origin pose='3.300000 0.150000 1.500000 0.000000 -0.000000 0.000000'/>
              <geometry>
                <box size='2.400000 0.300000 3.000000'/>
              </geometry>
              <surface>
                <friction>
                  <ode mu='-1.000000' mu2='-1.000000' fdir1='0.000000 0.000000 0.000000' slip1='0.000000' slip2='0.000000'/>
                </friction>
                <bounce restitution_coefficient='0.000000' threshold='100000.000000'/>
                <contact>
                  <ode soft_cfm='0.000000' soft_erp='0.200000' kp='1000000000000.000000' kd='1.000000' max_vel='100.000000' min_depth='0.001000'/>
                </contact>
              </surface>
            </collision>
            <visual name='ow_2_geom_visual' cast_shadows='1' laser_retro='0.000000' transparency='0.000000'>
              <origin pose='6.850000 1.500000 1.500000 0.000000 -0.000000 1.570800'/>
              <geometry>
                <box size='2.400000 0.300000 3.000000 ...
(more)
2013-06-18 04:18:55 -0500 received badge  Notable Question (source)
2013-06-13 09:56:50 -0500 asked a question p3d controller not working properly in groovy ??

I have a the model of a door in gazebo whose position I monitor using the p3d plugin. My algorithm for opening and closing the door is this

  • Find and set the yaw at which door can be assumed to be open/close.
  • Using the p3d controller get thecurrent yaw of the door joint (joint between door and world).
  • Until the current yaw = goal yaw apply a force to open/close the door. Once reached, remove the force and kill the node.

This was perfectly working for me in fuerte gazebo (1.0.2). I recently moved all my gazebo stuff to groovy. Now, by this algorithm, the doors swings and opens but some problem occurs and the door model seems to vibrate in place (shakes) and the node does not kill itself. I am suspecting it could be a problem with the p3d controller, since the node performs perfectly well in fuerte. I could also be in the urdf file. This is my urdf.xacro

<?xml version="1.0" ?>
<robot name="${room_name}_door" xmlns:xacro="http://ros.org/wiki/xacro" 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">
    <property name="room_name" value="workroom_f0" />
    <property name="x_position" value="3.73" />
    <property name="y_position" value="7.1" />
    <property name="z_position" value="0.06" />
    <property name="x_world_offset" value="-5" />
    <property name="y_world_offset" value="-5" />
    <property name="lower_limit" value="-2.5" />
    <property name="orientation" value="1.57" />
    <joint name="${room_name}_door_joint" type="revolute">
        <axis xyz="0 0 1" />
        <parent link="world" />
        <child link="${room_name}_door_block" />
        <origin rpy="0 0 ${orientation}" xyz="${x_position + x_world_offset} ${y_position + y_world_offset} ${z_position}" />
        <limit effort="100.0" lower="${lower_limit}" upper="0.001" velocity="5" />
    </joint>
    <joint name="doorblock_door" type="fixed">
        <axis xyz="0 0 1" />
        <parent link="${room_name}_door_block" />
        <child link="${room_name}_door" />
        <origin rpy="0 0 0" xyz="0 0 0" />
    </joint>
    <link name="world" />
    <link name="${room_name}_door_block">
        <inertial>
            <mass value="1" />
            <origin xyz="0 0 0" />
            <inertia ixx="1.0" ixy="0.0" ixz="0.0" iyy="1" iyz="0.0" izz="3" />
        </inertial>
        <visual>
            <origin rpy="0 0 0" xyz="0 0 0" />
            <geometry>
                <box size="0 0 0" />
            </geometry>
        </visual>
        <collision>
            <origin rpy="0 0 0" xyz="0 0 0" />
            <geometry>
                <box size="0 0 0" />
            </geometry>
        </collision>
    </link>
    <gazebo reference="${room_name}_door_block">
        <material>angen_gazebo/DoorWood</material>
        <laserRetro>2000</laserRetro>
        <dampingFactor>0.006</dampingFactor>
        <selfCollide>false</selfCollide>
        <turnGravityOff>true</turnGravityOff>
    </gazebo>
    <link name="${room_name}_door">
        <inertial ...
(more)
2013-05-31 04:52:53 -0500 received badge  Popular Question (source)
2013-05-04 01:34:29 -0500 received badge  Famous Question (source)
2013-04-30 17:43:41 -0500 received badge  Famous Question (source)
2013-04-20 11:36:57 -0500 received badge  Popular Question (source)
2013-04-16 03:31:18 -0500 received badge  Notable Question (source)
2013-04-16 02:40:50 -0500 received badge  Popular Question (source)
2013-04-11 18:30:29 -0500 received badge  Student (source)
2013-04-10 19:20:34 -0500 received badge  Notable Question (source)
2013-04-08 05:31:38 -0500 commented question .stl not supported in fuerte-gazebo ?

Yes you are right! My project-mate tried specifying 'scale' instead of mesh and it worked. Thanks. I downloaded all the 3d models from http://www.sweethome3d.com/importModels.jsp and converted them to stl using meshlab.

2013-04-07 06:17:11 -0500 received badge  Editor (source)
2013-04-07 06:16:27 -0500 asked a question .stl not supported in fuerte-gazebo ?

Hi,

I am trying to spawn few furniture models in my gazebo world. I am using gazebo in ros-fuerte. I tried them all in ros-electric-gazebo, simple to complicated mesh, .dae or .stl, everything worked but I am have problems spawning them in fuerte-gazebo. And I am getting why they occur.

  1. Some models do not appear at all, be it collada or stl, they do not appear at all.
  2. Some models do not appear as collada but when converted to stl using MeshLab the appear gigantically like this. (Somebody please give me 2 upvotes, I am not able to post images!)
  3. Only one model appears properly as of now like this.

What is the catch ? Why are they erratic ? All the models I have tried so far have worked properly in electric-gazebo.

This is my code in .world file:

<link name='WorkroomChair2_body' gravity='1' self_collide='0' kinematic='0'>
        <origin pose='0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000'/>
        <collision name='WorkroomChair2_top' laser_retro='0.000000'>
          <origin pose='2.475 7.05 0.045 0.000000 -0.000000 0.000000'/>
          <geometry>
            <mesh filename='rtable.stl' size='0.500000 0.650000 1.300000'/>
          </geometry>
          <surface>
            <friction>
              <ode mu='-1.000000' mu2='-1.000000' fdir1='0.000000 0.000000 0.000000' slip1='0.000000' slip2='0.000000'/>
            </friction>
            <bounce restitution_coefficient='0.000000' threshold='100000.000000'/>
            <contact>
              <ode soft_cfm='0.000000' soft_erp='0.200000' kp='1000000000000.000000' kd='1.000000' max_vel='100.000000' min_depth='0.001000'/>
            </contact>
          </surface>
        </collision>
        <visual name='WorkroomChair2_visual' cast_shadows='1' laser_retro='0.000000' transparency='0.000000'>
          <origin pose='2.475 7.05 0.045 0.000000 -0.000000 0.000000'/>
          <geometry>
            <mesh filename='rtable.stl' size='0.500000 0.650000 1.300000'/>
          </geometry>
          <material script='Gazebo/Red'/>
        </visual>
      </link>
    </model>

Thanks!

2013-04-05 07:23:45 -0500 received badge  Notable Question (source)