Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
doc:srdl2_tutorial [2014/11/27 16:24] – [Semantic Robot Description Language] admindoc:srdl2_tutorial [2014/11/27 17:00] – [Startup] admin
Line 3: Line 3:
  
 \\ \\
-^ This page describes the 'catkinized' version of KnowRob that uses the [[http://wiki.ros.org/catkin/|catkin buildsystem]] and the pure Java-based [[http://wiki.ros.org/rosjava|rosjava]]. The documentation for the older version, which was based on the rosbuild buildsystem and rosjava_jni, can be found [[/doc/srdl2_tutorial?rev=1417090277|here]].^+^ This page describes the 'catkinized' version of KnowRob that uses the [[http://wiki.ros.org/catkin/|catkin buildsystem]] and the pure Java-based [[http://wiki.ros.org/rosjava|rosjava]]. The documentation for the older version, which was based on the rosbuild buildsystem and rosjava_jni, can be found [[/doc/srdl2_tutorial?rev=1417104665|here]].^
 \\ \\
  
Line 22: Line 22:
   * Robot model: Description of a concrete robot instance including its kinematic structure (auto-generated from URDF file), other hardware/software components and hardcoded capabilities   * Robot model: Description of a concrete robot instance including its kinematic structure (auto-generated from URDF file), other hardware/software components and hardcoded capabilities
   * 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('package://knowrob_srdl/owl/PR2.owl').
 +?- owl_parse('package://knowrob_srdl/owl/baxter.owl').
 +
 +% Load an example task description for serving a drink
 +?- register_ros_package(knowrob_actions).
 +?- owl_parse('package://knowrob_actions/owl/serve_drink.owl').
 +</code>
  
 ===== 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.
-  ?- srdl2:sub_component(tumrosie:'TUM_Rosie1', Sub). +<code prolog> 
-  Sub = 'http://ias.cs.tum.edu/kb/TUM_Rosie.owl#TUM_Rosie_WheeledOmnidirPlatform1' ; +?- sub_component(pr2:'PR2Robot1', Sub). 
-  Sub = 'http://ias.cs.tum.edu/kb/TUM_Rosie.owl#TUM_Rosie_Torso1' . +Sub = pr2:pr2_base ; 
- ...+Sub = pr2:pr2_left_arm ; 
 +Sub = pr2:pr2_right_arm 
 +[...
 +</code> 
 + 
 +Filter the list of components to only those of a given type, e.g. a //Camera//: 
 + 
 +<code prolog> 
 +?- sub_component(pr2:'PR2Robot1', Sub),  
 +   owl_individual_of(Sub, srdl2comp:'Camera'). 
 +Sub = pr2:pr2_high_def_frame 
 +Sub = pr2:pr2_high_def_frame ; 
 +Sub = pr2:pr2_wide_stereo_l_stereo_camera_frame ; 
 +Sub = pr2:pr2_wide_stereo_r_stereo_camera_frame ; 
 +Sub = pr2:pr2_narrow_stereo_l_stereo_camera_frame 
 +[...] 
 +</code> 
 + 
 +Read all properties of a component: 
 + 
 +<code prolog> 
 +?- sub_component(pr2:'PR2Robot1', Sub), owl_has(Sub, P, O). 
 +Sub = pr2:pr2_high_def_frame, 
 +Sub = pr2:pr2_high_def_frame, 
 +P = srdl2comp:update_rate, 
 +O = literal(type('http://qudt.org/vocab/unit#Hertz','20.0')) ; 
 +Sub = pr2:pr2_high_def_frame, 
 +P = srdl2comp:frameName, 
 +O = literal(type(xsd:string,high_def_optical_frame)) ; 
 +Sub = pr2:pr2_high_def_frame, 
 +P = srdl2comp:hfov, 
 +O = literal(type(xsd:string,'0.785398163397')) 
 +[...] 
 +</code> 
 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):
-  ?- srdl2:comp_type_available(tumrosie:'TUM_Rosie1', CompT). +<code prolog> 
-  CompT = 'http://ias.cs.tum.edu/kb/srdl2-comp.owl#VectorFieldArmController+?- comp_type_available(pr2:'PR2Robot1', srdl2comp:'Camera'). 
-  CompT = 'http://ias.cs.tum.edu/kb/srdl2-comp.owl#ArmMotionController'+true
-  CompT = 'http://ias.cs.tum.edu/kb/srdl2-comp.owl#MotionControllerComponent'+
-  ... +
-   +
-Check which capabilities exists on a robot +
-  ?- srdl2:cap_available_on_robot(Cap, tumrosie:'TUM_Rosie1'). +
-  Cap = 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#ArmMotionCapability'+
-  Cap = 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#BaseMotionCapability'+
-  Cap = 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#GripperMotionCapability'+
-  Cap = 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#HeadMotionCapability'+
-  ...+
  
 +?- comp_type_available(pr2:'PR2Robot1', Sub).
 +Sub = srdl2comp:'Pr2Base' ;
 +Sub = srdl2comp:'WheeledBase' ;
 +Sub = srdl2comp:'MobileBase' ;
 +[...]
 +</code>
 +
 +Check which capabilities exists on a robot:
 +<code prolog>
 +?- cap_available_on_robot(Cap, pr2:'PR2Robot1').
 +Cap = srdl2cap:'GraspingCapability' ;
 +Cap = srdl2cap:'ObjectManipulationCapability' ;
 +[...]
 +</code>
 ===== Requirements of an action ===== ===== Requirements of an action =====
  
 Capabilities an action depends on: Capabilities an action depends on:
-  ?- srdl2:required_cap_for_action(tablesetting:'TableSetting', Cap). + 
-  Cap 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#PuttingDownAnObjectCapability' ; +<code prolog> 
-  Cap 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#PickingUpAnObjectCapability' ; +?- required_cap_for_action(serve_drink:'ServeADrink', C). 
-  Cap = 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#BaseMotionCapability' ; +srdl2cap:'BaseMotionCapability' ; 
-  Cap 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#ArmMotionCapability' ; +srdl2cap:'ArmMotionCapability' ; 
-  ...+srdl2cap:'GraspingCapability' ; 
 +srdl2cap:'GripperMotionCapability' 
 +[...
 +</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)
-  ?- srdl2:required_comp_for_action(tablesetting:'TableSetting', Comp). +<code prolog> 
-  Comp = 'http://ias.cs.tum.edu/kb/srdl2-comp.owl#MobileBase'+?- required_comp_for_action(serve_drink:'ServeADrink', C). 
-  Comp = 'http://ias.cs.tum.edu/kb/srdl2-comp.owl#ArmMotionController'+srdl2comp:'MobileBase'
-  Comp = 'http://ias.cs.tum.edu/kb/srdl2-comp.owl#ArmComponent'+srdl2comp:'ArmMotionController'
-  ...+srdl2comp:'ArmComponent'
 +C = srdl2comp:'ManipulationEntity' 
 +[...
 +</code>
  
 ===== Missing components or capabilities ===== ===== Missing components or capabilities =====
  
-  ?- missing_cap_for_action(tablesetting:'TableSetting', tumrosie:'TUM_Rosie1', Cap). +<code prolog> 
-  Cap = 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#PuttingDownAnObjectCapability'+% No components nor capabilities are missing for the ServeADrink action on the PR2
-  Cap = 'http://ias.cs.tum.edu/kb/srdl2-cap.owl#PickingUpAnObjectCapability'+?- missing_comp_for_action(serve_drink:'ServeADrink', pr2:'PR2Robot1', C). 
- +false.
-  ?- missing_comp_for_action(tablesetting:'TableSetting', tumrosie:'TUM_Rosie1', Comp). +
-  false.+
  
 +?- missing_cap_for_action(serve_drink:'ServeADrink', pr2:'PR2Robot1', C).
 +false.
  
 +% The Baxter robot, in contrast, cannot perform the task due to lacking navigation abilities:
 +?- missing_cap_for_action(serve_drink:'ServeADrink', baxter:baxter_baxter1, C).
 +C = srdl2cap:'BaseMotionCapability'
 +</code>
 ===== Matching requirements to capabilities ===== ===== Matching requirements to capabilities =====