selectSensorInfo Method
- Sensor.selectSensorInfo(*args)
Obtain specified types of sensor data; the number and order of returns are consistent with the input parameters.
- Parameters:
args (Sensor.OutputType) – Any number of
Sensor.OutputTypeenums, used to specify the types of data to obtain. The supported enum values and corresponding data are as follows:
Supported Data Types and Descriptions Enum Value
Data Type
Description
Sensor.OutputType.RectifyOptional[np.ndarray]
Rectified image, shape=(700, 400, 3), BGR format
Sensor.OutputType.DifferenceOptional[np.ndarray]
Difference image, shape=(700, 400, 3), BGR format
Sensor.OutputType.DepthOptional[np.ndarray]
Depth image, shape=(700, 400), unit in millimeters (mm)
Sensor.OutputType.ForceOptional[np.ndarray]
3D force distribution, shape=(35, 20, 3)
Sensor.OutputType.ForceNormOptional[np.ndarray]
Normal force component, shape=(35, 20, 3)
Sensor.OutputType.ForceResultantOptional[np.ndarray]
6-dimensional resultant force, shape=(6,)
Sensor.OutputType.Marker2DOptional[np.ndarray]
Tangential displacement, shape=(35, 20, 2)
Sensor.OutputType.Mesh3DOptional[np.ndarray]
Current frame 3D mesh, shape=(35, 20, 3)
Sensor.OutputType.Mesh3DInitOptional[np.ndarray]
Initial 3D mesh, shape=(35, 20, 3)
Sensor.OutputType.Mesh3DFlowOptional[np.ndarray]
Mesh deformation vector, shape=(35, 20, 3)
Sensor.OutputType.TimeStampOptional[np.ndarray]
Sensor timestamp, shape=(35, 20, 3)
- Returns:
The requested sensor data; the number and order of returns are consistent with the input parameters.
- Return type:
np.ndarrayorNonecorresponding to the input parameters (when data is not obtained)
Note
If you need to obtain multiple types of data at the same time, use a single function call in the form shown in the routine. This ensures all data comes from the same frame and the calculation speed is optimized.
Example Code
from xensesdk import Sensor
# 创建传感器实例
sensor = Sensor.create('OP000064')
# 获取指定类型的传感器数据
rectify, depth, force = sensor.selectSensorInfo(
Sensor.OutputType.Rectify,
Sensor.OutputType.Depth,
Sensor.OutputType.Force
)
# 输出数据形状(示例)
print("校正图像形状:", rectify.shape) # (700, 400, 3)
print("深度图像形状:", depth.shape) # (700, 400)
print("三维力分布形状:", force.shape) # (35, 20, 3)
# 释放资源
sensor.release()