0
$\begingroup$

Gazebo Answers logo

HI!

I created a simple rock model, the visual is a .dae file and the collision is a simple box of roughly the same size. I then add multiple clones of the rock randomly distributed on the floor of my gazebo world (at the end of the world described in test2.sdf) I have a robot equipped with the Gazebo camera plugin. If I look inside the gazebo client gui, the rocks appear along all the other elements, and with the camera previzualization activated, it seems the camera sees everything (screenshot 1). But when I open for example rqt_image_view to check out the feed from the camera topic, then my rocks disappear (screenshot 2)! All the other elements are still viewed... Any idea why? And more importantly, any ideas how to fix this? I would like my robot to be able to see the rocks, for it to be able to avoid them, pick them up, etc.

Screenshot 1

15343228484713462.png

Screenshot 2

15343228676044275.png

Here are the files of my model

model.config

<?xml version="1.0"?>

<model>
  <name>unit_box_1</name>
  <version>1.0</version>
  <sdf version="1.5">model.sdf</sdf>

  <author>
    <name>Louis M</name>
    <email></email>
  </author>

  <description>
    A Rock.
  </description>
</model>

model.sdf

<?xml version="1.0" ?>
<sdf version="1.5">
  <model name="unit_box_1">
    <link name="link">
      <inertial>
        <pose>-0.01 -0.012 0.15 0 0 0</pose>
        <mass>0.390</mass>
        <inertia>
          <ixx>0.00058</ixx>
          <ixy>0</ixy>
          <ixz>0</ixz>
          <iyy>0.00058</iyy>
          <iyz>0</iyz>
          <izz>0.00019</izz>
        </inertia>
      </inertial>
      <collision name="collision">
        <pose>0 0 -0.46 0 0 0</pose>
        <geometry>
          <box>
            <size>0.05 0.05 0.2</size>
          </box>
        </geometry>
        <surface>
          <friction>
            <ode>
              <mu>1</mu>
              <mu2>1</mu2>
              <fdir1>0 0 0</fdir1>
              <slip1>0</slip1>
              <slip2>0</slip2>
            </ode>
            <torsional>
              <coefficient>1</coefficient>
              <patch_radius>0</patch_radius>
              <surface_radius>0</surface_radius>
              <use_patch_radius>1</use_patch_radius>
              <ode>
                <slip>0</slip>
              </ode>
            </torsional>
          </friction>
          <bounce>
            <restitution_coefficient>0</restitution_coefficient>
            <threshold>1e+06</threshold>
          </bounce>
          <contact>
            <collide_without_contact>0</collide_without_contact>
            <collide_without_contact_bitmask>1</collide_without_contact_bitmask>
            <collide_bitmask>1</collide_bitmask>
            <ode>
              <soft_cfm>0</soft_cfm>
              <soft_erp>0.2</soft_erp>
              <kp>1e+13</kp>
              <kd>1</kd>
              <max_vel>0.01</max_vel>
              <min_depth>0</min_depth>
            </ode>
            <bullet>
              <split_impulse>1</split_impulse>
              <split_impulse_penetration_threshold>-0.01</split_impulse_penetration_threshold>
              <soft_cfm>0</soft_cfm>
              <soft_erp>0.2</soft_erp>
              <kp>1e+13</kp>
              <kd>1</kd>
            </bullet>
          </contact>
        </surface>
      </collision>
      <visual name="visual">
        <pose>0 0 -0.46 0 0 0</pose>
        <geometry>
          <mesh>
            <uri>model://unit_box_1/meshes/experimental.dae</uri>
          </mesh>
        </geometry>
      </visual>
    </link>
    <static>0</static>
    <allow_auto_disable>1</allow_auto_disable>
  </model>
</sdf>

experimental.dae

