glove module
This module implements the class Glove.
- class cyberglove.glove.Glove
The class
Gloveis responsible for connecting to the CyberGlove III. It offers functionality to connect to the hardware, to interact with it and to receive sensor data.- connect_glove(ip_address, localport=49500)
Connect the CyberGlove III by creating a socket and listen on the given port. Both the static IP-address of the computer and the port must be given to the CyberGlove by writing the information onto its flash card. This method is blocking and returns True as soon as a client connects.
- Parameters
ip_address (str) – IP address of the computer to verify (e.g. “192.168.1.2”)
localport (int) – port to open (defaults to 49500)
- Returns
True if glove got connected successfully
- Return type
bool
- disconnect_glove()
Closes the socket in use.
- Returns
None
- get_amount_of_sensors()
Gets the amount of sensors the connected glove. Sends command ‘?S’ and returns the answer.
- Returns
either 18 or 22
- Return type
int
- get_digital_filter()
Queries the status of filter (refer to
docs/more/SerialCommands.pdffor more information). Sends command ‘?F’ and returns whether the filter is on or off.- Returns
True if digital filter is enabled
- Return type
bool
- get_glove_information()
Gets information-text from the CyberGlove-microcontroller. Sends command ‘?i’ and returns the decoded answer.
- Returns
decoded answer
- Return type
str
- get_hardware_sensor_mask()
Three bytes-mask representing the actual sensor available in the CyberGlove hardware. Sends command ‘?K’ and returns the bit-mask as string.
- Returns
Hardware-sensor-mask as string
- Return type
str
- get_one_dataset()
Requests exactly one dataset from the CyberGlove. Sends command ‘G’, handles errors (e.g. incomplete datasets) and returns the dataset as numpy-array.
- Returns
one-dimensional array consisting of 22 values between 0 and 255
- Return type
numpy.ndarray
- Raises
socket.error – socket-error
- get_right_handed()
Returns True if the CyberGlove is tailored for a right hand. Sends command ‘?R’ and returns the corresponding answer.
- Returns
True if the glove is right-handed
- Return type
bool
- get_status()
Queries the current status of the CyberGlove. Sends command ‘?G’ and returns the corresponding answer. See
docs/more/SerialCommands.pdffor details.- Returns
status string
- Return type
str
- get_version_number()
Queries the version of the CyberGlove. Sends command ‘?V’ and returns the sanitized answer.
- Returns
(Glove-Firmware, internal information format version number)
- Return type
tuple
- start_prompt()
Starts a command prompt to enter commands and receive answers. Use ‘exit’ to exit the prompt.
- Returns
None