00001 00029 #include "sr_self_test/manual_test.hpp" 00030 #include <diagnostic_msgs/DiagnosticStatus.h> 00031 00032 #include <sr_robot_msgs/ManualSelfTest.h> 00033 00034 namespace shadow_robot 00035 { 00036 ManualTests::ManualTests( std::string message, int id ) 00037 : nh_("~") 00038 { 00039 message_ = message; 00040 id_ = id; 00041 00042 user_input_client_ = nh_.serviceClient<sr_robot_msgs::ManualSelfTest>("manual_self_tests"); 00043 } 00044 00045 void ManualTests::run_manual_tests(diagnostic_updater::DiagnosticStatusWrapper& status) 00046 { 00047 user_input_client_.waitForExistence(); 00048 00049 sr_robot_msgs::ManualSelfTest srv; 00050 srv.request.message = message_; 00051 00052 user_input_client_.call(srv); 00053 00054 if( srv.response.ok ) 00055 { 00056 status.summary(diagnostic_msgs::DiagnosticStatus::OK, "OK"); 00057 } 00058 else 00059 { 00060 status.summary(diagnostic_msgs::DiagnosticStatus::ERROR, "Test failed: " + srv.response.message); 00061 } 00062 } 00063 } //end namespace 00064 00065 /* For the emacs weenies in the crowd. 00066 Local Variables: 00067 c-basic-offset: 2 00068 End: 00069 */ 00070