Abstraction of data from a wide range of sensors is one of the key features of CSTK. As such, regardless of whether the information came via the serial port, from a local network, from a logged file, or from an internal sensor, data is treated the same.

The SensorData Class

SensorData is an abstract base class that is used as an interface to specific implementations of data acquisition routines. These routines are named after the specific protocol that they use, with the word parser attached at the end since it parses that specific sensor data. For instance, a child class of SensorData that acquires sensor data from the serial port is called Rs232Parser, or one that reads data from a log file is called LogFileParser. Algorithms and applications that need certain sensor data will use the SensorData class troughout the code to get access to the sensor's information, rather than specifically using one of its Parser child classes.

Each of the child classes is associated with a structure containing all relevant parameters, which is primarily used to initialse the specific implementations via the constructor. Having an instantiation sensordata of the SensorData class, one can specify it to be for data from the serial rs232 port using just the constructor:

Rs232Settings rs232set; rs232set.baudrate = 9200;
sensordata = new Rs232Parser(rs232set);

The latest source for SensorData can be found in the CVS under sensordata/, and an example (sensordata_demo) is located in examples/.

sensordata architecture

Rs232Parser

Most commercially available sensors produce their readings via a serial or USB port, using the rs232 protocol. Rs232Parser opens up a connection to such a port with loads of parameters so that it can manage most protocols. These include baudrate, number of databits and stopbits, parity specification, and the size of the data buffer.

The latest source for Rs232Parser can be found in the CVS under sensordata/rs232parser/.

UDPParser

Those sensors that are attached to the local network usually transmit their data via UDP packages. UDPParser retrieves sensor data contained in such packages, given the port to which the packages are supposed to be sent to.

The latest source for UDPParser can be found in the CVS under sensordata/udpparser/.

LogFileParser

Many experiments require sensor data to be logged in files so that they can be analysed more thoroughly afterwards, or to be able to rerun experiments with different algorithms. LogFileParser reads a file from the local file system and parses it for sensor data.

The latest source for LogFileParser can be found in the CVS under sensordata/logfileparser/.

SimParser

SimParser is a module that outputs 'simulated' sensor data, which behaves in such a way that it can be used to test out visualisation methods or other algorithms without requiring a sensor or concrete data to be present in the system.

The latest source for SimParser can be found in the CVS under sensordata/simparser/.