removing models leaves behind some visuals

Create issue
Issue #1702 closed
John Hsu created an issue

This can be reproduced by deleting a model, then re-spawning the same model with the same name, an error appears complaining about existing visual nodes in ogre. For example, while running the haptix world sim api tutorial, by calling the following functions in sequence:

% Define a new model.  Here, we're taking the cricket_ball model from:
% and tweaking it slightly (just changing the color from Red to Green).
sdf = '<sdf version="1.5"> <model name="cricket_ball"> <link name="link"> <pose>0 0 0.0375 0 0 0</pose> <inertial> <mass>0.1467</mass> <inertia> <ixx>8.251875e-05</ixx> <ixy>0</ixy> <ixz>0</ixz> <iyy>8.251875e-05</iyy> <iyz>0</iyz> <izz>8.251875e-05</izz> </inertia> </inertial> <collision name="collision"> <geometry> <sphere> <radius>0.0375</radius> </sphere> </geometry> </collision> <visual name="visual"> <geometry> <sphere> <radius>0.0375</radius> </sphere> </geometry> <material> <script> <uri>file://media/materials/scripts/gazebo.material</uri> <name>Gazebo/Green</name> </script> </material> </visual> </link> </model> </sdf>';
% Add the new model to the world, at the world origin, 5m off the ground, with
% gravity enabled.  Then it will drop onto the table.
hxs_add_model(sdf, 'green_cricket_ball', [0; 0; 5], [0; 0; 0], 1);
% Remove the model
% Add back the same model
hxs_add_model(sdf, 'green_cricket_ball', [0; 0; 5], [0; 0; 0], 1);
terminate called after throwing an instance of 'Ogre::ItemIdentityException'

  what():  OGRE EXCEPTION(4:ItemIdentityException): An object of type 'Entity' with name 'green_cricket_ball::link_COM_VISUAL____SPHERE__' already exists. in SceneManager::createMovableObject at /tmp/buildd/ogre3d-1.9-1.9.0~osrf2/OgreMain/src/OgreSceneManager.cpp (line 6853)

Comments (11)

  1. Log in to comment