Home | Tutorials | Wiki | Issues
Ask Your Question

Problem with creating model in tutorial

asked 2017-03-28 04:59:43 -0600

Lawrence gravatar image

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 image description

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 flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-03-28 12:22:08 -0600

updated 2017-03-28 12:23:28 -0600

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

edit flag offensive delete link 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!

Lawrence gravatar imageLawrence ( 2017-03-29 03:08:34 -0600 )edit

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

chapulina gravatar imagechapulina ( 2017-03-29 10:48:10 -0600 )edit

answered 2017-03-29 03:27:01 -0600

Lawrence gravatar image

updated 2017-03-29 03:27:54 -0600

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?

image description

edit flag offensive delete link more


Hi @Lawrence, please either start a new question or update the existing question with the new problem ;)

chapulina gravatar imagechapulina ( 2017-03-29 10:49:27 -0600 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-03-28 04:58:14 -0600

Seen: 333 times

Last updated: Mar 29 '17