ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The class names are all full qualified here, but you could of course import them so that it wouldn't be necessary (making the code more compact).

ServiceServer<org.ros.message.std_msgs.Empty, org.ros.message.std_msgs.Empty> server = node.newServiceServer(
    "callme", "std_srvs/Empty",
    new ServiceResponseBuilder<org.ros.service.std_srvs.Empty.Request, org.ros.service.std_srvs.Empty.Response>() {
      @Override
      public org.ros.service.std_srvs.Empty.Response build(org.ros.service.std_srvs.Empty.Request request) throws ServiceException {
        org.ros.service.std_srvs.Empty.Response response = new org.ros.service.std_srvs.Empty.Response();
        // ...
        return response;
      }
    };
});