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've managed to achieve this by starting my third party application (where the requests derive from) in a separate thread then making the thread wait using:

synchronized (thread1) {
    thread1.wait();
 }

Then, wake it up in the onSuccess (and onFailure - don't want it getting stuck waiting) with:

  synchronized (thread1) {
      thread1.notifyAll();
  }

Cheers! -James

I've managed to achieve this by starting my third party application (where the requests derive from) in a separate thread then making the thread wait when you issue the request using:

synchronized (thread1) {
    thread1.wait();
 }

Then, wake it up in the onSuccess (and onFailure - don't want it getting stuck waiting) with:

  synchronized (thread1) {
      thread1.notifyAll();
  }

Cheers! -James

I've managed to achieve this by starting my third party application (where the requests derive from) in a separate thread then making the thread wait when you issue the request using:

synchronized (thread1) {
    thread1.wait();
 }

Then, wake it up in the onSuccess (and onFailure - don't want it getting stuck waiting) with:

  synchronized (thread1) {
      thread1.notifyAll();
  }

Then I created a method to construct the requests that my third party client can call:

 public static void buildRequest(String str){

    final rosd_messages.RosDRequest req;
    req = node1.getServiceRequestMessageFactory().newFromType(rosd_messages.RosD._TYPE);
    req.setTask(str);
     ServiceClient<rosd_messages.RosDRequest, rosd_messages.RosDResponse> sClient;

    try {
        sClient = node1.newServiceClient("abc123", rosd_messages.RosD._TYPE);
      } catch (ServiceNotFoundException e) {
            throw new RosRuntimeException(e);
    }

Note: There is no reason you have to use custom requests. I think this gives you the ability to build your own requests dynamically in a fairly efficient way. If you have a better idea, I am all ears.

Cheers! -James