29 #include "roscpp_tutorials/TwoInts.h" 31 bool add(roscpp_tutorials::TwoInts::Request &req,
32 roscpp_tutorials::TwoInts::Response &res )
34 res.sum = req.a + req.b;
35 ROS_INFO(
"request: x=%ld, y=%ld", (
long int)req.a, (
long int)req.b);
36 ROS_INFO(
" sending back response: [%ld]", (
long int)res.sum);
40 int main(
int argc,
char **argv)
42 ros::init(argc, argv,
"add_two_ints_server");
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
bool add(roscpp_tutorials::TwoInts::Request &req, roscpp_tutorials::TwoInts::Response &res)
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
int main(int argc, char **argv)