Robotics StackExchange | Archived questions

Referencing models from other package's launch files

Hi guys,

is it possible to distribute world models (incl. dae-files) and vehicle models in different packages? I've got the following package structure using Gazebo 2.2.3:

catkin_ws/src/model_package contains the *.world files including references to the respective *.dae files catkin_ws/src/robot_package contains the robot description as well as the respective controller,ros plugins and launch files

When i try to reference the world file of the modelpackage in the launch file of the robot in the robotpackage via

<arg name="world_name" default="$(find model_package)/worlds/Road.world"/>

i obtain the error

Error [SystemPaths.cc:367] File or path does not exist[""]

Error [MeshShape.cc:64] No mesh specified

I assume, that the linked mesh cannot be loaded. The mesh itself is referenced like

<geometry>
    <mesh><uri>file://Road.dae</uri></mesh>
 </geometry>

The world can be loaded from any launch file inside the model package. I just checked the GAZEBORESOURCEPATH and GAZEBOMODELPATH. The variables are set correctly to the directory, where both the world file and the dae-file are placed. Any suggestions?

Best regards,

Asked by Illuminatur on 2016-01-20 05:50:25 UTC

Comments

Try using:

Asked by Javi V on 2016-01-20 10:14:07 UTC

Hi, i tried this, but i obtain the following error: XML Attribute[filename] in element[mesh] not defined in SDF, ignoring. Any other ideas?

Asked by Illuminatur on 2016-01-21 11:02:57 UTC

Answers

Here is a tutorial that describes Gazebo's model format, and how to have one model depend on another model:

http://gazebosim.org/tutorials?tut=model_structure&cat=build_robot

Here is a tutorial about making a model:

http://gazebosim.org/tutorials?tut=build_model&cat=build_robot

Here is the SDF specification:

http://sdformat.org/spec

Some other bits of info

Asked by nkoenig on 2016-01-21 11:54:26 UTC

Comments

Hey,

thanks for your response. I know these Gazebo paths and i've checked that these variables are exported (via a created setup.bash file) correctly.

With respect to my basic problem, i have tried several tests and recognized a similar problem with loading plugins. I strongly assume, that this is related to the same underlying problem. I've written a plugin, which i try to load from an external launch file, which is not originated from the same catkin-package. This seems to be loaded in a complete new linux environment. I'll explain:

The plugin tries to read files in the Load() function by resolving the GAZEBO RESOURCE PATH:

  // Load GAZEBO_RESOURCE_PATH from environment variable
  const char* gazeboResourcePaths = getenv("GAZEBO_RESOURCE_PATH");
  if(!gazeboResourcePaths)
  {
    gzerr << "(MyPlugin) GAZEBO_RESOURCE_PATH is empty. Perhaps you forgot to source the necessary bash scripts. \n";
    return;
  }
  std::string gazeboResourcePathString(gazeboResourcePaths);
  gzmsg << "(MyPlugin) Load variable GAZEBO_RESOURCE_PATH from environment successfully: " << gazeboResourcePathString << "\n";

During runtime, when invoking this plugin with an in-place (same catkin-package) launch file, the gazebo resource path is resolved to the expected directories, i have set previously with my setup.bash-script. But, when i am trying to integrate the plugin in an external launch-file i solely obtain the following console output:

Msg (MyPlugin) Load variable GAZEBO_RESOURCE_PATH from environment successfully: /usr/share/gazebo-2.2:/usr/share/gazebo_models

which is the basic path, but my additionally exported resource pathes are missing.

Is there any idea, what's the problem?

Best regards!

Asked by Illuminatur on 2016-01-29 02:35:08 UTC

Comments

If GAZEBO_RESOURCE_PATH is empty, then you haven't sourced the setup.sh file that sets the environment variable. Can you make sure you source the correct bash scripts?

Asked by nkoenig on 2016-02-02 11:59:28 UTC