ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Trying with the pioneer2dx_camera.world confirms that there is a bug with setting pose of nested models in diamondback and electric. The problem is due to a bug in the recursive updates in Entity.cc. Ticketed.

Current work around is to combine nested models into a single model. For example, pioneer2dx_camera.world becomes:

<?xml version="1.0"?>

<gazebo:world 
  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:window="http://playerstage.sourceforge.net/gazebo/xmlschema/#window" 
  xmlns:param="http://playerstage.sourceforge.net/gazebo/xmlschema/#param" 
  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:ui="http://playerstage.sourceforge.net/gazebo/xmlschema/#ui"
  xmlns:rendering="http://playerstage.sourceforge.net/gazebo/xmlschema/#rendering" 
  xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
  xmlns:physics="http://playerstage.sourceforge.net/gazebo/xmlschema/#physics" >

  <verbosity>5</verbosity>

  <physics:ode>
    <stepTime>0.001</stepTime>
    <gravity>0 0 0</gravity>
    <cfm>0.0000000001</cfm>
    <erp>0.2</erp>

    <stepType>quick</stepType>
    <stepIters>100</stepIters>
    <stepW>1.3</stepW>
    <contactMaxCorrectingVel>100.0</contactMaxCorrectingVel>
    <contactSurfaceLayer>0.00</contactSurfaceLayer>
  </physics:ode>

  <rendering:gui>
    <type>fltk</type>
    <size>800 600</size>
    <updateRate>20</updateRate>
    <pos>0 0</pos>

    <frames>
      <row height="100%">
        <camera width="100%">
          <xyz>0.35 -0.5 0.43</xyz>
          <rpy>0 14 111.5</rpy>
        </camera>
      </row>
    </frames>
  </rendering:gui>

  <rendering:ogre>
    <ambient>0.5 0.5 0.5 1.0</ambient>
  </rendering:ogre>

   <!-- Ground Plane -->
  <model:physical name="plane1_model">
    <xyz>0 0 0</xyz>
    <rpy>0 0 0</rpy>
    <static>true</static>

    <body:plane name="plane1_body">
      <geom:plane name="plane1_geom">
        <normal>0 0 1</normal>
        <size>2000 2000</size>
        <segments>10 10</segments>
        <uvTile>100 100</uvTile>
        <material>Gazebo/Grey</material>
      </geom:plane>
    </body:plane>
  </model:physical>

  <model:physical name="cylinder1_model">
    <xyz>1 -1.5 0.5</xyz>
    <rpy>0.0 0.0 0.0</rpy>

    <body:cylinder name="cylinder1_body">
      <massMatrix>true</massMatrix> 
      <mass>1.0</mass>
      <ixx>0.01</ixx>
      <ixy>0.00</ixy>
      <ixz>0.00</ixz>
      <iyy>0.01</iyy>
      <iyz>0.00</iyz>
      <izz>0.01</izz>
      <cx>0.0</cx>
      <cy>0.0</cy>
      <cz>0.0</cz>
      <geom:cylinder name="cylinder1_geom">
        <size>0.5 1</size>
        <visual>
          <mesh>unit_cylinder</mesh>
          <material>Gazebo/RustyBarrel</material>
        </visual>
      </geom:cylinder>
    </body:cylinder>
  </model:physical>

  <model:physical name="pioneer2dx_model1">
    <xyz>0 0 0.148</xyz>
    <rpy>0.0 0.0 0.0</rpy>

  <body:box name="sonyvid30_body">
    <xyz>0.15 0.0 0.09</xyz>
    <rpy>0.0 0.0 0.0</rpy>

    <massMatrix>true</massMatrix> 
    <mass>0.1</mass>
    <ixx>0.01</ixx>
    <ixy>0.00</ixy>
    <ixz>0.00</ixz>
    <iyy>0.01</iyy>
    <iyz>0.00</iyz>
    <izz>0.01</izz>
    <cx>0.0</cx>
    <cy>0.0</cy>
    <cz>0.0</cz>
    <geom:box name="camera_bottom_geom">
      <xyz>0.0 0.0 0.02</xyz>
      <rpy>0 0 90</rpy>
      <size>0.15 0.14 0.04</size>

      <visual>
        <rpy>0 0 -90</rpy>
        <size>0.15 0.14 0.04</size>
        <mesh>sonyvid30/sonyvid30_bottom.mesh</mesh>
        <material>Gazebo/Grey</material>
      </visual>
    </geom:box>
  </body:box>

  <body:box name="sonyvid30_column_body">
    <xyz>0.15 0.0 0.13</xyz>
    <rpy>0.0 0.0 0.0</rpy>

    <massMatrix>true</massMatrix> 
    <mass>0.01</mass>
    <ixx>0.001</ixx>
    <ixy>0.00</ixy>
    <ixz>0.00</ixz>
    <iyy>0.001</iyy>
    <iyz>0.00</iyz>
    <izz>0.001</izz>
    <cx>0.0</cx>
    <cy>0.0</cy>
    <cz>0.0</cz>
    <geom:box name="camera_column_geom">
      <xyz>0.02 0.00 0.0</xyz>
      <rpy>0 0 90</rpy>
      <size>0.11 0.11 0.03</size>

      <visual>
        <rpy>0 0 -90</rpy>
        <size>0.11 0.11 0.03</size>
        <mesh>sonyvid30/sonyvid30_mid.mesh</mesh>
        <material>Gazebo/Black</material>
      </visual>
    </geom:box>
  </body:box>


  <body:box name="sonyvid30_top_body">
    <xyz>0.15 0.0 0.15</xyz>
    <rpy>0.0 0.0 0.0</rpy>

    <massMatrix>true</massMatrix> 
    <mass>0.01</mass>
    <ixx>0.001</ixx>
    <ixy>0.00</ixy>
    <ixz>0.00</ixz>
    <iyy>0.001</iyy>
    <iyz>0.00</iyz>
    <izz>0.001</izz>
    <cx>0.0</cx>
    <cy>0.0</cy>
    <cz>0.0</cz>
    <geom:box name="camera_top_geom">
      <rpy>0 0 90</rpy>
      <size>0.12 0.119 0.03</size>

      <visual>
        <xyz>0.0 0.06 -0.015</xyz>
        <rpy>0 0 90</rpy>
        <size>0.12 0.119 0.03</size>
        <mesh>sonyvid30/sonyvid30_top.mesh</mesh>
        <material>Gazebo/Grey</material>
      </visual>
    </geom:box>

    <geom:cylinder name="camera_lens_geom">
      <xyz>0.045 -0.002 -0.002</xyz>
      <rpy>0 90 0</rpy>
      <size>0.01 0.04</size>

      <visual>
        <size>0.025 0.025 0.04</size>
        <mesh>unit_cylinder</mesh>
        <material>Gazebo/White</material>
      </visual>
    </geom:cylinder>

    <sensor:camera name="sonyvid30_camera_sensor">
      <imageSize>320 240</imageSize>
      <hfov>60</hfov>
      <nearClip>0.1</nearClip>
      <farClip>50</farClip>
      <saveFrames>false</saveFrames>
      <saveFramePath>frames</saveFramePath>

      <controller:generic_camera name="sonyvid30_camera_controller">
        <interface:camera name="camera_iface_0"/>
      </controller:generic_camera>
    </sensor:camera>
  </body:box>

  <joint:hinge name="pan_joint">
    <body1>sonyvid30_body</body1>
    <body2>sonyvid30_column_body</body2>
    <anchor>sonyvid30_body</anchor>
    <axis>0 0 1</axis>
    <lowStop>-170</lowStop>
    <highStop>170</highStop>
    <erp>0.2</erp>
    <cfm>10e-5</cfm>
  </joint:hinge>

  <joint:hinge name="tilt_joint">
    <body1>sonyvid30_column_body</body1>
    <body2>sonyvid30_top_body</body2>
    <anchor>sonyvid30_body</anchor>
    <axis>0 1 0</axis>
    <lowStop>-20</lowStop>
    <highStop>20</highStop>
    <erp>0.2</erp>
    <cfm>10e-5</cfm>
  </joint:hinge>

  <controller:generic_ptz name="sonyvid30_controller">
    <panJoint>pan_joint</panJoint>
    <tiltJoint>tilt_joint</tiltJoint>

    <motionGain>1</motionGain>
    <force>0.001</force>
    <interface:ptz name="ptz_iface_1"/>
  </controller:generic_ptz>

    <!-- 
    The include should be last within a model. All previous statements
    will override those in the included file 
    -->
    <include embedded="true">
      <xi:include href="models/pioneer2dx.model" />
    </include>
  </model:physical>

  <!-- White Directional light -->
  <model:renderable name="directional_white">
    <xyz>2.0 0 2.0</xyz>
    <static>true</static>

    <light>
      <type>spot</type>
      <spotCone>1000 1000 100</spotCone>
      <direction>-0.1 0 -0.9</direction>
      <diffuseColor>0.8 0.8 0.8</diffuseColor>
      <specularColor>0.1 0.1 0.1</specularColor>
      <range>10</range>

      <!-- Constant(0-1) Linear(0-1) Quadratic -->
      <attenuation>1.0 0.0 0</attenuation>
    </light>
  </model:renderable>

</gazebo:world>

one can potentially simplify above using xacro macros.