Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:srdl2_tutorial [2014/11/27 16:08] – [Matching requirements to capabilities] admin | doc:srdl2_tutorial [2014/11/27 17:00] – [Startup] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Semantic Robot Description Language ====== | ====== Semantic Robot Description Language ====== | ||
~~NOTOC~~ | ~~NOTOC~~ | ||
+ | |||
+ | \\ | ||
+ | ^ This page describes the ' | ||
+ | \\ | ||
+ | |||
+ | |||
{{ : | {{ : | ||
The Semantic Robot Description Language (SRDL) extends KnowRob with representations for robot hardware, robot software and robot capabilities. The hardware models can automatically be [[/ | The Semantic Robot Description Language (SRDL) extends KnowRob with representations for robot hardware, robot software and robot capabilities. The hardware models can automatically be [[/ | ||
Line 17: | Line 23: | ||
* Task model: Description of the concrete task at hand, using the action classes defined in the srdl-action ontology | * Task model: Description of the concrete task at hand, using the action classes defined in the srdl-action ontology | ||
+ | ===== Startup ===== | ||
+ | |||
+ | <code prolog> | ||
+ | $ rosrun rosprolog rosprolog knowrob_srdl | ||
+ | |||
+ | % Load SRDL model of the PR2 and Baxter robots | ||
+ | ?- owl_parse(' | ||
+ | ?- owl_parse(' | ||
+ | |||
+ | % Load an example task description for serving a drink | ||
+ | ?- register_ros_package(knowrob_actions). | ||
+ | ?- owl_parse(' | ||
+ | </ | ||
+ | |||
+ | ===== Components and capabilities of a robot ===== | ||
+ | Read all components of a robot. There is no distinction between robots and components any more, robots are just complex components that consist of many parts. | ||
+ | <code prolog> | ||
+ | ?- sub_component(pr2:' | ||
+ | Sub = pr2: | ||
+ | Sub = pr2: | ||
+ | Sub = pr2: | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | Filter the list of components to only those of a given type, e.g. a //Camera//: | ||
+ | |||
+ | <code prolog> | ||
+ | ?- sub_component(pr2:' | ||
+ | | ||
+ | Sub = pr2: | ||
+ | Sub = pr2: | ||
+ | Sub = pr2: | ||
+ | Sub = pr2: | ||
+ | Sub = pr2: | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | Read all properties of a component: | ||
+ | |||
+ | <code prolog> | ||
+ | ?- sub_component(pr2:' | ||
+ | Sub = pr2: | ||
+ | Sub = pr2: | ||
+ | P = srdl2comp: | ||
+ | O = literal(type(' | ||
+ | Sub = pr2: | ||
+ | P = srdl2comp: | ||
+ | O = literal(type(xsd: | ||
+ | Sub = pr2: | ||
+ | P = srdl2comp: | ||
+ | O = literal(type(xsd: | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | Check whether a component of a certain type exists on a robot (or, in general, as part of another component): | ||
+ | <code prolog> | ||
+ | ?- comp_type_available(pr2:' | ||
+ | true | ||
+ | |||
+ | ?- comp_type_available(pr2:' | ||
+ | Sub = srdl2comp:' | ||
+ | Sub = srdl2comp:' | ||
+ | Sub = srdl2comp:' | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | Check which capabilities exists on a robot: | ||
+ | <code prolog> | ||
+ | ?- cap_available_on_robot(Cap, | ||
+ | Cap = srdl2cap:' | ||
+ | Cap = srdl2cap:' | ||
+ | [...] | ||
+ | </ | ||
+ | ===== Requirements of an action ===== | ||
+ | |||
+ | Capabilities an action depends on: | ||
+ | |||
+ | <code prolog> | ||
+ | ?- required_cap_for_action(serve_drink:' | ||
+ | C = srdl2cap:' | ||
+ | C = srdl2cap:' | ||
+ | C = srdl2cap:' | ||
+ | C = srdl2cap:' | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | Components an action depends on (either directly or via required capabilities that depend on these components) | ||
+ | <code prolog> | ||
+ | ?- required_comp_for_action(serve_drink:' | ||
+ | C = srdl2comp:' | ||
+ | C = srdl2comp:' | ||
+ | C = srdl2comp:' | ||
+ | C = srdl2comp:' | ||
+ | [...] | ||
+ | </ | ||
+ | |||
+ | ===== Missing components or capabilities ===== | ||
+ | |||
+ | <code prolog> | ||
+ | % No components nor capabilities are missing for the ServeADrink action on the PR2: | ||
+ | ?- missing_comp_for_action(serve_drink:' | ||
+ | false. | ||
+ | |||
+ | ?- missing_cap_for_action(serve_drink:' | ||
+ | false. | ||
+ | |||
+ | % The Baxter robot, in contrast, cannot perform the task due to lacking navigation abilities: | ||
+ | ?- missing_cap_for_action(serve_drink:' | ||
+ | C = srdl2cap:' | ||
+ | </ | ||
===== Matching requirements to capabilities ===== | ===== Matching requirements to capabilities ===== | ||
Line 55: | Line 171: | ||
- | ===== Example queries ===== | ||
- | |||
- | ==== Components and capabilities of a robot ==== | ||
- | Read all components of a robot. There is no distinction between robots and components any more, robots are just complex components that consist of many parts. | ||
- | ?- srdl2: | ||
- | Sub = ' | ||
- | Sub = ' | ||
- | ... | ||
- | Check whether a component of a certain type exists on a robot (or, in general, as part of another component): | ||
- | ?- srdl2: | ||
- | CompT = ' | ||
- | CompT = ' | ||
- | CompT = ' | ||
- | ... | ||
- | | ||
- | Check which capabilities exists on a robot | ||
- | ?- srdl2: | ||
- | Cap = ' | ||
- | Cap = ' | ||
- | Cap = ' | ||
- | Cap = ' | ||
- | ... | ||
- | |||
- | ==== Action requirements ==== | ||
- | Capabilities an action depends on: | ||
- | ?- srdl2: | ||
- | Cap = ' | ||
- | Cap = ' | ||
- | Cap = ' | ||
- | Cap = ' | ||
- | ... | ||
- | Components an action depends on (either directly or via required capabilities that depend on these components) | ||
- | ?- srdl2: | ||
- | Comp = ' | ||
- | Comp = ' | ||
- | Comp = ' | ||
- | ... | ||
- | |||
- | ==== Missing components or capabilities ==== | ||
- | |||
- | ?- missing_cap_for_action(tablesetting:' | ||
- | Cap = ' | ||
- | Cap = ' | ||
- | |||
- | ?- missing_comp_for_action(tablesetting:' | ||
- | false. | ||