API 参考Qnbot Exo PlusPython

发现与配置

基础接口

当前版本 · 1.4.0

discover_exos()

扫描可发现的外骨骼设备。

类型

discover_exos() -> tuple[DiscoveredExo, ...]

返回值

发现结果序列,单个 DiscoveredExo 包含以下字段:

字段

字段类型说明
portstr串口路径
transport_typeExoTransportType连接类型,必需字段;当前为 ExoTransportType.SERIAL(serial)
device_infoExoDeviceInfo | None探测成功时的设备信息
errorExoDiscoveryIssue | None探测失败时的错误;与 device_info 互斥

ExoDiscoveryIssue 包含 code: ExoDiscoveryErrorCode 与 message: str。错误码为 PORT_OPEN、PROTOCOL_ERROR、INCOMPATIBLE。

ExoConfig

配置一个外骨骼设备的连接、逻辑名称与启用状态。

类型

ExoConfig(
    connection: SerialConnection = SerialConnection(),
    name: str | None = None,
    enabled: bool = True,
)

connection 选择串口,name 设置用于 device(name) 的逻辑名称,enabled=False 时不启用该配置。Exo 不支持通过 SerialConnection.serial_number 定位设备。to_dict() 返回可交给 Core 的设备配置。

Sdk(...).exo() 返回 Exo 域入口。