Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
write_an_interface_to_your_perception_system [2013/01/07 09:56] – [KnowRob integration] tenorth | write_an_interface_to_your_perception_system [2013/02/12 17:41] – external edit 127.0.0.1 | ||
---|---|---|---|
Line 123: | Line 123: | ||
===== Perception service ===== | ===== Perception service ===== | ||
- | src/ | + | The dummy perception service is very similar to the dummy publisher. Whenever a request for an object detection is received, it responds with a simulated detection of a random object type at a random pose. In real scenarios, the request will probably not be empty, but specify properties of the perception method to be used. The code of the dummy service can be found in the file src/ |
+ | < | ||
+ | rosrun knowrob_perception_tutorial dummy_service | ||
+ | </ | ||
===== Service client ===== | ===== Service client ===== | ||
- | src/ | + | The '' |
Line 134: | Line 136: | ||
===== KnowRob integration ===== | ===== KnowRob integration ===== | ||
- | implemented | + | While the service client is much simpler than the topic listener, the integration with KnowRob is a bit more complex. The reason is that the service call needs to be actively triggered, while the topic listener just runs in the background in a separate thread. This means that the inference needs to be aware of the possibility of acquiring information about object detections by calling this service. Such functionality can be realized using [[define_computables|computables]] that describe for an OWL class or property how individuals of this class or values of this property can be computed. To better understand the following steps, it is recommended to have completed the [[define_computables|tutorial on defining computables]]. |
- | integrated as computable prolog class | + | In a first step, we need to implement a Prolog predicate that performs the service call, processes the returned information, |
- | + | ||
- | in contrast to topic-based example, which performed most processing | + | |
< | < | ||
- | comp_object_detection(_ObjClass, | + | comp_object_detection(ObjInst, _ObjClass) :- |
% Call the DetectObject service for retrieving a new object detection. | % Call the DetectObject service for retrieving a new object detection. | ||
Line 169: | Line 169: | ||
</ | </ | ||
+ | The predicate first calls the static '' | ||
+ | This predicate can be used to manually query the perception service from Prolog (assuming the perception service is running in another terminal): | ||
+ | < | ||
+ | rosrun rosprolog rosprolog knowrob_perception_tutorial | ||
+ | ?- comp_object_detection(Obj, | ||
+ | Obj = ' | ||
+ | </ | ||
+ | Such a manual query requires that the user is aware of the existence of this service. It also requires adaptation of the query whenever the context changes, e.g. when different or multiple recognition systems are used. We can avoid these problems by wrapping the predicate into a computable; with this definition, the predicate will automatically be called whenever the user asks for an object pose and when the service interface is available. The following OWL code defines a computable Prolog class for the example predicate: | ||
- | ====== Adapting | + | < |
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | Instead of calling | ||
+ | < | ||
+ | ?- rdfs_instance_of(A, | ||
+ | A = ' | ||
+ | </ | ||
Line 178: | Line 199: | ||
====== Other kinds of perception systems ====== | ====== Other kinds of perception systems ====== | ||
- | In this tutorial, we have concentrated on object recognition as a special case of a perception | + | In this tutorial, we have concentrated on object recognition as a special case of perception. There are of course other perception tasks like the identification and pose estimation of humans, recognition and interpretation of spoken commands, etc. Most of these systems can however be interfaced in a very similar way: If they produce information continuously and asynchronously, |
+ | |||
+ | |||
+ | |||
+ | ====== Adapting the examples to your system ====== | ||
+ | |||
+ | To keep the examples as simple and self-contained as possible, we have defined our own dummy components and messages. Your perception system will probably use slightly different messages and may provide more or less information. In this case, you will need to adapt the service client or topic listener to correctly extract information from your messages. After creating the object instance with '' | ||
+ | |||
+ | |||