This is an old revision of the document!
Skill Description
This page will refer to example skills from this repository written by Pontus Rosqvist.
A skill description extends SkillDescription and is an object which keeps track of which parameters a skill has, what type the parameters are and if they are required, can be inferred or optional. In the skill description one also specifies any conditions which need to be met, these can be pre-conditions (before the skill is executed), hold-conditions (while the skill is executing) and post-conditions (after the skill has been executed). These conditions only need to be specified, SkiROS then takes care of checking that they hold. An example of a skill description can be seen in basic_primitive, skill_phases and infer_parameters among others.
Parameters
The parameters a skill has is specified in the skill description. A parameter can be a python object or an object from the world model. A float could be specified as a parameter in the following way:
class DescriptionName(SkillDescription): def createDescription(self): self.addParam('NameOfParameter', 0.0, ParamTypes.Required)
Here the value “0.0” becomes the default value for that parameter, one can also specify that the parameter has to be a float without specifying a default parameters:
class DescriptionName(SkillDescription): def createDescription(self): self.addParam('NameOfParameter', Float, ParamTypes.Required)
A parameter has a name which is a string which determines the key that the parameter is saved with in the dict self.params in the skill. One also needs to specify if the parameter is required optional or similar. The types of parameters are
- ParamTypes.Required
- ParamTypes.Optional
- ParamTypes.Inferred
Required parameters need to be specified, optional parameters do not :). Inferred parameters are parameters which are required but the skill description can infer them with the help of the world model. Parameters can be inferred if they are the only parameter which satisifes that condition, these conditions might be that the object is the only object of that type in the world model or if the pre-conditions uniquely determine the object in the world model. An example of how one can infer a parameter can be seen in infer_parameters.
The type of a parameter can also be a type which exists in the world model, these are specified in the following way
class DescriptionName(SkillDescription): def createDescription(self): self.addParam('NameOfParameter', Element('PREFIX:TYPE'), ParamTypes.Required)
a concrete example of how this can be done can be seen in update_world_model, infer_parameters and world_model_interface.
Pre-conditions
TODO
Hold-conditions
TODO
Post-conditions
TODO