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 VisionAppster 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 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 often system-dependent. For example, the order of devices on a USB bus may be different, and the IP addresses of remote devices may change. If you save an application and later run it in another machine, it may not be able to run as such. If you know that a device ID needs to be changed before the app can run, you can right-click the deviceID parameter in the Builder and set its configurability to “required”. This way the Engine will require you to set the value and save it in the app’s settings before the app can be started.

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.