I created my world with gazebo9 and saved it.

world$ tree
└── myworld
    ├── model.config
    └── model.sd

Now when I start it with

$ gazebo myworld

I get

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

Why am I getting a memory error when all this ran fine. Starting Gazebo on its own works.

I am using: Ubuntu 18.04 gazebo9

Question 1 and Question 2 don't have solutions.

I have restarted my virtual machine and still get the same error. In some cases, nothing happens.


1 Answer 1


You might be confusing Gazebo worlds and models. A world is a single SDF file structured as below:

<sdf version="VERSION">
  <world name="NAME">
    <!-- Included models, links etc. -->

For example, these are the contents of the sample /usr/share/gazebo-9/worlds/willowgarage.world world file:

<?xml version="1.0" ?>
<sdf version="1.5">
  <world name="default">

In order to pre-load a world at startup time, you pass the path to the file as argument to Gazebo:

$ gazebo /usr/share/gazebo-9/worlds/willowgarage.world

The directory structure you described looks more like that of a model, which in addition to a SDF file also includes a configuration and (optionally) other resources such as meshes, materials etc. As far as I know there's no way to directly load a model at startup time, other than as an element included in a world file.

So to answer your question, the problem is probably that Gazebo is expecting its argument to point to an SDF file, but finds it to be a directory instead, and crashes as a result.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.