Gazebo | Ignition | Community
Ask Your Question
0

Referencing models from other package's launch files

asked 2016-01-20 04:50:25 -0600

Illuminatur gravatar image

updated 2016-01-29 01:36:23 -0600

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 model_package in the launch file of the robot in the robot_package 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 GAZEBO_RESOURCE_PATH and GAZEBO_MODEL_PATH. The variables are set correctly to the directory, where both the world file and the dae-file are placed. Any suggestions?

Best regards,

edit retag flag offensive close merge delete

Comments

Try using: <mesh filename="package://&lt;pkg_name&gt;/foo/mesh.dae"/> But make sure that it is finding the world file you are giving as parameter first.

Javi V gravatar imageJavi V ( 2016-01-20 09:14:07 -0600 )edit

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

Illuminatur gravatar imageIlluminatur ( 2016-01-21 10:02:57 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-01-29 01:35:08 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

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!

edit flag offensive delete link more

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?

nkoenig gravatar imagenkoenig ( 2016-02-02 10:59:28 -0600 )edit
0

answered 2016-01-21 10:54:26 -0600

nkoenig gravatar image

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=mo...

Here is a tutorial about making a model:

http://gazebosim.org/tutorials?tut=bu...

Here is the SDF specification:

http://sdformat.org/spec

Some other bits of info

  • The package keyword is only used within ROS, and has no valid meaning in Gazebo.
  • A URI that uses the file:// prefix must be either a full path, or reference a file that is in GAZEBO_RESOURCE_PATH
  • You can use a model:// URI prefix, which will find files/models contained in GAZEBO_MODEL_PATH
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-01-20 04:50:25 -0600

Seen: 3,137 times

Last updated: Jan 29 '16