<?xml version="1.0" encoding="UTF-8"?>
<COLLADA xmlns="http://www.collada.org/2005/11/COLLADASchema" version="1.4.1">
    <asset>
        <contributor>
            <author>VCGLab</author>
            <authoring_tool>VCGLib | MeshLab</authoring_tool>
        </contributor>
        <up_axis>Y_UP</up_axis>
        <created>Wed Apr 25 01:36:10 2012</created>
        <modified>Wed Apr 25 01:36:10 2012</modified>
        <unit meter="0.00254" name="inches"/>
    </asset>
    <library_images>
        <image id="texture0" name="texture0">
          <init_from>../materials/textures/coke_can.png</init_from>
        </image>
    </library_images>
    <library_materials>
        <material id="material0" name="material0">
            <instance_effect url="#material0-fx"/>
        </material>
    </library_materials>
    <library_effects>
        <effect id="material0-fx">
          <profile_COMMON>
                <newparam sid="texture0-surface">
                    <surface type="2D">
                        <init_from>texture0</init_from>
                        <format>R8G8B8</format>
                    </surface>
                </newparam>
                <newparam sid="texture0-sampler">
                    <sampler2D>
                        <source>texture0-surface</source>
                        <minfilter>LINEAR</minfilter>
                        <magfilter>LINEAR</magfilter>
                    </sampler2D>
                </newparam>
                <technique sid="common">
                    <blinn>
                        <emission>
                            <color>0 0 0 1</color>
                        </emission>
                        <ambient>
                            <color>1 1 1 1</color>
                        </ambient>
                        <diffuse>
                            <texture texture="texture0" texcoord="UVSET0"/>
                        </diffuse>
                        <specular>
                            <color>0.2 0.2 0.2 1</color>
                        </specular>
                        <shininess>
                            <float>0.3</float>
                        </shininess>
                        <reflective>
                            <color>0 0 0 1</color>
                        </reflective>
                        <reflectivity>
                            <float>0.5</float>
                        </reflectivity>
                        <transparent>
                            <color>0 0 0 1</color>
                        </transparent>
                        <transparency>
                            <float>0</float>
                        </transparency>
                        <index_of_refraction>
                            <float>0</float>
                        </index_of_refraction>
                    </blinn>
                </technique>
            </profile_COMMON>
        </effect>
    </library_effects>
    <library_geometries>
        <geometry id="shape0-lib" name="shape0">
            <mesh>
                <source id="shape0-lib-positions" name="position">
                    <float_array id="shape0-lib-positions-array" count="7686">-31.52  a lot of numbers 183.9</float_array>
                    <technique_common>
                        <accessor count="2562" source="#shape0-lib-positions-array" stride="3">
                            <param name="X" type="float"/>
                            <param name="Y" type="float"/>
                            <param name="Z" type="float"/>
                        </accessor>
                    </technique_common>
                </source>
                <source id="shape0-lib-normals" name="normal">
                    <float_array id="shape0-lib-normals-array" count="15360">0.671913 another lot of numbers -0.958825</float_array>
                    <technique_common>
                        <accessor count="5120" source="#shape0-lib-normals-array" stride="3">
                            <param name="X" type="float"/>
                            <param name="Y" type="float"/>
                            <param name="Z" type="float"/>
                        </accessor>
                    </technique_common>
                </source>
                <source id="shape0-lib-map" name="map">
                    <float_array id="shape0-lib-map-array" count="30720">0.01326 another big lot of numbers 0.5587</float_array>
                    <technique_common>
                        <accessor count="15360" source="#shape0-lib-map-array" stride="2">
                            <param name="U" type="float"/>
                            <param name="V" type="float"/>
                        </accessor>
                    </technique_common>
                </source>
                <vertices id="shape0-lib-vertices">
                    <input semantic="POSITION" source="#shape0-lib-positions"/>
                </vertices>
                <triangles count="5120" material="material0">
                    <input offset="0" semantic="VERTEX" source="#shape0-lib-vertices"/>
                    <input offset="1" semantic="NORMAL" source="#shape0-lib-normals"/>
                    <input offset="2" semantic="TEXCOORD" source="#shape0-lib-map"/>
                    <p>151 more numbers 15359</p>
                </triangles>
            </mesh>
        </geometry>
    </library_geometries>
    <library_visual_scenes>
        <visual_scene id="VisualSceneNode" name="VisualScene">
            <node id="node" name="node">
                <instance_geometry url="#shape0-lib">
                    <bind_material>
                        <technique_common>
                            <instance_material symbol="material0" target="#material0">
                                <bind_vertex_input semantic="UVSET0" input_semantic="TEXCOORD"/>
                            </instance_material>
                        </technique_common>
                    </bind_material>
                </instance_geometry>
            </node>
        </visual_scene>
    </library_visual_scenes>
    <scene>
        <instance_visual_scene url="#VisualSceneNode"/>
    </scene>
</COLLADA>

and here are my launch and world files

my_robot.launch

<?xml version="1.0"?>
<launch>

  <arg name="kinect_enabled" default="false"/>

  <include file="$(find gazebo_ros)/launch/empty_world.launch">
    <arg name="world_name" value="$(find my_robot_gazebo)/worlds/test2.sdf"/>
    <arg name="paused" value="true"/>
    <arg name="use_sim_time" value="true"/>
    <arg name="gui" value="true"/>
    <arg name="headless" value="false"/>
    <arg name="debug" value="false"/>
  </include>

  <include file="$(find my_robot_gazebo)/launch/spawn_my_robot.launch">
    <arg name="kinect_enabled" value="$(arg kinect_enabled)"/>
  </include>

test2.sdf (world)

This code block was moved to the following github gist: https://gist.github.com/answers-se-migration-openrobotics/63d34c457cd990c4f81e0319fecd4031

Thank you very much for any input on how to get my camera to see those rocks!

For info I am using Gazebo 9 with ROS Kinetic

Originally posted by kinglm on Gazebo Answers with karma: 1 on 2018-08-15

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Gazebo Answers logo

The solution that worked for me was putting the model description directly inside the world .sdf file. Under the tag, instead of I have which contains the entire description (the same one that was in the model.sdf file).

So no more model.config or model.sdf. The collada (.dae) mesh file is still in a separate folder though.

I don't know what the reason behind this is, and it bloats the world file, but at least now my camera output topic contains the rocks!

Cheers


Originally posted by kinglm with karma: 1 on 2018-10-10

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by m.bahno on 2020-09-18:
My guess would be that GAZEBO_MODEL_PATH is not set correctly for rqt_image_view and thus the models are not loaded. I had similar problem when trying to run Gazebo client on another machine.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.