Advertise service from nodelets

asked 2018-06-06 20:36:12 -0500

vinaykumarhs2020 gravatar image

I am trying to advertise a service from the nodelet. I am able to get the topic publisher/subscriber working fine, but the service is not being advertised.

Platform: Ubuntu 16.04 + ROS Kinetic

Here's how my onInit() function looks like:

nh = getNodeHandle(); 
pnh = getPrivateNodeHandle();
NODELET_INFO_STREAM("Starting nodelet"); 
srv = nh.advertiseService("test_service", &NodeletClass::callback_fn, this);
NODELET_INFO_STREAM("Test service name: " << srv.getService() );

When the nodelet starts, I do see the nodelet's name and nodelet manager's name in rosnode list. Stdout has:

   Starting nodelet
   Test service name: /test_service

But I don't see /test_service in rosservice list.

Does anyone know if the nodelets can advertise services? or any specific instructions to do so?


edit retag flag offensive close merge delete