-
Notifications
You must be signed in to change notification settings - Fork 466
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
Robot: Report mesh loading issues #1629
Merged
rhaschke
merged 4 commits into
ros-visualization:melodic-devel
from
rhaschke:melodic-devel
Jun 11, 2021
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d1006b5
RobotLink: Only create entity if mesh loading succeeded
simonschmeisser ebacfbf
Robot: report link geometry errors via RobotModelDisplay's status fields
rhaschke a84f31d
PropertryTree help: Consider line breaks in string
rhaschke 73f0703
RobotLink: Don't attempt to create the same (failing) geometry twice
rhaschke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -151,6 +151,7 @@ void RobotLinkSelectionHandler::postRenderPass(uint32_t /*pass*/) | |||||
} | ||||||
} | ||||||
|
||||||
static std::map<const RobotLink*, std::string> errors; | ||||||
|
||||||
RobotLink::RobotLink(Robot* robot, | ||||||
const urdf::LinkConstSharedPtr& link, | ||||||
|
@@ -318,6 +319,26 @@ RobotLink::~RobotLink() | |||||
delete axes_; | ||||||
delete details_; | ||||||
delete link_property_; | ||||||
errors.erase(this); | ||||||
} | ||||||
|
||||||
void RobotLink::addError(const char* format, ...) | ||||||
{ | ||||||
char buffer[256]; | ||||||
va_list args; | ||||||
va_start(args, format); | ||||||
vsnprintf(buffer, sizeof(buffer), format, args); | ||||||
va_end(args); | ||||||
|
||||||
std::string& err = const_cast<std::string&>(getGeometryErrors()); | ||||||
if (!err.empty()) | ||||||
err.append("\n"); | ||||||
err.append(buffer); | ||||||
} | ||||||
|
||||||
const std::string& RobotLink::getGeometryErrors() const | ||||||
{ | ||||||
return errors[this]; | ||||||
} | ||||||
|
||||||
bool RobotLink::hasGeometry() const | ||||||
|
@@ -595,22 +616,22 @@ void RobotLink::createEntityForGeometryElement(const urdf::LinkConstSharedPtr& l | |||||
|
||||||
scale = Ogre::Vector3(mesh.scale.x, mesh.scale.y, mesh.scale.z); | ||||||
|
||||||
std::string model_name = mesh.filename; | ||||||
const std::string& model_name = mesh.filename; | ||||||
|
||||||
try | ||||||
{ | ||||||
loadMeshFromResource(model_name); | ||||||
entity = scene_manager_->createEntity(ss.str(), model_name); | ||||||
if (loadMeshFromResource(model_name).isNull()) | ||||||
addError("Could not load mesh resource '%s'", model_name.c_str()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
or so, just a suggestion to keep things simple |
||||||
else | ||||||
entity = scene_manager_->createEntity(ss.str(), model_name); | ||||||
} | ||||||
catch (Ogre::InvalidParametersException& e) | ||||||
{ | ||||||
ROS_ERROR("Could not convert mesh resource '%s' for link '%s'. It might be an empty mesh: %s", | ||||||
model_name.c_str(), link->name.c_str(), e.what()); | ||||||
addError("Could not convert mesh resource '%s': %s", model_name.c_str(), e.what()); | ||||||
} | ||||||
catch (Ogre::Exception& e) | ||||||
{ | ||||||
ROS_ERROR("Could not load model '%s' for link '%s': %s", model_name.c_str(), link->name.c_str(), | ||||||
e.what()); | ||||||
addError("Could not load model '%s': %s", model_name.c_str(), e.what()); | ||||||
} | ||||||
break; | ||||||
} | ||||||
|
@@ -695,8 +716,8 @@ void RobotLink::createCollision(const urdf::LinkConstSharedPtr& link) | |||||
if (collision_mesh) | ||||||
{ | ||||||
collision_meshes_.push_back(collision_mesh); | ||||||
valid_collision_found = true; | ||||||
} | ||||||
valid_collision_found |= collision == link->collision; // don't consider the same geometry twice | ||||||
} | ||||||
} | ||||||
#endif | ||||||
|
@@ -755,8 +776,8 @@ void RobotLink::createVisual(const urdf::LinkConstSharedPtr& link) | |||||
if (visual_mesh) | ||||||
{ | ||||||
visual_meshes_.push_back(visual_mesh); | ||||||
valid_visual_found = true; | ||||||
} | ||||||
valid_visual_found |= visual == link->visual; // don't consider the same geometry again | ||||||
} | ||||||
} | ||||||
#endif | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was referring to this variadic function that could be simplified by using
QString
orQStringList