4.16. glove — Wrapper around the 5DT Data Glove SDK

This module contains a wrapper around the Data Glove SDK by Fifth Dimension Technologies. The underlying SDK can either be version 1 or version 2. Note that some methods are only implemented if the module was compiled with version 2 of the SDK. All the functions from the SDK are wrapped as methods of the DataGlove class. Most methods require that a connection to a glove device was previously established via the open() method.

cgkit.glove.available()

Returns True if the Data Glove functionality is available.

If this function returns False, an exception will be raised whenever you try to instantiate a class from this module.

class cgkit.glove.DataGlove

This class encapsulates the data glove handle and contains the functions from the SDK as methods. Before you can use most of the methods, you have to establish a connection to a data glove by calling the open() method.

DataGlove.isConnected()

Returns True if a connection to a data glove was established (i.e. if open() was successfully called).

DataGlove.open(port)

Establish a connection to the data glove at the specified port. port is a string containing the serial port to use. For example, under Windows you might specify "COM1", "COM2", etc.

DataGlove.close()

Disconnect from the glove. The return value is a boolean indicating if there was an error. Calling close() while there is no connection established is not considered an error.

DataGlove.getGloveHand()

Return the handedness of the glove. The return value is either FD_HAND_LEFT or FD_HAND_RIGHT. If you want a string representation of the handedness you can use the return value as key for the dictionary HANDEDNESS.

DataGlove.getGloveType()

Return the type of the data glove. The return value is one of the following:

Type Description
FD_GLOVENONE No data glove
FD_GLOVE5U Data Glove 5 Ultra serial
FD_GLOVE5UW Data Glove 5 Ultra serial, wireless
FD_GLOVE5U_USB Data Glove 5 Ultra USB
FD_GLOVE7 Data Glove 5
FD_GLOVE7W Data Glove 5, wireless
FD_GLOVE16 Data Glove 16
FD_GLOVE16W Data Glove 16, wireless
FD_GLOVE14U Data Glove 14 Ultra serial
FD_GLOVE14UW Data Glove 14 Ultra serial, wireless
FD_GLOVE14U_USB Data Glove 14 Ultra USB

If you want the string representation of the glove type you can use the return value as key for the dictionary GLOVETYPE.

Todo: The above are only the return values of the v2 SDK.

DataGlove.getNumSensors()

Return the number of sensors.

DataGlove.getNumGestures()

Return the number of available gestures.

DataGlove.getSensorRawAll()

Return a list with the raw sensor values of all sensors.

DataGlove.getSensorRaw(sensor)

Return the raw sensor value of the specified sensor. sensor is an integer in the range between 0 and getNumSensors()-1.

DataGlove.setSensorRawAll(data)
DataGlove.setSensorRaw(sensor, raw)
DataGlove.getSensorScaledAll()

Return a list of the scaled sensor values of all sensors.

DataGlove.getSensorScaled(sensor)

Return the scaled sensor value of the specified sensor. sensor is an integer in the range between 0 and getNumSensors()-1.

DataGlove.getCalibrationAll()

Return the current auto-calibration settings for all sensors. The return value is a 2-tuple (lower, upper) where lower is a list with the minimum values and upper a list with maximum values.

DataGlove.getCalibration(sensor)

Return the auto-calibration for one particular sensor. The return value is a 2-tuple (lower, upper) that contains the minimum and maximum value.

DataGlove.setCalibrationAll(lower, upper)

Set the auto-calibration settings. lower is a list with the minimum sensor values and upper is a list with the maximum values.

DataGlove.setCalibration(sensor, lower, upper)

Set the auto-calibration values for one sensor. lower is the minimum sensor value and upper is the maximum value.

DataGlove.getSensorMaxAll()

Return a list with the maximum scaled values of the sensors.

DataGlove.getSensorMax(sensor)

Return a maximum scaled sensor value for one particular sensor.

DataGlove.setSensorMaxAll(max)

Set the maximum scaled sensor values. max is a list with the values.

DataGlove.setSensorMax(sensor, max)

Set the maximum scaled sensor value for one sensor.

DataGlove.resetCalibration([sensor])

Reset the auto-calibration values. In version 2 of the SDK you can pass an optional sensor index which will only reset that particular sensor.

DataGlove.getGesture()

Return the current gesture.

DataGlove.getThresholdAll()

Return the current gesture recognition threshold values. The return value is a 2-tuple (lower, upper) that contains the lower and upper threshold values.

DataGlove.getThreshold(sensor)

Return the gesture recognition threshold values for one sensor. The return value is a 2-tuple (lower, upper) that contains the lower and upper threshold value.

DataGlove.setThresholdAll(lower, upper)

Set the gesture recognition threshold values for all sensors. lower is a list with the lower threshold values and upper is a list with the upper threshold values.

DataGlove.setThreshold(sensor, lower, upper)

Set the gesture recognition threshold values for one sensor. lower is the lower threshold value and upper is the upper threshold value.

DataGlove.getGloveInfo()

Return a string with glove information.

DataGlove.getDriverInfo()

Return a string with driver information.

DataGlove.scanUSB()

Scans the USB for available gloves. The return value is a list with product IDs of the gloves found. The product IDs can be one of DG14U_R, DG14U_L, DG5U_R and DG5U_R. — Availability: V2

DataGlove.setCallback(callback)

Set a callback function that gets called when a new packet was received. callback must be a callable object. — Availability: V2

DataGlove.getPacketRate()

Return the current packet rate in Hertz. — Availability: V2

DataGlove.newData()

Returns a boolean that indicates whether new data is available or not. — Availability: V2

DataGlove.getFWVersionMajor()

Return the major version of the glove’s firmware. This is only implemented for the Data Glove 14 Ultra. Other gloves will always return 0. — Availability: V2

DataGlove.getFWVersionMinor()

Return the minor version of the glove’s firmware. This is only implemented for the Data Glove 14 Ultra. Other gloves will always return 0. — Availability: V2

DataGlove.getAutoCalibrate()

Returns True if auto calibration is activated. — Availability: V2

DataGlove.setAutoCalibrate(flag)

Enable or disable auto-calibration. If flag is True auto-calibration is enabled. — Availability: V2

DataGlove.saveCalibration(filename)

Save the current calibration data to disk. — Availability: V2

DataGlove.loadCalibration(filename)

Load the calibration settings from a file. — Availability: V2

Note

The module uses the SDK by Fifth Dimension Technologies (5DT) which can be found at http://www.5dt.com/. The following is the copyright information of the SDK:

Copyright (C) 2000-2004, 5DT <Fifth Dimension Technologies>

Previous topic

4.15. wintab — Wrapper around the Wintab Developer Kit

Next topic

4.17. asfamc — Acclaim skeleton and motion file (ASF/AMC) reader

This Page