======== Monitors ======== A monitor is a stop condition that is attached to a skill. In each pitasc cycle (update step), it checks its condition, which can be the successful completion of the task or an error in the middle of execution. If the condition is met, an so-called *event* is triggered which can be used to transition to the next skill. A monitor can surveil forces, movement distances along axis, rotation angles around axis and more. For example, a monitor can be used to surveil the traveled distance in z-direction, i.e., when the robot has moved for example 10 mm, pitasc executes the next skill. Defined at file ``models/coordination.xml`` in package **pitasc_library**. **General structure** --------------------- **xml** Chain of prototype based inheritance .. code-block:: any_monitor --> monitor --> object --> dictionary --> base --> descriptive All monitors are inheriting from 'monitor'. Monitors contain the following attributes inside the ```` tag. .. cell table width fucked up: https://github.com/readthedocs/sphinx_rtd_theme/issues/1505 .. list-table:: Attributes inside ```` tag :widths: auto :header-rows: 1 * - Attribute - Description * - id - Name of the monitor, e.g. "my_monitor". Needs to be locally unique to allow identification. If not unique, a incrementing element e.g., "_no0", "_no1", "_no2", ... will be added * - data_type - Already set by inheritance (dict) * - prototype - The base type the monitor "inherits" from, e.g. "monitor". | Monitors contain the following parameters inside the ```` tag by default. .. list-table:: Members inside ```` tag :widths: auto :header-rows: 1 * - Member - Description * - description - Describes the monitor * - implementation - Implementation details (links to the cpp class) * - categories - Categories the monitor is part of (e.g., geometry, io, ..) * - visibility - Visibility of the monitor (one of: required, basic, expert, hidden) | Monitors contain the following parameters inside the ```` tag by default. .. list-table:: Members inside ```` tag :widths: 25 25 :header-rows: 1 * - Member - Description * - event - Primary event, that is triggered by the monitor (Default: succeeded) | The xml definition of a monitor basically looks like the following: .. code-block:: xml {Choose meaningful description} {Add category(s) separated by comma} {Choose enum} {Add cpp library name} {Add monitor cpp class name} {Choose event name} For example, the definition of a ``monitor_duration`` looks like this: .. code-block:: xml Triggers after a certain time. logic cppitasc_monitors DurationMonitor The amount of time to wait until triggering required .. note:: See also :doc:`../how-to/advanced/How_to_create_a_custom_monitor`