How to create a custom skill
This guide explains how to create a simple custom skill that avoids the implementation of collections, loops, tasks and bounds by inheriting them from an already created skill.
First, you have to create the file XML containing the skill. Good practice is to save custom skills in a separate ros package. Save your skill file in the /skills
directory of your package and use the following naming convention
skill_[skil_name].xml
.
package_name
├── examples
├── skills
| └── skill_[skill_name].xml <-- Your skill_file
└── ...
To create a simple skill, you need to first include everything that is part of your skill, e.g., skills, monitors, scripts, etc. Add the include statement at the start of the <models>
tag with the following syntax.
<pitasc>
<models>
<include package="package_name" file="path/skill_[skill_name].xml"/>
...
Warning
Don’t include xml-files that include the new skill itself. Otherwise you get an error message due to circular including.
The skill gets added right after the include statements in the <models>
. For this, use the <type>
tag so that you can edit the metadata easily.
<type id="skill_[skill_name]" prototype="{base skill}">
<!-- skill body -->
</type>
The
id
, i.e., the skill name, should be unique and descriptive.The attribute
prototype
refers to the base skill, which is the basis of the new skill. If you want to create a skill that is a simple extension of another skill, this would be the prototype. An example of this would be the skillskill_idle_duration
, which has the prototypeskill_idle
and only attaches amonitor_duration
monitor. If you want to create a more complex skill that includes multiple skills, the prototype must be a composition skill like, e.g.,skill_concurrency
. An example of this would be the skillskill_guarded_approach
.
Set the metadata inside the <meta>
tag of the skill.
...
<models>
<meta>
<member id="description"> {Description} </member>
<member id="categories"> {category_1, category_2, ...} </member>
<member id="visibility"> {choose required, basic, expert or hidden} </member>
</meta>
...
The parameter
description
contains a description. Describe the skill in as much detail as needed to understand the skill completely. This description can be used to create the automatically generated documentation.The parameter
categories
should include the categories of the parent skill and the categories of sub-skills. An exception to this is the internal category of base-skills. The category has no special meaning, but can help to sort the skills, e.g., in a documentation or a GUI. Examples for categories are the entries of Skills.The parameter
visibility
determines how a skill is shown inside the documentation. It can be set to required, basic, expert and hidden. In most cases, basic visibility should be used.
Inside the <data>
tag, every component of the skill like parameters, sub-skills, etc are placed.
...
</meta>
<data>
<!-- skill components and implementation -->
</data>
For an example of a very basic custom skill, see the example in the Skills fundamentals.
The following guides explain how to add and use each type of component.