37 #include "diagnostic_msgs/SelfTest.h" 68 ROS_INFO(
"Doing preparation stuff before we run our test.\n");
69 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"Pretest completed successfully.");
76 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"ID not set");
83 status.
add(
"some value", some_val);
84 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"We successfully changed the value.");
91 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"We observed the change in value");
95 status.
summaryf(diagnostic_msgs::DiagnosticStatus::ERROR,
"We failed to observe the change in value, it is currently %f.", some_val);
101 ROS_INFO(
"Doing cleanup stuff after we run our test.\n");
102 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"Posttest completed successfully.");
void test4(diagnostic_updater::DiagnosticStatusWrapper &status)
void summary(unsigned char lvl, const std::string s)
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 test3(diagnostic_updater::DiagnosticStatusWrapper &status)
void pretest(diagnostic_updater::DiagnosticStatusWrapper &status)
int main(int argc, char **argv)
void summaryf(unsigned char lvl, const char *format,...)
Simple node with a self test that reports an error.
void checkTest()
Check if a self-test is pending. If so, start it and wait for it to complete.
Class to facilitate the creation of component self-tests.
void test1(diagnostic_updater::DiagnosticStatusWrapper &status)
void posttest(diagnostic_updater::DiagnosticStatusWrapper &status)
void add(const std::string &key, const T &val)
self_test::TestRunner self_test_