nicotouch¶
The nicotouch package contains classes to read the optoforce sensors of the NICO robot.
optoforce¶
The optoforce class allows access to the optoforce sensor data.
- class nicotouch.optoforcesensors.optoforce(ser_number=None, cache_frequency=None)¶
Bases:
object- _scan_ports(ser_number=None)¶
Scans serial ports for OptoForce device with given serial number and returns the port. Returns the first sensor found if no serial number is given.
- Parameters
ser_number (str) – Serial number of the sensor (optional)
- Returns
Port of OptoForce sensor with specified serial number (or first one found if ser_number is None)
- Return type
str
- _worker_thread()¶
- get_sensor_all()¶
- get_sensor_array()¶
- get_sensor_string()¶
- get_sensor_values()¶
- get_sensor_values_from_array(seq)¶
- get_sensor_values_hex()¶
- get_sensor_values_m()¶
- get_sensor_values_raw()¶
OptoforceMultichannel¶
The OptoforceMultichannel class allows access to the data of optoforce devices with multiple sensors.
- class nicotouch.OptoforceMultichannel.OptoforceMultichannel(ser_number=None, cache_frequency=None)¶
Bases:
objectOptoforceMultichannel allows access to multiple OptoForce sensors Connected to the same device
- _scan_ports(ser_number=None)¶
Scans serial ports for OptoForce device with given serial number and returns the connection. Returns the first sensor found if no serial number is given.
- Parameters
ser_number (str) – Serial number of the sensor (optional)
- Returns
Connected OptoforceDriver with specified serial number (or any if ser_number is None)
- Return type
_nicotouch_internal.optoforce.OptoforceDriver
- get_sensor_values()¶
Returns latest newton sensor readings for each channel
- Returns
“time”, “count”, “status” and newton x,y,z “forces” for each channel (see global OptoforceMultichannel.keys for channel keys)
- Return type
dict
- get_sensor_values_raw()¶
Returns latest raw sensor readings for each channel
- Returns
“time”, “count”, “status” and raw x,y,z “forces” for each channel (see global OptoforceMultichannel.keys for channel keys)
- Return type
dict
- update_cache()¶
Collects new sensor values from the device.
- nicotouch.OptoforceMultichannel._cache_thread(object, frequency)¶
Thread that caches sensor values at defined frequency. Only pass weakrefs! If object is not a weakref, it may introduce memory leaks!