53 switch (marker_type) {
54 case visualization_msgs::Marker::CUBE:
55 case visualization_msgs::Marker::CYLINDER:
56 case visualization_msgs::Marker::SPHERE:
59 case visualization_msgs::Marker::ARROW:
62 case visualization_msgs::Marker::LINE_STRIP:
65 case visualization_msgs::Marker::LINE_LIST:
68 case visualization_msgs::Marker::SPHERE_LIST:
69 case visualization_msgs::Marker::CUBE_LIST:
70 case visualization_msgs::Marker::POINTS:
73 case visualization_msgs::Marker::TEXT_VIEW_FACING:
76 case visualization_msgs::Marker::MESH_RESOURCE:
79 case visualization_msgs::Marker::TRIANGLE_LIST:
90 if(marker.action != visualization_msgs::Marker::ADD)
96 switch (marker.type) {
97 case visualization_msgs::Marker::ARROW:
107 case visualization_msgs::Marker::CUBE:
108 case visualization_msgs::Marker::CYLINDER:
109 case visualization_msgs::Marker::SPHERE:
120 case visualization_msgs::Marker::LINE_STRIP:
121 case visualization_msgs::Marker::LINE_LIST:
130 case visualization_msgs::Marker::SPHERE_LIST:
131 case visualization_msgs::Marker::CUBE_LIST:
132 case visualization_msgs::Marker::TRIANGLE_LIST:
141 case visualization_msgs::Marker::POINTS:
149 case visualization_msgs::Marker::TEXT_VIEW_FACING:
158 case visualization_msgs::Marker::MESH_RESOURCE:
168 ss <<
"Unknown marker type: " << marker.type <<
'.' ;
174 std::string warning = ss.str();
191 std::vector<MarkerID> marker_ids;
192 marker_ids.reserve(array.markers.size());
195 std::stringstream ss;
196 bool markers_added =
false;
198 for(
const visualization_msgs::Marker& marker : array.markers)
200 if (marker.action == visualization_msgs::Marker::ADD)
201 markers_added =
true;
203 else if (marker.action == visualization_msgs::Marker::DELETEALL)
208 ss <<
"Found a DELETEALL after having markers added. These markers will never show";
211 markers_added =
false;
215 MarkerID current_id(marker.ns, marker.id);
216 std::vector<MarkerID>::iterator
search = std::lower_bound(marker_ids.begin(), marker_ids.end(), current_id);
217 if (search != marker_ids.end())
220 ss <<
"Found '" << marker.ns.c_str() <<
"/" << marker.id <<
"' multiple times";
225 marker_ids.insert(search, current_id);
231 std::string warning = ss.str();
249 if (marker.pose.orientation.x == 0.0 && marker.pose.orientation.y == 0.0 && marker.pose.orientation.z == 0.0 &&
250 marker.pose.orientation.w == 0.0)
253 ss <<
"Uninitialized quaternion assuming identity.";
259 ss <<
"Unnormalized quaternion in marker message.";
267 if(marker.type == visualization_msgs::Marker::ARROW && marker.scale.x != 0.0 && marker.scale.y != 0.0)
270 if(marker.scale.x == 0.0 || marker.scale.y == 0.0 || marker.scale.z == 0.0)
273 ss <<
"Scale contains 0.0 in x, y or z.";
280 if(marker.scale.x == 0.0)
283 ss <<
"Width LINE_LIST or LINE_STRIP is 0.0 (scale.x).";
286 else if(marker.scale.y != 0.0 || marker.scale.z != 0.0)
289 ss <<
"scale.y and scale.z of LINE_LIST or LINE_STRIP are ignored.";
296 if(marker.scale.x == 0.0 || marker.scale.y == 0.0)
299 ss <<
"Width and/or height of POINTS is 0.0 (scale.x, scale.y).";
302 else if(marker.scale.z != 0.0)
305 ss <<
"scale.z of POINTS is ignored.";
312 if(marker.scale.z == 0.0)
315 ss <<
"Text height of TEXT_VIEW_FACING is 0.0 (scale.z).";
318 else if(marker.scale.x != 0.0 || marker.scale.y != 0.0)
321 ss <<
"scale.x and scale.y of TEXT_VIEW_FACING are ignored.";
328 if(marker.color.a == 0.0)
331 ss <<
"Marker is fully transparent (color.a is 0.0).";
338 if(marker.points.size() != 0 && marker.points.size() != 2)
341 ss <<
"Number of points for an ARROW marker should be either 0 or 2.";
348 if(marker.points.empty())
351 ss <<
"Points should not be empty for specified marker type.";
354 else if(marker.type == visualization_msgs::Marker::TRIANGLE_LIST && (marker.points.size() % 3) != 0)
357 ss <<
"Number of points should be a multiple of 3 for TRIANGLE_LIST Marker.";
360 else if(marker.type == visualization_msgs::Marker::LINE_LIST && (marker.points.size() % 2) != 0)
363 ss <<
"Number of points should be a multiple of 2 for LINE_LIST Marker.";
366 else if(marker.type == visualization_msgs::Marker::LINE_STRIP && marker.points.size() <= 1)
369 ss <<
"At least two points are required for a LINE_STRIP Marker.";
376 if(!marker.points.empty())
379 ss <<
"Points array is ignored by specified marker type.";
386 if(marker.colors.size() == 0)
391 if(marker.colors.size() != marker.points.size())
394 ss <<
"Number of colors is not equal to number of points or 0.";
401 if(!marker.colors.empty())
404 ss <<
"Colors array is ignored by specified marker type.";
411 if(marker.text.empty())
414 ss <<
"Text is empty for TEXT_VIEW_FACING type marker.";
417 else if(marker.text.find_first_not_of(
" \t\n\v\f\r") == std::string::npos)
420 ss <<
"Text of TEXT_VIEW_FACING Marker only consists of whitespaces.";
427 if(!marker.text.empty())
430 ss <<
"Text is ignored for specified marker type.";
437 if(marker.mesh_resource.empty())
440 ss <<
"Path to mesh resource is empty for MESH_RESOURCE marker.";
447 if (!marker.mesh_resource.empty())
450 ss <<
"Mesh_resource is ignored for specified marker type.";
453 if (marker.mesh_use_embedded_materials)
456 ss <<
"Using embedded materials is not supported for markers other than MESH_RESOURCE.";
471 if(new_status > current_status)
472 current_status = new_status;
void setStatusStd(StatusProperty::Level level, const std::string &name, const std::string &text)
Show status level and text, using a std::string. Convenience function which converts std::string to Q...
void deleteStatusStd(const std::string &name)
Delete the status entry with the given std::string name. This is thread-safe.
void setMarkerStatus(MarkerID id, StatusLevel level, const std::string &text)
void checkColors(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkQuaternion(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
bool checkMarkerMsg(const visualization_msgs::Marker &marker, MarkerDisplay *owner)
void checkScale(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkPointsEmpty(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkColor(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkMesh(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkColorsEmpty(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
MarkerBase * createMarker(int marker_type, MarkerDisplay *owner, DisplayContext *context, Ogre::SceneNode *parent_node)
std::pair< std::string, int32_t > MarkerID
bool checkMarkerArrayMsg(const visualization_msgs::MarkerArray &array, MarkerDisplay *owner)
void increaseWarningLevel(StatusProperty::Level new_status, StatusProperty::Level ¤t_status)
void checkPointsArrow(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
Pure-virtual base class for objects which give Display subclasses context in which to work...
void checkPointsNotEmpty(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void addSeparatorIfRequired(std::stringstream &ss)
void deleteMarkerStatus(MarkerID id)
void checkTextNotEmptyOrWhitespace(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkMeshEmpty(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
#define ROS_LOG(level, name,...)
void checkScalePoints(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkScaleText(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
void checkScaleLineStripAndList(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
bool validateQuaternions(const visualization_msgs::InteractiveMarker &marker)
void checkTextEmpty(const visualization_msgs::Marker &marker, std::stringstream &ss, StatusProperty::Level &level)
ROSCPP_DECL bool search(const std::string &ns, const std::string &key, std::string &result)
Displays "markers" sent in by other ROS nodes on the "visualization_marker" topic.
#define ROSCONSOLE_DEFAULT_NAME