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
doc:create_your_own_knowrob_package [2014/08/07 09:03] admindoc:create_your_own_knowrob_package [2021/02/18 08:13] (current) daniel86
Line 1: Line 1:
-====== Create your own KnowRob package ======+======= Create your own KnowRob package ======
  
-If your application requires functionality beyond that one already provided by the standard KnowRob packages, you will need to create your own KnowRob package. The following description assumes that you would like to add knowledge in terms of OWL ontologies, or implement new Prolog predicates, or both. If you would just like to link against Java libraries provided by KnowRob, you don't have to follow the description below, but can just implement a normal ROS package that depends on the respective KnowRob packages.+If your application requires functionality beyond that one already provided by the standard KnowRob packages, you will need to create your own KnowRob package. The following description assumes that you would like to add knowledge in terms of OWL ontologies, or implement new Prolog predicates, or both.
  
-KnowRob packages are normal ROS packages that, in addition, contain some special files and folders. This common structure allows tools like [[http://www.ros.org/wiki/rosprolog|rosprolog]] to automatically load the package and all its dependencies.+KnowRob packages are normal ROS packages that, in addition, contain some special files and folders. This common structure allows [[https://github.com/knowrob/rosprolog|rosprolog]] to automatically load the package and all its dependencies.
  
 <code> <code>
Line 11: Line 11:
   |- owl   |- owl
   |  \- your_file.owl   |  \- your_file.owl
-  |- prolog +  |- src 
-     |- init.pl+     |- __init__.pl
      \- your_module.pl      \- your_module.pl
 </code> </code>
Line 18: Line 18:
 The example above assumes that you would like to create a package //your_package// with an OWL ontology //your_file.owl// and a Prolog file //your_module.pl//. Consider wrapping your functionality into a [[http://www.swi-prolog.org/pldoc/doc_for?object=section%281,%275%27,swi%28%27/doc/Manual/modules.html%27%29%29|Prolog module]] to increase modularity and to avoid name clashes. The example above assumes that you would like to create a package //your_package// with an OWL ontology //your_file.owl// and a Prolog file //your_module.pl//. Consider wrapping your functionality into a [[http://www.swi-prolog.org/pldoc/doc_for?object=section%281,%275%27,swi%28%27/doc/Manual/modules.html%27%29%29|Prolog module]] to increase modularity and to avoid name clashes.
  
-The //init.pl// should initialize the package, which may include loading dependencies, parsing OWL files, and registering RDF namespaces. When referring to OWL files, consider using URLs of the form package://<pkg_name>/owl/file.owl that reference files relative to a ROS package. They are used by the [[http://wiki.ros.org/resource_retriever|ROS 'resource_retriever' library]] and are also understood by the OWL parser in KnowRob. You can have a look at e.g. //comp_spatial// for an example. Once you have set up your package like this, you can launch it using +The //init.pl// should initialize the package, which may include loading dependencies, parsing OWL files, and registering RDF namespaces. When referring to OWL files, consider using URLs of the form //package:%%//%%<pkg_name>/owl/file.owl// that reference files relative to a ROS package. They are used by the [[http://wiki.ros.org/resource_retriever|ROS 'resource_retriever' library]] and are also understood by the OWL parser in KnowRob. Once you have set up your package like this, you can launch it using 
     rosrun rosprolog rosprolog your_package     rosrun rosprolog rosprolog your_package
  
-Like in any other ROS package, you will need to specify your dependencies in the package.xml. Which packages to depend on depends on which functionality you would like to use. You only need to list the direct dependencies, their dependencies are automatically included as well. To use the minimal KnowRob functionality, you should depend on //knowrob_common// -- other common candidates are //knowrob_objects// for object/perception/spatial information-related things, or //knowrob_actions// for representation and reasoning about actions.+Like in any other ROS package, you will need to specify your dependencies in the //package.xml//. 
 +You only need to list the direct dependencies, their dependencies are automatically included as well. 
 +To use the minimal KnowRob functionality, you should depend on //knowrob//.