VTSensor()
📖 Method Description
Instantiate the VTSensor class for operating the Vitai vision-based tactile sensor. This class provides core functionality for sensor initialization, data acquisition, and image processing.
📝 Syntax
from pyvitaisdk import VTSensor, VTSensorType
sensor = VTSensor(
config=None,
marker_size=[9, 9],
marker_offsets=None,
sensor_type=None
)
🔧 Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
config | VTSDeviceConfig | None | None | Device configuration object obtained through VTSDeviceFinder.Set to None for offline data processing |
marker_size | int | List[int] | [9, 9] | Number of Marker point rows and columns Can be an integer (square) or a list with 2 elements [rows, cols] |
marker_offsets | List[int] | None | None | Marker display boundary offset parameters List with 4 elements: [top, bottom, left, right] |
sensor_type | VTSensorType | None | None | Sensor type, must be specified for offline processing |
📤 Return Type
VTSensor - VTSensor sensor instance object
💡 Example Code
Online Data Acquisition (Real-time Sensor)
from pyvitaisdk import VTSensor, VTSDeviceFinder
# Get device
finder = VTSDeviceFinder()
devices = finder.get_devices()
if devices:
# Create sensor instance with default parameters
sensor = VTSensor(devices[0])
print("VTSensor sensor initialized (default configuration)")
# Or use custom parameters
# sensor = VTSensor(
# config=devices[0],
# marker_size=[10, 10],
# marker_offsets=[5, 5, 5, 5]
# )
# print("VTSensor sensor initialized (custom configuration)")
sensor.release() # Release resources
else:
print("No devices found")
Offline Data Processing
from pyvitaisdk import VTSensor, VTSensorType
# Initialize in offline mode
sensor = VTSensor(
config=None, # Offline mode
marker_size=[9, 9],
sensor_type=VTSensorType.GF225
)
print("VTSensor sensor initialized (offline processing mode)")
sensor.release() # Release resources
⚠️ Notes
Device Configuration
- Online Mode:
configparameter must be a validVTSDeviceConfigobject - Offline Mode: Set
configparameter toNonefor processing saved image data, and specifysensor_type
Marker Configuration Recommendations
marker_size: Configure according to the actual Marker point matrix on the sensor surfacemarker_offsets: Used to adjust visualization boundaries
🔗 Related Methods
- VTSDeviceFinder() - Get device configuration
- calibrate - Calibrate sensor
- collect_sensor_data - Collect sensor data
- release - Release sensor instance