Skip to content

lishengling1/client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

client

example4

#include "ros/ros.h"

#include "beginner_tutorials/AddTwoInts.h"

#include

int main(int argc, char **argv) {

ros::init(argc, argv, "add_two_ints_client");

if (argc != 3)

{

ROS_INFO("usage: add_two_ints_client X Y");

return 1;

}

ros::NodeHandle n;

ros::ServiceClient client = n.serviceClient<beginner_tutorials::AddTwoInts>("add_two_ints");

beginner_tutorials::AddTwoInts srv;

srv.request.a = atoll(argv[1]);

srv.request.b = atoll(argv[2]);

if (client.call(srv))

{

ROS_INFO("Sum: %ld", (long int)srv.response.sum);

}

else {

ROS_ERROR("Failed to call service add_two_ints");

return 1;

}

return 0; }

About

example4

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published