Skip to content

Commit

Permalink
Fix Ogre::ItemIdentityException when loading mesh (#1105)
Browse files Browse the repository at this point in the history
When loading a mesh without a material defined rviz crashes with error:
terminate called after throwing an instance of 'Ogre::ItemIdentityException'
  what():  ItemIdentityException: Resource with the name RVIZ/ShadedRed0Robot already exists.
  • Loading branch information
kartikmohta authored and wjwwood committed Jul 17, 2017
1 parent 4e6ab4d commit 4c8793b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/rviz/robot/robot_link.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -620,11 +620,11 @@ void RobotLink::createEntityForGeometryElement(const urdf::LinkConstSharedPtr& l
offset_node->setPosition(offset_position);
offset_node->setOrientation(offset_orientation);

static int count = 0;
if (default_material_name_.empty())
{
default_material_ = getMaterialForLink(link);

static int count = 0;
std::stringstream ss;
ss << default_material_->getName() << count++ << "Robot";
std::string cloned_name = ss.str();
Expand All @@ -636,7 +636,6 @@ void RobotLink::createEntityForGeometryElement(const urdf::LinkConstSharedPtr& l
for (uint32_t i = 0; i < entity->getNumSubEntities(); ++i)
{
default_material_ = getMaterialForLink(link, material_name);
static int count = 0;
std::stringstream ss;
ss << default_material_->getName() << count++ << "Robot";
std::string cloned_name = ss.str();
Expand All @@ -657,7 +656,6 @@ void RobotLink::createEntityForGeometryElement(const urdf::LinkConstSharedPtr& l
{
// Need to clone here due to how selection works. Once selection id is done per object and not per material,
// this can go away
static int count = 0;
std::stringstream ss;
ss << material_name << count++ << "Robot";
std::string cloned_name = ss.str();
Expand Down

1 comment on commit 4c8793b

@lakshmip001
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using ros-kinetic on ubuntu 16.04 and rviz version 1.12.16 , OPENGL 3.0, orge 1.9.0
I come across following error . I tried your procedure but still faces error as below.

terminate called after throwing an instance of 'Ogre::ItemIdentityException'
what(): OGRE EXCEPTION(4:ItemIdentityException): An object of type 'Entity' with name 'Robot Link4' already exists. in SceneManager::createMovableObject at /build/ogre-1.9-mqY1wq/ogre-1.9-1.9.0+dfsg1/OgreMain/src/OgreSceneManager.cpp (line 6832)
Aborted (core dumped)

Kindly please help me understand what is 'robot link4' as my urdf is universal robot and happens when I try adding tesseract plugin or by loading robot model after adding tesseract plugin

Please sign in to comment.