SRDL Basic Tutorial

From Knowledgewiki

This page describes how to get started with SRDL Semantic robot description language.

Contents

Getting Started

The SRDL functionality is packaged in the ROS package mod_srdl. In order to use it follow these steps:

1) Make sure to have a working copy of package mod_srdl on your computer (use 'git pull' and 'rosmake mod_srdl' otherwise)

2) Start srdl with the command 'rosrun rosprolog rosprolog mod_srdl'

Some basic queries

Here are examples for some basic queries to get started:

All subactions of an action:

subActions(srdl_action:'TableSetting', L).

All components of a robot:

hasComponent(rosie:'TUM_Rosie_RobotInstance1', C).

Match based on robot components

matchRobotAndAction(rosie:'TUM_Rosie_RobotInstance1', srdl_action:'TableSetting').
matchRobotAndAction(rosie:'TUM_Rosie_RobotInstance1', srdl_action:'ChocolateCakeBaking').

All missing capabilities for an unfeasible action:

returnMissingCapsForAction(srdl_action:'ChocolateCakeBaking',  rosie:'TUM_Rosie_RobotInstance1', Caps).

Print all components that are missing for an unfeasible action (order via capability and capability provision alternative):

printMissingComponents(srdl_action:'ChocolateCakeBaking', rosie:'TUM_Rosie_RobotInstance1').

Compute success probability (based on experience) for an action:

computeSuccessProbability(srdl_action:'TableSetting', P).

Show technical specification/ attributes of components (as far as specified/ contained in KB):

printAttributesOfComponent(pr2:'PR2_l_ArmComposition').

Check if a capability can be learned:

verifyCapAvailability(srdl_cap:'RedCupRecognitionCapability', rosie:'TUM_Rosie_RobotInstance1').
isLearnableCapability(srdl_cap:'RedCupRecognitionCapability', rosie:'TUM_Rosie_RobotInstance1').

Actions in which TUM Rosie and PR2 differ

Example 1 - Driving backwards (possible for Rosie but not for PR2):

matchRobotAndAction(rosie:'TUM_Rosie_RobotInstance1', srdl_action:'DriveBackwards').
matchRobotAndAction(pr2:'PR2_Instance1', srdl_action:'DriveBackwards').
returnMissingCapsForAction(srdl_action:'DriveBackwards',  pr2:'PR2_Instance1', Caps).
printMissingComponents(srdl_action:'DriveBackwards', pr2:'PR2_Instance1').

Example 2 - Crushing a can of coke using strong grip (possible for PR2 but not for Rosie):

matchRobotAndAction(rosie:'TUM_Rosie_RobotInstance1', srdl_action:'CrushCokeCan').
returnMissingCapsForAction(srdl_action:'CrushCokeCan',  rosie:'TUM_Rosie_RobotInstance1', Caps).
printMissingComponents(srdl_action:'CrushCokeCan', rosie:'TUM_Rosie_RobotInstance1').
matchRobotAndAction(pr2:'PR2_Instance1', srdl_action:'CrushCokeCan').

Describe a new robot

First run the urdfImporter program in mod_srdl on the robot's URDF description, creating an OWL file with an SRDL description of the robot's kinematics.

The next step is to create an instance of the robot and link it to its components. Assume we are describing a robot 'Marvin'.

  • Create a class 'Marvin' as subclass of knowrob:Robot
  • Create an instance of Marvin, e.g. MarvinRobot1
  • Link the instance to its kinematic base that has been imported from urdf (e.g. marvin_base)
Marvin subClassOf knowrob:Robot
MarvinRobot1 type Marvin
MarvinRobot1 hasBaseLinkInKinematicChain marvin_base
MarvinRobot1 hasSuccessorInKinematicChain marvin_base

Now you should already be able to query for all components of the robot as defined in the URDF description:

?- hasComponent(marvin:'MarvinRobot1', C).

The robot description is to contain more than just the kinematics, we thus need to add semantic descriptions.

If the respective item (e.g. a camera) has a corresponding URDF frame, we can just add another type to the auto-generate instance in addition to the SRDL_component:UrdfLink.

MarvinCam1 type SRDL_component:UrdfLink
MarvinCam1 type WideAngleCamera

We can also create a new instance of type SRDL_component:ComponentComposition and assign several URDF links as sub-components. This is useful to model an arm or a hand, which consist of multiple links, and assign semantic meaning to it.

Marvin_r_GripperComposition type ParallelGripper
Marvin_r_GripperComposition type ComponentComposition
Marvin_r_GripperComposition hasBaseLinkOfComposition MarvinPalmLink
Marvin_r_GripperComposition hasEndLinkOfComposition Marvin_r_finger1
Marvin_r_GripperComposition hasEndLinkOfComposition Marvin_r_finger2