6 #include <std_msgs/Float32.h> 7 #include <nav_msgs/Odometry.h> 12 typedef diagnostic_msgs::DiagnosticStatus
DS;
29 ROS_INFO(
"Starting initialization timer...");
42 diagnostic_updater_.
add(
43 "swri::Subscriber test (manual diagnostics)",
this,
47 diagnostic_updater_.
add(
48 "swri::Subscriber test (auto diagnostics)",
this,
52 diagnostic_updater_.
add(
53 "swri::Subscriber test (value diagnostics)",
this,
63 diagnostic_updater_.
update();
68 status.
summary(DS::OK,
"No errors reported.");
82 status.
mergeSummary(DS::WARN,
"Timeouts have occurred.");
88 status.
addf(
"Topic Name",
"%s -> %s",
104 status.
addf(
"Timed Out Count",
"%d [> %f ms]",
108 status.
add(
"Timed Out Count",
"N/A");
114 status.
summary(DS::OK,
"No errors reported.");
131 status.
summary(DS::WARN,
"No message has been received.");
132 status.
add(
"Float value",
"N/A");
134 status.
summary(DS::OK,
"No errors reported.");
136 status.
addf(
"Float value (data())",
"%f", sub_.
data()->data);
141 status.
addf(
"Float value (->)",
"%f", sub_->
data);
146 int main(
int argc,
char **argv)
148 ros::init(argc, argv,
"latched_subscriber_test");
du::Updater diagnostic_updater_
const std::string & mappedTopic() const
void initialize(const ros::WallTimerEvent &ignored)
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
void summary(unsigned char lvl, const std::string s)
void handleDiagnosticsTimer(const ros::TimerEvent &ignored)
double maxPeriodMilliseconds() const
void setHardwareID(const std::string &hwid)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void add(const std::string &name, TaskFunction f)
void appendDiagnostics(diagnostic_updater::DiagnosticStatusWrapper &status, const std::string &name, const int flags)
double maxLatencyMicroseconds() const
void autoDiagnostics(du::DiagnosticStatusWrapper &status)
const std::string & unmappedTopic() const
void addf(const std::string &key, const char *format,...)
void initialize(ros::NodeHandle &nh, const std::string &topic, const ros::TransportHints &transport_hints=ros::TransportHints())
WallTimer createWallTimer(WallDuration period, void(T::*callback)(const WallTimerEvent &), T *obj, bool oneshot=false, bool autostart=true) const
ros::WallTimer init_timer_
double meanLatencyMicroseconds() const
int numPublishers() const
void setTimeout(const ros::Duration &time_out)
void mergeSummary(unsigned char lvl, const std::string s)
double timeoutMilliseconds() const
double minPeriodMilliseconds() const
double minLatencyMicroseconds() const
bool timeoutEnabled() const
int main(int argc, char **argv)
void add(const std::string &key, const T &val)
const boost::shared_ptr< M const > & data() const
double meanPeriodMilliseconds() const
swri::LatchedSubscriber< std_msgs::Float32 > sub_
void manualDiagnostics(du::DiagnosticStatusWrapper &status)
diagnostic_msgs::DiagnosticStatus DS
double meanFrequencyHz() const
void valueDiagnostics(du::DiagnosticStatusWrapper &status)