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
loading_files_and_ros_packages [2012/12/01 10:45] – [Loading files and ROS packages] tenorthloading_files_and_ros_packages [2014/06/05 11:38] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Loading files and ROS packages ====== +#REDIRECT doc:loading_files_and_ros_packages
-~~NOTOC~~ +
-There are different ways how OWL and Prolog files can be loaded. For testing purposes, one can load single files. For deployment, one usually wants to set up a ROS package in such a way that all related files are automatically loaded. Both alternatives will be explained below. +
- +
-=====  Loading OWL files  ===== +
-OWL files need to be parsed to be [[http://www.swi-prolog.org/pldoc/package/semweb.html|internally represented as Prolog triples]]. Parsing is done using the [[http://www.semanticweb.gr/thea/index.html|Thea library (version 0.5)]]. The following command can be used to load an OWL file: +
- +
-<code> +
- owl_parse('path/to/file.owl', false, false, true). +
-</code> +
- +
-=====  Loading Prolog modules  ===== +
-Most functionality in KnowRob is contained in [[http://www.swi-prolog.org/pldoc/doc_for?object=section%281,%275%27,swi%28%27/doc/Manual/modules.html%27%29%29|Prolog modules]]. They can be loaded using the use_module directive. The module needs to be either somewhere in the Prolog 'library' path or be referenced relative to the current working directory: +
-<code> +
- use_module(library('module-name')). +
- use_module('path/to/module-name'). +
-</code> +
- +
-=====  Loading OWL/Prolog files in ROS packages  ===== +
- +
-KnowRob uses [[http://www.ros.org/wiki/rosprolog|rosprolog]] to interact with the ROS filesystem structure. This facilitates loading complex package structures since dependencies on other ROS packages with KnowRob components are automatically resolved and loaded. +
- +
-In order to use this functionality, each ROS package containing KnowRob components needs to correctly define its dependencies on other packages (in the manifest.xml) and contain a file 'prolog/init.pl'. This file will be called by rosprolog in order to set up the package itself and to initialize all dependencies (again by calling their init.pl). +
- +
-Each KnowRob ROS package can be loaded using the following predicate: +
-<code> +
- register_ros_package('pkg-name'). +
-</code> +
- +
-Alternatively, one can launch KnowRob giving the respective package as argument to rosprolog: +
-<code> +
- rosrun rosprolog rosprolog pkg-name +
-</code> +
- +
-=====  Exporting knowledge into OWL files  ===== +
-At some point, you may want to create OWL files. This can be done with the predicates in the 'owl_export' module in the 'knowrob_common' package: +
- +
-<code> +
- % Export the perception of an object to an OWL file +
- export_object(knowrob:'Drawer1', 'path/to/object.owl'). +
-  +
- % Export the definition of an object class to an OWL file +
- export_object_class(knowrob:'Drawer', 'path/to/objclass.owl'). +
-  +
- % Export the map as the set of all perceptions of objects to an OWL file +
- export_map(ias_semantic_map:'SemanticEnvironmentMap0', 'path/to/map.owl'). +
-  +
- % Export an action specification (TBOX) to an OWL file +
- export_action(knowrob:'PickingUpAnObject', 'path/to/action.owl'). +
-</code>+