36 #include "diagnostic_msgs/SelfTest.h"
43 diagnostic_msgs::SelfTest srv;
47 diagnostic_msgs::SelfTest::Response &res = srv.response;
56 printf(
"Self test %s for device with id: [%s]\n", passfail.c_str(), res.id.c_str());
59 for (
size_t i = 0; i < res.status.size(); i++)
61 printf(
"%2zd) %s\n", i + 1, res.status[i].name.c_str());
62 if (res.status[i].level == 0)
64 else if (res.status[i].level == 1)
65 printf(
" [WARNING]: ");
69 printf(
"%s\n", res.status[i].message.c_str());
71 for (
size_t j = 0; j < res.status[i].values.size(); j++)
72 printf(
" [%s] %s\n", res.status[i].values[j].key.c_str(), res.status[i].values[j].value.c_str());
80 printf(
"Failed to call service.\n");
85 int main(
int argc,
char **argv)
90 printf(
"usage: run_selftest name\n");