1.14. Object Detection Mock

Warning

This component is deprecated and is no longer maintained. The documentation may not reflect a working configuration.

This small program can be used to fake object detection. It provides the possibility to search for arbitrary objects via rpc calls and task specifications. It returns a random location from a list which can be provided at component startup. The location remains the same in subsequent queries.

1.14.2. Startup

The program can be invoked with the following parameters:

-avail <arg> Available rooms for searching. May be any of (colon-separated):
  • Kitchen, Living, Bath, Wardrobe, NotAvail
  • default: all

-help Print this help.

-method <arg> Name for the search method
  • default: find
-server <arg> RSB scope to create the remote server at
  • no default, apartment config: /home/objects/find/
-task <arg> RSB scope to listen to for task specifications
  • no default, apartment config: /home/objects/find/

1.14.3. Interfaces

You can search for objects in two different ways. a) Send an object of type rst.communicationpatterns.TaskState containing the object to search for in the payload with an initiated state and the handler set to initiator. The task state’s payload will be updated with the according location and the task is marked as completed by the handler. b) Invoke the find method with the object’s name as an argument.

In the apartment context, the component is configured with the following scopes:

Scope (Listener and Informer) Type
/home/objects/find/ rst.communicationpatterns.TaskState
Scope (Local Server) + Method Argument Type Return Type
/home/objects/find/find() String String

1.14.4. Examples

In order to successfully implement one of these Java examples, you need JDK 7+ and rsb / rst 0.12+.

// Import the following:
import com.google.protobuf.ByteString;
import rsb.*;
import rst.communicationpatterns.TaskStateType.TaskState;

1.14.4.1. Remote server method call

 RemoteServer remote = Factory.getInstance().createRemoteServer("/home/objects/find");
 remote.activate();
 String object = "My Object";
 String location = remote.call("find", object);
 System.out.println("found '" + object + "' in: " + location);
 remote.deactivate();