Gazebo | Ignition | Community
Ask Your Question

delete_model() hangs for several mins after repeated additions/deletions of a sdf model (which sometimes entirely vanishes from the scene too) in Gazebo

asked 2020-04-30 06:18:13 -0500

alikureishy gravatar image

I've been facing issues with repeatedly adding and deleting the same model into gazebo (for a repetitive training task). The model is that of a simple cylindrical object (a pole) with no joints ... just one link. After a few (~5-10) successful additions/deletions of this model into the scene, subsequent delete_model() calls start getting stuck for a few minutes each. It hangs even though I can clearly see the model exists in the scene. At this point, the only way to "release" the stuck call is to manually delete the model through the gazebo UI. But, then it keeps getting stuck the same way on all subsequent calls to delete_model().

Furthermore, if I try to invoke any other service call while the delete_model() call is held up, those calls also sit blocked, seemingly waiting for the previous invocation to return.

In addition, the object I'm adding to the scene sometimes just disappears from the scene as well, though I'm not sure whether the issues share a common cause. Anyway, thought I'd mention that too, just in case. Maybe it's the SDF of the object that isn't correctly setup?

When the delete_model() call hangs, I have consistently seen the following error message on the shell:

[Err] [] Joint axis index [0] larger than DOF count [0].

... but I can't quite figure out what it means.

The SDF of the object I'm adding/deleting is below:

    <a="" href="http://
        xmlns:xacro="" version="1.6">
        <model name="pole">
            <link name="pole_link"/>
                <pose frame="">0 0 0 0 -0 0</pose>
            <pose frame="">0 0 0 0 -0 0</pose>
            <visual name="visual">
                <pose frame="">0 0 0 0 -0 0</pose>
                    <shader type="pixel">
                    <ambient>0.3 0.3 0.3 1</ambient>
                    <diffuse>0.7 0.7 0.7 1</diffuse>
                    <specular>0.01 0.01 0.01 1</specular>
                    <emissive>0 0 0 1</emissive>
            <collision name="collision">
                <pose frame="">0 0 0 0 -0 0</pose>
                            <fdir1>0 0 0</fdir1>
                        <threshold>1e+06</threshold ...
edit retag flag offensive close merge delete


I can confirm I have the same problem. I haven't looked into it yet, so I cannot offer any advice, but I can add some more information. For me, the service gets stuck randomly the first time I call it. And, it does so more when I run gazebo with the GUI than when I run it headless. So this has been a problem for me during development, but luckily enough, it hasn't been much of a problem when I use gazebo headless remotely for automated testing.

nlamprian gravatar imagenlamprian ( 2020-04-30 12:17:43 -0500 )edit

Thanks for the note, @nlamprian. Unfortunately for me, I need to run it with the GUI at the moment. Hopefully someone in the community here can offer some advice about what to do.

alikureishy gravatar imagealikureishy ( 2020-05-01 02:16:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-05-02 10:52:34 -0500

I investigated this and I tracked the problem down to a publisher. I have opened an issue.

Unfortunately, once the problem shows up, the Gazebo-ROS API is rendered useless. You cannot spawn or delete models through the relevant services anymore.

You can use the gz tool though as a workaround.

To delete a model, run: gz model -m model_0 -d
To spawn a model, run: gz model -m model_0 -f <path_to_model>.sdf
For more options, run: gz help model

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-04-30 06:16:11 -0500

Seen: 269 times

Last updated: May 02 '20