Go to the documentation of this file.
33 #include "diagnostic_msgs/SelfTest.h"
77 ROS_ERROR(
"Value testing test2 was not found when trying to remove it.");
87 ROS_INFO(
"Doing preparation stuff before we run our test.\n");
88 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"Pretest completed successfully.");
102 bool lookup_successful =
true;
104 if (lookup_successful)
106 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"ID Lookup successful");
117 status.
summary(diagnostic_msgs::DiagnosticStatus::ERROR,
"ID Lookup failed");
133 throw std::runtime_error(
"we did something that threw an exception");
136 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"We made it past the exception throwing statement.");
146 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"We successfully changed the value.");
153 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"We observed the change in value");
157 status.
summaryf(diagnostic_msgs::DiagnosticStatus::ERROR,
"We failed to observe the change in value, it is currently %f.",
some_val);
163 ROS_INFO(
"Doing cleanup stuff after we run our test.\n");
164 status.
summary(diagnostic_msgs::DiagnosticStatus::OK,
"Posttest completed successfully.");
void add(const std::string &key, const bool &b)
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
void test4(diagnostic_updater::DiagnosticStatusWrapper &status)
void test1(diagnostic_updater::DiagnosticStatusWrapper &status)
void add(const std::string &name, TaskFunction f)
void summary(const diagnostic_msgs::DiagnosticStatus &src)
int main(int argc, char **argv)
Class to facilitate the creation of component self-tests.
Simple node with a self test that reports an error.
void setID(std::string id)
Sets the ID of the part being tested.
void posttest(diagnostic_updater::DiagnosticStatusWrapper &status)
void test3(diagnostic_updater::DiagnosticStatusWrapper &status)
void checkTest()
Check if a self-test is pending. If so, start it and wait for it to complete.
void pretest(diagnostic_updater::DiagnosticStatusWrapper &status)
bool removeByName(const std::string name)
void test2(diagnostic_updater::DiagnosticStatusWrapper &status)
void summaryf(unsigned char lvl, const char *format,...)
self_test::TestRunner self_test_
self_test
Author(s): Kevin Watts, Brice Rebsamen
, Jeremy Leibs and Blaise Gassend
autogenerated on Tue Nov 15 2022 03:17:24