Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
doc:knowrob_basics [2021/02/18 08:43] – [Installing and launching the system] daniel86 | doc:knowrob_basics [2021/02/18 09:25] (current) – [Visualizing objects] daniel86 | ||
---|---|---|---|
Line 13: | Line 13: | ||
===== Querying the KnowRob ontology ===== | ===== Querying the KnowRob ontology ===== | ||
- | The KnowRob | + | Starting |
+ | Additionally | ||
+ | You can start exploring the available classes, e.g. with | ||
<code prolog> | <code prolog> | ||
- | ? | + | ? |
- | A = 'http:// | + | A = dul:' |
- | A = 'http:// | + | A = dul:'ChemicalObject' ; < |
- | A = 'http:// | + | A = dul:'DesignedArtifact' ; < |
- | A = ' | + | A = dul:'DesignedSubstance' . < |
- | A = 'http:// | + | |
- | A = 'http:// | + | |
- | Yes. | + | |
</ | </ | ||
- | 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 ' | + | 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 dot (full stop). You can step through the results with the semicolon |
- | Before continuing with the tutorial, try to get familiar with the taxonomy and its main [[KnowRob_Taxonomy|classes]] and properties, either by exploring | + | Before continuing with the tutorial, try to get familiar with the [[http:// |
+ | The best way to explore | ||
===== Loading and querying environment information ===== | ===== Loading and querying environment information ===== | ||
Line 33: | Line 33: | ||
So far, we only performed reasoning on the class level. For robotic applications, | So far, we only performed reasoning on the class level. For robotic applications, | ||
<code prolog> | <code prolog> | ||
- | ? | + | ? |
</ | </ | ||
- | You can query for properties of instances using the rdf_has(S, | + | You can query for properties of instances using the holds(S, |
<code prolog> | <code prolog> | ||
- | ? | + | ? |
- | A = knowrob:'Drawer1' ; | + | A = iai_kitchen:'iai_kitchen_fridge_area_lower_drawer_main' ; |
- | A = knowrob:'Drawer103' ; | + | A = iai_kitchen:'iai_kitchen_kitchen_island_left_lower_drawer_main' ; |
- | A = knowrob:'Drawer109' ; | + | A = iai_kitchen:'iai_kitchen_kitchen_island_left_upper_drawer_main' ; |
[...] | [...] | ||
</ | </ | ||
Line 47: | Line 47: | ||
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. In this example we pass two unbound variables //P// and //O// as arguments and receive all possible combinations of values as result. | 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. In this example we pass two unbound variables //P// and //O// as arguments and receive all possible combinations of values as result. | ||
<code prolog> | <code prolog> | ||
- | ?- owl_has(knowrob:'Drawer1', P, O). | + | ?- owl_has(iai_kitchen:'iai_kitchen_kitchen_island_left_lower_drawer_main', P, O). |
- | P = knowrob:prismaticallyConnectedTo, | + | P = urdf:hasBaseLinkName, |
- | O = knowrob:' | + | O = kitchen_island_left_lower_drawer_main |
- | P = knowrob:depthOfObject, | + | P = urdf:hasEndLinkName, |
- | O = literal(type(xsd: | + | O = kitchen_island_left_lower_drawer_handle |
- | P = knowrob: | + | [...] |
- | O = literal(type(xsd: | + | |
- | P = knowrob: | + | |
- | O = literal(type(xsd: | + | |
- | P = knowrob: | + | |
- | O = knowrob:' | + | |
- | P = knowrob: | + | |
- | O = knowrob:' | + | |
- | P = knowrob: | + | |
- | O = knowrob:' | + | |
- | P = knowrob: | + | |
- | O = ' | + | |
- | P = ' | + | |
- | O = literal(drawer_fridge_bottom_fixed_link) ; | + | |
- | P = rdf:type, | + | |
- | O = owl:' | + | |
- | P = rdf:type, | + | |
- | O = knowrob:' | + | |
- | </ | + | |
- | + | ||
- | + | ||
- | ===== Visualizing objects ===== | + | |
- | + | ||
- | KnowRob includes a browser-based visualization canvas that can display 3D data such as the environment map or the robot itself. The canvas is based on [[http:// | + | |
- | <code bash> | + | |
- | roslaunch rosbridge_server rosbridge_websocket.launch | + | |
- | </ | + | |
- | + | ||
- | You can just leave the rosbridge node running in the background while you are working on KnowRob. The following queries load a semantic environment map with a set of objects inside and push them to the 3D canvas. The result should look like the image below. | + | |
- | + | ||
- | {{ : | + | |
- | + | ||
- | <code prolog> | + | |
- | % Load the visualization Prolog module | + | |
- | ?- register_ros_package(knowrob_vis). | + | |
- | + | ||
- | % Load an environment map to get some example objects | + | |
- | ?- owl_parse(' | + | |
- | + | ||
- | % Start the KnowRob side of the visualization canvas. This will start | + | |
- | % a web server at http:// | + | |
- | ?- visualisation_server. | + | |
- | + | ||
- | % Select the map instance of type ' | + | |
- | % and add it to the 3D canvas | + | |
- | ?- owl_individual_of(A, | + | |
- | | + | |
</ | </ | ||