Skip to content

fly_ruler_ros2.client ​

本页由 fr-docs-dev gen-api 从源码 docstring 生成,请勿手工编辑;重新生成执行 just api。

不依赖 ROS/core 的同步只读 HTTP client。

公开成员 ​

名称类型定义位置
NodeClient类本页
NodeDescription类本页
LifecycleState类本页
NodeDiagnostics类本页
NodeClientError类本页
NodeUnavailableError类本页
NodeProtocolError类本页
JsonValue类型别名本页

定义 ​

NodeClient ​

python
class NodeClient(base_url: str, *, timeout: float = 5.0)

查询节点已经发布的快照;不重试、不发送写请求。

属性

名称类型说明
base_url—只读 HTTP(S) 根地址。
timeout—每次网络操作的超时,单位秒。

__init__ ​

python
def __init__(base_url: str, *, timeout: float = 5.0) -> None

校验并保存连接设置。

参数

名称类型默认值说明
base_urlstr—HTTP(S) 根地址,可含路径前缀。
timeoutfloat5.0每次网络操作的有限正超时,单位秒。

异常

类型说明
ValueError地址包含凭据、查询、片段,或超时不是有限正数。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:97

base_url ​

python
base_url = base_url.rstrip('/')

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:119

timeout ​

python
timeout = timeout

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:120

describe ​

python
def describe() -> NodeDescription

GET /v1/model,保留未知的合法 metadata 字段。

返回

类型说明
NodeDescription本次请求校验后的只读快照。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:159

state ​

python
def state() -> LifecycleState

GET /v1/state,返回 ROS 状态而非私有运行状态。

返回

类型说明
LifecycleState本次请求校验后的只读快照。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:167

parameters ​

python
def parameters() -> dict[str, JsonValue]

GET /v1/parameters,返回节点参数的 JSON 快照。

返回

类型说明
dict[str, JsonValue]本次请求校验后的只读快照。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:175

diagnostics ​

python
def diagnostics() -> NodeDiagnostics

GET /v1/diagnostics,时间以秒表示,计数不得为负。

返回

类型说明
NodeDiagnostics本次请求校验后的只读快照。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:183

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:89

NodeDescription ​

python
class NodeDescription(name: Annotated[str, Field(min_length=1)], namespace: Annotated[str, Field(min_length=1)], metadata: dict[str, JsonValue])

ROS 节点身份和未经重定义的 core/ROS2 元数据。

属性

名称类型说明
nameAnnotated[str, Field(min_length=1)]ROS 节点名称。
namespaceAnnotated[str, Field(min_length=1)]ROS 命名空间。
metadatadict[str, JsonValue]原样保留的模型和 ROS 元数据。

name ​

python
name: Annotated[str, Field(min_length=1)]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:36

namespace ​

python
namespace: Annotated[str, Field(min_length=1)]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:37

metadata ​

python
metadata: dict[str, JsonValue]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:38

__init__ ​

python
def __init__(name: Annotated[str, Field(min_length=1)], namespace: Annotated[str, Field(min_length=1)], metadata: dict[str, JsonValue]) -> None

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:26

LifecycleState ​

python
class LifecycleState(id: Annotated[int, Field(ge=0)], label: Annotated[str, Field(min_length=1)])

ROS 标准生命周期状态,允许标准过渡态。

属性

名称类型说明
idAnnotated[int, Field(ge=0)]ROS 生命周期状态编号。
labelAnnotated[str, Field(min_length=1)]ROS 生命周期状态名称。

id ​

python
id: Annotated[int, Field(ge=0)]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:50

label ​

python
label: Annotated[str, Field(min_length=1)]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:51

__init__ ​

python
def __init__(id: Annotated[int, Field(ge=0)], label: Annotated[str, Field(min_length=1)]) -> None

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:41

NodeDiagnostics ​

python
class NodeDiagnostics(tick_count: Annotated[int, Field(ge=0)], simulation_time: Annotated[FiniteFloat, Field(ge=0)], late_ticks: Annotated[int, Field(ge=0)], last_error: str | None)

最后发布的步计数、模型时间(秒)、超期次数和错误。

属性

名称类型说明
tick_countAnnotated[int, Field(ge=0)]已完成的模型步数。
simulation_timeAnnotated[FiniteFloat, Field(ge=0)]模型时间,单位秒。
late_ticksAnnotated[int, Field(ge=0)]逾期步数。
last_errorstr | None最近一次错误,没有错误时为 None。

tick_count ​

python
tick_count: Annotated[int, Field(ge=0)]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:65

simulation_time ​

python
simulation_time: Annotated[FiniteFloat, Field(ge=0)]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:66

late_ticks ​

python
late_ticks: Annotated[int, Field(ge=0)]

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:67

last_error ​

python
last_error: str | None

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:68

__init__ ​

python
def __init__(tick_count: Annotated[int, Field(ge=0)], simulation_time: Annotated[FiniteFloat, Field(ge=0)], late_ticks: Annotated[int, Field(ge=0)], last_error: str | None) -> None

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:54

NodeClientError ​

python
class NodeClientError(RuntimeError)

只读 HTTP 查询未成功。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:71

NodeUnavailableError ​

python
class NodeUnavailableError(NodeClientError)

连接失败、超时或 HTTP 503。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:75

NodeProtocolError ​

python
class NodeProtocolError(NodeClientError)

响应 JSON/字段不合法或其他 HTTP 错误。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/client.py:79

JsonValue ​

python
type JsonValue = None | bool | int | FiniteFloat | str | list[JsonValue] | dict[str, JsonValue]

可公开传输的 JSON 值,包括任意深度的有限数值。

实现位置:packages/fly_ruler_ros2/python/fly_ruler_ros2/_json_types.py:5