跳到主要内容

get_devices()

实例方法 | VTSDeviceFinder 类

📖 方法说明

获取所有连接到计算机的纬钛视触觉传感器设备配置列表。此方法会扫描并返回当前可用的设备。


📝 语法

devices = finder.get_devices()

🔧 参数

无参数


📤 返回类型

List[VTSDeviceConfig] - 设备配置对象列表

每个 VTSDeviceConfig 对象包含设备的配置信息,可用于初始化传感器实例。


💡 示例代码

from pyvitaisdk import VTSDeviceFinder, GF225

# 创建 VTSDeviceFinder 实例
finder = VTSDeviceFinder()

# 获取所有设备
devices = finder.get_devices()

if devices:
print(f"找到 {len(devices)} 个设备")

else:
print("未找到任何设备")

⚠️ 注意事项

设备连接

如果返回空列表,请检查:

  • 传感器是否已正确连接到计算机
  • USB 连接是否稳定
最佳实践
  • 在使用设备前,先检查列表是否为空
  • 建议在程序启动时调用一次,然后缓存结果

🔗 相关方法