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:33] – [Components and capabilities of a robot] admin | doc:srdl2_tutorial [2014/11/27 17:00] – [Startup] admin | ||
---|---|---|---|
Line 28: | Line 28: | ||
$ rosrun rosprolog rosprolog knowrob_srdl | $ rosrun rosprolog rosprolog knowrob_srdl | ||
- | % Load SRDL model of the PR2 robot | + | % Load SRDL model of the PR2 and Baxter robots |
?- owl_parse(' | ?- owl_parse(' | ||
+ | ?- owl_parse(' | ||
+ | % Load an example task description for serving a drink | ||
+ | ?- register_ros_package(knowrob_actions). | ||
+ | ?- owl_parse(' | ||
</ | </ | ||
Line 40: | Line 44: | ||
Sub = 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: | ||
[...] | [...] | ||
</ | </ | ||
Line 55: | Line 89: | ||
</ | </ | ||
- | Check which capabilities exists on a robot | + | Check which capabilities exists on a robot: |
<code prolog> | <code prolog> | ||
- | | + | ?- cap_available_on_robot(Cap, |
- | Cap = 'http:// | + | Cap = srdl2cap:'GraspingCapability' ; |
- | Cap = ' | + | Cap = srdl2cap:'ObjectManipulationCapability' ; |
- | Cap = 'http:// | + | [...] |
- | Cap = ' | + | |
- | ... | + | |
</ | </ | ||
===== Requirements of an action ===== | ===== Requirements of an action ===== | ||
Capabilities an action depends on: | Capabilities an action depends on: | ||
- | | + | |
- | | + | <code prolog> |
- | | + | ?- required_cap_for_action(serve_drink:'ServeADrink', |
- | | + | C = srdl2cap:' |
- | | + | C = srdl2cap:' |
- | ... | + | C = srdl2cap:'GraspingCapability' ; |
+ | C = srdl2cap:' | ||
+ | [...] | ||
+ | </code> | ||
Components an action depends on (either directly or via required capabilities that depend on these components) | Components an action depends on (either directly or via required capabilities that depend on these components) | ||
- | | + | <code prolog> |
- | | + | ?- required_comp_for_action(serve_drink:'ServeADrink', |
- | | + | C = srdl2comp:' |
- | | + | C = srdl2comp:' |
- | ... | + | C = srdl2comp:' |
+ | C = srdl2comp:' | ||
+ | [...] | ||
+ | </ | ||
===== Missing components or capabilities ===== | ===== Missing components or capabilities ===== | ||
- | ?- missing_cap_for_action(tablesetting:' | + | <code prolog> |
- | Cap = 'http:// | + | % No components nor capabilities are missing for the ServeADrink action on the PR2: |
- | Cap = ' | + | ?- missing_comp_for_action(serve_drink:'ServeADrink', |
- | + | false. | |
- | ?- missing_comp_for_action(tablesetting:'TableSetting', | + | |
- | 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 ===== | ||