================================= How to attach a script to a skill ================================= The way to attach scripts to skills is almost the same as attaching a monitor. First you have to include the script by adding the include statement at the start of the ```` tag. .. rstcheck: ignore-next-code-block .. code-block:: xml :emphasize-lines: 3 ... .. Comment to get indent after code-block .. .. note:: | For adding all in pitasc already defined scripts, use the following include statement, which you can also find in every example application file. | ```` There are two options for attaching a script to a skill. The first option is to create a child of the script directly inside the ```` tag of the skill. You can either use the ```` or the ```` tag to add a script. For more information about these tags and there use look at :doc:`../advanced/How_to_add_a_parameter_to_a_skill_monitor_etc`. .. code-block:: xml :emphasize-lines: 2,3,4,5 value ... The second option is to create the child of the script outside the ```` tag as a parameter of the skill and create a reference to this script parameter using the ```` tag inside the ```` tag. This option has lower readability and thus, it is not recommended. .. note:: See also the xml reference of :doc:`../../../xml_reference/scripts/index` **Example 1: Attach script to skill** .. code-block:: xml :emphasize-lines: 18, 19, 20, 21, 22 <...> <...> tool start_position 0.0, -0.15, 0.0, 0.0, 0, 0.0 /my_service False True **Example 2: Attach script to skill definition** .. code-block:: xml :emphasize-lines: 7, 8, 9 Calls my special std_srvs/Trigger service /my_service .. note:: In this example, a ``skill_idle_once`` is used as prototype, which continues after one pitasc cycle. So, the ``blocking`` member of ``script_call_trigger_srvs`` must be ``false`` (which is the default value). Another (possibly better) way is to use a ``skill_idle`` as prototype and add also a ``monitor_script_result`` to handle the results of the trigger service respectively.