1 #include <boost/bind.hpp> 4 #include <boost/bind.hpp> 8 #include <std_msgs/Float32.h> 9 #include <nav_msgs/Odometry.h> 14 typedef diagnostic_msgs::DiagnosticStatus
DS;
31 ROS_INFO(
"Starting initialization timer...");
52 diagnostic_updater_.
add(
53 "swri::Subscriber test (manual diagnostics)",
this,
56 diagnostic_updater_.
add(
57 "swri::Subscriber test (auto diagnostics)",
this,
72 diagnostic_updater_.
update();
77 status.
summary(DS::OK,
"No errors reported.");
91 status.
mergeSummary(DS::WARN,
"Timeouts have occurred.");
97 status.
addf(
"Topic Name",
"%s -> %s",
113 status.
addf(
"Timed Out Count",
"%d [> %f ms]",
117 status.
add(
"Timed Out Count",
"N/A");
123 status.
summary(DS::OK,
"No errors reported.");
138 int main(
int argc,
char **argv)
140 ros::init(argc, argv,
"subscriber_test");
void summary(unsigned char lvl, const std::string s)
double meanFrequencyHz() const
void setHardwareID(const std::string &hwid)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ros::WallTimer init_timer_
void add(const std::string &name, TaskFunction f)
du::Updater diagnostic_updater_
void appendDiagnostics(diagnostic_updater::DiagnosticStatusWrapper &status, const std::string &name, const int flags)
double maxLatencyMicroseconds() const
double minPeriodMilliseconds() const
void addf(const std::string &key, const char *format,...)
void manualDiagnostics(du::DiagnosticStatusWrapper &status)
const std::string & unmappedTopic() const
int numPublishers() const
const std::string & mappedTopic() const
diagnostic_msgs::DiagnosticStatus DS
bool timeoutEnabled() const
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
int main(int argc, char **argv)
WallTimer createWallTimer(WallDuration period, void(T::*callback)(const WallTimerEvent &), T *obj, bool oneshot=false, bool autostart=true) const
void setTimeout(const ros::Duration &time_out)
void initialize(const ros::WallTimerEvent &ignored)
double meanPeriodMilliseconds() const
void mergeSummary(unsigned char lvl, const std::string s)
double timeoutMilliseconds() const
double meanLatencyMicroseconds() const
void autoDiagnostics(du::DiagnosticStatusWrapper &status)
void handleDiagnosticsTimer(const ros::TimerEvent &ignored)
#define ROS_INFO_THROTTLE(rate,...)
void add(const std::string &key, const T &val)
double minLatencyMicroseconds() const
double maxPeriodMilliseconds() const
void handleMessage(const nav_msgs::OdometryConstPtr &msg)