Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
doc:writing_an_interface_to_your_perception_system [2014/11/27 13:23] – [Subscriber] admindoc:writing_an_interface_to_your_perception_system [2014/11/27 14:52] – [KnowRob integration] admin
Line 102: Line 102:
 Whenever the subscriber is started, it creates the KnowRob-internal representations for all object detections that are received via the topic. It can be run from Prolog via the [[http://www.swi-prolog.org/packages/jpl/|JPL Java-Prolog interface]] as defined in prolog/perception_tutorial.pl: Whenever the subscriber is started, it creates the KnowRob-internal representations for all object detections that are received via the topic. It can be run from Prolog via the [[http://www.swi-prolog.org/packages/jpl/|JPL Java-Prolog interface]] as defined in prolog/perception_tutorial.pl:
  
-<code>+<code prolog>
 obj_detections_listener(Listener) :- obj_detections_listener(Listener) :-
-  jpl_new('edu.tum.cs.ias.knowrob.tutorial.DummySubscriber', ['knowrob_tutorial_listener'], Listener), +  jpl_new('org.knowrob.tutorials.DummySubscriber', [], Listener), 
-  jpl_call(Listener, 'startObjDetectionsListener', [], _).+  jpl_list_to_array(['org.knowrob.tutorials.DummySubscriber'], Arr), 
 +  jpl_call('org.knowrob.utils.ros.RosUtilities', runRosjavaNode, [Listener, Arr], _).
 </code> </code>
  
-If the dummy publisher is runningthe following sequence of commands starts the topic listener, queries for object instances and their poses.+To start a rosjava node from KnowRob, you first need to instantiate the class containing the node definition, create an array with the fully-qualified class name, and pass it to the ''runRosjavaNode'' method. After starting the dummy publisher in another terminalyou can start KnowRob, create the topic listener, and query for object instances and their poses.
  
-<code>+<code prolog>
 ?- obj_detections_listener(L). ?- obj_detections_listener(L).
-L = @'J#00000000000173056232'. +L = @'J#00000000000034668496
-Attaching 0x8afd1010+% ... several rosjava INFO messages ...
  
-<wait for a few seconds...>+wait for a few seconds...
  
 ?- owl_individual_of(A, knowrob:'HumanScaleObject'). ?- owl_individual_of(A, knowrob:'HumanScaleObject').
-A = 'http://ias.cs.tum.edu/kb/knowrob.owl#Cup_vUXiHMJy' ; +A = knowrob:'Cup_uGmuwKPo' ; 
-A = 'http://ias.cs.tum.edu/kb/knowrob.owl#Cup_bneXbLGX' ; +A = knowrob:'DrinkingBottle_TaVWzXre' ; 
-A = 'http://ias.cs.tum.edu/kb/knowrob.owl#DinnerFork_TaVWzXre'+A = knowrob:'DrinkingBottle_rMsqkRjP'
 +A = knowrob:'DinnerFork_tDjYwuhx'
  
-?- current_object_pose('http://ias.cs.tum.edu/kb/knowrob.owl#DinnerFork_TaVWzXre', P).+?- current_object_pose(knowrob:'DinnerFork_tDjYwuhx', P).
 P = [1.0,0.0,0.0,2.9473,0.0,1.0,0.0,2.6113,0.0,0.0,1.0,0.2590,0.0,0.0,0.0,1.0]. P = [1.0,0.0,0.0,2.9473,0.0,1.0,0.0,2.6113,0.0,0.0,1.0,0.2590,0.0,0.0,0.0,1.0].
 </code> </code>