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
create_your_own_knowrob_package [2012/12/01 10:00] tenorthcreate_your_own_knowrob_package [2012/12/01 10:09] tenorth
Line 3: Line 3:
 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 e.g. some Java libraries provided by the packages, 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. If you would just like to link against e.g. some Java libraries provided by the packages, you don't have to follow the description below, but can just implement a normal ROS package that depends on the respective KnowRob packages.
  
-The answer depends on which kind of package you would like to create: +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.
- +
-(1) If the package implements new Prolog functionality or contains custom OWL files, you should create a package similar to e.g. comp_spatial. It should be a normal ROS package that, in addition, contains the following files:+
  
 <code> <code>
 +  your_package
 +  |- manifest.xml
 +  |- CMakeLists.txt
   |- owl   |- owl
   |  \- your_file.owl   |  \- your_file.owl
Line 15: Line 16:
 </code> </code>
  
-The init.pl should initialize the package, which may include loading dependencies, parsing OWL files, and registering RDF namespaces. Have a look at e.gcomp_spatial for an exampleThe owl.in or pl.in files you will find in some packages are required since the RDF parser needs global paths for loading files referenced by an OWL file. owl.in files therefore contain a placeholder that is replaced during compilation as specified in your CMakeLists.txt. Once you have set up your package like this, you can launch the system using +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. The //...owl.in// or //...pl.in// files you will find in some packages are required since the RDF parser needs global paths for loading files referenced by an OWL file. owl.in files therefore contain a placeholder that is replaced during compilation as specified in your //CMakeLists.txt//. 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 
     rosrun rosprolog rosprolog your_package     rosrun rosprolog rosprolog your_package
  
-(2) If you would just like to use existing packages in your program, e.gto send queries via jpl or to call Java methods in one of the packages, it's enough to just depend on the KnowRob package. +Like in any other ROS package, you will need to specify your dependencies in the manifest.xmlWhich packages to depend on depends on which functionality you would like to use. You just need to list the direct dependencies in your manifest, their dependencies are automatically included as well. Common candidates could be to depend on //mod_vis// (if you would like to use the visualization somewhere) or on //ias_semantic_map// (if you would like to use that map).
- +
-Regarding which package to depend on, this depends on which functionality you would like to use. You just need to list the direct dependencies in your manifest, their dependencies are automatically included as well. Common candidates could be to depend on mod_vis (if you would like to use the visualization somewhere) or on ias_semantic_map (if you would like to use that map). +
- +