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:57] – [Querying the KnowRob ontology] daniel86 | doc:knowrob_basics [2021/02/18 09:25] (current) – [Visualizing objects] daniel86 | ||
---|---|---|---|
Line 18: | Line 18: | ||
<code prolog> | <code prolog> | ||
?- subclass_of(A, | ?- subclass_of(A, | ||
- | A = dul:' | + | A = dul:' |
- | A = dul:' | + | A = dul:' |
- | A = dul:' | + | A = dul:' |
- | A = dul:' | + | A = dul:' |
</ | </ | ||
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, | + | |
- | | + | |
</ | </ | ||