This page will refer to example skills from [[https://git.cs.lth.se/robotlab/skill_examples/-/tree/master/|this]] repository written by Pontus Rosqvist.
A skill description extends [[https://git.cs.lth.se/robotlab/rvmi/skiros2/-/blob/master/skiros2_common/src/skiros2_common/core/abstract_skill.py|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 [[https://git.cs.lth.se/robotlab/skill_examples/-/blob/master/src/skill_examples/basic_primitive_skill.py|basic_primitive]], [[https://git.cs.lth.se/robotlab/skill_examples/-/blob/master/src/skill_examples/skill_phases.py|skill_phases]] and [[https://git.cs.lth.se/robotlab/skill_examples/-/blob/master/src/skill_examples/infer_parameters.py|infer_parameters]] among others.
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:
<cli>
class DescriptionName(SkillDescription):
def createDescription(self):
self.addParam('NameOfParameter', 0.0, ParamTypes.Required)
</cli>
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:
<cli>
class DescriptionName(SkillDescription):
def createDescription(self):
self.addParam('NameOfParameter', Float, ParamTypes.Required)
</cli>
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