The GoWebScan SDK is distributed with an example application, GoWebScanSdkExample, which demonstrates how to read and write required files, how to connect to sensors and configure the timing, how to set up the main processing class (GoWebScanProcess) how to receive and send sensor data to GoWebScanProcess and retrieve completed boards, and how to record, save, and reprocess raw sensor data.
The example application saves the completed boards as images to the storage folder, but a real application would send this data for further processing. The application demonstrates running a system in Detection mode or Calibration mode. In Detection mode, GoWebScan detects discrete objects and produces a uniform-resolution array representing the object profile data (along with tracheid and vision data depending on the sensor models). In Calibration mode, GoWebScan computes offsets to align sensors in the Z and Y axis and computes gains for a flat field calibration of vision sensors (white balancing).
Prior to running the example application, the system settings (contained in the Settings.xml file located in the storage folder) should be updated to describe the user's system. Additionally, an example system calibration (Calibration.xml located in the storage folder) is included for demonstrational purposes but is not applicable once the system settings are changed. When a new system calibration is run via the example application, the calibration file will be overwritten. When running the application in detection mode, all output board images are saved to the storage folder.
The key classes in GoWebScan that a user application must interact with are as follows:
- GoWebScanSettings: Loads and stores (to an XML) user settings defining the system topology and processing parameters. For users familiar with the previous generation chroma+scan series sensors, this file is similar to the Settings.xml in the station storage. Any parameter that existed in the chroma+scan settings file retains the same meaning as before and can be reused. There are additional required parameters, and as such, a chroma+scan settings file cannot be directly reused without some modification.
- GoWebScanConfig: Translates the user settings in GoWebScanSettings into system parameters. A GoWebScanConfig object needs to be constructed with a GoWebScanSettings object as a parameter, and needs to be passed into the processor object (GoWebScanProcess).
- GoWebScanProcess: Accepts raw sensor messages for processing and produces uniform resolution system tiles (in Web mode) or completed boards (in Detection mode). It may also record and save the raw sensor messages for offline debugging. Internally, this class delegates processing to various control and algorithm classes.
- GoWebScanSystemMsg: Contains the profile, tracheid (if applicable), and/or vision (if applicable) data of the detected board.
- GoWebScanCalCollector: Collects raw sensor data during system calibration and produces an input dataset for calibration processing.
- GoWebScanCalInput: Contains the input calibration dataset.
- GoWebScanCalProcessor: Performs the processing during system calibration on an input dataset and produces a GoWebScanCal object representing the system calibration.
- GoWebScanCal: Contains the system calibration offsets and gains, and stores and loads the data to an XML file.
- GoWebScanCalTarget: Contains the dimensions of the calibration bar, and stores and loads the data to an XML file.
GoWebScanSdkExample demonstrates the following steps for using the GoWebScan SDK:
- Constructs a GoSdk library and a GoWebScanSdk library.
- Constructs a GoSystem and sets a data handler for received sensor messages.
- Loads the GoWebScanSettings file.
- If in Web or Detection mode, loads the GoWebScanCal file, otherwise if in Calibration mode, loads the GoWebScanCalTarget file.
- Connects to each enabled sensor, enables data, configures the timing, and reads information about the current active area. For systems with vision sensors, the GoGeoCal file containing camera orientation information is downloaded from the sensors. Additionally, configuration of the vision sensor timing should be performed as demonstrated in the example application to avoid interference.
- Constructs the GoWebScanConfig object. For Detection mode, the application constructs the GoWebScanProcess object. For Calibration mode, the application constructs the GoWebScanCalCollector and GoWebScanCalProcessor objects.
- Starts the system using a scheduled start. For vision systems, configuration of the sensor start time should include a delay as demonstrated in the example application to avoid interference.
- In the data handler for received sensor messages, if in Detection mode, the application passes the messages to GoWebScanProcess_Process() and queries GoWebScanProcess_Receive() if any completed boards are available. In Calibration mode, the application passes the messages to GoWebScanCalCollector_AddMsg() until the collector is completed.
- If boards are available in Detection mode, extracts the profile, vision, and/or tracheid data and maps the data to one of the user-specified sections. At this point the data output is complete.
- In Calibration mode, produces a calibration dataset using GoWebScanCalCollector_GetProcessorData() and passes the dataset to GoWebScanCalProcessor_Execute() which will return the completed GoWebScanCal object if no errors occurred. Saves the calibration to file.
- In Detection mode, the ability to record sensor messages is demonstrated. If recording is enabled, which is done through GoWebScanProcess_EnableRecording, GoWebScanProcess will record copies of all incoming GoDataSet messages that are processed through GoWebScanProcess_Process. This recording may later be saved by calling GoWebScanProcess_SaveRecording. The purpose of saving recording data is to reprocess it off-site for testing and debugging purposes. Also included in the example code is a demonstration of how to load and replay the recording file.
Recording data can consume significant amounts of memory quickly, but there are limits to safeguard the system from running out of memory. There is a limit on the max number of completed boards, which is set through GoWebScanProcess_SetMaxRecordBoardCount. There is also a limit on the max number of bytes worth of recording data, which is set through GoWebScanProcess_SetMaxRecordSize. Once either of these limits is reached, additional processed messages will no longer be recorded.
Saving recordings to disk may be slow. Therefore, prior to saving a recording, it is best practice to pause any additional board processing functionality.