Skip to content

lishengling1/service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

service

example3

#include "ros/ros.h"

#include "beginner_tutorials/AddTwoInts.h"

bool add(beginner_tutorials::AddTwoInts::Request &req, beginner_tutorials::AddTwoInts::Response &res)

{ res.sum = req.a + req.b;

ROS_INFO("request: x=%ld, y=%ld", (long int)req.a, (long int)req.b);

ROS_INFO("sending back response: [%ld]", (long int)res.sum);

return true; }

int main(int argc, char **argv) { ros::init(argc, argv, "add_two_ints_server");

ros::NodeHandle n;

ros::ServiceServer service = n.advertiseService("add_two_ints", add);

ROS_INFO("Ready to add two ints.");

ros::spin();

return 0; }

About

example3

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published