Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| doc:srdl2_tutorial [2014/11/27 16:24] – [Semantic Robot Description Language] admin | doc:srdl2_tutorial [2014/11/27 17:05] (current) – [Matching requirements to capabilities] admin | ||
|---|---|---|---|
| Line 22: | Line 22: | ||
| * Robot model: Description of a concrete robot instance including its kinematic structure (auto-generated from URDF file), other hardware/ | * Robot model: Description of a concrete robot instance including its kinematic structure (auto-generated from URDF file), other hardware/ | ||
| * 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 ===== | ===== 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. | 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 = 'http://ias.cs.tum.edu/kb/TUM_Rosie.owl# | + | ?- sub_component(pr2:'PR2Robot1', Sub). |
| - | Sub = ' | + | Sub = pr2:pr2_base ; |
| - | ... | + | Sub = pr2: |
| + | Sub = pr2: | ||
| + | [...] | ||
| + | </code> | ||
| + | |||
| + | Filter the list of components to only those of a given type, e.g. a // | ||
| + | |||
| + | <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): | Check whether a component of a certain type exists on a robot (or, in general, as part of another component): | ||
| - | | + | <code prolog> |
| - | CompT = 'http:// | + | ?- comp_type_available(pr2:'PR2Robot1', |
| - | CompT = ' | + | true |
| - | CompT = ' | + | |
| - | ... | + | |
| - | + | ||
| - | Check which capabilities exists on a robot | + | |
| - | ?- srdl2: | + | |
| - | Cap = ' | + | |
| - | Cap = ' | + | |
| - | Cap = ' | + | |
| - | Cap = ' | + | |
| - | ... | + | |
| + | ?- 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 ===== | ===== 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. | ||
| - | ===== Matching requirements to capabilities | + | % The Baxter robot, in contrast, cannot perform the task due to lacking navigation abilities: |
| + | ?- missing_cap_for_action(serve_drink:' | ||
| + | C = srdl2cap:' | ||
| + | </ | ||
| + | ===== Behind the scenes: Implementation of the matching procedures | ||
| The matching can effectively reduced to the following statement: | The matching can effectively reduced to the following statement: | ||
| + | <code prolog> | ||
| missing_cap_for_action(Action, | missing_cap_for_action(Action, | ||
| | | ||
| \+ cap_available_on_robot(Cap, | \+ cap_available_on_robot(Cap, | ||
| - | A missing capability is thus defined as one that is required by an action, but not provided by the robot. Required means that either the action itself or any sub-action has a dependency on this capability: | + | </ |
| + | |||
| + | A missing capability is thus defined as one that is required by an action but not provided by the robot. | ||
| + | <code prolog> | ||
| required_cap_for_action(Action, | required_cap_for_action(Action, | ||
| | | ||
| Line 82: | Line 149: | ||
| | | ||
| | | ||
| + | </ | ||
| - | There are three possibilities to express that a capability is available on a robot: Either it is asserted to be available for the whole class of robots (e.g. every PR2 has a holonomic base), for a specific robot instance, or it can be concluded that the capability should be available because all specified dependencies on components or other capabilities are fulfilled: | ||
| + | There are three possibilities to express that a capability is available on a robot: Either it is asserted to be available for the whole class of robots (e.g. every PR2 has a mobile base), for a specific robot instance, or it can be concluded that the capability should be available because all specified dependencies on components or other capabilities are fulfilled: | ||
| + | <code prolog> | ||
| % capability asserted for robot instance | % capability asserted for robot instance | ||
| cap_available_on_robot(Cap, | cap_available_on_robot(Cap, | ||
| Line 104: | Line 173: | ||
| | | ||
| | | ||
| + | </ | ||
| The matching procedure is equivalent for components. | The matching procedure is equivalent for components. | ||

