6 #include <std_srvs/Empty.h> 11 typedef diagnostic_msgs::DiagnosticStatus
DS;
34 ROS_INFO(
"Starting initialization timer...");
61 diagnostic_updater_.
add(
62 "swri::ServiceServer test service 1",
this,
65 diagnostic_updater_.
add(
66 "swri::ServiceServer test service 2",
this,
69 diagnostic_updater_.
add(
70 "swri::ServiceServer test service 3",
this,
79 std_srvs::Empty::Response &res)
81 ROS_INFO(
"test service 1 called. returning %s",
82 test1_result_ ?
"true" :
"false");
87 std_srvs::Empty::Response> &event)
95 const std_srvs::Empty::Request &request,
96 std_srvs::Empty::Response &response)
98 ROS_INFO(
"test service 3 called by %s", name.c_str());
104 diagnostic_updater_.
update();
109 status.
summary(DS::OK,
"No errors reported.");
116 status.
summary(DS::OK,
"No errors reported.");
123 status.
summary(DS::OK,
"No errors reported.");
129 int main(
int argc,
char **argv)
131 ros::init(argc, argv,
"service_server_test");
bool handleService1(std_srvs::Empty::Request &req, std_srvs::Empty::Response &res)
void appendDiagnostics(diagnostic_updater::DiagnosticStatusWrapper &status, const std::string &name, const int flags)
void summary(unsigned char lvl, const std::string s)
void setHardwareID(const std::string &hwid)
void setLogCalls(bool enable)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void add(const std::string &name, TaskFunction f)
int main(int argc, char **argv)
swri::ServiceServer test3_srv_
swri::ServiceServer test1_srv_
void service2Diagnostics(du::DiagnosticStatusWrapper &status)
ros::WallTimer init_timer_
swri::ServiceServer test2_srv_
void service3Diagnostics(du::DiagnosticStatusWrapper &status)
bool handleService3(const std::string &name, const std_srvs::Empty::Request &request, std_srvs::Empty::Response &response)
Timer createTimer(Rate r, Handler h, Obj o, bool oneshot=false, bool autostart=true) const
WallTimer createWallTimer(WallDuration period, void(T::*callback)(const WallTimerEvent &), T *obj, bool oneshot=false, bool autostart=true) const
void service1Diagnostics(du::DiagnosticStatusWrapper &status)
void handleDiagnosticsTimer(const ros::TimerEvent &ignored)
void setInstrumentPerClient(bool enable)
void initialize(const ros::WallTimerEvent &ignored)
bool handleService2(ros::ServiceEvent< std_srvs::Empty::Request, std_srvs::Empty::Response > &event)
diagnostic_msgs::DiagnosticStatus DS
du::Updater diagnostic_updater_