Gazebo | Ignition | Community
Ask Your Question
0

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.cc:712] 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:

<sdf 
    <a="" href="http://
        xmlns:xacro="http://ros.org/wiki/xacro%22" version="1.6">
        xmlns:xacro="http://ros.org/wiki/xacro">
        <model name="pole">
            <link name="pole_link"/>
            <inertial>
                <mass>2.14885</mass>
                <inertia>
                    <ixx>0.0287722</ixx>
                    <ixy>0</ixy>
                    <ixz>0</ixz>
                    <iyy>0.0287722</iyy>
                    <iyz>0</iyz>
                    <izz>0.00024175</izz>
                </inertia>
                <pose frame="">0 0 0 0 -0 0</pose>
            </inertial>
            <pose frame="">0 0 0 0 -0 0</pose>
            <gravity>1</gravity>
            <self_collide>0</self_collide>
            <kinematic>0</kinematic>
            <enable_wind>0</enable_wind>
            <visual name="visual">
                <pose frame="">0 0 0 0 -0 0</pose>
                <geometry>
                    <cylinder>
                        <radius>0.015</radius>
                        <length>0.5</length>
                    </cylinder>
                </geometry>
                <material>
                    <lighting>1</lighting>
                    <script>
                        <uri>file://media/materials/scripts/gazebo.material</uri>
                        <name>Gazebo/Red</name>
                    </script>
                    <shader type="pixel">
                        <normal_map>__default__</normal_map>
                    </shader>
                    <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>
                </material>
                <transparency>0</transparency>
                <cast_shadows>1</cast_shadows>
            </visual>
            <collision name="collision">
                <laser_retro>0</laser_retro>
                <max_contacts>10</max_contacts>
                <pose frame="">0 0 0 0 -0 0</pose>
                <geometry>
                    <cylinder>
                        <radius>0.015</radius>
                        <length>0.5</length>
                    </cylinder>
                </geometry>
                <surface>
                    <friction>
                        <ode>
                            <mu>1</mu>
                            <mu2>1</mu2>
                            <fdir1>0 0 0</fdir1>
                            <slip1>0</slip1>
                            <slip2>0</slip2>
                        </ode>
                        <torsional>
                            <coefficient>1</coefficient>
                            <patch_radius>0</patch_radius>
                            <surface_radius>0</surface_radius>
                            <use_patch_radius>1</use_patch_radius>
                            <ode>
                                <slip>0</slip>
                            </ode>
                        </torsional>
                    </friction>
                    <bounce>
                        <restitution_coefficient>0</restitution_coefficient>
                        <threshold>1e+06</threshold ...
(more)
edit retag flag offensive close merge delete

Comments

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
0

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

nlamprian gravatar image

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

Stats

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

Seen: 44 times

Last updated: May 02