Gazebo | Ignition | Community
Ask Your Question
0

problem with including a model

asked 2013-03-19 09:02:32 -0500

prasanna.kumar gravatar image

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

edit retag flag offensive close merge delete

Comments

For people who are looking for information, I had to convert my xacro file to URDF (using xacro.py) and include it as mentioned in [this answer](http://answers.gazebosim.org/question/6568/uri-paths-to-packages-in-the-sdf-model-file/?answer=15102#post-id-15102).

prasad gravatar imageprasad ( 2016-12-28 03:26:48 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
2

answered 2013-03-19 14:29:51 -0500

AndreiHaidu gravatar image

updated 2013-04-30 17:29:41 -0500

Hi

You did not load the model correctly, try it like this in your .world file:

<world>
...
    <include>
        <uri>model://my_model</uri>
        <pose>0.3 0.5 0.9 0 0 0</pose>
    </include>
</world>

If it doesn't work, make sure that you have your GAZEBO PATHS set correctly. Or just add the .model file to ~/.gazebo/models folder.

If you still have trouble ask for more info.

UPDATE!!! an example of setting the paths (plugin, model, resource):

export GAZEBO_PLUGIN_PATH=~/<path>/my_package_example/lib:${GAZEBO_PLUGIN_PATH}

export GAZEBO_MODEL_PATH=~/<path>/my_package_example/models:${GAZEBO_MODEL_PATH}

export GAZEBO_RESOURCE_PATH=~/<path>/my_package_example/models:${GAZEBO_RESOURCE_PATH}

Cheers, Andrei

edit flag offensive delete link more

Comments

Hey Andrei, have you gotten this to work for models outside the ~/.gazebo/models folder? My model is being recognized by Gazebo -- I can insert it from the "insert" menu. But trying to <include> it in a world file produces: Error [ModelDatabase.cc:373] Unable to download model[model://iri_wam] Error [ModelDatabase.cc:373] Unable to download model[model://iri_wam] Error [parser.cc:544] Unable to find uri[model://iri_wam]

Ben B gravatar imageBen B ( 2013-04-30 17:10:12 -0500 )edit
1

Hey Ben, you get the error because you did not have the paths set to your models outside of the .gazebo folder. Check the updated answer I wrote some examples of how to set them, just add those lines to the ~/.bashrc file and don't forget to source it after. Hope it works, Cheers

AndreiHaidu gravatar imageAndreiHaidu ( 2013-04-30 17:33:42 -0500 )edit

I'm pretty sure my paths are set correctly because I can insert the model from within Gazebo. Should the <uri> include any indication of the database name, or just the model, or a path to the model?

Ben B gravatar imageBen B ( 2013-04-30 17:48:45 -0500 )edit

It is weird that by drag and drop it works and the other way it does not. In my world file I have like just as in the answer: <uri>model://my_model</uri> . In which version of gazebo are you getting this error? Do you also have your model.config file set right? Maybe that also plays a role?

AndreiHaidu gravatar imageAndreiHaidu ( 2013-05-01 16:18:47 -0500 )edit

Is your my_model in a the ~/.gazebo directory or elsewhere?

Ben B gravatar imageBen B ( 2013-05-01 16:36:06 -0500 )edit

it is elsewhere

AndreiHaidu gravatar imageAndreiHaidu ( 2013-05-02 02:37:46 -0500 )edit

Is your database.config in models or `my_package_example`? Also, are you storing your plugin .so files in the database lib directory, or in a separate directory for each model?

Ben B gravatar imageBen B ( 2013-05-02 17:33:33 -0500 )edit

I did not find any `database.config` file, or you meant the models `.config` file, I have that for every model in a separate folder, ex: `my_package/models/model1/model.config` , `my_package/models/model2/model.config`, the plugins library files are all in the `my_package/lib` folder

AndreiHaidu gravatar imageAndreiHaidu ( 2013-05-04 08:11:24 -0500 )edit

Ah. Got it. The problem was that I was assuming my_model corresponded to the model name in the model.config file. Instead, as you probably know, it refers to the folder that the model resides in.

Ben B gravatar imageBen B ( 2013-05-06 18:43:11 -0500 )edit

BTW, the database.config file is now "suggested" in the user manual. I'm not too sure what, if anything, it does. http://gazebosim.org/user_guide/started__models__database.html

Ben B gravatar imageBen B ( 2013-05-06 20:37:08 -0500 )edit
0

answered 2014-07-02 10:06:55 -0500

This was not initially obvious to me, but it turned out to be my problem. I was one character off between the name of the folder that my model was stored in and the "model name" tag that is defined inside my SDF file.

Gazebo is looking for the folder name, not the value of the "model name" tag in the SDF. Confusing to be sure.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-03-19 09:02:32 -0500

Seen: 36,513 times

Last updated: Jul 02 '14