Advertising multiple services from a single node [closed]
Hi,
I'm writing a node, that advertises multiple services.
Should I use a diffrent object name for each service, or the same name (see below)? As I understand it, this results in either multiple instances of a ros::ServiceServer Object, or a single one in the latter case..
Ex. 1:
ros::ServiceServer service1 = nodeHandle.advertiseService("serviceOne", serviceOneFunction); ros::ServiceServer service2 = nodeHandle.advertiseService("serviceTwo", serviceTwoFunction);
Ex. 2:
ros::ServiceServer service = nodeHandle.advertiseService("serviceOne", serviceOneFunction); ros::ServiceServer service = nodeHandle.advertiseService("serviceTwo", serviceTwoFunction);
Which Option should I choose? Is there anything else to remember, while writing nodes, that advertise multiple services?
Thanks