37 #include <boost/algorithm/string/predicate.hpp>
38 #include <boost/lexical_cast.hpp>
44 :
rviz::Display(), msg_(0)
48 "Topic",
"/diagnostics_agg",
49 ros::message_traits::datatype<diagnostic_msgs::DiagnosticArray>(),
50 "diagnostic_msgs::DiagnosticArray topic to subscribe to.",
51 this, SLOT( updateRosTopic() ));
54 "the parent frame_id to visualize diagnostics",
57 "diagnostics namespace",
"/",
58 "diagnostics namespace to visualize diagnostics",
59 this, SLOT(updateDiagnosticsNamespace()));
62 "radius of diagnostics circle",
63 this, SLOT(updateRadius()));
67 this, SLOT(updateLineWidth()));
71 this, SLOT(updateAxis()));
72 axis_property_->addOption(
"x", 0);
73 axis_property_->addOption(
"y", 1);
74 axis_property_->addOption(
"z", 2);
78 this, SLOT(updateFontSize()));
106 const float round_trip = 10.0;
107 Ogre::Quaternion orientation;
108 Ogre::Vector3 position;
112 position, orientation ))
114 ROS_WARN(
"Error transforming from frame '%s' to frame '%s'",
120 Ogre::Vector3 orbit_position;
128 orbit_position.z = 0;
130 else if (
axis_ == 1) {
133 orbit_position.x = 0;
135 else if (
axis_ == 2) {
138 orbit_position.y = 0;
159 msg_->setVisible(
false);
170 (
const diagnostic_msgs::DiagnosticArray::ConstPtr& msg)
177 std::set<std::string> new_namespaces;
178 for (
size_t i = 0; i <
msg->status.size(); i++) {
179 new_namespaces.insert(
msg->status[i].name);
182 std::set<std::string> difference_namespaces;
184 new_namespaces.begin(), new_namespaces.end(),
185 std::inserter(difference_namespaces,
186 difference_namespaces.end()));
187 if (difference_namespaces.size() != 0) {
192 difference_namespaces.clear();
193 std::set_difference(new_namespaces.begin(), new_namespaces.end(),
195 std::inserter(difference_namespaces,
196 difference_namespaces.end()));
197 if (difference_namespaces.size() != 0) {
207 const float alpha = 0.8;
208 const Ogre::ColourValue
OK(0.3568627450980392, 0.7529411764705882, 0.8705882352941177,
alpha);
209 const Ogre::ColourValue
WARN(0.9411764705882353, 0.6784313725490196, 0.3058823529411765,
alpha);
210 const Ogre::ColourValue
ERROR(0.8509803921568627, 0.3254901960784314, 0.30980392156862746, 0.5);
211 const Ogre::ColourValue
UNKNOWN(0.2, 0.2, 0.2, 0.5);
212 Ogre::ColourValue color;
215 for (
size_t i = 0; i <
msg->status.size(); i++) {
216 diagnostic_msgs::DiagnosticStatus
status =
msg->status[i];
218 if (
status.level == diagnostic_msgs::DiagnosticStatus::OK) {
222 else if (
status.level == diagnostic_msgs::DiagnosticStatus::WARN) {
226 else if (
status.level == diagnostic_msgs::DiagnosticStatus::ERROR) {
246 Ogre::ColourValue font_color(color);
259 for (
size_t i = 0; i < 128 + 1; i++) {
260 Ogre::Vector3 step_position;
261 const double theta = M_PI * 2.0 / 128 * i;
265 step_position.z = 0.0;
267 else if (
axis_ == 1) {
272 else if (
axis_ == 2) {
292 msg_->setVisible(
false);
343 for (std::set<std::string>::iterator it =
namespaces_.begin();