difference of advertiseService between class methods and function callback.

asked 2016-02-08 20:30:59 -0500

chenchengshao@gmail.com gravatar image

ROS run through launch file specify the node "surface_service" in namespace "opnear3".

the node "surface_service" has the function to provide the service "print_service", the code is below, the callback signature is from class methods: ros::NodeHandle nh; ros::ServiceServer surface_server_; surface_server_ = nh.advertiseService( "print_service", &xxxx::select_callback, this); then the name of service generated will be "/print_service"

But I noticed if I use callback signature from function like: ros::NodeHandle nh; ros::ServiceServer surface_server_; surface_server_ = nh.advertiseService( "print_service", select_callback); Then the name of service generated will be "/opnear3/surface_service/print_service"

Could anybody help to explain this? for the class methods call scenario ,how can I get the same service like function callback? Thanks

edit retag flag offensive close merge delete