Hardware devices🔗

Device configuration🔗

An app can control a number of different hardware devices through various drivers. There is the camera and I/O, and probably some data link devices. In different applications, these devices may need to be configured in different ways. Perhaps the most typical example is the exposure time of a camera, which needs to be changed based on the product being inspected.

VisionAppster Tools handle all hardware devices in a uniform way. The Application Engine maintains a device database that provides apps a way to store device-specific settings. The database is stored as a bunch of JSON files and a database index that maps device IDs to settings.

If the autoConfig flag in a tool is true, the database index will be used to find the settings for a hardware device automatically. Alternatively, the app developer can type in the name of a configuration set manually using the parameterSet parameter.

A manually assigned configuration set is a system-dependent parameter that can be changed in the app’s settings. The configuration set name is simply a file name that will be looked up in the database folder when the app starts up. If found, the parameters in the configuration set will be set to the driver.

Device IDs🔗

Cameras, digital I/O devices and data link devices are identified using device IDs. A device ID is composed of a driver ID, a colon and a device part that identifies the device using driver-specific syntax.

The driver ID is used to pick the correct driver for the device. For example, “webcam” would select a webcam driver. On Linux, the webcam driver identifies cameras with character strings such as “usb-video-index0”. Thus, a fully-qualified device ID could be something like “webcam:usb-video-index0”.

Device IDs are system-dependent. If you save an application and later run it in another machine, the Application Engine requires you to check all device IDs in the app and to save them in the app’s settings. This is because it is rarely possible to use the same device ID on different computers. For example, the order of devices on a USB bus may be different, and the IP addresses of remote devices may change.

Device IDs can also be given as regular expressions. This is indicated by surrounding the ID with forward slashes. For example, “/^webcam:.*0$/” uses the first web camera whose id ends with “0”. The regular expression “/./” matches all devices and thus uses the very first detected device.

If an application contains tools that have hardware-specific parameters and the values of those parameters aren’t regular expressions, the values must be set in the app’s settings before it can be started. This happens by clicking the app’s name on the front page of the Engine’s management web interface and selecting the appropriate values there.