The Datastore is a persistent, key-value database in the Robot System. It consists of an arbitrary number of entries, which can be accessed both by function blocks and the operators panel.
Data on the Datastore
- can be used across several program runs.
- are available across robot system restarts.
- are shared between all programs, components and users.
- can be accessed from function blocks inside running programs and outside with the operators panel.
- can be accessed asynchronously in programs, which means that there is no need to link respective input/output parameters across programs and subprograms. Data can be written to the Datastore at a certain point in the program and can be read from the Datastore from an other point in the program.
- can be modified manually during program execution time in the Runview with the Datastore view or with the KPI view.
Each Datastore entry consists of the following fields:
- group: Identifying string forming a namespace for several entries. Together with the id it needs to be unique for each entry. The group can be empty but must not contain any spaces.
- id: Identifying string for each entry. Together with the group it needs to be unique for each entry. The ID must not be empty and must not any contain spaces.
- value: The value for the respective entry.
- type: The associated type of the value (see below).
- display_title: An alternative string to display the entry. If the display title is not set, the id of the entry will be used instead for displaying.
- operator_readonly: A flag, which determines whether the entry can be modified at the KPI Panel in the Operator Cockpit.
The following basic datatypes can be used on the Datastore:
- string for text
- int for integer data
- float for floating point data
- bool for boolean data with the values true / True and false / False
- pose for pose data with the format x;y;z;rz;ry;rx, where the translation values are in meters and the orientation values are in radians.
- joints6 for joints data with 6 axes with the format j1;j2;j3;j4;j5;j6, where all values are in degrees for rotational joints or in meters for translational joints.
More complex data needs to be assembled manually with these six basic datatypes.
To access the Datastore from a program several function blocks can be used, which are described in detail in the Function Block Library section. Function blocks for the following operations are available:
- Get Value: Function blocks to read data from the Datastore. These function blocks do not evaluate the type but try to convert the read value to their respective format and eventually raise an E_CAST exception if the data is not appropriate. Pose and Joints function blocks will raise a INVALID_POSE or INVALID_JOINTS exception, if the data can not be converted respectively.
- Set Value: Function blocks to write data to the Datastore. When a value is written for the first time, the respective type is saved and later can only be changed with the Set Type function block.
- Set Type: Function block to change the type of a Datastore entry.
- Set Display Title: Function block to change the displayed title of a Datastore entry.
- Set Operator Lock: Function block to change the permission for the operator to change the value of the entry in the Operator Cockpit. By default an entry created with a function block is not editable for an operator.
- Delete Item: Function block to remove an entry from the datastore.
- Delete Namespace: Function block to remove all entries with the same prefix from the datastore, e.g. the two Datastore entries grid/x and grid/y share the same namespace grid and can be deleted together with this function block.
- Delete All Items: Function block to remove all entries from the Datastore.
- Counter: Special function block, which reads an integer entry from the Datastore, increments it and writes it back to the Datastore.
Example Use Cases and applications¶
Use Datasetore for clean Cycle Stop¶
The Datastore can be used to implement a clean cycle stop in actual production applications.
In this case the task runs in a loop, e.g. continuously processing parts. The loop can be manually controlled and stopped after each cycle. The program will not be stopped immediately, but finish the current cycle and can even do some finishing operations, e.g. moving the robot to a safety position.
To activate the cycle stop. The respective boolean variable in the Datastore has to be set to true. This can be done either through the Operators Panel or in the Runview at the Datastore View as shown in the following image. In both cases the change has to be applied with the Apply marked changes button.
Good Part / Bad Part Tracking¶
Another example of using the Datastore is tracking the number of good or bad parts across several program runs.
In this example it is assumed, that the detection whether a part is bad is reported by a digital I/O. Depending on the result the good_part_counter or the bad_part_counter is increased. Both values are persistently saved and further incremented each program execution as long as they are not resetted manually. Those values enable KPIs and statistics tracking.