Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing OGRE exception if ManualObject already exists #18

Open
wants to merge 1 commit into
base: release
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/map_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,24 @@ void MapElement::visualizeMap(lanelet::LaneletMapConstPtr theMap) {


// Create manual objects that will be attached to the scene-node
if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) {
sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_));
}
Ogre::ManualObject* mapManualObject =
sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++));
if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) {
sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_));
}
Ogre::ManualObject* seperatorManualObject =
sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++));
if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) {
sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_));
}
Ogre::ManualObject* areaManualObject =
sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++));
if (sceneManager_->hasManualObject("llet_object_" + std::to_string(manObjCounter_))) {
sceneManager_->destroyManualObject("llet_object_" + std::to_string(manObjCounter_));
}
Ogre::ManualObject* parkingManualObject =
sceneManager_->createManualObject("llet_object_" + std::to_string(manObjCounter_++));

Expand Down Expand Up @@ -397,4 +409,4 @@ Ogre::Vector3 MapElement::ogreVec3FromLLetPoint(const lanelet::ConstPoint3d poin
return Ogre::Vector3(numeric_cast<Ogre::Real>(point.x()), numeric_cast<Ogre::Real>(point.y()), 0.f);
}

} // namespace lanelet_rviz_plugin_ros
} // namespace lanelet_rviz_plugin_ros