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_
void initialize(const ros::WallTimerEvent &ignored)
void summary(unsigned char lvl, const std::string s)
void handleDiagnosticsTimer(const ros::TimerEvent &ignored)
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)
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)
double minPeriodMilliseconds() const
void addf(const std::string &key, const char *format,...)
const std::string & unmappedTopic() const
void initialize(ros::NodeHandle &nh, const std::string &topic, const ros::TransportHints &transport_hints=ros::TransportHints())
int numPublishers() const
ros::WallTimer init_timer_
const std::string & mappedTopic() const
bool timeoutEnabled() const
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
const boost::shared_ptr< M const > & data() const
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)
double meanPeriodMilliseconds() const
void mergeSummary(unsigned char lvl, const std::string s)
double timeoutMilliseconds() const
double meanLatencyMicroseconds() const
int main(int argc, char **argv)
void add(const std::string &key, const T &val)
double minLatencyMicroseconds() const
swri::LatchedSubscriber< std_msgs::Float32 > sub_
void manualDiagnostics(du::DiagnosticStatusWrapper &status)
double maxPeriodMilliseconds() const
diagnostic_msgs::DiagnosticStatus DS
void valueDiagnostics(du::DiagnosticStatusWrapper &status)