# Problem with creating model in tutorial

I was looking at the tutorial of the "Making a mobile robot"

And here I meet a problem

I can't find my_robot file in the left side of the Gazebo GUI

I bet the problem is because I didn't setup the model directory correctly, so I check up the previous section of this part:

mkdir -p ~/.gazebo/models/my_robot <= this is in the tutorial, but I didn't find the "models" file in my "gazebo" file, so I change into this direction: mkdir -p /home/iclab/gazebo_models/my_robot <= gazebo_models is another file I create

Then I follow the instructions to create model.config and model.sdf file

But after I want to insert my own model, I can't find my_robot file in the left side as tutorial

Can anyone tell me why?

Thanks a lot!

edit retag close merge delete

Sort by » oldest newest most voted

Gazebo looks for models in a few specific directories. The tutorial tells you to place the model inside ~/.gazebo/models because Gazebo always looks there by default (unless you made some custom installation).

If the ~/.gazebo/models directory doesn't exist, it should be fine to create it yourself. In fact, that's what the -p flag in the mkdir command in the tutorial is doing.

(by the way, it looks like you already have some models in that directory, look on the top left corner of your screenshot)

It's also fine to use a custom directory path as you did. But in this case, you must tell Gazebo to look there too. Gazebo checks an environment variable GAZEBO_MODEL_PATH to know where to look. You can prepend your path to that variable like this:

export GAZEBO_MODEL_PATH=/home/iclab/gazebo_models:$GAZEBO_MODEL_PATH Note that this will only work for the current shell (terminal). To make it persistent for the next terminals you open, you can do: echo "export GAZEBO_MODEL_PATH=/home/iclab/gazebo_models:$GAZEBO_MODEL_PATH" >> ~/.bashrc

more

Thanks for your reply so quickly! I can insert the model box now. It seems the left and above table of contents is the record of the models I've called. I'll keep going until I meet another problem. Thanks!

( 2017-03-29 03:08:34 -0500 )edit

Glad to help! Make sure you mark this answer as correct if it solved your problem, so other users can know it ;)

( 2017-03-29 10:48:10 -0500 )edit

Now I have another problem...I have paste the command @chapulina gives me: echo "export GAZEBO_MODEL_PATH=/home/iclab/gazebo_models:\$GAZEBO_MODEL_PATH" >> ~/.bashrc

I believe it works, for the left side of the model direction appears the direction I set up. But when I drag the model from it, the terminal window shows error and fails to insert. I found a same name model "My Robot" in the top of the Insert sheet, and which I success to drag it into the environment.

By the way, the name of my own model is "model", not "My Robot". Is this because of the default setting so it appears this name in gazebo?

And why does the error occur in terminal window?

more