======= 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.
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.
your_package
|- package.xml
|- CMakeLists.txt
|- owl
| \- your_file.owl
|- src
|- __init__.pl
\- your_module.pl
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:%%//%%/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
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//.