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

problems loading models in gazebo

asked 2022-04-18 19:22:47 -0600

dhos gravatar image

I have a problem with my maze, simply when I start the world it appears empty, even though I defined the location of the models inside the .world file in my packages in Catkin's Workspace like </include> <url>model://my_maze</url> </include> I tried to change the location of the folder where my package is to the gazebo folder and still the items do not load,just appears the turtlebot3 in a empty world, can someone help me, it would be for a final project at my college.

edit retag flag offensive close merge delete

Comments

1

Can you specify which file are you launching for the turtlebot and if possible can you provide the world file and the launch files? Thanks

I will still mention the procedure to use custom world in the gazebo, (I assume your pkg is at ~/catkin_ws/src/my_pkg)

  • mkdir ~/catkin_ws/src/my_pkg/worlds

  • cd ~/catkin_ws/src/my_pkg/worlds

  • touch my_world.world

  • Put all your models in the world file (you can use various mesh formats like .dae .stl or even robot format .urdf)

  • To be able to use the custom models from ~/catkin_ws/src/my_pkg/models you need to put this in your ~/catkin_ws/src/my_pkg/package.xml <run_depend>gazebo_ros</run_depend> <export> <gazebo_ros gazebo_model_path="${prefix}/models"/> <gazebo_ros gazebo_media_path="${prefix}/models"/> </export>

  • echo "export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$HOME/catkin_ws/src/"

NOTE: I am using this tutorial as a referance. if there is any typo PLMK

aarsh_t gravatar image aarsh_t  ( 2022-04-19 13:22:39 -0600 )edit

You can copy & paste your model of the labyrinth in your /home/${USER}/.gazebo/models and then create a world with it inside (Gazebo should have this model loaded then). Maybe your building_editor_models folder isn'a added to the GAZEBO_MODEL_PATH too (e.g. in ~/.bashrc like this: export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/model_editor_models). Suggestions from @aarsh_t and @shonigmann are good too, please check them.

ljaniec gravatar image ljaniec  ( 2022-04-19 14:57:45 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
1

answered 2022-04-19 13:45:13 -0600

aarsh_t gravatar image

updated 2022-04-19 15:50:01 -0600

I will still mention the procedure to use custom world in the gazebo, (I assume your pkg is at ~/catkin_ws/src/my_pkg)

  • mkdir ~/catkin_ws/src/my_pkg/worlds

  • cd ~/catkin_ws/src/my_pkg/worlds

  • touch my_world.world

  • Put all your models in the world file (you can use various mesh formats like .dae .stl or even robot format .urdf)

  • To be able to use the custom models from ~/catkin_ws/src/my_pkg/models you need to put this in your ~/catkin_ws/src/my_pkg/package.xml <run_depend>gazebo_ros</run_depend> <export> <gazebo_ros gazebo_model_path="${prefix}/models"/> <gazebo_ros gazebo_media_path="${prefix}/models"/> </export>

[Edit]

  • echo "export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:$HOME/catkin_ws/src/" >> ~/.bashrc

NOTE: I am using this tutorial as a referance. if there is any typo PLMK

[Continue from comment]

  • echo "export GAZEBO_RESOURCE_PATH=$GAZEBO_RESOURCE_PATH:$HOME/catkin_ws/src/my_pkg/worlds" >> ~/.bashrc

[Edit-2]

one more way is to do it in launch file if you do not want to do export all the time and not want to add it to bashrc as well. something like this,

<env name="GAZEBO_MODEL_PATH" value="$(find my_pkg)/models:$(optenv GAZEBO_MODEL_PATH)"/>

<env name="GAZEBO_RESOURCE_PATH" value="$(find my_pkg)/worlds:$(optenv GAZEBO_RESOURCE_PATH)"/>

edit flag offensive delete link more
2

answered 2022-04-19 13:43:57 -0600

shonigmann gravatar image

This is most likely a better question for https://answers.gazebosim.org/questions/ - in the future I suggest you direct your Gazebo questions there. But the most likely culprit is that you simply haven't added your package's models folder to the Gazebo model path.

export GAZEBO_MODEL_PATH=/path/to/my/package/models/:$GAZEBO_MODEL_PATH

If you have done this and still don't see your models, I would recommend either:

  • looking in your Gazebo server log for details (located in the hidden .gazebo folder, by default: ~/.gazebo/server-XXXXX/default.log where XXXXX is the Gazebo Master URI port number). This should tell you
  • running Gazebo in "verbose" mode to print out relevant error messages. gazebo --verbose path/to/my/world.world
edit flag offensive delete link more
0

answered 2022-04-20 15:46:17 -0600

dhos gravatar image

thanks everyone, the problem was actually referring to the GAZEBO_MODEL_PATH, I added it in the .bash and it worked correctly

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-04-18 19:17:10 -0600

Seen: 5,227 times

Last updated: Apr 20 '22