Service Configuration

The Vision Service offers a non-real-time counterpart for some real-time components (e.g. function blocks). For this purpose the Vision Service implements an ADS server, which enables access from both the real-time and development environments.

The Vision Service enables the TwinCAT Vision API function blocks to indirectly access the hard disk from the real-time environment, e.g. to load or save images.

The Vision Service is configured under VISION > Service Configuration.

Service Configuration 1:

Vision Service status

Service on Target Machine

Target system on which the TwinCAT Vision Service is running.

Connection

Status of the connection between the development environment and Service. This is a good indicator of whether the Service is running properly.

Version

Version number of the TwinCAT Vision Service.

Service Configuration 2:

Before it is used for the first time, the Vision Service must be installed on the target system, see Setup instructions.

Manually starting the Vision Service

The Vision Service is normally started automatically together with TwinCAT. However, if the Vision Service is offline, it can be reactivated with a TwinCAT restart (click Service Configuration 3: or Service Configuration 4:). If this does not work, or if the Service repeatedly fails to start, it should be re-registered with TwinCAT; see: Vision Service doesn't start.

Service Configuration 5:

Default Directories

These paths define the point on the target system at which TwinCAT Vision, by default, should search for files and save them.

Default Image Directory

This is the default path used by the function blocks to read and write images:

FB_VN_ReadImage

FB_VN_WriteImage

Default Container Directory

This is the default path used by the function blocks to read and write containers:

FB_VN_ReadContainer

FB_VN_WriteContainer

Default ML-Model Directory

This is the default path used by the function blocks to read and write ML models:

FB_VN_ReadMlModel

FB_VN_WriteMlModel

Default Calibration Directory

This path is used by default by the function blocks for reading and writing calibration results:

FB_VN_ReadCalibrationResult

FB_VN_WriteCalibrationResult

A complete list of all important paths can be found in the section Important paths.

Vision Service Log

All important service events are written to the log file TcVnService.log on the target system, which can be found under C:\ProgramData\Beckhoff\TcVnService. In case of support questions regarding the TwinCAT Vision Service, the log file and the time at which the behavior occurred must be sent as well. The development system also features a logger for all components under the Vision node.

Vision Service Cache settings

By default, the Vision Service caches the images it reads in order to provide the requested images more quickly the next time they are retrieved. This optimized mode of operation covers the requirements of most applications and is therefore recommended.

In case the image content changes but the file name remains the same, image caching can be disabled. To do this, open the Vision Service settings at C:\ProgramData\Beckhoff\TcVnService\settings.json on the target system, change the default value of the updateCacheOnReadSize parameter from 0 to 1 and save the file.

Service Configuration 6:

Exit Vision Service

To change the settings, the TwinCAT Vision Service (TcVnService.exe) must first be terminated via the task manager, otherwise the changes will not be applied. After that, the service can be restarted by restarting in Config Mode.

Notice

Inconsistent data

Ensure that the same file is not accessed simultaneously by multiple processes, which can lead to file corruption or inconsistent data.