34 #include <diagnostic_msgs/DiagnosticStatus.h> 35 #include <diagnostic_msgs/DiagnosticArray.h> 43 #include <boost/smart_ptr.hpp> 64 n_tilde(
"~"), publish_rate(0.0)
70 n_tilde.
param(
"publish_frequency_diagnostics", publish_freq, 1.0);
90 diagnostic_msgs::DiagnosticArray diag_msg;
92 std::vector<diagnostic_msgs::DiagnosticStatus> vec_diag_msg;
98 for (
unsigned int i = 0; i < diagnostics.size(); ++i)
100 diagnostic_msgs::DiagnosticStatus diag;
102 std::vector<diagnostic_msgs::KeyValue> keyvalues;
104 diag.level = diagnostics[i].level;
109 diag.name =
"srh/" + diagnostics[i].joint_name;
112 diag.name =
"sr_arm/" + diagnostics[i].joint_name;
115 diag.name = diagnostics[i].joint_name;
119 diagnostic_msgs::KeyValue keyval;
120 keyval.key =
"Target";
123 ss << diagnostics[i].target;
124 keyval.value = ss.str();
125 keyvalues.push_back(keyval);
127 keyval.key =
"Position";
129 ss << diagnostics[i].position;
130 keyval.value = ss.str();
131 keyvalues.push_back(keyval);
133 keyval.key =
"Flags";
135 ss << diagnostics[i].flags;
136 keyval.value = ss.str();
137 keyvalues.push_back(keyval);
140 std::map<const std::string, const unsigned int>::const_iterator iter;
144 keyval.key = iter->first;
146 ss << diagnostics[i].debug_values[iter->first];
147 keyval.value = ss.str();
148 keyvalues.push_back(keyval);
155 diag.values = keyvalues;
156 vec_diag_msg.push_back(diag);
160 diag_msg.status = vec_diag_msg;
void publish(const boost::shared_ptr< M > &message) const
static const double palm_msg_rate_const
const to convert the rate data to Hz
Publisher sr_diagnostics_pub
The publisher which publishes the data to the \/diagnostics topic.
static const std::map< const std::string, const unsigned int > names_and_offsets
a map containing the names and offsets of the smart motor node
The Diagnosticer is a ROS publisher which publishes diagnostic data regarding the Dextrous Hand or th...
hardware_types hardware_type
store the hardware_type for this diagnosticer.
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
This is a parent class for the different types of Shadowhand we can have. It makes it possible to swa...
static const double palm_numb_msg_const
const to convert the rate data to Hz
~SRDiagnosticer()
Destructor.
SRDiagnosticer(boost::shared_ptr< SRArticulatedRobot > sr_art_robot, hardware_types hw_type)
boost::shared_ptr< SRArticulatedRobot > sr_articulated_robot
The shadowhand object (can be either an object connected to the real robot or a virtual hand)...
hardware_types
An enum containing the different types of hardware the diagnosticer is publishing data about...
Rate publish_rate
the rate at which the data will be published. This can be set by a parameter in the launch file...
ROSCPP_DECL void spinOnce()
NodeHandle node
ros node handle