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

I have the same problem here. I ended up with modifying the pubsub example. I read the javadoc and I ended at the node.newServiceServer part. I started to write my first service with empty request and empty response.

  ServiceServer<org.ros.message.std_msgs.Empty, org.ros.message.std_msgs.Empty> server = node.newServiceServer("callme",)

According to the javadoc, the params are

  • Type Parameters:
    • RequestType - type for the request
    • ResponseType - type for the response
  • Parameters:
    • serviceName - the name of the service
    • serviceType - the type of the service (e.g. "test_ros/AddTwoInts")
    • responseBuilder - called for every request to build a response

Now I am lost. What is the serviceType and what the responseBuilder?????? Can anyone complete my simple line if I want to have a simple service printing "hello world" if the service /callme is called? Thank you.