Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorial:knowrob_basics [2012/12/01 10:11] – created tenorth | tutorial:knowrob_basics [2014/06/05 11:38] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Getting started ===== | + | #REDIRECT doc:knowrob_basics |
- | + | ||
- | For effectively using the KnowRob system, some basic knowledge about its main techniques, OWL and Prolog, is helpful. It becomes crucial when extending and adapting the system. | + | |
- | + | ||
- | === Learning OWL === | + | |
- | * Download the Protege OWL editor (version 4.1) which makes exploring and editing OWL files much easier: http:// | + | |
- | + | ||
- | * Have a look at the documentation (http:// | + | |
- | + | ||
- | * Also look at the code you just created in Protege with a text editor to see how the relations you created using the GUI are represented in OWL. | + | |
- | + | ||
- | === Learning PROLOG === | + | |
- | In the beginning, you probably won't need very sophisticated Prolog skills, but it will be good to have a rough understanding of how a Prolog program looks like and what the basic concepts are. | + | |
- | + | ||
- | It's a good start to have a look at the tutorials at http:// | + | |
- | + | ||
- | ===== Setting up KnowRob ===== | + | |
- | + | ||
- | For experimenting with KnowRob, you should install the source distribution from code.in.tum.de. Please refer to http:// | + | |
- | + | ||
- | | + | |
- | sudo apt-get install [[...]] | + | |
- | | + | |
- | + | ||
- | Launch the system using the rosprolog script which takes the name of the package to be launched as parameter. When calling a package with rosprolog, the init.pl file is loaded, and all init.pl of referenced packages as well. That procedure ensures that all packages are initialized when being loaded. For more information on how to load your own packages, have a look at the [[http:// | + | |
- | | + | |
- | + | ||
- | You should now see the Prolog console. | + | |
- | + | ||
- | ===== Querying the KnowRob ontology ===== | + | |
- | + | ||
- | The KnowRob taxonomy is loaded by default since mod_vis, the module we loaded, depends on ias_knowledge_base which contains the taxonomy. So you can start exploring the available classes, e.g. with | + | |
- | ?- owl_subclass_of(A, | + | |
- | A = ' | + | |
- | A = ' | + | |
- | A = ' | + | |
- | A = ' | + | |
- | A = ' | + | |
- | A = ' | + | |
- | | + | |
- | + | ||
- | Some notes on the query syntax: Predicates in a query can be linked with a comma, denoting the logical AND, or a semicolon for the logical OR. Each query is finished with a full stop. You can step through the results with the semicolon or just hit < | + | |
- | + | ||
- | Before continuing with the tutorial, try to get familiar with the taxonomy and its main [[KnowRob_Taxonomy|classes]] and properties, either by exploring the hierarchy from Prolog or, more convenient, by loading knowrob.owl into the Protege editor. | + | |
- | + | ||
- | ===== Loading and querying environment information ===== | + | |
- | + | ||
- | So far, we only performed reasoning on the class level. For robotic applications, | + | |
- | + | ||
- | An example set of instances are the semantic maps, contained as OWL file in the [[http:// | + | |
- | | + | |
- | + | ||
- | The package [[http:// | + | |
- | | + | |
- | + | ||
- | Instances are queried using the rdf_has(S, | + | |
- | ?- owl_has(A, rdf:type, knowrob:' | + | |
- | A = ' | + | |
- | A = ' | + | |
- | A = ' | + | |
- | | + | |
- | + | ||
- | For getting an overview of the information that is available about one object instance, we can query for all triples where the respective instance fills the Subject slot: | + | |
- | ?- owl_has(' | + | |
- | P = ' | + | |
- | O = ' | + | |
- | P = ' | + | |
- | O = ' | + | |
- | P = ' | + | |
- | O = ' | + | |
- | P = ' | + | |
- | O = literal(type(' | + | |
- | P = ' | + | |
- | O = literal(type(' | + | |
- | P = ' | + | |
- | O = ' | + | |
- | P = ' | + | |
- | O = ' | + | |
- | P = ' | + | |
- | O = literal(type(' | + | |
- | | + | |
- | + | ||
- | ===== Visualizing objects ===== | + | |
- | + | ||
- | A visualization often helps to find problems with information in the knowledge base, and is also useful to demonstrate what the robot knows about the world. Therefore, we created a [[http:// | + | |
- | + | ||
- | For launching the launch visualization module, type | + | |
- | | + | |
- | + | ||
- | By default, the system loads the kitchen background. We will now clear the canvas, manually select some objects from the map, and push them to the visualization. | + | |
- | | + | |
- | + | ||
- | Note: $C refers to the last binding of the top-level variable C, in this case the handle identifying the canvas. To select and visualize object instances, we call | + | |
- | | + | |
- | + | ||
- | When skipping through the results with the semicolon ;, you'll see the cupboards appear on the canvas. You will notice that they do not have any handles - when pushing just the object itself, the canvas does not draw its children. You can, however, tell it to do so by using the add_object_with_children predicate: | + | |
- | | + | |
- | + | ||
- | The small window that has opened in addition to the visualization canvas contains some control routines that mainly interact with the right section of the canvas, which displays action sequences. In addition, it can show information about any kind of instance in the system, for instance the objects we just added to the canvas. One way of displaying this information is simply by clicking on the object, but you can also update the content from Prolog: | + | |
- | | + |