habitat.sensors: the sensor-function manager
The sensor function manager provides a collection of sensor functions, which are used by parser modules to turn extracted fields into useful data.
Sensor functions are grouped into “libraries”, which are python modules. When loaded, these modules are assigned a shorthand. For example, functions in habitat.sensors.stdtelem are available simply as stdtelem.func. The shorthand assigned is specified in the config document.
These all libraries listed in the Sensor Manager’s configuration are loaded upon initialisation.
The sensor_manager provides the base library built in; it includes
- ascii_int
- ascii_float
- string
Other libraries are available with habitat. See sensors
A sensor function takes two arguments, config and data. It can return a string, list, dict, int, float, or any other python object that can be stored in a couchdb database.
config is a dict of options. It is passed to the function from SensorManager.parse()
data is the string to parse.
The main Sensor Manager class
program: a habitat.main.Program object
All modules listed in the config document for the sensor manager will be loaded using load().